Пример #1
0
    def read(self):
        beamReader = FluentCase(self.beamCaseFile)
        beamReader.read()
        print 'beam mesh read in. Done!'
        print '------------------------------------------------------------'
        self.solidMeshes = beamReader.getMeshList()
        self.geomFields = models.GeomFields('geom')
        self.solidMetricsCalculator = models.MeshMetricsCalculatorA(
            self.geomFields, self.solidMeshes)
        self.solidMetricsCalculator.init()

        fluidReader = FluentCase(self.fluidCaseFile)
        fluidReader.read()
        print 'fluid mesh read in. Done!'
        print '------------------------------------------------------------'
        self.fluidMeshes = fluidReader.getMeshList()
        self.fluidMeshesNew = self.fluidMeshes
        self.fluidMetricsCalculator = models.MeshMetricsCalculatorA(
            self.geomFields, self.fluidMeshes)
        self.fluidMetricsCalculator.init()

        self.solidBoundaryMeshes = [
            m.extrude(1, self.beam_thickness, True) for m in self.solidMeshes
        ]
        self.solidBoundaryMetricsCalculator = models.MeshMetricsCalculatorA(
            self.geomFields, self.solidBoundaryMeshes)

        self.solidBoundaryMetricsCalculator.init()
Пример #2
0
    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()
Пример #3
0
    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()   
Пример #4
0
    def read(self):
        beamReader = FluentCase(self.beamCaseFile)
        beamReader.read()
        print 'beam mesh read in. Done!'
        print '------------------------------------------------------------'
        self.solidMeshes = beamReader.getMeshList()
        self.geomFields =  models.GeomFields('geom')
        self.solidMetricsCalculator = models.MeshMetricsCalculatorA(self.geomFields,self.solidMeshes)
        self.solidMetricsCalculator.init()

        fluidReader = FluentCase(self.fluidCaseFile)
        fluidReader.read()
        print 'fluid mesh read in. Done!'
        print '------------------------------------------------------------'
        self.fluidMeshes = fluidReader.getMeshList()
        self.fluidMeshesNew = self.fluidMeshes
        self.fluidMetricsCalculator = models.MeshMetricsCalculatorA(self.geomFields,self.fluidMeshes)
        self.fluidMetricsCalculator.init()

        self.solidBoundaryMeshes = [m.extrude(1, self.beam_thickness, True) for m in self.solidMeshes]
        self.solidBoundaryMetricsCalculator = models.MeshMetricsCalculatorA(self.geomFields,self.solidBoundaryMeshes)
        
        self.solidBoundaryMetricsCalculator.init()
Пример #5
0
numTimeSteps = 2
globalTime = 0
globalCount = 0
timeStep = 2e-8
saveFrequency = 1
initialTransient = False

### ===================== mesh read ===============================================###

fileBase_input = "/home/yildirim/memosa/src/fvm/scripts/cantilever3D_coupling/"
fileBase_output = "./" + str(int(-applied_voltage)) + "/"

print fileBase_input + "fluid_3D_new.cas"
### 3D fluid mesh
fluidReader = FluentCase(fileBase_input + "fluid_3D_new.cas")
fluidReader.read()
fluent_meshes_fluid = fluidReader.getMeshList()
#paritioning
nmesh = 1
npart = [MPI.COMM_WORLD.Get_size()]
print "options.typeFluid = ", options.typeFluid
etypeFluid = [etype[options.typeFluid]]
#partMesh constructor and setTypes
part_mesh_fluid = fvmparallel.MeshPartitioner(fluent_meshes_fluid, npart,
                                              etypeFluid)
part_mesh_fluid.setWeightType(0)
part_mesh_fluid.setNumFlag(0)
#actions
part_mesh_fluid.isDebug(0)
part_mesh_fluid.partition()
part_mesh_fluid.mesh()
Пример #6
0
import sys
sys.setdlopenflags(0x100 | 0x2)

import fvm.fvmbaseExt as fvmbaseExt
import fvm.importers as importers
import fvm.models_atyped_double as models
import fvm.exporters_atyped_double as exporters
from FluentCase import FluentCase
#fvmbaseExt.enableDebug("cdtor")

