spc = coacciones.newSPConstraint(1, 1, 0.0) spc = coacciones.newSPConstraint(2, 1, 0.0) # Node 2 # Loads definition cargas = preprocessor.getLoadLoader casos = cargas.getLoadPatterns ts = casos.newTimeSeries("trig_ts", "ts") ts.factor = 1 ts.tStart = 0 ts.tFinish = 2 ts.period = 1 ts.shift = 0 casos.currentTimeSeries = "ts" #Load case definition lp0 = casos.newLoadPattern("default", "0") lp0.newNodalLoad(2, xc.Vector([-F, 0])) #We add the load case to domain. casos.addToDomain("0") x = [] y = [] recorder = prueba.getDomain.newRecorder("element_prop_recorder", None) recorder.setElements(xc.ID([0])) recorder.callbackRecord = "x.append(self.getMaterial().getStrain()); y.append(self.getN())" recorder.callbackRestart = "print \"Restart method called.\"" ''' \prop_recorder nodes= preprocessor.getNodeLoader{2} \callback_record
concrSetName="concrSetFbEl1", reinfMatTag=rfSteel.matTagK, reinfSetName="reinfSetFbEl1") #Load modulation. ts = casos.newTimeSeries("constant_ts", "ts") casos.currentTimeSeries = "ts" dom = preprocessor.getDomain #Load case definition lp0 = casos.newLoadPattern("default", "0") strain = list() stress = list() areaSec = width * depth for F in Flist: pointLoad = xc.Vector([F, 0, 0]) lp0.newNodalLoad(2, pointLoad) #applies the point load on node 2 #We add the load case to domain. casos.addToDomain("0") #reads load pattern "0" and adds it to the domain # Solve #analisis= predefined_solutions.simple_newton_raphson(feProblem) analisis = predefined_solutions.simple_static_modified_newton(feProblem) analOk = analisis.analyze(1) fConcrMin = setsRCEl1.concrFibers.getFiberWithMinStrain() epsCMin = fConcrMin.getMaterial().getStrain( ) # minimum strain among concrete fibers strain.append(epsCMin * 1E3) stress.append(F / areaSec / 1e6) dom.revertToStart() lp0.clearLoads()
import math from model import predefined_spaces from materials import typical_materials __author__ = "Luis C. Pérez Tato (LCPT)" __copyright__ = "Copyright 2014, LCPT" __license__ = "GPL" __version__ = "3.0" __email__ = "*****@*****.**" E = 2.1e6 # Young modulus of the steel en kg/cm2. nu = 0.3 # Poisson's ratio. h = 0.1 # Thickness. dens = 1.33 # Density kg/m2. v1 = xc.Vector([0, math.sqrt(2) / 2, math.sqrt(2) / 2]) v2 = xc.Vector([0, -math.sqrt(2) / 2, math.sqrt(2) / 2]) # Problem type feProblem = xc.FEProblem() preprocessor = feProblem.getPreprocessor nodes = preprocessor.getNodeHandler modelSpace = predefined_spaces.StructuralMechanics3D(nodes) nodes.newNodeIDXYZ(1, 0, 0, 0) nodes.newNodeIDXYZ(2, 2, 0, 0) nodes.newNodeIDXYZ(3, 2, 1, 1) nodes.newNodeIDXYZ(4, 0, 1, 1) # Materials definition memb1 = typical_materials.defElasticMembranePlateSection(
constCont = preprocessor.getConstraintLoader #constraints container fix_node_6dof.fixNode6DOF(constCont, 1) #fix_node_6dof.Nodo6DOFMovYZImpedidos(constCont,2) fix_node_6dof.Nodo6DOFMovXGiroYLibres(constCont, 2) #fix_node_6dof.Nodo6DOFMovXGirosYZLibres(constCont,2) # Loads definition cargas = preprocessor.getLoadLoader #loads container casos = cargas.getLoadPatterns #Load modulation. ts = casos.newTimeSeries("constant_ts", "ts") casos.currentTimeSeries = "ts" #Load case definition lp0 = casos.newLoadPattern("default", "0") pointLoad = xc.Vector([0, 0, 0, 0, M_y, 0]) lp0.newNodalLoad(2, pointLoad) #applies the point load on node 2 #We add the load case to domain. casos.addToDomain("0") #reads load pattern "0" and adds it to the domain # Solve #analisis= predefined_solutions.simple_newton_raphson(problem) analisis = predefined_solutions.simple_static_modified_newton(problem) analOk = analisis.analyze(1) #printing results nodos = preprocessor.getNodeLoader nodos.calculateNodalReactions(True) nodos = preprocessor.getNodeLoader '''
A= 0.0 yG= 0.0 zG= 0.0 IEA= 0.0; IK12= 0.0; IK13= 0.0 IK21= 0.0; IEIy= 0.0; IK23= 0.0 IK31= 0.0; IK32= 0.0; IEIz= 0.0 TEA= 0.0; TK12= 0.0; TK13= 0.0 TK21= 0.0; TEIy= 0.0; TK23= 0.0 TK31= 0.0; TK32= 0.0; TEIz= 0.0 elast0= typical_materials.defElasticMaterial(preprocessor, "elast0",Es) # Sections fiberSectionTest= preprocessor.getMaterialHandler.newMaterial("fiber_section_3d","fiberSectionTest") fiberSectionTest.addFiber("elast0",Area,xc.Vector([yF,zF])) A= fiberSectionTest.getArea yG= fiberSectionTest.getCenterOfMassY() zG= fiberSectionTest.getCenterOfMassZ() initialTangentStiffness= fiberSectionTest.getInitialTangentStiffness() IEA= initialTangentStiffness.at(1,1) IK12= initialTangentStiffness.at(1,2) IK13= initialTangentStiffness.at(1,3) IK21= initialTangentStiffness.at(2,1) IEIy= initialTangentStiffness.at(2,2) IK23= initialTangentStiffness.at(2,3) IK31= initialTangentStiffness.at(3,1) IK32= initialTangentStiffness.at(3,2) IEIz= initialTangentStiffness.at(3,3)
h=.30) # Section geometry. matSeccTest = typical_materials.MaterialData("mattest", E=7E9, nu=0.3, rho=2500) # Section material. # Problem type modelSpace = predefined_spaces.StructuralMechanics3D(nodes) # Definimos el material defSeccAggregation.defSeccAggregation3d(preprocessor, seccTest, matSeccTest) nodes.defaultTag = 1 #First node number. nod = nodes.newNodeXYZ(0, 0, 0) nod = nodes.newNodeXYZ(L, 0, 0) # Geometric transformations lin = modelSpace.newLinearCrdTransf("lin", xc.Vector([0, 0, 1])) # Elements definition elements = preprocessor.getElementHandler elements.defaultTransformation = "lin" elements.defaultMaterial = seccTest.sectionName elements.numSections = 3 # Number of sections along the element. elements.defaultTag = 1 beam3d = elements.newElement("ForceBeamColumn3d", xc.ID([1, 2])) # Constraints modelSpace.fixNode000_000(1) # Loads definition cargas = preprocessor.getLoadHandler casos = cargas.getLoadPatterns ts = casos.newTimeSeries("constant_ts", "ts")
spc = modelSpace.constraints.newSPConstraint(2, 1, 0.0) spc = modelSpace.constraints.newSPConstraint(2, 2, 0.0) spc = modelSpace.constraints.newSPConstraint(3, 2, 0.0) spc = modelSpace.constraints.newSPConstraint(4, 2, 0.0) # Loads definition loadHandler = preprocessor.getLoadHandler lPatterns = loadHandler.getLoadPatterns #Load modulation. ts = lPatterns.newTimeSeries("constant_ts", "ts") lPatterns.currentTimeSeries = "ts" #Load case definition lp0 = lPatterns.newLoadPattern("default", "0") lp0.newNodalLoad(3, xc.Vector([0, F, 0, 0, 0, 0])) lp0.newNodalLoad(4, xc.Vector([0, F, 0, 0, 0, 0])) #We add the load case to domain. lPatterns.addToDomain(lp0.name) # Solution analisis = predefined_solutions.simple_static_linear(feProblem) result = analisis.analyze(1) n1MedioElem = 0.0 n2MedioElem = 0.0 n12MedioElem = 0.0 #elements= preprocessor.getElementHandler elem.getResistingForce() mats = elem.getPhysicalProperties.getVectorMaterials #Materials at gauss points. #Gauss points iterator
def appendLoadToCurrentLoadPattern(self,dicQuadSurf): ''' Append load to the current load pattern.''' loadVector= xc.Vector(self.loadVector) self.lstGridRg.appendLoadVectorToCurrentLoadPattern(loadVector)
hastiales_mesh = fem.SurfSetToMesh(surfSet=hastiales, matSect=wall_mat, elemType='ShellMITC4', elemSize=eSize) dintel_mesh = fem.SurfSetToMesh(surfSet=dintel, matSect=deck_mat, elemType='ShellMITC4', elemSize=eSize) fem.multi_mesh(preprocessor=prep, lstMeshSets=[losCim_mesh, hastiales_mesh, dintel_mesh]) murete_i_mesh = fem.LinSetToMesh(linSet=murete_i, matSect=muretes_mat, elemSize=eSize, vDirLAxZ=xc.Vector([0, 0, 1]), elemType='ElasticBeam3d', coordTransfType='linear') murete_i_mesh.generateMesh(prep) # mesh this set of lines murete_d_mesh = fem.LinSetToMesh(linSet=murete_d, matSect=muretes_mat, elemSize=eSize, vDirLAxZ=xc.Vector([0, 0, 1]), elemType='ElasticBeam3d', coordTransfType='linear') murete_d_mesh.generateMesh(prep) # mesh this set of lines overallSet = losCim + hastiales + dintel # ***BOUNDARY CONDITIONS*** # Regions resting on springs (Winkler elastic foundation)
elements.defaultMaterial= "seccion" beam2d= elements.newElement("ForceBeamColumn2d",xc.ID([1,2])); # Constraints constraints= preprocessor.getBoundaryCondHandler modelSpace.fixNode000(1) # Loads definition loadHandler= preprocessor.getLoadHandler lPatterns= loadHandler.getLoadPatterns #Load modulation. ts= lPatterns.newTimeSeries("constant_ts","ts") lPatterns.currentTimeSeries= "ts" #Load case definition lp0= lPatterns.newLoadPattern("default","0") lp0.newNodalLoad(2,xc.Vector([0,-F,0])) #We add the load case to domain. lPatterns.addToDomain("0") # Solution procedure analisis= predefined_solutions.simple_static_modified_newton(feProblem) result= analisis.analyze(10) nodes.calculateNodalReactions(True,1e-7) nod2= nodes.getNode(2) delta= nod2.getDisp[1] # Node 2 xAxis displacement nod1= nodes.getNode(1) Ry= nod1.getReaction[1] RMz= nod1.getReaction[2] elements= preprocessor.getElementHandler
def appendLoadToCurrentLoadPattern(self): accVector= xc.Vector(self.acceleration) for clin in self.matLines: LSecMat= clin.material loadVector=LSecMat.getLongitudinalDensity()*accVector clin.appendVector3dUniformLoadGlobalToCurrentLoadPattern(loadVector)
# Constraints modelSpace = predefined_spaces.getStructuralMechanics3DSpace(preprocessor) modelSpace.fixNode000_000(1) modelSpace.fixNodeF00_00F(2) # Loads definition loadHandler = preprocessor.getLoadHandler lPatterns = loadHandler.getLoadPatterns #Load modulation. ts = lPatterns.newTimeSeries("constant_ts", "ts") lPatterns.currentTimeSeries = "ts" #Load case definition lp0 = lPatterns.newLoadPattern("default", "0") lp0.newNodalLoad(2, xc.Vector([NDato, 0, 0, 0, 0, MzDato])) #We add the load case to domain. lPatterns.addToDomain(lp0.name) # Solution procedure analisis = predefined_solutions.simple_newton_raphson(feProblem) analOk = analisis.analyze(10) nodes = preprocessor.getNodeHandler nodes.calculateNodalReactions(True, 1e-7) RN = nodes.getNode(1).getReaction[0] RM = nodes.getNode(1).getReaction[5] RN2 = nodes.getNode(2).getReaction[0]
# of beam stiffness and resisting force from the basic system to the # global-coordinate system lin = modelSpace.newLinearCrdTransf("lin") elements = prep.getElementHandler elements.defaultTransformation = "lin" elements.defaultMaterial = beamSection.name beam2d = elements.newElement("ElasticBeam2d", xc.ID([n1.tag, n2.tag])) ## *** Loads *** ### define GRAVITY ------------------------------------------------------------- loadPatterns = prep.getLoadHandler.getLoadPatterns gravityTS = loadPatterns.newTimeSeries("constant_ts", "ts") loadPatterns.currentTimeSeries = "ts" lp0 = loadPatterns.newLoadPattern("default", "0") # by the way we check that the loads cummulate lp0.newNodalLoad(n2.tag, xc.Vector([0.0, -2000, 0])) loadPatterns.addToDomain(lp0.getName()) # Append load pattern to domain. ## Static analysis. solution = predefined_solutions.SolutionProcedure() analysis = solution.simpleStaticLinear(FEcase) result = analysis.analyze(1) prep.getDomain.setLoadConstant() prep.getDomain.setTime(0.0) ### Define RECORDERS dFree = [] recDFree = prep.getDomain.newRecorder("node_prop_recorder", None) recDFree.setNodes(xc.ID([n2.tag])) recDFree.callbackRecord = "dFree.append([self.getDomain.getTimeTracker.getCurrentTime,self.getDisp])"
modelSpace.fixNode000_000(1) modelSpace.fixNode000_000(5) modelSpace.fixNode000_000(9) # Loads definition cargas = preprocessor.getLoadHandler casos = cargas.getLoadPatterns #Load modulation. ts = casos.newTimeSeries("constant_ts", "ts") casos.currentTimeSeries = "ts" lpG = casos.newLoadPattern("default", "G") #casos.currentLoadPattern= "G" lpG.newNodalLoad(nod4.tag, xc.Vector([F, 0.0, 0.0, 0.0, 0.0, 0.0])) lpG.newNodalLoad(nod8.tag, xc.Vector([F, 0.0, 0.0, 0.0, 0.0, 0.0])) lpG.newNodalLoad(nod12.tag, xc.Vector([F, 0.0, 0.0, 0.0, 0.0, 0.0])) # Combinaciones combs = cargas.getLoadCombinations comb = combs.newLoadCombination("ELU001", "1.00*G") printFlag = 0 solu = feProblem.getSoluProc solCtrl = solu.getSoluControl solModels = solCtrl.getModelWrapperContainer sm = solModels.newModelWrapper("sm") cHandler = sm.newConstraintHandler("penalty_constraint_handler") cHandler.alphaSP = 1.0e15
sides = s.getSides # Edge iterator for l in sides: for i in l.getEdge.getNodeTags(): modelSpace.fixNode000_FFF(i) # Load definition. lp0 = modelSpace.newLoadPattern(name='0') f1 = preprocessor.getSets.getSet("f1") nNodes = f1.getNumNodes node = f1.getNodeIJK(1, int(NumDivI / 2 + 1), int(NumDivJ / 2 + 1)) # print("Central node: ", node.tag) # print("Central node coordinates: ", node.getCoo) lp0.newNodalLoad(node.tag, xc.Vector([0, 0, -ptLoad, 0, 0, 0])) # Concentrated load nElems = f1.getNumElements # We add the load case to domain. modelSpace.addLoadCaseToDomain(lp0.name) # Solution procedure analysis = predefined_solutions.simple_static_linear(feProblem) analOk = analysis.analyze(1) f1 = preprocessor.getSets.getSet("f1") from postprocess.reports import export_internal_forces setTotal = preprocessor.getSets["total"] fName = "/tmp/test_export_shell_internal_forces.txt" internalForcesDict = export_internal_forces.getInternalForcesDict(
Ly = 1 Lz = 1 # Problem type feProblem = xc.FEProblem() preprocessor = feProblem.getPreprocessor nodes = preprocessor.getNodeHandler modelSpace = predefined_spaces.StructuralMechanics3D(nodes) nod0 = nodes.newNodeIDXYZ(0, 0, 0, 0) nod1 = nodes.newNodeXYZ(0, -Ly, 0) nod2 = nodes.newNodeXYZ(0, -Ly, -Lz) nod3 = nodes.newNodeXYZ(Lx, -Ly, -Lz) nod3.mass = nodeMassMatrix constraints = preprocessor.getBoundaryCondHandler nod0.fix(xc.ID([0, 1, 2, 3, 4, 5]), xc.Vector([0, 0, 0, 0, 0, 0])) # Materials definition scc = typical_materials.defElasticSection3d(preprocessor, "scc", area, EMat, GMat, Izz, Iyy, Ir) # Geometric transformation(s) linX = modelSpace.newLinearCrdTransf("linX", xc.Vector([1, 0, 0])) linY = modelSpace.newLinearCrdTransf("linY", xc.Vector([0, 1, 0])) # Elements definition elements = preprocessor.getElementHandler elements.defaultTransformation = "linX" elements.defaultMaterial = "scc" beam3d = elements.newElement("ElasticBeam3d", xc.ID([0, 1])) beam3d = elements.newElement("ElasticBeam3d", xc.ID([1, 2]))
nodes.defaultTag= 0 #First node number. nod= nodes.newNodeXYZ(0,0.0,0.0) nod= nodes.newNodeXYZ(Lbeam,0.0,0.0) nod= nodes.newNodeXYZ(0.0,Lbeam,0.0) nod= nodes.newNodeXYZ(0.0,0.0,Lbeam) # Geometric transformations trfs= preprocessor.getTransfCooHandler # Coord. trasformation for beam in global X direction #local Z axis of the element # parallel to global -Y (it matches # the direction of the local Z axis of the reinforced # concrete sections (parallel to the width) ltXbeam= modelSpace.newLinearCrdTransf("ltXbeam", xc.Vector([0,-1,0])) # Coord. trasformation for beam in global Y direction # local Z axis of the element # (parallel to global -Z) ltYbeam= modelSpace.newLinearCrdTransf("ltYbeam",xc.Vector([0,0,-1])) # Coord. trasformation for beam in global Z direction # local Z axis # of the element (45º with global +X) ltZbeam= modelSpace.newLinearCrdTransf("ltZbeam",xc.Vector([1/math.sqrt(2),1/math.sqrt(2),0,1])) # The local Z axis of the elements matches the direction of the local Z axis # of the reinforced concrete sections (parallel to the width), # that is why we define:
__version__= "3.0" __email__= "[email protected] [email protected]" E= 2.1e6 # Steel Young's modulus [kg/cm2]. nu= 0.3 # Poisson's ratio. h= 0.1 # thickness. dens= 1.33 # specific mass [kg/m2]. import xc_base import geom import xc from model import predefined_spaces from materials import typical_materials from solution import predefined_solutions v1= xc.Vector([0,1,0]) v2= xc.Vector([0,0,1]) feProblem= xc.FEProblem() preprocessor= feProblem.getPreprocessor nodes= preprocessor.getNodeHandler # Problem type modelSpace= predefined_spaces.StructuralMechanics3D(nodes) n1= nodes.newNodeXYZ(0,0,0) # first corner nodes counter-clockwise n2= nodes.newNodeXYZ(1,0,0) n3= nodes.newNodeXYZ(1,1,0) n4= nodes.newNodeXYZ(0,1,0) n5= nodes.newNodeXYZ(0.5,0,0) # mid-side nodes counter-clockwise n6= nodes.newNodeXYZ(1,0.5,0) n7= nodes.newNodeXYZ(0.5,1,0)
spc= constraints.newSPConstraint(1,1,0.0) spc= constraints.newSPConstraint(4,0,0.0) # Node 4 spc= constraints.newSPConstraint(4,1,0.0) spc= constraints.newSPConstraint(2,0,0.0) # Node 2 spc= constraints.newSPConstraint(3,0,0.0) # Node 3 # Loads definition loadHandler= preprocessor.getLoadHandler lPatterns= loadHandler.getLoadPatterns #Load modulation. ts= lPatterns.newTimeSeries("constant_ts","ts") lPatterns.currentTimeSeries= "ts" #Load case definition lp0= lPatterns.newLoadPattern("default","0") lp0.newNodalLoad(2,xc.Vector([0,-F2])) lp0.newNodalLoad(3,xc.Vector([0,-F1])) #We add the load case to domain. lPatterns.addToDomain("0") # Solution procedure import os pth= os.path.dirname(__file__) #print "pth= ", pth if(not pth): pth= "." execfile(pth+"/../aux/sol_superlu.py") nodes.calculateNodalReactions(True,1e-7)
casos = cargas.getLoadPatterns #Load modulation. ts = casos.newTimeSeries("constant_ts", "ts") casos.currentTimeSeries = "ts" #Load case definition lp0 = casos.newLoadPattern("default", "0") #casos.currentLoadPattern= "0" loadN = -1 loadVy = -2 loadVz = -3 loadMx = -4 loadMy = -5 loadMz = -6 lp0.newNodalLoad(2, xc.Vector([loadN, loadVy, loadVz, loadMx, loadMy, loadMz])) #We add the load case to domain. casos.addToDomain("0") # Solution procedure analysis = predefined_solutions.plain_newton_raphson(feProblem) analOk = analysis.analyze(1) if (analOk != 0): print "Error!; failed to converge." exit() nodes = preprocessor.getNodeHandler nodes.calculateNodalReactions(True, 1e-6) n1 = nodes.getNode(1) reacN1 = n1.getReaction
glue = modelSpace.constraints.newGlueNodeToElement(n10, elem, xc.ID(gluedDOFs)) #Equivalent in this case: #glue= modelSpace.constraints.newEqualDOF(n10.tag,1,xc.ID(gluedDOFs)) # Loads definition cargas = preprocessor.getLoadLoader casos = cargas.getLoadPatterns #Load modulation. ts = casos.newTimeSeries("constant_ts", "ts") casos.currentTimeSeries = "ts" #Load case definition lp0 = casos.newLoadPattern("default", "0") lp0.newNodalLoad(10, xc.Vector(loadOnDOFs)) #We add the load case to domain. casos.addToDomain("0") # Solution solver = predefined_solutions.SolutionProcedure() analisis = solver.simpleLagrangeStaticLinear(feProblem) # analisis= predefined_solutions.simple_static_linear(feProblem) result = analisis.analyze(1) nodes.calculateNodalReactions(False) reactionNode10 = nodes.getNode(10).getReaction ratio1 = reactionNode10.Norm() svdReactionNodes = nodal_reactions.getReactionFromNodes( nodes, "UVWRxRyRz", [1, 2, 3, 4]) actionNode10 = xc.Vector(loadOnDOFs)
lastXpos = len(xList_deck) - 1 lastYpos = len(yList_deck) - 1 lastZpos = len(zList_deck) - 1 # grid model definition gridDeck = gm.GridModel(prep, xList_deck, yList_deck, zList_deck) # Grid geometric entities definition (points, lines, surfaces) # Points' generation gridDeck.generatePoints() #Displacements of the grid points in a range # deltZ_max=L_long_side_Y*math.tan(alpha) r = gm.IJKRange((0, 0, 0), (1, 0, lastZpos)) gridDeck.movePointsRange(r, xc.Vector([0.0, delta_Y, delta_Y * math.tan(alpha)])) r = gm.IJKRange((0, lastYpos, 0), (1, lastYpos, lastZpos)) gridDeck.movePointsRange( r, xc.Vector([0.0, -delta_Y, (L_long_side_Y - delta_Y) * math.tan(alpha)])) r = gm.IJKRange((0, 1, 0), (lastXpos, 1, lastZpos)) gridDeck.movePointsRange(r, xc.Vector([0.0, 0, yList_deck[1] * math.tan(alpha)])) r = gm.IJKRange((0, 2, 0), (lastXpos, 2, lastZpos)) gridDeck.movePointsRange(r, xc.Vector([0.0, 0, yList_deck[2] * math.tan(alpha)])) r = gm.IJKRange((2, lastYpos, 0), (lastXpos, lastYpos, lastZpos)) gridDeck.movePointsRange( r, xc.Vector([0.0, 0, yList_deck[lastYpos] * math.tan(alpha)])) r = gm.IJKRange((lastXpos, 0, 0), (lastXpos, lastYpos, lastZpos))
l = lines.newLine(2, 4) l.nDiv = nDivLines * 2 l = lines.newLine(4, 3) l.nDiv = nDivLines l = lines.newLine(5, 6) l.nDiv = nDivLines l = lines.newLine(6, 8) l.nDiv = nDivLines * 2 l = lines.newLine(8, 7) l.nDiv = nDivLines setTotal = preprocessor.getSets.getSet("total") setTotal.genMesh(xc.meshDir.I) constraints = preprocessor.getBoundaryCondHandler pt1.getNode().fix(xc.ID([0, 1, 2]), xc.Vector([0.0, 0.0, 0.0])) pt3.getNode().fix(xc.ID([0, 1, 2]), xc.Vector([0.0, 0.0, 0.0])) pt5.getNode().fix(xc.ID([0, 1, 2]), xc.Vector([0.0, 0.0, 0.0])) pt7.getNode().fix(xc.ID([0, 1, 2]), xc.Vector([0.0, 0.0, 0.0])) nodeTag2 = pt2.getTagNode nodeTag6 = pt6.getTagNode nodeTag8 = pt8.getTagNode mesh = feProblem.getDomain.getMesh nodeTagCentralLoad = mesh.getNearestNode(geom.Pos3d(B / 2, H, 0.0)).tag nodeTagLateralLoad = mesh.getNearestNode(geom.Pos3d(offset + B / 4, H, 0.0)).tag tagElem1 = mesh.getNearestElement(geom.Pos3d(0, H / (10 * nDivLines), 0.0)).tag tagElem2 = mesh.getNearestElement(geom.Pos3d(B / (10 * nDivLines), H, 0.0)).tag tagElem4 = mesh.getNearestElement(geom.Pos3d(offset, H / (10 * nDivLines),
else: loadOnDOFs[i] = -1000.0 glue = modelSpace.constraints.newGlueNodeToElement(nA, elem, xc.ID(gluedDOFs)) # Loads definition loadHandler = preprocessor.getLoadHandler lPatterns = loadHandler.getLoadPatterns #Load modulation. ts = lPatterns.newTimeSeries("constant_ts", "ts") lPatterns.currentTimeSeries = "ts" #Load case definition lp0 = lPatterns.newLoadPattern("default", "0") lp0.newNodalLoad(nA.tag, xc.Vector(loadOnDOFs)) #We add the load case to domain. lPatterns.addToDomain(lp0.name) # Solution analisis = predefined_solutions.simple_static_linear(feProblem) result = analisis.analyze(1) nodes.calculateNodalReactions(False, 1e-7) reactionNodeA = nA.getReaction ratio1 = reactionNodeA.Norm() svdReactionNodes = nodal_reactions.getReactionFromNodes( nodes, "UVWRxRyRz", elem.getNodes.getExternalNodes) actionNodeA = xc.Vector(loadOnDOFs) actionNodeANorm = actionNodeA.Norm()
for n in range(4, 7): constraints.newSPConstraint(n, 0, 0.0) constraints.newSPConstraint(n, 1, 0.0) # Loads definition loadHandler = preprocessor.getLoadHandler lPatterns = loadHandler.getLoadPatterns #Load modulation. ts = lPatterns.newTimeSeries("constant_ts", "ts") lPatterns.currentTimeSeries = "ts" #Load case definition lp0 = lPatterns.newLoadPattern("default", "0") for n in range(1, 4): lp0.newNodalLoad(n, xc.Vector([FX, FY, FZ, 0, 0, 0])) for n in range(4, 7): lp0.newNodalLoad(n, xc.Vector([0, 0, FZ, 0, 0, 0])) #We add the load case to domain. lPatterns.addToDomain(lp0.name) # Solution result = modelSpace.analyze(calculateNodalReactions=True) deltX_nodXYZ = [nodXYZ[i].getDisp[0] for i in range(3)] deltY_nodXYZ = [nodXYZ[i].getDisp[1] for i in range(3)] deltZ_nodXYZ = [nodXYZ[i].getDisp[2] for i in range(3)] RX_fixedNodXYZ = [fixedNodXYZ[i].getReaction[0] for i in range(3)] RY_fixedNodXYZ = [fixedNodXYZ[i].getReaction[1] for i in range(3)]
setTotal.killElements() # deactivate the elements mesh= feProblem.getDomain.getMesh mesh.setDeadSRF(0.0) mesh.freezeDeadNodes("bloquea") # Constraint inactive nodes. # Loads definition cargas= preprocessor.getLoadLoader casos= cargas.getLoadPatterns #Load modulation. ts= casos.newTimeSeries("constant_ts","ts") casos.currentTimeSeries= "ts" #Load case definition lp0= casos.newLoadPattern("default","0") lp0.newNodalLoad(2,xc.Vector([F,0,F,0,0,0])) lp0.newNodalLoad(3,xc.Vector([F,0,F,0,0,0])) lp0.newNodalLoad(6,xc.Vector([F,0,F,0,0,0])) lp0.newNodalLoad(7,xc.Vector([F,0,F,0,0,0])) #We add the load case to domain. casos.addToDomain("0") # Solution analisis= predefined_solutions.simple_static_linear(feProblem) result= analisis.analyze(1) nodes.calculateNodalReactions(True) nodes= preprocessor.getNodeLoader nod1= nodes.getNode(1)
seedElemHandler.defaultTransformation = cooTrf.name elem = seedElemHandler.newElement("ElasticBeam2d", xc.ID([0, 0])) xcTotalSet = preprocessor.getSets.getSet('total') mesh = xcTotalSet.genMesh(xc.meshDir.I) # Constraints modelSpace.fixNode000(p0.getNode().tag) # Actions loadCaseManager = load_cases.LoadCaseManager(preprocessor) loadCaseNames = ['p0', 'p1', 'p2', 'p3'] loadCaseManager.defineSimpleLoadCases(loadCaseNames) ## Point load 0. cLC = loadCaseManager.setCurrentLoadCase('p0') pLoad = xc.Vector([4.45e3, 0.0, 0.0]) p1.getNode().newLoad(pLoad) ## Point load 1. cLC = loadCaseManager.setCurrentLoadCase('p1') pLoad = xc.Vector([4.45e3, -445e3, 0.0]) p1.getNode().newLoad(pLoad) ## Point load 2. cLC = loadCaseManager.setCurrentLoadCase('p2') pLoad = xc.Vector([4.45e3, -667e3, 0.0]) p1.getNode().newLoad(pLoad) ## Point load 3. cLC = loadCaseManager.setCurrentLoadCase('p3') pLoad = xc.Vector([4.45e3, -890e3, 0.0])
motionPeakFactor = 0.0 motionLastSendCommitTag = 0.0 motionPathTimeIncrement = 0.0 feProblem = xc.FEProblem() preprocessor = feProblem.getPreprocessor #Load modulation. loadHandler = preprocessor.getLoadHandler lPatterns = loadHandler.getLoadPatterns ts = lPatterns.newTimeSeries("constant_ts", "ts") gm = lPatterns.newLoadPattern("uniform_excitation", "gm") mr = gm.motionRecord hist = mr.history accel = lPatterns.newTimeSeries("path_ts", "accel") accel.path = xc.Vector([1, 2, 3, 4]) hist.accel = accel hist.delta = 0.01 motionDuration = mr.getDuration() motionPath = mr.history.accel.path motionPathSize = mr.history.getNumberOfDataPoints() motionFactor = mr.history.accel.getFactor(0.5) motionPeakFactor = mr.history.accel.getPeakFactor motionLastSendCommitTag = mr.history.accel.lastSendCommitTag motionPathTimeIncrement = mr.history.accel.getTimeIncr(0.5) ratio1 = (motionDuration - 4) / 4 ratio2 = (motionFactor - 1.5) / 1.5 ratio3 = (motionPeakFactor - 4) / 4 ratio4 = (motionLastSendCommitTag + 1)
L = 1.5 # Bar length (m) # Load F = 1.5e3 # Load magnitude (kN) feProblem = xc.FEProblem() preprocessor = feProblem.getPreprocessor nodes = preprocessor.getNodeHandler # Problem type modelSpace = predefined_spaces.StructuralMechanics3D(nodes) nodes.defaultTag = 1 #First node number. nod = nodes.newNodeXYZ(0, 0.0, 0.0) nod = nodes.newNodeXYZ(L, 0.0, 0.0) lin = modelSpace.newLinearCrdTransf("lin", xc.Vector([0, 1, 0])) # Materials definition scc = typical_materials.defElasticSection3d(preprocessor, "scc", A, E, G, Iz, Iy, J) elements = preprocessor.getElementHandler elements.defaultTransformation = "lin" elements.defaultMaterial = "scc" elements.defaultTag = 1 #Tag for next element. beam3d = elements.newElement("ElasticBeam3d", xc.ID([1, 2])) modelSpace.fixNode000_000(1) cargas = preprocessor.getLoadHandler
G = E / (2 * (1 + nu)) # Shear modulus J = .2e-1 # Cross section torsion constant (m4) # Load f = 1.5 # Load magnitude en N/m. # Problem type feProblem = xc.FEProblem() preprocessor = feProblem.getPreprocessor nodes = preprocessor.getNodeHandler modelSpace = predefined_spaces.StructuralMechanics3D(nodes) nodes.defaultTag = 1 #First node number. nod = nodes.newNodeXYZ(0, 0.0, 0.0) nod = nodes.newNodeXYZ(L, 0.0, 0.0) lin = modelSpace.newLinearCrdTransf("lin", xc.Vector([0, 1, 0])) # Materials definition fy = 275e6 # Yield stress of the steel. steel = typical_materials.defSteel01(preprocessor, "steel", E, fy, 0.001) respT = typical_materials.defElasticMaterial(preprocessor, "respT", G * J) # Torsion response. respVy = typical_materials.defElasticMaterial( preprocessor, "respVy", 1e9) # Shear response in y direction. respVz = typical_materials.defElasticMaterial( preprocessor, "respVz", 1e9) # Shear response in z direction. # Sections import os pth = os.path.dirname(__file__) #print "pth= ", pth