n1 = nodes.newNodeXY(0, 0) n2 = nodes.newNodeXY(a / 2, -b) n3 = nodes.newNodeXY(a, 0) # Materials definition sectionProperties = xc.CrossSectionProperties1d() sectionProperties.A = A sectionProperties.E = E section = typical_materials.defElasticSectionFromMechProp1d( preprocessor, "section", sectionProperties) # Element definition. elements = preprocessor.getElementHandler elements.dimElem = 2 # Two-dimensional space. elements.defaultMaterial = section.name truss1 = elements.newElement("TrussSection", xc.ID([n1.tag, n2.tag])) truss2 = elements.newElement("TrussSection", xc.ID([n2.tag, n3.tag])) constraints = preprocessor.getBoundaryCondHandler # Zero movement for node 1. spc1 = constraints.newSPConstraint(n1.tag, 0, 0.0) spc2 = constraints.newSPConstraint(n1.tag, 1, 0.0) # Zero movement for node 3. spc3 = constraints.newSPConstraint(n3.tag, 0, 0.0) spc4 = constraints.newSPConstraint(n3.tag, 1, 0.0) # Load definition. lp0 = modelSpace.newLoadPattern(name='0') lp0.newNodalLoad(n2.tag, xc.Vector([0, -F])) # We add the load case to domain. modelSpace.addLoadCaseToDomain(lp0.name)
fiberSectionRepr.setGeomNamed("testQuadRegion") quadFibers.setupFibers() A = quadFibers.getFibers().getArea agg = materiales.newMaterial("section_aggregator", "agg") agg.setSection("quadFibers") agg.setAdditions(["T", "Vy", "Vz"], ["respT", "respVy", "respVz"]) # Torsion and shear responses. # Elements definition elements = preprocessor.getElementHandler elements.defaultTransformation = "lin" elements.defaultMaterial = "agg" elements.numSections = 2 # Number of sections along the element. elements.defaultTag = 1 el = elements.newElement("ForceBeamColumn3d", xc.ID([1, 2])) # Constraints modelSpace.fixNode000_000(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, 0, 0, M, 0, 0])) #We add the load case to domain.
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.name elements.defaultMaterial = scc.name elements.defaultTag = 1 # Tag for next element. beam3d = elements.newElement("ElasticBeam3d", xc.ID([1, 2])) modelSpace.fixNode000_000(1) # Load definition. lp0 = modelSpace.newLoadPattern(name='0') lp0.newNodalLoad(2, xc.Vector([F, 0, 0, 0, 0, 0])) # We add the load case to domain. modelSpace.addLoadCaseToDomain(lp0.name) import os os.system("rm -r -f /tmp/test09.db") db = feProblem.newDatabase("BerkeleyDB", "/tmp/test09.db") db.save(100) feProblem.clearAll()
kPlBaja= 20*12*Ehorm*Ibaja/(Hbaja**3) kPl1a= 20*12*Ehorm*I1a/(H**3) kPl2a= kPl1a kPl3a= 20*12*Ehorm*I3a/(H**3) kPl4a= kPl3a feProblem= xc.FEProblem() preprocessor= feProblem.getPreprocessor nodes= preprocessor.getNodeHandler # Problem type modelSpace= predefined_spaces.StructuralMechanics2D(nodes) nodes.defaultTag= 0 nod= nodes.newNodeXY(0,0) nod.mass= nodeMassMatrix nod.setProp("gdlsCoartados",xc.ID([0,1,2])) nod= nodes.newNodeXY(0,4) nod.mass= nodeMassMatrix nod.setProp("gdlsCoartados",xc.ID([1,2])) nod= nodes.newNodeXY(0,4+3) nod.mass= nodeMassMatrix nod.setProp("gdlsCoartados",xc.ID([1,2])) nod= nodes.newNodeXY(0,4+3+3) nod.mass= nodeMassMatrix nod.setProp("gdlsCoartados",xc.ID([1,2])) nod= nodes.newNodeXY(0,4+3+3+3) nod.mass= nodeMassMatrix nod.setProp("gdlsCoartados",xc.ID([1,2])) nod= nodes.newNodeXY(0,4+3+3+3+3) nod.mass= nodeMassMatrix nod.setProp("gdlsCoartados",xc.ID([1,2]))
nodes = preprocessor.getNodeHandler modelSpace = predefined_spaces.SolidMechanics2D(nodes) n1 = nodes.newNodeIDXY(1, 0, 0) n2 = nodes.newNodeIDXY(2, 2, 0) n2.setTrialDisp(xc.Vector([0.002, 0.003])) n3 = nodes.newNodeIDXY(3, 2, 1) n3.setTrialDisp(xc.Vector([0.006, 0.0032])) n4 = nodes.newNodeIDXY(4, 0, 1) elast2d = typical_materials.defElasticIsotropicPlaneStress( preprocessor, "elast2d", E, nu, rho) # Elements definition elements = preprocessor.getElementHandler elements.defaultMaterial = elast2d.name quad4n = elements.newElement("FourNodeQuad", xc.ID([1, 2, 3, 4])) preprocessor.getDomain.commit() detJ = quad4n.detJ(0.0, 0.0) avgStress = quad4n.getPhysicalProperties.getCommittedAvgStress sgMed1 = avgStress[0] sgMed2 = avgStress[1] sgMed3 = avgStress[2] ratio1 = (detJ - 0.5) / 0.5 ratio2 = (sgMed1 - 66920) / 66920 ratio3 = (sgMed2 - 23080) / 23080 ratio4 = (sgMed3 - 40960) / 40960 ''' print("detJ= ",(detJ)) print("sg1= ",(sgMed1))
nodes= preprocessor.getNodeLoader 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(preprocessor, "memb1",E,nu,dens,h) elementos= preprocessor.getElementLoader elementos.defaultMaterial= "memb1" elem= elementos.newElement("corot_shell_mitc4",xc.ID([1,2,3,4])) ratio1= (elem.getCoordTransf.getG2Vector-v1).Norm() ratio2= (elem.getCoordTransf.getG3Vector-v2).Norm() ratio3= (elem.getCoordTransf.getVPosCentroide-C).Norm() ''' print "v1= ",v1 print "v2= ",v2 print "ratio1= ",ratio1 print "ratio2= ",ratio2 print "ratio3= ",ratio3 '''
# Problem type modelSpace = predefined_spaces.StructuralMechanics3D(nodes) n1 = nodes.newNodeIDXYZ(1, p1.x, p1.y, p1.z) n2 = nodes.newNodeIDXYZ(2, p2.x, p2.y, p2.z) n3 = nodes.newNodeIDXYZ(3, p3.x, p3.y, p3.z) n4 = nodes.newNodeIDXYZ(4, p4.x, p4.y, p4.z) p10 = geom.Pos3d(p1.x, p1.y, p1.z) n10 = nodes.newNodeIDXYZ(10, p10.x, p10.y, p10.z) # Materials definition memb1 = typical_materials.defElasticMembranePlateSection( preprocessor, "memb1", E, nu, dens, h) elements = preprocessor.getElementHandler elements.defaultMaterial = memb1.name elem = elements.newElement("ShellMITC4", xc.ID([1, 2, 3, 4])) # Constraints constraints = preprocessor.getBoundaryCondHandler modelSpace.fixNode000_FFF(n1.tag) modelSpace.fixNode000_FFF(n2.tag) modelSpace.fixNode000_FFF(n3.tag) modelSpace.fixNode000_FFF(n4.tag) # modelSpace.fixNode000_000( n1.tag) # modelSpace.fixNode000_000( n2.tag) # modelSpace.fixNode000_000( n3.tag) # modelSpace.fixNode000_000( n4.tag) # Glued node. gluedDOFs = [0, 2, 5] loadOnDOFs = [0, 0, 0, 0, 0, 0]
preprocessor, "elast", EMat, nuMat, espChapa * dens, espChapa) points = preprocessor.getMultiBlockTopology.getPoints pt1 = points.newPntIDPos3d(1, geom.Pos3d(0.0, 0.0, 0.0)) pt2 = points.newPntIDPos3d(2, geom.Pos3d(b, 0.0, 0.0)) pt3 = points.newPntIDPos3d(3, geom.Pos3d(b, L, 0.0)) pt4 = points.newPntIDPos3d(4, geom.Pos3d(0, L, 0.0)) surfaces = preprocessor.getMultiBlockTopology.getSurfaces surfaces.defaultTag = 1 s = surfaces.newQuadSurfacePts(1, 2, 3, 4) s.nDivI = 4 s.nDivJ = NumDiv seedElemHandler = preprocessor.getElementHandler.seedElemHandler seedElemHandler.defaultMaterial = elast.name elem = seedElemHandler.newElement("ShellNLDKGQ", xc.ID([0, 0, 0, 0])) f1 = preprocessor.getSets.getSet("f1") f1.genMesh(xc.meshDir.I) # Constraints ln = preprocessor.getMultiBlockTopology.getLineWithEndPoints(pt1.tag, pt2.tag) lNodes = ln.nodes for n in lNodes: n.fix(xc.ID([0, 1, 2, 3, 4, 5]), xc.Vector([0, 0, 0, 0, 0, 0])) # UX,UY,UZ,RX,RY,RZ # Solution procedure solu = feProblem.getSoluProc solCtrl = solu.getSoluControl
feProblem = xc.FEProblem() preprocessor = feProblem.getPreprocessor nodes = preprocessor.getNodeHandler modelSpace = predefined_spaces.SolidMechanics2D(nodes) nod1 = nodes.newNodeXY(0.0, 0.0) nod2 = nodes.newNodeXY(L, 0.0) # Materials definition elast = typical_materials.defElasticMaterial(preprocessor, "elast", E) # Elements definition elements = preprocessor.getElementHandler elements.defaultMaterial = elast.name elements.dimElem = 2 # Dimension of element space truss = elements.newElement("Truss", xc.ID([nod1.tag, nod2.tag])) truss.sectionArea = A # Constraints constraints = preprocessor.getBoundaryCondHandler # spc1 = constraints.newSPConstraint(nod1.tag, 0, 0.0) spc2 = constraints.newSPConstraint(nod1.tag, 1, 0.0) spc3 = constraints.newSPConstraint(nod2.tag, 0, 0.0) spc4 = constraints.newSPConstraint(nod2.tag, 1, 0.0) # Loads definition loadHandler = preprocessor.getLoadHandler lPatterns = loadHandler.getLoadPatterns
# 1 2 5 n1 = nodes.newNodeIDXY(1, 0, 0) n2 = nodes.newNodeIDXY(2, 1, 0) n3 = nodes.newNodeIDXY(3, 1, 1) n4 = nodes.newNodeIDXY(4, 0, 1) n6 = nodes.newNodeIDXY(5, 2, 1) n7 = nodes.newNodeIDXY(6, 2, 2) n8 = nodes.newNodeIDXY(7, 1, 2) elast2d = typical_materials.defElasticIsotropicPlaneStress( preprocessor, "elast2d", E, nu, rho) # Elements definition elementos = preprocessor.getElementLoader elementos.defaultMaterial = "elast2d" a = elementos.newElement("quad4n", xc.ID([1, 2, 3, 4])) b = elementos.newElement("quad4n", xc.ID([3, 5, 6, 7])) totalSet = preprocessor.getSets.getSet('total') polygons = totalSet.getElements.getContours(True) length = polygons[0].getLongitud() + polygons[1].getLongitud() ratio1 = (length - 8.0) / 8.0 ''' print "lentgh= ",length print "ratio1= ",ratio1 ''' import os fname = os.path.basename(__file__)
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.name elements.defaultMaterial = scc.name beam3d = elements.newElement("ElasticBeam3d", xc.ID([0, 1])) beam3d = elements.newElement("ElasticBeam3d", xc.ID([1, 2]))
onlyIncluded=True) barr2_rg = gm.IJKRange((lastXpos, 0, lastZpos), (lastXpos, lastYpos, lastZpos)) barr2_kps = gridDeck.getSetPntRange(ijkRange=barr2_rg, setName='barr2_kps') barr2_ln = sets.get_lines_on_points(setPoints=barr2_kps, setLinName='barr2_ln', onlyIncluded=True) barrs = barr1_ln + barr2_ln barrs.name = 'barrs' # Connection between cables and deck gluedDOFs = [0, 1, 2, 3, 4, 5] deckElem = shells.elements cablNod = cables.nodes for n in cablNod: nearElem = deckElem.getNearestElement(n.getCurrentPos3d(0.0)) modelSpace.constraints.newGlueNodeToElement(n, nearElem, xc.ID(gluedDOFs)) # ***BOUNDARY CONDITIONS*** execfile(modelDataScriptDir + '/sets_springs.py') # Regions resting on springs (Winkler elastic foundation) # wModulus: Winkler modulus of the foundation (springs in Z direction) # cRoz: fraction of the Winkler modulus to apply for friction in # the contact plane (springs in X, Y directions) found_wink_walls = sprbc.ElasticFoundation(wModulus=wModulus_walls, cRoz=0.05) found_wink_walls.generateSprings(xcSet=setShortWall) found_wink_walls.generateSprings(xcSet=setLongWall) found_wink_fill = sprbc.ElasticFoundation(wModulus=wModulus_fill, cRoz=0.05) found_wink_fill.generateSprings(xcSet=setInsideArea) # Gluing of slabs
modelSpace = predefined_spaces.StructuralMechanics3D(nodes) nodes.newSeedNode() # Define materials typical_materials.defCableMaterial(preprocessor, "cable", E, sigmaPret, 0.0) ''' We define nodes at the points where loads will be applied. We will not compute stresses so we can use an arbitrary cross section of unit area.''' # Seed element definition seedElemHandler = preprocessor.getElementHandler.seedElemHandler seedElemHandler.defaultMaterial = "cable" seedElemHandler.dimElem = 3 # Dimension of element space seedElemHandler.defaultTag = 1 #Number for the next element will be 1. truss = seedElemHandler.newElement("CorotTruss", xc.ID([1, 2])) truss.area = area # seed element definition ends points = preprocessor.getMultiBlockTopology.getPoints pt = points.newPntIDPos3d(1, geom.Pos3d(0.0, 0.0, 0.0)) pt = points.newPntIDPos3d(2, geom.Pos3d(lng, lng, 0.0)) lines = preprocessor.getMultiBlockTopology.getLines lines.defaultTag = 1 l = lines.newLine(1, 2) l.nDiv = NumDiv l1 = preprocessor.getSets.getSet("l1") l1.genMesh(xc.meshDir.I) # Constraints
modelSpace = predefined_spaces.StructuralMechanics3D(nodes) n1 = nodes.newNodeXYZ(p1.x, p1.y, p1.z) n2 = nodes.newNodeXYZ(p2.x, p2.y, p2.z) n3 = nodes.newNodeXYZ(p3.x, p3.y, p3.z) n4 = nodes.newNodeXYZ(p4.x, p4.y, p4.z) p10 = geom.Pos3d(0.5, 0.5, 0.0) n10 = nodes.newNodeXYZ(p10.x, p10.y, p10.z) # Materials definition memb1 = typical_materials.defElasticMembranePlateSection( preprocessor, "memb1", E, nu, dens, h) elements = preprocessor.getElementHandler elements.defaultMaterial = memb1.name elem = elements.newElement("ShellMITC4", xc.ID([n1.tag, n2.tag, n3.tag, n4.tag])) # Constraints constraints = preprocessor.getBoundaryCondHandler modelSpace.fixNode000_FFF(n1.tag) modelSpace.fixNode000_FFF(n2.tag) modelSpace.fixNode000_FFF(n3.tag) modelSpace.fixNode000_FFF(n4.tag) #modelSpace.fixNode000_000( n1.tag) #modelSpace.fixNode000_000( n2.tag) #modelSpace.fixNode000_000( n3.tag) #modelSpace.fixNode000_000( n4.tag) #Glued node. gluedDOFs = [0, 1, 2, 3, 4, 5] loadOnDOFs = [0, 0, 0, 0, 0, 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) n8 = nodes.newNodeXYZ(0, 0.5, 0) n9 = nodes.newNodeXYZ(0.5, 0.5, 0) # central node. # Materials definition memb1 = typical_materials.defElasticMembranePlateSection( preprocessor, "memb1", E, nu, dens, h) elements = preprocessor.getElementHandler elements.defaultMaterial = "memb1" elem = elements.newElement( "ShellMITC9", xc.ID([ n1.tag, n2.tag, n3.tag, n4.tag, n5.tag, n6.tag, n7.tag, n8.tag, n9.tag ])) ratio0 = (elem.getArea(True) - 1) ratio1 = (elem.getCoordTransf.getG2Vector - v1).Norm() ratio2 = (elem.getCoordTransf.getG3Vector - v2).Norm() ''' print "area= ",elem.getArea(True) print "v1= ",v1 print "elem.v1= ", elem.getCoordTransf.getG2Vector print "ratio1= ",ratio1 print "v2= ",v2 print "elem.v2= ", elem.getCoordTransf.getG3Vector print "ratio2= ",ratio2 '''
E=EdiagCable, prestress=sigmaPrestrSaddCable, rho=rhoSaddCable) # Plotting of CAD entities # from postprocess.xcVtk.CAD_model import vtk_CAD_graphic # displaySettings= vtk_CAD_graphic.DisplaySettingsBlockTopo() # totalSet= prep.getSets.getSet('total') # displaySettings.displayBlocks(setToDisplay=totalSet,caption= 'Model grid') # Seed element for struts seedElemHandler = prep.getElementHandler.seedElemHandler seedElemHandler.defaultMaterial = "strutMat" seedElemHandler.dimElem = 3 seedElemHandler.defaultTag = 1 strutTruss = seedElemHandler.newElement("CorotTruss", xc.ID([0, 0])) strutTruss.sectionArea = strutArea strutSet.genMesh(xc.meshDir.I) # Seed element for diagonal cables seedElemHandler = prep.getElementHandler.seedElemHandler seedElemHandler.defaultMaterial = "diagCableMat" seedElemHandler.dimElem = 3 # three-dimensional space seedElemHandler.defaultTag = 1 diagTruss = seedElemHandler.newElement("CorotTruss", xc.ID([0, 0])) diagTruss.sectionArea = diagArea diagSet.genMesh(xc.meshDir.I) # Seed element for saddle cables seedElemHandler = prep.getElementHandler.seedElemHandler seedElemHandler.defaultMaterial = "saddCableMat" seedElemHandler.dimElem = 3 seedElemHandler.defaultTag = 1
nodeHandler = preprocessor.getNodeHandler nodeHandler.dimSpace = 1 # One coordinate for each node. nodeHandler.numDOFs = 1 # One degree of freedom for each node. n1 = nodeHandler.newNodeX(1) n2 = nodeHandler.newNodeX(1.0 + l) # Materials definition elast = typical_materials.defElasticMaterial(preprocessor, "elast", K) # Elements definition elements = preprocessor.getElementHandler elements.defaultMaterial = "elast" elements.dimElem = 1 #Element dimension. elements.defaultTag = 1 zl = elements.newElement("ZeroLength", xc.ID([n1.tag, n2.tag])) # Constraints constraints = preprocessor.getBoundaryCondHandler spc = constraints.newSPConstraint(n1.tag, 0, 0.0) # Node 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") #lPatterns.currentLoadPattern= "0" nl = lp0.newNodalLoad(n2.tag, xc.Vector([F]))
fiberSectionRepr.setGeomNamed("geomCuadFibrasTN") cuadFibrasTN.setupFibers() A = cuadFibrasTN.getFibers().getSumaAreas(1.0) agg = materiales.newMaterial("section_aggregator", "cuadFibras") agg.setSection("cuadFibrasTN") agg.setAdditions(["T", "Vy", "Vz"], ["respT", "respVy", "respVz"]) # Respuestas a torsión y cortantes. # Elements definition elementos = preprocessor.getElementLoader elementos.defaultTransformation = "lin" elementos.defaultMaterial = "cuadFibras" elementos.numSections = 2 # Número de secciones a lo largo del elemento. elementos.defaultTag = 1 el = elementos.newElement("force_beam_column_3d", xc.ID([1, 2])) # Constraints coacciones = preprocessor.getConstraintLoader fix_node_6dof.fixNode6DOF(coacciones, 1) # 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") casos.currentLoadPattern = "0" mesh = prueba.getDomain.getMesh
## Lines lineHandler= preprocessor.getMultiBlockTopology.getLines l1= lineHandler.newLine(p0.tag,p1.tag) l1.nDiv= 2 totalMass= shape.get('P')*span totalWeight= totalMass*9.81 # Mesh modelSpace= predefined_spaces.StructuralMechanics2D(nodes) trfs= preprocessor.getTransfCooHandler lin= trfs.newLinearCrdTransf2d("lin") seedElemHandler= preprocessor.getElementHandler.seedElemHandler seedElemHandler.defaultMaterial= xcSection.name seedElemHandler.defaultTransformation= lin.name elem= seedElemHandler.newElement("ElasticBeam2d",xc.ID([0,0])) xcTotalSet= preprocessor.getSets.getSet('total') mesh= xcTotalSet.genMesh(xc.meshDir.I) # Constraints modelSpace.fixNode00F(p0.getNode().tag) modelSpace.fixNodeF0F(p1.getNode().tag) # Actions loadCaseManager= load_cases.LoadCaseManager(preprocessor) loadCaseNames= ['deadLoad'] loadCaseManager.defineSimpleLoadCases(loadCaseNames) ## Dead load. cLC= loadCaseManager.setCurrentLoadCase('deadLoad')
nodes = preprocessor.getNodeHandler modelSpace = predefined_spaces.SolidMechanics3D(nodes) nod9 = nodes.newNodeIDXYZ(9, 0, 0, 0) nod10 = nodes.newNodeIDXYZ(10, 1, 0, 0) nod11 = nodes.newNodeIDXYZ(11, 1, 1, 0) nod12 = nodes.newNodeIDXYZ(12, 0, 1, 0) nod13 = nodes.newNodeIDXYZ(13, 0, 0, 1) nod14 = nodes.newNodeIDXYZ(14, 1, 0, 1) nod15 = nodes.newNodeIDXYZ(15, 1, 1, 1) nod16 = nodes.newNodeIDXYZ(16, 0, 1, 1) elements = preprocessor.getElementHandler elements.defaultMaterial = "elast3d" elements.defaultTag = 1 #Tag for the next element. brick = elements.newElement("Brick", xc.ID([9, 10, 11, 12, 13, 14, 15, 16])) constraints = preprocessor.getBoundaryCondHandler #Constrain the displacement of node 1. nod9.fix(xc.ID([0, 1, 2]), xc.Vector([0, 0, 0])) nod10.fix(xc.ID([0, 1, 2]), xc.Vector([0, 0, 0])) nod11.fix(xc.ID([0, 1, 2]), xc.Vector([0, 0, 0])) nod12.fix(xc.ID([0, 1, 2]), xc.Vector([0, 0, 0])) # Loads definition cargas = preprocessor.getLoadHandler casos = cargas.getLoadPatterns #Load modulation. ts = casos.newTimeSeries("constant_ts", "ts") casos.currentTimeSeries = "ts"
# Nodes nodes = preprocessor.getNodeHandler modelSpace = predefined_spaces.StructuralMechanics3D(nodes) nodes.defaultTag = 1 # First node number. nod1 = nodes.newNodeXYZ(0, 0.0, 0.0) nod2 = nodes.newNodeXYZ(L / 2.0, 0.0, 0.0) nod3 = nodes.newNodeXYZ(L, 0.0, 0.0) lin = modelSpace.newLinearCrdTransf("lin", xc.Vector([0, 1, 0])) elements = preprocessor.getElementHandler elements.defaultTransformation = lin.name elements.defaultMaterial = section.name elements.defaultTag = 1 # Tag for next element. beam3d = elements.newElement("ElasticBeam3d", xc.ID([nod1.tag, nod2.tag])) # Constraints modelSpace.fixNode000_000(1) rr = preprocessor.getBoundaryCondHandler.newRigidBeam(nod2.tag, nod3.tag) # Loads definition lp0 = modelSpace.newLoadPattern(name='0') lp0.newNodalLoad(2, xc.Vector([F, 0, 0, 0, 0, 0])) # We add the load case to domain. modelSpace.addLoadCaseToDomain(lp0.name) # Solution import os
# Problem type modelSpace= predefined_spaces.StructuralMechanics3D(nodes) n1= nodes.newNodeXYZ(p1.x,p1.y,p1.z) n2= nodes.newNodeXYZ(p2.x,p2.y,p2.z) n3= nodes.newNodeXYZ(p3.x,p3.y,p3.z) n4= nodes.newNodeXYZ(p4.x,p4.y,p4.z) pA= geom.Pos3d(0.5,0.5,0.0) nA= nodes.newNodeXYZ(pA.x,pA.y,pA.z) # Materials definition memb1= typical_materials.defElasticMembranePlateSection(preprocessor, "memb1",E,nu,dens,h) elements= preprocessor.getElementHandler elements.defaultMaterial= memb1.name elem= elements.newElement("ShellMITC4",xc.ID([n1.tag,n2.tag,n3.tag,n4.tag])) # Constraints constraints= preprocessor.getBoundaryCondHandler modelSpace.fixNode000_FFF(n1.tag) modelSpace.fixNode000_FFF(n2.tag) modelSpace.fixNode000_FFF(n3.tag) modelSpace.fixNode000_FFF(n4.tag) # modelSpace.fixNode000_000( 1) # modelSpace.fixNode000_000( 2) # modelSpace.fixNode000_000( 3) # modelSpace.fixNode000_000( 4) # Glued node. gluedDOFs= [0,1,2,3,4,5] loadOnDOFs= [0,0,0,0,0,0]
prep= prueba.getPreprocessor nodos= prep.getNodeHandler predefined_spaces.gdls_resist_materiales3D(nodos) nodos.newNodeIDXYZ(1,0,0,0) nodos.newNodeIDXYZ(2,L,0,0) nodos.newNodeIDXYZ(3,L,L,0) nodos.newNodeIDXYZ(4,0,L,0) # Definimos materiales memb1= typical_materials.defElasticMembranePlateSection(prep,"memb1",E,nu,dens,h) elementos= prep.getElementHandler elementos.defaultMaterial= "memb1" elem= elementos.newElement("shell_mitc4",xc.ID([1,2,3,4])) # Condiciones de contorno coacciones= prep.getBoundaryCondHandler fix_node_6dof.fixNode6DOF(coacciones,1) fix_node_6dof.fixNode6DOF(coacciones,2) # Definimos cargas cargas= prep.getLoadHandler casos= cargas.getLoadPatterns #Load modulation.
pt2= puntos.newPntIDPos3d(2, geom.Pos3d(b,0.0,0) ) pt3= puntos.newPntIDPos3d(3, geom.Pos3d(b,L,0) ) pt4= puntos.newPntIDPos3d(4, geom.Pos3d(0,L,0) ) surfaces= preprocessor.getCad.getSurfaces surfaces.defaultTag= 1 s= surfaces.newQuadSurfacePts(1,2,3,4) s.nDivI= 1 s.nDivJ= NumDiv nodes.newSeedNode() seedElemLoader= preprocessor.getElementLoader.seedElemLoader seedElemLoader.defaultMaterial= "elast" seedElemLoader.defaultTag= 1 elem= seedElemLoader.newElement("shell_mitc4",xc.ID([0,0,0,0])) f1= preprocessor.getSets.getSet("f1") f1.genMesh(xc.meshDir.I) # Constraints ln= preprocessor.getCad.getLineWithEndPoints(pt1.tag,pt2.tag) lNodes= ln.getNodes() for n in lNodes: n.fix(xc.ID([0,1,2,3,4,5]),xc.Vector([0,0,0,0,0,0])) # UX,UY,UZ,RX,RY,RZ # Procedimiento de solución solu= prueba.getSoluProc solCtrl= solu.getSoluControl
nodes = preprocessor.getNodeHandler modelSpace = predefined_spaces.StructuralMechanics3D(nodes) # Define materials elast = typical_materials.defElasticMaterial(preprocessor, "elast", E) nodes.newSeedNode() # Define materials nmb1 = typical_materials.defElasticMembranePlateSection( preprocessor, "memb1", E, nu, 0.0, thickness) seedElemHandler = preprocessor.getElementHandler.seedElemHandler seedElemHandler.defaultMaterial = "memb1" seedElemHandler.defaultTag = 1 elem = seedElemHandler.newElement("ShellMITC4", xc.ID([0, 0, 0, 0])) points = preprocessor.getMultiBlockTopology.getPoints pt = points.newPntIDPos3d(1, geom.Pos3d(0.0, 0.0, 0.0)) pt = points.newPntIDPos3d(2, geom.Pos3d(CooMaxX, 0.0, 0.0)) pt = points.newPntIDPos3d(3, geom.Pos3d(CooMaxX, CooMaxY, 0.0)) pt = points.newPntIDPos3d(4, geom.Pos3d(0.0, CooMaxY, 0.0)) surfaces = preprocessor.getMultiBlockTopology.getSurfaces surfaces.defaultTag = 1 s = surfaces.newQuadSurfacePts(1, 2, 3, 4) s.nDivI = NumDivI s.nDivJ = NumDivJ #Constraints. f1 = preprocessor.getSets.getSet("f1") f1.genMesh(xc.meshDir.I)
nod= nodes.newNodeXY(2*a+l,0.0) # Geometric transformations lin= modelSpace.newLinearCrdTransf("lin") # Materials definition scc= typical_materials.defElasticSection2d(preprocessor, "scc",A,E,I) # Elements definition elements= preprocessor.getElementHandler elements.defaultTransformation= "lin" elements.defaultMaterial= "scc" # sintaxis: beam2d_02[<tag>] elements.defaultTag= 1 #Tag for next element. beam2d= elements.newElement("ElasticBeam2d",xc.ID([1,2])) beam2d.h= h beam2d= elements.newElement("ElasticBeam2d",xc.ID([2,3])) beam2d.h= h beam2d= elements.newElement("ElasticBeam2d",xc.ID([3,4])) beam2d.h= h beam2d= elements.newElement("ElasticBeam2d",xc.ID([4,5])) beam2d.h= h # Constraints constraints= preprocessor.getBoundaryCondHandler # spc= constraints.newSPConstraint(2,0,0.0) # Node 2
def genMesh(self,nodes,springMaterials): self.defineWireframeModel(nodes) nodes.newSeedNode() preprocessor= self.modelSpace.preprocessor trfs= preprocessor.getTransfCooHandler transformationName= self.name+'LinearTrf' self.trf= trfs.newLinearCrdTransf2d(transformationName) wallMatData= typical_materials.MaterialData(name=self.name+'Concrete',E=self.concrete.getEcm(),nu=0.2,rho=2500) foundationSection= section_properties.RectangularSection(self.name+"FoundationSection",self.b,self.footingThickness) foundationMaterial= foundationSection.defElasticShearSection2d(preprocessor,wallMatData) #Foundation elements material. elementSize= 0.2 seedElemHandler= preprocessor.getElementHandler.seedElemHandler seedElemHandler.defaultMaterial= foundationSection.sectionName seedElemHandler.defaultTransformation= transformationName seedElem= seedElemHandler.newElement("ElasticBeam2d",xc.ID([0,0])) self.wallSet= preprocessor.getSets.defSet("wallSet") self.heelSet= preprocessor.getSets.defSet("heelSet") self.toeSet= preprocessor.getSets.defSet("toeSet") self.foundationSet= preprocessor.getSets.defSet("foundationSet") for lineName in ['heel','toe']: l= self.wireframeModelLines[lineName] l.setElemSize(elementSize) l.genMesh(xc.meshDir.I) for e in l.getElements(): self.foundationSet.getElements.append(e) self.wallSet.getElements.append(e) if(lineName=='heel'): self.heelSet.getElements.append(e) else: self.toeSet.getElements.append(e) self.foundationSet.fillDownwards() stemSection= section_properties.RectangularSection(self.name+"StemSection",self.b,(self.stemTopWidth+self.stemBottomWidth)/2.0) stemMaterial= stemSection.defElasticShearSection2d(preprocessor,wallMatData) #Stem elements material. self.stemSet= preprocessor.getSets.defSet("stemSet") for lineName in ['stem']: l= self.wireframeModelLines[lineName] l.setElemSize(elementSize) seedElemHandler.defaultMaterial= stemSection.sectionName l.genMesh(xc.meshDir.I) for e in l.getElements(): y= -e.getPosCentroid(True).y h= self.getDepth(y) stemSection.h= h e.sectionProperties= stemSection.getCrossSectionProperties2D(wallMatData) self.stemSet.getElements.append(e) self.wallSet.getElements.append(e) # Springs on nodes. self.foundationSet.computeTributaryLengths(False) self.fixedNodes= [] elasticBearingNodes= self.foundationSet.getNodes kX= springMaterials[0] #Horizontal kSx= kX.E kY= springMaterials[1] #Vertical kSy= kY.E lngTot= 0.0 for n in elasticBearingNodes: lT= n.getTributaryLength() lngTot+= lT #print "tag= ", n.tag, " lT= ", lT #print "before k= ", kY.E kX.E= kSx*lT kY.E= kSy*lT fixedNode, newElem= self.modelSpace.setBearing(n.tag,["kX","kY"]) self.fixedNodes.append(fixedNode) self.stemSet.fillDownwards() self.wallSet.fillDownwards()
NumDiv = 25 CooMax = 10 # Problem type feProblem = xc.FEProblem() preprocessor = feProblem.getPreprocessor nodes = preprocessor.getNodeHandler modelSpace = predefined_spaces.SolidMechanics3D(nodes) # Define materials elast = typical_materials.defElasticMaterial(preprocessor, "elast", 3000) seedElemHandler = preprocessor.getElementHandler.seedElemHandler seedElemHandler.defaultMaterial = elast.name seedElemHandler.dimElem = 3 # Dimension of element space seedElemHandler.defaultTag = 1 #Tag for the next element. truss = seedElemHandler.newElement("Truss", xc.ID([0, 0])) truss.sectionArea = 10.0 points = preprocessor.getMultiBlockTopology.getPoints pt = points.newPntIDPos3d(1, geom.Pos3d(0.0, 0.0, 0.0)) pt = points.newPntIDPos3d(2, geom.Pos3d(CooMax, CooMax, CooMax)) lines = preprocessor.getMultiBlockTopology.getLines lines.defaultTag = 1 l1 = lines.newLine(1, 2) l1.nDiv = NumDiv length = l1.getLength() l1.splitAtLambda(0.5) length1 = l1.getLength()
#it is a generic section created to be assigned to the elements specified #its stress and strain state is neutral (if we ask this section for stress or strain #values the result is always 0) materialHandler= preprocessor.getMaterialHandler sctFibers= materialHandler.newMaterial("fiber_section_3d","sctFibers") fiberSectionRepr= sctFibers.getFiberSectionRepr() fiberSectionRepr.setGeomNamed("geomSectFibers") sctFibers.setupFibers() # Elements definition elements= preprocessor.getElementHandler elements.defaultMaterial='sctFibers' elements.dimElem= 1 # Dimension of element space elements.defaultTag= 1 elem= elements.newElement("ZeroLengthSection",xc.ID([1,2])) # Constraints modelSpace.fixNode000_000(1) modelSpace.fixNodeF00_0F0(2) # Loads definition cargas= preprocessor.getLoadHandler #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])
sectionProperties.E = E sectionProperties.G = G sectionProperties.Iz = Iz sectionProperties.Iy = Iy sectionProperties.J = J seccion = typical_materials.defElasticSectionFromMechProp3d( preprocessor, "seccion", sectionProperties) # Geometric transformation(s) lin = modelSpace.newLinearCrdTransf("lin", xc.Vector([0, -1, 0])) # Elements definition elements = preprocessor.getElementLoader elements.defaultTransformation = "lin" elements.defaultMaterial = "seccion" elements.defaultTag = 1 #Tag for the next element. beam3d = elements.newElement("ElasticBeam3d", xc.ID([1, 2])) # Constraints modelSpace.fixNode000_000(1) # 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") #casos.currentLoadPattern= "0" eleLoad = lp0.newElementalLoad("beam3d_uniform_load") eleLoad.elementTags = xc.ID([1])