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]