elements.dimElem= 3 # Problem type modelSpace= predefined_spaces.StructuralMechanics3D(nodes) #Defines the # dimension of the space: nodes by three coordinates (x,y,z) and # six DOF for each node (Ux,Uy,Uz,thetaX,thetaY,thetaZ) # coordinates in global X,Y,Z axes for the grid generation xList=[0] yList=[0,1,3,6,7] zList=[0] lastYpos=len(yList)-1 eSize= 0.2 #length of elements # grid model definition gridGeom= gm.GridModel(prep,xList,yList,zList) # Grid geometric entities definition (points, lines, surfaces) # Points' generation gridGeom.generatePoints() gridGeom.movePointsRange(gm.IJKRange((0,1,0),(0,1,0)),xc.Vector([0.0,0,1.0])) gridGeom.movePointsRange(gm.IJKRange((0,2,0),(0,3,0)),xc.Vector([0.0,0,1.5])) beamY_rg=gm.IJKRange((0,0,0),(0,lastYpos,0)) beamY=gridGeom.genLinOneRegion(ijkRange=beamY_rg,setName='beamY') # *** MATERIALS *** S235JR= EC3_materials.S235JR S235JR.gammaM= 1.00
m2in=1/in2m N2kip=1/kip2N Pa2ksi= 1.45038e-7 #data L= 15*12*in2m # beam length T= -60*kip2N*in2m # service load torque (60 kip-in) FEcase= xc.FEProblem() preprocessor=FEcase.getPreprocessor prep=preprocessor #short name nodes= prep.getNodeHandler elements= prep.getElementHandler elements.dimElem= 3 modelSpace= predefined_spaces.StructuralMechanics3D(nodes) #Defines the grid=gm.GridModel(prep,xList=[0,L/2,L],yList=[0],zList=[0]) grid.generatePoints() steel_W=astm.A992 #steel W shapes beam=grid.genLinOneXYZRegion([(0,0,0),(L,0,0)],'beam') beam_mat= astm.HSSShape(steel_W,'HSS10X6X1/2') beam_mat.defElasticShearSection3d(prep) beam_mesh= fem.LinSetToMesh(linSet=beam,matSect=beam_mat,elemSize=0.25,vDirLAxZ=xc.Vector([0,1,0]), elemType='ElasticBeam3d') beam_mesh.generateMesh(prep) J= beam_mat.J() Jcomp= 176/(m2in**4) ratio0= abs(J-Jcomp)/Jcomp G= steel_W.G()
FEcase = xc.FEProblem() FEcase.title = 'Cylindrical tank' prep = FEcase.getPreprocessor nodes = prep.getNodeHandler elements = prep.getElementHandler elements.dimElem = 3 # Problem type modelSpace = predefined_spaces.StructuralMechanics3D(nodes) #Defines the # grid model definition Rcoo = [R] Angcoo = [i * 360 / 25 for i in range(25)] zTop = zBase + height Zcoo = [zBase, zTop] grid = gm.GridModel(prep, Rcoo, Angcoo, Zcoo, xCentCoo=xCent, yCentCoo=yCent) grid.generateCylZPoints() tank = grid.genSurfOneXYZRegion(xyzRange=((R, 0, zBase), (R, Angcoo[-1], zTop)), setName='tank', closeCyl='Y') steel = astm.A36 steel_prop = tm.MaterialData(name='steel', E=steel.E, nu=steel.nu, rho=steel.rho) tank_mat = tm.DeckMaterialData(name='tank_mat', thickness=thickness, material=steel_prop)
# area = math.pi * (r2**2 - r1**2) volume = area * t mass = volume * matRho grav = 10 #Gravity acceleration (m/s2) weight = mass * grav FEcase = xc.FEProblem() preprocessor = FEcase.getPreprocessor prep = preprocessor #short name nodes = prep.getNodeHandler elements = prep.getElementHandler elements.dimElem = 3 modelSpace = predefined_spaces.StructuralMechanics3D(nodes) gridGeom = gm.GridModel(prep, rList, angList, zList, xCentCoo=0, yCentCoo=0) gridGeom.generateCylZPoints() ring = gridGeom.genSurfOneXYZRegion([(r1, 0, 0), (r2, angList[-1], 0)], setName='ring', closeCyl='Y') #out=outHndl.OutputHandler(modelSpace) #out.displayBlocks() steel = tm.defElasticIsotropic3d(preprocessor=preprocessor, name='steel', E=172e9, nu=0.3, rho=matRho) ring_mat = tm.defMembranePlateFiberSection(preprocessor, name='ring_mat',
for i in range(6): yList_deck.append(yList_deck[len(yList_deck) - 1] + gapSl) yList_deck.append(yList_deck[len(yList_deck) - 1] + widthSl) yList_deck.append(L_long_side_Y - delta_Y - firstSl) yList_deck.append(L_long_side_Y) #yList_deck=[0,delta_Y+3.3,L_long_side_Y-delta_Y-3,L_long_side_Y] zList_deck = [0, 0.4] #auxiliary data 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)])) for i in range(1, lastYpos):
import os import xc_base import geom import xc from model.geometry import grid_model as gm # *** GEOMETRY *** FEcase = xc.FEProblem() prep = FEcase.getPreprocessor # coordinates in global X,Y,Z axes for the generation of grid A xList = [i for i in range(6)] yList = [i for i in range(11)] zList = [i for i in range(2)] #Points' generation gridModel = gm.GridModel(prep, xList, yList, zList) gridModel.generatePoints() #Sets of points set01 = gridModel.getSetPntXYZRange(xyzRange=((0, 0, 0), (5, 10, 0)), setName='set01') np_set01 = set01.getPoints.size ratio1 = np_set01 - (6 * 11) set02 = gridModel.getSetPntMultiXYZRegion(lstXYZRange=[((0, 0, 0), (5, 5, 0)), ((0, 6, 0), (5, 10, 0)) ], setName='set02') np_set02 = set02.getPoints.size ratio2 = np_set02 - (6 * 11) #Sets of surfaces
# *** GEOMETRY *** FEcase= xc.FEProblem() prep=FEcase.getPreprocessor # coordinates in global X,Y,Z axes for the generation of grid A xListA=[i for i in range(6)] yList=[i for i in range(11)] zList=[i for i in range(5)] #auxiliary data lastXpos=len(xListA)-1 lastYpos=len(yList)-1 lastZpos=len(zList)-1 #Points' generation gridA=gm.GridModel(prep,xListA,yList,zList) gridA.generatePoints() gA_nbPoints=gridA.pointCounter ratio0=gA_nbPoints-len(xListA)*len(yList)*len(zList) # print(ratio0) # grid B is = grid A moved 10 units in X direction xListB=[i+10 for i in range(6)] gridB=gm.GridModel(prep,xListB,yList,zList) gridB.generatePoints() gB_nbPoints=gridB.pointCounter ratio1=gB_nbPoints-len(xListB)*len(yList)*len(zList) # print(ratio1)
xCent = 1 #x center of the elliptical coordinate system yCent = 2 #y center of the elliptical coordinate system semi_x0 = 5 # X semi-axis of the initial ellipse semi_y0 = 2 # Y semi-axis of the initial ellipse semi_x1 = 1 # X semi-axis of the final ellipse semi_y1 = 3 # Y semi-axis of the final ellipse semiAxisXList = [semi_x0] #list of X-semi-axes of ellipses angList = [i * 22.5 for i in range(16)] # list of angular coordinates zList = [0] # list of z coordinates semiAxisYList = [semi_y0] #list of Y-semi-axes of ellipses grid = gm.GridModel(prep=preprocessor, xList=semiAxisXList, yList=angList, zList=zList, xCentCoo=xCent, yCentCoo=yCent, semiYellipList=semiAxisYList) grid.generateEllipZPoints() pCent = geom.Pos3d(xCent, yCent, 0) pnt0 = grid.getPntXYZ((semi_x0, 0, 0)) ratio0 = pnt0.getPos.dist(pCent) - semi_x0 pnt90 = grid.getPntXYZ((semi_x0, 90, 0)) ratio1 = pnt90.getPos.dist(pCent) - semi_y0 pnt180 = grid.getPntXYZ((semi_x0, 180, 0)) ratio2 = pnt180.getPos.dist(pCent) - semi_x0 pnt270 = grid.getPntXYZ((semi_x0, 270, 0)) ratio3 = pnt270.getPos.dist(pCent) - semi_y0
zGround=0 #End data # *** GEOMETRIC model (points, lines, surfaces) - SETS *** FEcase= xc.FEProblem() prep=FEcase.getPreprocessor nodes= prep.getNodeHandler elements= prep.getElementHandler elements.dimElem= 3 modelSpace= predefined_spaces.StructuralMechanics3D(nodes) #Defines the # dimension of the space: nodes by three coordinates (x,y,z) and # six DOF for each node (Ux,Uy,Uz,thetaX,thetaY,thetaZ) gridGeom=gm.GridModel(prep,xGridCoo,yGridCoo,zGridCoo) gridGeom.generatePoints() #Lines generation columns=gridGeom.genLinMultiXYZRegion([ ((0,0,0),(0,0,10)), ((4,0,0),(4,0,10))],'columns') beams=gridGeom.genLinMultiXYZRegion([ ((0,0,5),(4,0,5)), ((0,0,10),(4,0,10))],'beams') diagonals=gridGeom.genSetLinFromMultiLstXYZPnt([ ((0,0,5),(4,0,0)), ((0,0,5),(4,0,10))],'diagonals') #Materials steel=EC3_materials.S235JR
preprocessor = FEcase.getPreprocessor prep = preprocessor #short name nodes = prep.getNodeHandler elements = prep.getElementHandler elements.dimElem = 3 # Problem type modelSpace = predefined_spaces.StructuralMechanics3D(nodes) #Defines the # dimension of the space: nodes by three coordinates (x,y,z) and # six DOF for each node (Ux,Uy,Uz,thetaX,thetaY,thetaZ) sty = outSty.OutputStyle() out = outHndl.OutputHandler(modelSpace, sty) cam = out.getCameraParameters() sty.language = ('sp', 'UTF-8') # grid model definition (tablero) gridTabl = gm.GridModel(prep, xListTabl, yListTabl, zListTabl) # grid model definition (pilas) gridPil = gm.GridModel(prep, xListPil, yListPil, zListPil) # Grid geometric entities definition (points, lines, surfaces) # Points' generation gridTabl.generatePoints() gridPil.generatePoints() #Displacements of the grid points in a range #syntax: movePointsRange(ijkRange,vDisp) # ijkRange: range for the search # vDisp: xc vector displacement # for i in range(1,len(xList)): # r= gm.IJKRange((i,0,lastZpos),(i,lastYpos,lastZpos)) # gridGeom.movePointsRange(r,xc.Vector([0.0,0.0,-trSlope*xList[i]]))