reader = FluentCase("../test/TwoMaterialTest.cas")

#import debug
reader.read()

meshes = reader.getMeshList()

geomFields = models.GeomFields('geom')
metricsCalculator = models.MeshMetricsCalculatorA(geomFields, meshes)

metricsCalculator.init()

nSpecies = 1
# species conditions
smodel = models.SpeciesModelA(geomFields, meshes, nSpecies)
bcmap = smodel.getBCMap(0)
vcmap = smodel.getVCMap(0)

vcRightZone = vcmap[0]
vcLeftZone = vcmap[1]
Пример #7
0
pd.fySum = 0
pd.fzSum = 0
pd.initialTransient=False
pd.probeIndex = 671699
pd.probeFile = open(fileBase + "tipDisplacement-se.dat", "w")
pd.forceFile = open(fileBase + "beamForce-se.dat", "w")
pd.velocityFile = open(fileBase + "tipVelocity-se.dat", "w")

### read in meshes ###
beamFile = fileBase + 'Gen2_IBM_beam_12_1200.cas'
fluidFile = fileBase + 'Gen2_IBM_backgroundmesh_C2D2_wo_sub.cas'

fluidReader = FluentCase(sys.argv[1])
beamReader = FluentCase(sys.argv[2])

beamReader.read()
fluidReader.read()

pd.solidMeshes = beamReader.getMeshList()
pd.fluidMeshes = fluidReader.getMeshList()
pd.solidBoundaryMeshes = [m.extractBoundaryMesh() for m in pd.solidMeshes]

### geometry field ###

pd.geomFields =  models.GeomFields('geom')
pd.solidMetricsCalculator = models.MeshMetricsCalculatorA(pd.geomFields,
                                                          pd.solidMeshes)
pd.fluidMetricsCalculator = models.MeshMetricsCalculatorA(pd.geomFields,
                                                          pd.fluidMeshes)
pd.solidBoundaryMetricsCalculator = models.MeshMetricsCalculatorA(pd.geomFields,
                                                          pd.solidBoundaryMeshes)
Пример #8
0
fileBase = "/home/lin/work/app-memosa/src/fvm/verification/ElectroStatics/"

def advance(elec_model,niter):
    for i in range(0,niter):
        try:
            stopFlag=elec_model.advance(1)
            if stopFlag == 1:
                break
        except KeyboardInterrupt:
            break



reader = FluentCase(fileBase + "cav32_elec.cas")

reader.read()

#pdb.set_trace()

meshes = reader.getMeshList()

mesh0 = meshes[0]

import time
t0 = time.time()

geomFields =  models.GeomFields('geom')

metricsCalculator = models.MeshMetricsCalculatorA(geomFields,meshes)

metricsCalculator.init()
Пример #9
0
numTimeSteps = 2 
globalTime = 0
globalCount = 0
timeStep = 2e-8
saveFrequency = 1
initialTransient = False
probeIndex = 0

### ===================== mesh read ===============================================###
fileBase_input  = "/home/yildirim/memosa/src/fvm/scripts/cantilever3D_coupling/"
fileBase_output = "./" + str(int(-applied_voltage)) + "/"

### 2D plate mesh
beamReader = FluentCase(fileBase_input+"beam_2D.cas")
beamReader.read()

##paritioning
#nmesh = 1
#npart = [MPI.COMM_WORLD.Get_size()]
#print "options folud.type = ", options.type
#etype = [etype[options.type]]
##partMesh constructor and setTypes
#part_mesh = fvmparallel.MeshPartitioner( fluentMeshes, npart, etype );
#part_mesh.setWeightType(0);
#part_mesh.setNumFlag(0);
##actions
#part_mesh.isDebug(0)
#part_mesh.partition()
#part_mesh.mesh()
#solidMeshes  = part_mesh.meshList()
Пример #10
0
outfile = None
if __name__ == '__main__' and fileBase is None:
    if len(sys.argv) < 2:
        usage()
    fileBase = sys.argv[1]
    if len(sys.argv) == 3:
        outfile = sys.argv[2]

