示例#1
0
def system_sol(inipar, Up, Vp, neq, RHSG, MG, KG, CG, DME, Msvar, ILF, elements, mats, nodes, ac, const, cst_neq):
    """
    System's nonlinear dynamic or static solution
    
    Parameters:
    ----------
    inipar   = Global parameters
    Up       = Initial nodal displacements vector
    Vp       = Initial nodal velocities vector
    neq      = Number of free DOF
    RHSG     = Global loads assembly
    MG       = Global mass matrix
    KG       = Global stiffness matrix
    CG       = Global damping matrix
    DME      = Global index aseembly operator
    Msvar    = Global state variables for an increment
    ILF      = Internal local forces of the elements
    elements = Global array of elements
    mats     = Global array of materials profiles
    nodes    = Global array of nodes
    ac       = Integration method's constants (ONLY for NLDYNA)
    const    = Nodal constraints information
    cst_neq  = Number of equations after constraints
    
    Return:
    -------
    U        = System's displacement response
    MvarsGen = History of state variables of the system solution      
    
    """
    NLSTA  = int(inipar[5,0])
    NLDYNA = int(inipar[6,0])
    #
    ninc, T, dt, ac, theta = pre.intparams(inipar)
    Tol                    = inipar[2,0]
    maxite                 = inipar[3,0]
    #
    if (NLSTA == 1) and (NLDYNA == 0):
         U = np.zeros((cst_neq, ninc))
         start_time          = datetime.now()
         U, MvarsGen, ILFGen = NonLinResponseST(inipar, DME, Msvar, ILF, elements, mats, nodes, neq, ninc, dt, U, RHSG, KG, Tol, maxite, ac, const)
         end_time            = datetime.now()
         print('Duration for system solution: {}'.format(end_time - start_time))
         #
    elif (NLSTA == 0) and (NLDYNA == 1):
         KE      = ass.effective(KG, MG, CG, ac)
         U, V, A = inicond(Up, Vp, ninc , cst_neq, RHSG, MG, KG, CG)
         print("Finished initial conditions....: {}".format(0))
         del KG
         start_time          = datetime.now()
         U, MvarsGen, ILFGen = NonLinResponse(inipar, DME, Msvar, ILF, elements, mats, nodes, neq, ninc, dt, theta, ac, U, V, A, RHSG, MG, CG, KE, Tol, maxite, const)
         end_time            = datetime.now()
         print('Duration for system solution: {}'.format(end_time - start_time))
         #
    elif (NLSTA == 1) and (NLDYNA == 1):
         inipar[5,0] = 0
         KE      = ass.effective(KG, MG, CG, ac)
         U, V, A = inicond(Up, Vp, ninc , cst_neq, RHSG, MG, KG, CG)
         print("Finished initial conditions....: {}".format(0))
         del KG
         start_time          = datetime.now()
         U, MvarsGen, ILFGen = NonLinResponse(inipar, DME, Msvar, ILF, elements, mats, nodes, neq, ninc, dt, theta, ac, U, V, A, RHSG, MG, CG, KE, Tol, maxite, const)
         end_time            = datetime.now()
         print('Duration for system solution: {}'.format(end_time - start_time))
         #
    # End if 
    return U, MvarsGen, ILFGen 
示例#2
0
"""

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))
pos.plot_sheet(vals, T, amp_signal=30, amp_shift=50)
示例#3
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)