anaStruct icon indicating copy to clipboard operation
anaStruct copied to clipboard

How to clear information from memory?

Open Lucas1902 opened this issue 4 years ago • 3 comments

Hi, How to clear information from memory? I want to model one structure after another, I'm using anaStruct in a loop to check if a certain bar meets an established parameter. However, an error occurs due to an overlap of data from the second structure with the first.

Lucas1902 avatar Jun 03 '20 20:06 Lucas1902

Have you got some more information? If the anastruct SystemElements has no references to any object, it should be removed from memory. Only if you run in Jupyter Notebooks they could live longer.

ritchie46 avatar Jun 14 '20 06:06 ritchie46

from anastruct import * ss = SystemElements()

def entrada(): global lb, h0, tr_barra, cp_barra, nb, aux tr_barra = 20.0 cp_barra = -20.0 lb = 10.0 h0 = 1.5 aux = 0 nb = 5

Verificação

x = False
while x == False:

    nba = 3 * (nb - 1) + nb
    print(nb, nba)
    nos(nb)
    i = 1
    resultado = []
    verif = []
    while i <= nba:
        resultado.append(ss.get_element_results(element_id=int(i))['N'])
        print("BARRA ", i, resultado[i - 1])
        if cp_barra <= resultado[i - 1] <= tr_barra:
            print("ok")
            verif.append(True)
        else:
            verif.append(False)
        i += 1
    print(verif)
    if all(verif) == True:
        x = True
        pass
    else:
        aux += 1
        nb = nb + aux
    # print("nb final: ", nb)

def nos(nb): global nos_sup print("nb nos: ",nb)

sb = lb / (nb - 1)
nn = nb - 1
nos_sup = []
nos_inf = []
i = 0
while i <= nn:
    nos_sup.append([i * sb, h0])
    nos_inf.append([i * sb, 0])
    i += 1

i = 1
while i <= nn:
    ss.add_truss_element(location=[nos_inf[i - 1], nos_inf[i]])
    i += 1

i = 1
while i <= nn:
    ss.add_truss_element(location=[nos_sup[i - 1], nos_sup[i]])
    i += 1

i = 0
while i <= nn:
    ss.add_truss_element(location=[nos_inf[i], nos_sup[i]])
    i += 1
i = 1
while i <= nn:
    ss.add_truss_element(location=[nos_inf[i - 1], nos_sup[i]])
    i += 1

ss.add_support_hinged(node_id=1)
ss.add_support_hinged(node_id=nb)
i = 1
while i <= len(nos_sup):
    ss.point_load(node_id=(i + nb), Fy=-10, rotation=0)
    i += 1

ss.show_structure()
ss.solve()

entrada()

Lucas1902 avatar Jun 19 '20 12:06 Lucas1902

Could you create a minimal working example and clearly define your problem in English?

ritchie46 avatar Jul 25 '20 06:07 ritchie46

No response to question. Closing as can't reproduce / wontfix

smith120bh avatar Dec 31 '22 07:12 smith120bh