Exemple #1
0
def advance(ntstep):
    for i in range(0,ntstep):
        print 'timestep = ',i+1
      
        esbgk1.advance(numIter)
        print 'converged';
        esbgk1.updateTime()
        
        if ((i+1)%output_Coeff == 0) :
            if(fgamma>0):
                coeff=macroFields.coeff[cellSites].asNumPyArray()
                print 'BGK:',coeff[cellno,0],'cx^2',coeff[cellno,1],'cx',coeff[cellno,2]            
                
            if(fgamma==2):
                coeffg=macroFields.coeffg[cellSites].asNumPyArray()
                print 'ESBGK:',coeffg[cellno,0],'cx^2',coeffg[cellno,1],'cx',coeffg[cellno,2]
                print '     :','cy^2',coeffg[cellno,3],'cy',coeffg[cellno,4],'cz^2',coeffg[cellno,5],'cz',coeffg[cellno,6]
                print 'cxcy',coeffg[cellno,7],'cxcz',coeffg[cellno,8],'cycz',coeffg[cellno,9]
                
        
        if ((i+1)%output_interval == 0) :
            """
            dens=macroFields.density[cellSites].asNumPyArray()
            print 'density',dens[105],dens[115],dens[125],dens[135]
            press=macroFields.pressure[cellSites].asNumPyArray()
            print 'pressure',press[105],press[115],press[125],press[135]
            """
            dsfname = "output_"+string.zfill(str(i+1),5)+".dat"
           #esbgk1.OutputDsfBLOCK(dsfname)
            filename = "macro_"+string.zfill(str(i+1),5)+".dat"
            tecplotESBGK.esbgkTecplotFile(meshes,macroFields,filename)
Exemple #2
0
def advance(ntstep):
    for i in range(0,ntstep):
        print 'timestep = ',i+1
      
        esbgk1.advance(numIter)
        print 'converged';
        esbgk1.updateTime()
        
        if ((i+1)%output_Coeff == 0) :
            if(fgamma>0):
                coeff=macroFields.coeff[cellSites].asNumPyArray()
                print 'BGK:',coeff[cellno,0],'cx^2',coeff[cellno,1],'cx',coeff[cellno,2]            
                
            if(fgamma==2):
                coeffg=macroFields.coeffg[cellSites].asNumPyArray()
                print 'ESBGK:',coeffg[cellno,0],'cx^2',coeffg[cellno,1],'cx',coeffg[cellno,2]
                print '     :','cy^2',coeffg[cellno,3],'cy',coeffg[cellno,4],'cz^2',coeffg[cellno,5],'cz',coeffg[cellno,6]
                print 'cxcy',coeffg[cellno,7],'cxcz',coeffg[cellno,8],'cycz',coeffg[cellno,9]
                
        
        if ((i+1)%output_interval == 0) :
            """
            dens=macroFields.density[cellSites].asNumPyArray()
            print 'density',dens[105],dens[115],dens[125],dens[135]
            press=macroFields.pressure[cellSites].asNumPyArray()
            print 'pressure',press[105],press[115],press[125],press[135]
            """
            dsfname = "output_"+string.zfill(str(i+1),5)+"_"+str(MPI.COMM_WORLD.Get_rank())+".dat"
           #esbgk1.OutputDsfBLOCK(dsfname)
            filename = "macro_"+string.zfill(str(i+1),5)+"_"+str(MPI.COMM_WORLD.Get_rank())+".dat"
            tecplotESBGK.esbgkTecplotFile(meshes,macroFields,filename)
Exemple #3
0
def advance(ntstep):
    for i in range(0, ntstep):
        print 'timestep = ', i + 1
        esbgk1.advance(numIter)
        esbgk1.updateTime()

        if ((i + 1) % output_interval == 0):
            filename = "output_" + string.zfill(str(i + 1), 3) + ".plt"
            esbgk1.OutputDsfBLOCK(filename)
            filename = "macro_" + string.zfill(str(i + 1), 3) + ".plt"
            tecplotESBGK.esbgkTecplotFile(meshes, macroFields, filename)
Exemple #4
0
def advance(ntstep):
    for i in range(0,ntstep):
        print 'timestep = ',i+1
        esbgk1.advance(numIter)
        esbgk1.updateTime()
        
        if ((i+1)%output_interval == 0) :
            filename = "output_"+string.zfill(str(i+1),3)+".plt"
            esbgk1.OutputDsfBLOCK(filename)
            filename = "macro_"+string.zfill(str(i+1),3)+".plt"
            tecplotESBGK.esbgkTecplotFile(meshes,macroFields,filename)