if outfile == None:
    outfile = fileBase+"-ibm.dat"
    
reader = FluentCase(fileBase+".cas")

#import debug
reader.read();

meshes = reader.getMeshList()

mesh0 = meshes[0]

import time
t0 = time.time()

geomFields =  models.GeomFields('geom')
metricsCalculator = models.MeshMetricsCalculatorA(geomFields,meshes)

metricsCalculator.init()

if atype == 'tangent':
    metricsCalculator.setTangentCoords(0,7,1)
Пример #11
0
numTimeSteps = 2
globalTime = 0
globalCount = 0
timeStep = 2e-8
saveFrequency = 1
initialTransient = False
probeIndex = 0

### ===================== mesh read ===============================================###
fileBase_input = "/home/yildirim/memosa/src/fvm/scripts/cantilever3D_coupling/"
fileBase_output = "./" + str(int(-applied_voltage)) + "/"

### 2D plate mesh
beamReader = FluentCase(fileBase_input + "beam_2D.cas")
beamReader.read()

##paritioning
#nmesh = 1
#npart = [MPI.COMM_WORLD.Get_size()]
#print "options folud.type = ", options.type
#etype = [etype[options.type]]
##partMesh constructor and setTypes
#part_mesh = fvmparallel.MeshPartitioner( fluentMeshes, npart, etype );
#part_mesh.setWeightType(0);
#part_mesh.setNumFlag(0);
##actions
#part_mesh.isDebug(0)
#part_mesh.partition()
#part_mesh.mesh()
#solidMeshes  = part_mesh.meshList()
Пример #12
0
parser = OptionParser()
parser.set_defaults(type='quad')
parser.add_option("--type", help="'quad'[default], 'tri', 'hexa', or 'tetra'")
parser.add_option("--xdmf", action='store_true', help="Dump data in xdmf")
parser.add_option("--time",
                  "-t",
                  action='store_true',
                  help="Print timing information.")
(options, args) = parser.parse_args()

reader0 = FluentCase(sys.argv[1])
reader1 = FluentCase(sys.argv[2])

#import debug
reader0.read()
reader1.read()

meshes0 = reader0.getMeshList()
meshes1 = reader1.getMeshList()

#for mesh in meshes:
#    mesh.getCells().clearGatherScatterMaps()

mesh0 = meshes0[0]
mesh1 = meshes1[0]
nmesh = 2

mesh0.findCommonNodes(mesh1)

meshes = []
Пример #13
0
timeStep = 10
numTimeSteps = 10
saveFrequency = 2

parser = optparse.OptionParser()
parser.add_option("--volt", type=float)
parser.add_option("--type", help="'tri'[default], 'quad', 'hexa', or 'tetra'")
parser.add_option("--time","-t",action='store_true',help="Print timing information.")
(options, args) = parser.parse_args()

print args[0]
print args[1]
fluidReader = FluentCase(args[0])
solidReader = FluentCase(args[1])

fluidReader.read()
solidReader.read()

fluidMeshes0 = fluidReader.getMeshList()
solidMeshes = solidReader.getMeshList()
nodeCoord = solidMeshes[0].getNodeCoordinates().asNumPyArray()


nodeCoord[:,:] *=0.5

 #paritioning
nmesh = 1
npart = [MPI.COMM_WORLD.Get_size()]
print "options.typeFluid = ", options.type
etypeFluid = [etype[options.type]]
#partMesh constructor and setTypes
Пример #14
0
    f.close()

parser = OptionParser()
parser.set_defaults(type='quad')
parser.add_option("--type", help="'quad'[default], 'tri', 'hexa', or 'tetra'")
parser.add_option("--xdmf", action='store_true', help="Dump data in xdmf")
parser.add_option("--time","-t",action='store_true',help="Print timing information.")
(options, args) = parser.parse_args()

nmesh = 1

fileBase0 = "plate_steady_"
reader0 = FluentCase(sys.argv[1])

#import debug
reader0.read();

meshes0 = reader0.getMeshList()

