@author: casierraa
"""

from __future__ import division, print_function
import numpy as np
from datetime import datetime
import preprocesor as pre
import postprocesor as pos
import assemutil as ass
import matplotlib.pyplot as plt
#
folder, name = pre.initial_params()
start_time = datetime.now()
#
#%% PRE-PROCESSING
inipar, nodes, mats, elements, loads = pre.readin(folder=folder)
ninc, T, dt, ac, theta = pre.intparams(inipar)
#DME , IBC , neq = ass.DME(nodes, elements)
#U    = np.loadtxt(folder + 'response.txt' , ndmin=2)
##
#salida    = np.loadtxt(folder + 'salida.txt' , ndmin = 1 , dtype=np.int)
#npts = pos.sheets(salida , ninc , U , IBC , 'respuesta' , folder )
#pos.PLOTsheets( 'respuesta.txt' , folder , dt , ninc , npts , 200)
#
# Arrival times
#
vals = np.loadtxt(folder + "respuesta 02.txt")
plt.close("all")
#
plt.figure(0)
fig = plt.figure(figsize=(10, 8))
Beispiel #2
0
Last updated December 2015
"""
import numpy as np
import preprocesor as pre
import postprocesor as pos
import assemutil as ass
import shutil as shu
from datetime import datetime
import matplotlib.pyplot as plt

start_time = datetime.now()
name = raw_input('Enter the job name: ')
#   MODEL ASSEMBLY
#
# Reads the model
nodes, mats, elements, loads = pre.readin()
# Activate to generate echo files
#pre.echomod(nodes, mats, elements, loads)
# Retrieves problem parameters
ne, nn, nm, nl, COORD = pre.proini(nodes, mats, elements, loads)
# Counts equations and creates BCs array IBC
neq, IBC = ass.eqcounter(nn, nodes)
# Computes assembly operator
DME, IELCON = ass.DME(IBC, ne, elements)
# Assembles Global Stiffness Matrix KG
KG = ass.matassem(IBC, mats, elements, nn, ne, neq, COORD, DME, IELCON)
# Assembles Global Rigth Hand Side Vector RHSG
RHSG = ass.loadasem(loads, IBC, neq, nl)