Exemple #5
0
#esbgk1.updateTime()
def advance(ntstep):
    for i in range(0, ntstep):
        print 'timestep = ', i + 1
        esbgk1.advance(numIter)
        esbgk1.updateTime()

        if ((i + 1) % output_interval == 0):
            filename = "output_" + string.zfill(str(i + 1), 3) + ".plt"
            esbgk1.OutputDsfBLOCK(filename)
            filename = "macro_" + string.zfill(str(i + 1), 3) + ".plt"
            tecplotESBGK.esbgkTecplotFile(meshes, macroFields, filename)


esbgk1.OutputDsfBLOCK("output_000.plt")
tecplotESBGK.esbgkTecplotFile(meshes, macroFields, "macro_000.plt")
advance(numTsteps)
esbgk1.OutputDsfBLOCK("final.plt")

t1 = time.time()
print 'time taken for', numTsteps, 'tsteps', numIter, 'iters =', t1 - t0
"""

cellSite = meshes[0].getCells()
velField = macroFields.velocity[ cellSite ].asNumPyArray() 
print  macroFields.velocity[ cellSite ].asNumPyArray()
rhoField = macroFields.density[ cellSite ].asNumPyArray() 
print  macroFields.density[ cellSite ].asNumPyArray()
#import debug
#fmodel.advance(100)
filename="macro1.plt"
Exemple #6
0
#esbgk1.updateTime()
def advance(ntstep):
    for i in range(0,ntstep):
        print 'timestep = ',i+1
        esbgk1.advance(numIter)
        esbgk1.updateTime()
        
        if ((i+1)%output_interval == 0) :
            filename = "output_"+string.zfill(str(i+1),3)+".plt"
            esbgk1.OutputDsfBLOCK(filename)
            filename = "macro_"+string.zfill(str(i+1),3)+".plt"
            tecplotESBGK.esbgkTecplotFile(meshes,macroFields,filename)


esbgk1.OutputDsfBLOCK("output_000.plt")
tecplotESBGK.esbgkTecplotFile(meshes,macroFields,"macro_000.plt")       
advance(numTsteps)        
esbgk1.OutputDsfBLOCK("final.plt")

t1=time.time()
print 'time taken for',numTsteps,'tsteps',numIter,'iters =', t1-t0

"""

cellSite = meshes[0].getCells()
velField = macroFields.velocity[ cellSite ].asNumPyArray() 
print  macroFields.velocity[ cellSite ].asNumPyArray()
rhoField = macroFields.density[ cellSite ].asNumPyArray() 
print  macroFields.density[ cellSite ].asNumPyArray()
#import debug
#fmodel.advance(100)
#esbgk1.advance(1)
#esbgk1.OutputDsfBLOCK()
numIterations = 50
output_interval = 1


def advance(niter):
    for i in range(0, niter):
        esbgk1.advance(1)
        esbgk1.updateTime()
        print 'timestep = ', i + 1
        if ((i + 1) % output_interval == 0):
            filename = string.zfill(str(i + 1), 5) + "output.plt"
            esbgk1.OutputDsfBLOCK(filename)


advance(numIterations)
esbgk1.OutputDsfBLOCK("final.plt")
"""
cellSite = meshes[0].getCells()
velField = macroFields.velocity[ cellSite ].asNumPyArray() 
print  macroFields.velocity[ cellSite ].asNumPyArray()
rhoField = macroFields.density[ cellSite ].asNumPyArray() 
print  macroFields.density[ cellSite ].asNumPyArray()
#import debug
#fmodel.advance(100)
filename="macro1.plt"
tecplotESBGK.esbgkTecplotFile(meshes,macroFields,filename)
#tecplot.dumpTecplotFile(1,meshes,macroFields)
"""
Exemple #8
0
#esbgk1.advance(1)
#esbgk1.OutputDsfBLOCK()
numIterations=50
output_interval = 1
def advance(niter):
    for i in range(0,niter):
        esbgk1.advance(1)
        esbgk1.updateTime()
        print 'timestep = ',i+1
        if ((i+1)%output_interval == 0) :
            filename = string.zfill(str(i+1),5)+"output.plt"
            esbgk1.OutputDsfBLOCK(filename)

       
advance(numIterations)        
esbgk1.OutputDsfBLOCK("final.plt")