mesh0 = meshes0[0]
nmesh = 1

meshes = []
meshes.append(mesh0)

import time
t0 = time.time()

geomFields =  models.GeomFields('geom')
metricsCalculator0 = models.MeshMetricsCalculatorA(geomFields,meshes0)
Пример #15
0
numTimeSteps = 1
globalTime = 0
globalCount = 0
timeStep = 5e-8
saveFrequency = 50
initialTransient = False
probeIndex = 50

### ===================== mesh read ===============================================###

fileBase = "./"

### 2D plate mesh
beamReader = FluentCase(sys.argv[2])
beamReader.read();
solidMeshes = beamReader.getMeshList()
geomFields =  models.GeomFields('geom')
solidMetricsCalculator = models.MeshMetricsCalculatorA(geomFields,solidMeshes)
solidMetricsCalculator.init()

### 3D fluid mesh
fluidReader = FluentCase(sys.argv[1])
fluidReader.read();
fluidMeshes = fluidReader.getMeshList()
fluidMetricsCalculator = models.MeshMetricsCalculatorA(geomFields,fluidMeshes)
fluidMetricsCalculator.init()

nodes = fluidMeshes[0].getNodes()
xn = fluidMeshes[0].getNodeCoordinates().asNumPyArray()
for n in range(0, nodes.getCount()):
Пример #16
0
parser = optparse.OptionParser()
parser.add_option("--volt", type=float)
parser.add_option("--type", help="'tri'[default], 'quad', 'hexa', or 'tetra'")
parser.add_option("--time",
                  "-t",
                  action='store_true',
                  help="Print timing information.")
(options, args) = parser.parse_args()

print args[0]
print args[1]
fluidReader = FluentCase(args[0])
solidReader = FluentCase(args[1])

fluidReader.read()
solidReader.read()

fluidMeshes0 = fluidReader.getMeshList()
solidMeshes = solidReader.getMeshList()
nodeCoord = solidMeshes[0].getNodeCoordinates().asNumPyArray()

nodeCoord[:, :] *= 0.5

#paritioning
nmesh = 1
npart = [MPI.COMM_WORLD.Get_size()]
print "options.typeFluid = ", options.type
etypeFluid = [etype[options.type]]
#partMesh constructor and setTypes
part_mesh_fluid = fvmparallel.MeshPartitioner(fluidMeshes0, npart, etypeFluid)
if __name__ == '__main__' and fileBase is None:
    if len(sys.argv) != 2:
        usage()

    fileBase = sys.argv[1]


filename = fileBase+"fvm_coupling_hexa10x4x4_80x32x32.cas"
#filename = fileBase+"fvm_coupling_hexa10x4x4_120x48x48.cas"
#filename = fileBase+"fvm_coupling_hexa10x4x4_160x64x64.cas"

reader = FluentCase(filename)
print "reading %s", filename

#import debug
reader.read();


meshes = reader.getMeshList()

mesh0 = meshes[0]

import time
t0 = time.time()

geomFields =  fvm.models.GeomFields('geom')
metricsCalculator = fvm.models.MeshMetricsCalculatorA(geomFields,meshes)

metricsCalculator.init()

flowFields =  fvm.models.FlowFields('flow')
        f.write("\n")
    f.close()

parser = OptionParser()
parser.set_defaults(type='quad')
parser.add_option("--type", help="'quad'[default], 'tri', 'hexa', or 'tetra'")
parser.add_option("--xdmf", action='store_true', help="Dump data in xdmf")
parser.add_option("--time","-t",action='store_true',help="Print timing information.")
(options, args) = parser.parse_args()

reader0 = FluentCase(fileBase0+".cas")
reader1 = FluentCase(fileBase1+".cas")


#import debug
reader0.read();
reader1.read();

meshes0 = reader0.getMeshList()
meshes1 = reader1.getMeshList()

#for mesh in meshes:
#    mesh.getCells().clearGatherScatterMaps()

mesh0 = meshes0[0]
mesh1 = meshes1[0]
nmesh = 2

mesh0.findCommonNodes(mesh1)

meshes = []