#   SYSTEM SOLUTION
#
Beispiel #3
0
"""
from __future__ import division, print_function
import numpy as np
from os import sys
sys.path.append(r"C:\Users\nguarinz\workspace\FEM_PYTHON\main")
from datetime import datetime
import matplotlib.pyplot as plt
import preprocesor as pre
import postprocesor as pos
import assemutil as ass
import solutil as sol

start_time = datetime.now()

#%% PRE-PROCESSING
nodes, mats, elements, loads = pre.readin(folder="./")
DME, IBC, neq = ass.DME(nodes, elements)
print("Number of nodes: {}".format(nodes.shape[0]))
print("Number of elements: {}".format(elements.shape[0]))
print("Number of equations: {}".format(neq))

#%% SYSTEM ASSEMBLY
KG = ass.assembler(elements, mats, nodes, neq, DME)
RHSG = ass.loadasem(loads, IBC, neq)

#%% SYSTEM SOLUTION
UG = sol.static_sol(KG, RHSG)
if not (np.allclose(KG.dot(UG), RHSG)):
    print("The system is not in equilibrium!")
end_time = datetime.now()
print('Duration for system solution: {}'.format(end_time - start_time))
import easygui


folder = easygui.diropenbox(title="Folder for the job") + "/"
name = easygui.enterbox("Enter the job name")
echo = easygui.buttonbox("Do you want to echo files?",
                         choices=["Yes", "No"])     

start_time = datetime.now()


#%%
#   MODEL ASSEMBLY
#
# Reads the model
nodes, mats, elements, loads = pre.readin(folder=folder)
if echo == "Yes":
    pre.echomod(nodes, mats, elements, loads, folder=folder)
# Retrieves problem parameters
ne, nn, nm, nl, COORD = pre.proini(nodes, mats, elements, loads)
# Counts equations and creates BCs array IBC
neq, IBC = ass.eqcounter(nn, nodes)
# Computes assembly operator
DME, IELCON = ass.DME(IBC, ne, elements)
# Assembles Global Stiffness Matrix KG
KG = ass.matassem(IBC, mats, elements, nn, ne, neq, COORD, DME, IELCON)
# Assembles Global Rigth Hand Side Vector RHSG
RHSG = ass.loadasem(loads, IBC, neq, nl)

#%%
#   SYSTEM SOLUTION
Beispiel #5
0
def Struct_DYN(folder):
    """  
    Parameters:
    ----------
    folder = Location of input files
    """
    warnings.filterwarnings("ignore")
    #--------------------------------------------------------------------------------------------------------------------------------------
    # Pre-processing
    inipar, nodes, mats, elements, Nodal_loads, Msvar, ILF, Seismo_signal, const = pre.readin(
        folder)
    ninc, T, dt, ac, theta = pre.intparams(inipar)
    DME, IBC, neq = ass.DME(nodes, elements)
    const = cst.IBC_const(IBC, const)
    #--------------------------------------------------------------------------------------------------------------------------------------
    # System assembly
    Up, Vp = sol.inicond_U_V(neq)
    KG, MG, CG, Msvar, IGF, ILF = ass.assembler(inipar, Up, Msvar, ILF,
                                                elements, mats, nodes, neq,
                                                DME, ac, const)
    cst_neq, neq = cst.neq_cst(const, neq)
    Up, Vp = sol.inicond_U_V(
        cst_neq)  # New initial conditions after constraints
    Tfund, Tmin = modal.eigen(inipar, MG, KG)
    RHSG, DeltaT, ninc, inipar = ass.loadasem(IBC, MG, Seismo_signal,
                                              Nodal_loads, neq, ninc, inipar,
                                              Tmin, const)
    ninc, T, dt, ac, theta = pre.intparams(inipar)
    KG, MG, CG, Msvar, IGF, ILF = ass.assembler(inipar, Up, Msvar, ILF,
                                                elements, mats, nodes, neq,
                                                DME, ac, const)
    print("----------------------")
    print("Number of nodes: {}".format(nodes.shape[0]))
    print("Number of elements: {}".format(len(elements)))
    print("Number of equations: {}".format(neq))
    print("Number of equations after constraints: {}".format(cst_neq))
    print("----------------------")
    print("Natural periods of the system : ", Tfund)
    print("----------------------")
    print("Time step for solution: {} sec".format(DeltaT))
    print("Number of time increments: {}".format(ninc))
    print("----------------------")
    #--------------------------------------------------------------------------------------------------------------------------------------
    # System solution
    start_time = datetime.now()
    U, MvarsGen, ILFGen = sol.system_sol(inipar, Up, Vp, neq, RHSG, MG, KG, CG,
                                         DME, Msvar, ILF, elements, mats,
                                         nodes, ac, const, cst_neq)
    end_time = datetime.now()
    print("Duration for the system's solution: {}".format(end_time -
                                                          start_time))
    #--------------------------------------------------------------------------------------------------------------------------------------
    # Post-processing
    start_time = datetime.now()
    U = cst.Posproc_disp_cst(neq, ninc, const, U)
    end_time = datetime.now()
    print('Duration for post processing: {}'.format(end_time - start_time))
    print("----------------------")
    print('Analysis terminated successfully!')
    print("----------------------")
    return (U, folder, IBC, nodes, elements, ninc, T, MvarsGen, ILFGen)
Beispiel #6
0
"""
import numpy as np
import preprocesor as pre
import postprocesor as pos
import assemutil as ass
import shutil as shu
from datetime import datetime
import matplotlib.pyplot as plt


start_time = datetime.now()
name = raw_input('Enter the job name: ')
#   MODEL ASSEMBLY
#
# Reads the model
nodes, mats, elements, loads = pre.readin()
# Activate to generate echo files
#pre.echomod(nodes, mats, elements, loads)
# Retrieves problem parameters
ne, nn, nm, nl, COORD = pre.proini(nodes, mats, elements, loads)
# Counts equations and creates BCs array IBC
neq, IBC = ass.eqcounter(nn, nodes)
# Computes assembly operator
DME, IELCON = ass.DME(IBC, ne, elements)
# Assembles Global Stiffness Matrix KG
KG = ass.matassem(IBC, mats, elements, nn, ne, neq, COORD, DME, IELCON)
# Assembles Global Rigth Hand Side Vector RHSG
RHSG = ass.loadasem(loads, IBC, neq, nl)

#   SYSTEM SOLUTION
#