"""
cellSite = meshes[0].getCells()
velField = macroFields.velocity[ cellSite ].asNumPyArray() 
print  macroFields.velocity[ cellSite ].asNumPyArray()
rhoField = macroFields.density[ cellSite ].asNumPyArray() 
print  macroFields.density[ cellSite ].asNumPyArray()
#import debug
#fmodel.advance(100)
filename="macro1.plt"
tecplotESBGK.esbgkTecplotFile(meshes,macroFields,filename)
#tecplot.dumpTecplotFile(1,meshes,macroFields)
"""
Exemple #9
0
if 5 in bcMap:
    bcRight = bcMap[5]
    bcRight.bcType = 'PressureInletBC'
    bcRight.setVar('specifiedTemperature',1.0)
    bcRight.setVar('specifiedPressure',1.0)

vcMap=esbgk1.getVCMap()
print "initializing bcs"        
##esbgk1options.setVar('timeStep',pd.timeStepND)
esbgk1options.relativeTolerance=relTol;
esbgk1options.absoluteTolerance=absTol;

pd.prevIter=0
print "initializing bcs"
### solver options ###
tecplotESBGK.esbgkTecplotFile(pd.fluidMeshes,pd.macroFields,"quad","initial.dat")

### set up IBM ###

for mesh in pd.solidBoundaryMeshes:
    faces = mesh.getFaces()
    #temperature field on boundary mesh
    areaMag = pd.geomFields.areaMag[faces]
    faceCount = faces.getCount()
    tem = areaMag.newSizedClone(faceCount)
    tema = tem.asNumPyArray()
    tema[:] = tbeam
    pd.macroFields.temperature[faces] = tem
    dens = areaMag.newSizedClone(faceCount)
    densa = dens.asNumPyArray()
    densa[:] = pd.rho_init
Exemple #10
0
        
        if ((i+1)%output_interval == 0) :
            """
            dens=macroFields.density[cellSites].asNumPyArray()
            print 'density',dens[105],dens[115],dens[125],dens[135]
            press=macroFields.pressure[cellSites].asNumPyArray()
            print 'pressure',press[105],press[115],press[125],press[135]
            """
            dsfname = "output_"+string.zfill(str(i+1),5)+"_"+str(MPI.COMM_WORLD.Get_rank())+".dat"
           #esbgk1.OutputDsfBLOCK(dsfname)
            filename = "macro_"+string.zfill(str(i+1),5)+"_"+str(MPI.COMM_WORLD.Get_rank())+".dat"
            tecplotESBGK.esbgkTecplotFile(meshes,macroFields,filename)


esbgk1.OutputDsfBLOCK("output_00000.dat")
tecplotESBGK.esbgkTecplotFile(meshes,macroFields,"macro_00000"+"_"+str(MPI.COMM_WORLD.Get_rank())+".dat")       
advance(numTsteps)        


t1=time.time()
print 'time taken for',numTsteps,'tsteps',numIter,'iters =', t1-t0

"""

cellSite = meshes[0].getCells()
velField = macroFields.velocity[ cellSite ].asNumPyArray() 
print  macroFields.velocity[ cellSite ].asNumPyArray()
rhoField = macroFields.density[ cellSite ].asNumPyArray() 
print  macroFields.density[ cellSite ].asNumPyArray()
#import debug
#fmodel.advance(100)
Exemple #11
0
if 5 in bcMap:
    bcRight = bcMap[5]
    bcRight.bcType = 'PressureInletBC'
    bcRight.setVar('specifiedTemperature', 1.0)
    bcRight.setVar('specifiedPressure', 1.0)

vcMap = esbgk1.getVCMap()
print "initializing bcs"
##esbgk1options.setVar('timeStep',pd.timeStepND)
esbgk1options.relativeTolerance = relTol
esbgk1options.absoluteTolerance = absTol

pd.prevIter = 0
print "initializing bcs"
### solver options ###
tecplotESBGK.esbgkTecplotFile(pd.fluidMeshes, pd.macroFields, "quad",
                              "initial.dat")

### set up IBM ###

for mesh in pd.solidBoundaryMeshes:
    faces = mesh.getFaces()
    #temperature field on boundary mesh
    areaMag = pd.geomFields.areaMag[faces]
    faceCount = faces.getCount()
    tem = areaMag.newSizedClone(faceCount)
    tema = tem.asNumPyArray()
    tema[:] = tbeam
    pd.macroFields.temperature[faces] = tem
    dens = areaMag.newSizedClone(faceCount)
    densa = dens.asNumPyArray()
    densa[:] = pd.rho_init