def PushoverLcD(dispMax): ControlNode = 4 ControlNodeDof = 1 du = 0.00002 * m # Define time series # timeSeries('Constant', tag, '-factor', factor=1.0) op.timeSeries('Constant', 1) op.timeSeries('Linear', 2) # define loads op.pattern('Plain', 1, 2) op.sp(ControlNode, ControlNodeDof, du) # Define Analysis Options # create SOE op.system("BandGeneral") # create DOF number op.numberer("Plain") # create constraint handler op.constraints("Transformation") # create integrator op.integrator("LoadControl", 1) # create algorithm op.algorithm("Newton") # create analysis object op.analysis("Static") # Create Test op.test('NormDispIncr', 1. * 10**-6, 50) # Run Analysis op.record() # ok = op.analyze(Nsteps) nn = 0 while (op.nodeDisp(ControlNode, ControlNodeDof) < dispMax): ok = op.analyze(1) if ok != 0: ok = BasicAnalysisLoop(ok, nn) if ok != 0: print("Analysis failed at load factor:", nn) break nn = +1 print() print("# Analysis Complete #")
def PushoverDcF(Nsteps): ControlNode = 4 ControlNodeDof = 1 dForce = 1.*kN du = 0.00001*m # Define time series # timeSeries('Constant', tag, '-factor', factor=1.0) op.timeSeries('Constant',1) op.timeSeries('Linear', 2) # define loads op.pattern('Plain',1 , 2) op.load(ControlNode, dForce, 0., 0.) # Define Analysis Options # create SOE op.system("BandGeneral") # create DOF number op.numberer("Plain") # create constraint handler op.constraints("Transformation") # create integrator op.integrator("DisplacementControl", ControlNode, ControlNodeDof, du) # create algorithm op.algorithm("Newton") # create analysis object op.analysis("Static") # Create Test op.test('NormDispIncr', 1.*10**-11, 50) # Run Analysis op.record() ok = op.analyze(Nsteps)
def analyse(self, num_incr): ''' Analyse the system. Args: num_incr: An integer number of load increments. return_node_disp: ''' ops.constraints('Transformation') ops.numberer('RCM') ops.system('BandGeneral') ops.test('NormUnbalance', 2e-8, num_incr) ops.algorithm('Newton') ops.integrator('LoadControl', 1 / num_incr) ops.record() ops.analysis('Static') ok = ops.analyze(num_incr) # Report analysis status if ok == 0: print("Analysis done.") else: print("Convergence issue.")
ops.mesh('line', 1, 9, 4,5,8,9,10,11,7,6,2, wall_id, ndf, h) ops.mesh('line', 2, 3, 2,1,4, wall_id, ndf, h) ops.mesh('tri', wall_tag, 2, 1,2, wall_id, ndf, h) # fluid mesh fluid_tag = 4 ops.mesh('line', 5, 3, 2,3,4, water_bound_id, ndf, h) eleArgs = ['PFEMElementBubble',rho,mu,b1,b2,thk,kappa] ops.mesh('tri', fluid_tag, 2, 2,5, water_body_id, ndf, h, *eleArgs) for nd in ops.getNodeTags('-mesh', wall_tag): ops.fix(nd, 1,1) # save the original modal ops.record() # create constraint object ops.constraints('Plain') # create numberer object ops.numberer('Plain') # create convergence test object ops.test('PFEM', 1e-5, 1e-5, 1e-5, 1e-5, 1e-15, 1e-15, 20, 3, 1, 2) # create algorithm object ops.algorithm('Newton') # create integrator object ops.integrator('PFEM')
def runAnalysis(k): """ Tests and individual and returns the result of that test. The user should consider if it's possible for the test not to work. """ Fu = 21.1 * 10**3 # k = 2.6*10**6 b = 0.015 R0 = 19 cR1 = .95 cR2 = .15 Fu = 22.3 * 10**3 # k = 2.6*10**6 b = 0.0129 R0 = 3.1 cR1 = .3 cR2 = .01 # 21.1*10**3, 2.6*10**6, 0.015, 19, .95, .15] # 2.25427928e+04 3.33339323e+06 1.96273081e-02 5.46515829e+00 # 6.98429661e-01 5.28210755e-02 # 2.20833537e+04 3.03336982e+06 1.28872130e-02 3.13990345e+00 # 3.36067251e-01 1.04312516e-01 op.wipe() op.model('Basic', '-ndm', 2, '-ndf', 3) ## Analysis Parameters material(s) ## ------------------ LoadProtocol = np.array([ 0.0017, 0.005, 0.0075, 0.012, 0.018, 0.027, 0.04, 0.054, 0.068, 0.072, 0. ]) # Step size dx = 0.0001 op.uniaxialMaterial('Steel02', 1, Fu, k, b, R0, cR1, cR2, 0., 1., 0., 1.) ERelease = 1. op.uniaxialMaterial('Elastic', 2, ERelease, 0.0) ## Define geometric transformation(s) ## ---------------------------------- #geomTransf('Linear',1) op.geomTransf('PDelta', 1) op.beamIntegration('Lobatto', 1, 1, 3) # Define geometry # --------------- op.node(1, 0., 0., '-ndf', 3) op.node(2, 0., 0., '-ndf', 3) op.fix(1, 1, 1, 1) # Define element(s) # ----------------- op.element("zeroLength", 1, 1, 2, '-mat', 1, 2, 2, '-dir', 1, 2, 3, '-orient', 1., 0., 0., 0., 1., 0.) # Define Recorder(s) # ----------------- op.recorder('Node', '-file', 'RFrc.out', '-time', '-nodeRange', 1, 1, '-dof', 1, 'reaction') op.recorder('Node', '-file', 'Disp.out', '-time', '-nodeRange', 2, 2, '-dof', 1, 'disp') # Define Analysis Parameters # ----------------- op.timeSeries('Linear', 1, '-factor', 1.0) op.pattern('Plain', 1, 1, '-fact', 1.) op.load(2, 1., 0.0, 0.0) # op.initialize() op.constraints("Plain") op.numberer("Plain") # System of Equations op.system("UmfPack", '-lvalueFact', 10) # Convergence Test op.test('NormDispIncr', 1. * 10**-8, 25, 0, 2) # Solution Algorithm op.algorithm('Newton') # Integrator op.integrator('DisplacementControl', 2, 1, dx) # Analysis Type op.analysis('Static') ControlNode = 2 ControlNodeDof = 1 op.record() ok = 0 # Define Analysis for x in LoadProtocol: for ii in range(0, 2): # op. op.integrator('DisplacementControl', ControlNode, ControlNodeDof, dx) while (op.nodeDisp(2, 1) < x): ok = op.analyze(1) if ok != 0: print('Ending analysis') op.wipe() return np.array([0, 0]) op.integrator('DisplacementControl', ControlNode, ControlNodeDof, -dx) while (op.nodeDisp(2, 1) > -x): ok = op.analyze(1) if ok != 0: print('Ending analysis') op.wipe() return np.array([0, 0]) op.wipe() fileDispName = os.path.join('Disp.out') fileForceName = os.path.join('RFrc.out') disp = np.loadtxt(fileDispName) RFrc = np.loadtxt(fileForceName) # try: x = disp[:, 1] y = -RFrc[:, 1] xy = np.column_stack([x, y]) return xy