def __init__(self, beamMesh, backgroundMesh, beamThickness, initialGap): ## Read in 2d Solid Mesh self.beam_thickness = beamThickness self.Gap = initialGap beamReader = FluentCase(beamMesh) beamReader.read() print "read solid mesh" self.solidMeshes = beamReader.getMeshList() self.geomFields = models.GeomFields('geom') self.solidMetricsCalculator = models.MeshMetricsCalculatorA( self.geomFields, self.solidMeshes) self.solidMetricsCalculator.init() ## Define plate and deformation model self.plateFields = models.PlateFields('plate') self.pmodel = models.PlateModelA(self.geomFields, self.plateFields, self.solidMeshes) self.dmodel = models.PlateDeformationModelA(self.geomFields, self.plateFields, self.solidMeshes) bcMap = self.pmodel.getBCMap() ## Apply a default Boundary Condition #for i, bc in bcMap.iteritems(): #bc.bcType = 'SpecifiedTraction' ## Read in 3d Background Mesh fluidReader = FluentCase(backgroundMesh) fluidReader.read() self.fluidMeshes = fluidReader.getMeshList() self.fluidMetricsCalculator = models.MeshMetricsCalculatorA( self.geomFields, self.fluidMeshes) self.fluidMetricsCalculator.init() ## Define electric model self.elecFields = models.ElectricFields('elec') self.emodel = models.ElectricModelA(self.geomFields, self.elecFields, self.fluidMeshes) bcMap = self.emodel.getBCMap() ## Apply Default boundary conditions for i, bc in bcMap.iteritems(): bc.bcType = "Symmetry" self.solidBoundaryMeshes = [ m.extrude(1, beamThickness, True) for m in self.solidMeshes ] self.solidBoundaryMetricsCalculator = models.MeshMetricsCalculatorA( self.geomFields, self.solidBoundaryMeshes) self.solidBoundaryMetricsCalculator.init()
def createModels(self): if self.enablePlateModel == True: self.plateFields = models.PlateFields('plate') self.pmodel = models.PlateModelA(self.geomFields, self.plateFields, self.solidMeshes) self.dmodel = models.PlateDeformationModelA( self.geomFields, self.plateFields, self.solidMeshes) if self.enableElecModel == True: self.elecFields = models.ElectricFields('elec') self.emodel = models.ElectricModelA(self.geomFields, self.elecFields, self.fluidMeshesNew) if self.enableFlowModel == True: self.flowFields = models.FlowFields('flow') self.fmodel = models.FlowModelA(self.geomFields, self.flowFields, self.fluidMeshes) #currently contact model is implemented in ComputeForce.py #if self.enableContactModel == True: # self.contactFields = models.ContactFields('contact') # self.cmodel = models.ContactModelA(self.geomFields,self.contactFields,self.fluidMeshesNew) print 'models are created'
import time t0 = time.time() geomFields = models.GeomFields('geom') metricsCalculator0 = models.MeshMetricsCalculatorA(geomFields, meshes0) metricsCalculator0.init() nodes0 = mesh0.getNodes() rho = 7854. E = 2. * math.pow(10, 11) nu = 0.0 plateFields = models.PlateFields('plate') pmodel = models.PlateModelA(geomFields, plateFields, meshes0) bcMap = pmodel.getBCMap() for bcID in bcMap: if bcID == 6: bc = bcMap[bcID] bc.bcType = 'Clamped' bc['specifiedXRotation'] = 0 bc['specifiedYRotation'] = 0. bc['specifiedZDeformation'] = 0. elif bcID == 5: bc = bcMap[bcID] bc.bcType = 'SpecifiedTraction' elif bcID == 4: bc = bcMap[bcID] bc.bcType = 'SpecifiedShear'
for c in range(0, cells.getCount()): rsqr = xc[c][0]*xc[c][0] + xc[c][1]*xc[c][1] if rsqr < small: small = rsqr probeIndex = c ### output files probeFile = open(fileBase + "centerDisplacement.dat", "w") ### =============================== models =====================================### ### Plate Model and boundary conditions ### plateFields = models.PlateFields('plate') pmodel = models.PlateModelA(geomFields,plateFields,solidMeshes) dmodel = models.PlateDeformationModelA(geomFields,plateFields,solidMeshes) bcMap = pmodel.getBCMap() for id in anchors: bc = bcMap[id] bc.bcType = 'Clamped' bc['specifiedXRotation']=0 bc['specifiedYRotation']=0. bc['specifiedZDeformation']=0. for id in beam: bc = bcMap[id] bc.bcType = 'SpecifiedTraction' vcMap = pmodel.getVCMap()