def create_fields( runTime, mesh ): from Foam.OpenFOAM import ext_Info, nl ext_Info() << "Reading thermophysical properties\n" << nl from Foam.thermophysicalModels import basicPsiThermo, autoPtr_basicPsiThermo thermo = basicPsiThermo.New( mesh ) p = thermo.p() h = thermo.h() psi = thermo.psi() from Foam.OpenFOAM import IOobject, word, fileName from Foam.finiteVolume import volScalarField rho = volScalarField( IOobject( word( "rho" ), fileName( runTime.timeName() ), mesh, IOobject.READ_IF_PRESENT, IOobject.AUTO_WRITE ), thermo.rho() ) ext_Info() << "Reading field U\n" << nl from Foam.finiteVolume import volVectorField U = volVectorField( IOobject( word( "U" ), fileName( runTime.timeName() ), mesh, IOobject.MUST_READ, IOobject.AUTO_WRITE ), mesh ) from Foam.finiteVolume.cfdTools.compressible import compressibleCreatePhi phi = compressibleCreatePhi( runTime, mesh, rho, U ) from Foam.OpenFOAM import dimensionedScalar pMin = dimensionedScalar( mesh.solutionDict().subDict( word( "PIMPLE" ) ).lookup( word( "pMin" ) ) ) ext_Info() << "Creating turbulence model\n" << nl from Foam import compressible turbulence = compressible.turbulenceModel.New( rho, U, phi, thermo() ) # initialMass = fvc.domainIntegrate(rho) ext_Info() << "Creating field DpDt\n" << nl from Foam import fvc from Foam.finiteVolume import surfaceScalarField DpDt = fvc.DDt( surfaceScalarField( word( "phiU" ), phi / fvc.interpolate( rho ) ), p ) from Foam.finiteVolume import MRFZones mrfZones = MRFZones( mesh ) mrfZones.correctBoundaryVelocity( U ) from Foam.finiteVolume import porousZones pZones = porousZones( mesh ) from Foam.OpenFOAM import Switch pressureImplicitPorosity = Switch( False ) return thermo, turbulence, p, h, psi, rho, U, phi, pMin, DpDt, mrfZones, pZones, pressureImplicitPorosity
def create_fields( runTime, mesh ): from Foam.OpenFOAM import ext_Info, nl ext_Info() << "Reading field p\n" << nl from Foam.OpenFOAM import IOobject, word, fileName from Foam.finiteVolume import volScalarField p = volScalarField( IOobject( word( "p" ), fileName( runTime.timeName() ), mesh, IOobject.MUST_READ, IOobject.AUTO_WRITE ), mesh ) ext_Info() << "Reading field U\n" << nl from Foam.finiteVolume import volVectorField U = volVectorField( IOobject( word( "U" ), fileName( runTime.timeName() ), mesh, IOobject.MUST_READ, IOobject.AUTO_WRITE ), mesh ) from Foam.finiteVolume.cfdTools.incompressible import createPhi phi = createPhi( runTime, mesh, U ) pRefCell = 0 pRefValue = 0.0 from Foam.finiteVolume import setRefCell pRefCell, pRefValue = setRefCell( p, mesh.solutionDict().subDict( word( "SIMPLE" ) ), pRefCell, pRefValue ) from Foam.transportModels import singlePhaseTransportModel laminarTransport = singlePhaseTransportModel( U, phi ) from Foam import incompressible turbulence = incompressible.RASModel.New( U, phi, laminarTransport ) from Foam.finiteVolume import porousZones pZones = porousZones( mesh ) from Foam.OpenFOAM import Switch pressureImplicitPorosity = Switch( False ) nUCorr = 0 if pZones.size(): # nUCorrectors for pressureImplicitPorosity if (mesh.solutionDict().subDict( word( "SIMPLE" ) ).found( word( "nUCorrectors" ) ) ) : from Foam.OpenFOAM import readInt nUCorr = readInt( mesh.solutionDict().subDict( word( "SIMPLE" ) ).lookup( word( "nUCorrectors" ) ) ) pass if nUCorr > 0 : pressureImplicitPorosity = True pass pass return p, U, phi, pRefCell, pRefValue, laminarTransport, turbulence, pZones, pressureImplicitPorosity, nUCorr
def create_fields(runTime, mesh): from Foam.OpenFOAM import ext_Info, nl ext_Info() << "Reading thermophysical properties\n" << nl from Foam.thermophysicalModels import basicPsiThermo, autoPtr_basicPsiThermo thermo = basicPsiThermo.New(mesh) p = thermo.p() h = thermo.h() psi = thermo.psi() from Foam.OpenFOAM import IOobject, word, fileName from Foam.finiteVolume import volScalarField rho = volScalarField( IOobject(word("rho"), fileName(runTime.timeName()), mesh, IOobject.READ_IF_PRESENT, IOobject.AUTO_WRITE), thermo.rho()) ext_Info() << "Reading field U\n" << nl from Foam.finiteVolume import volVectorField U = volVectorField( IOobject(word("U"), fileName(runTime.timeName()), mesh, IOobject.MUST_READ, IOobject.AUTO_WRITE), mesh) from Foam.finiteVolume.cfdTools.compressible import compressibleCreatePhi phi = compressibleCreatePhi(runTime, mesh, rho, U) from Foam.OpenFOAM import dimensionedScalar pMin = dimensionedScalar(mesh.solutionDict().subDict( word("PIMPLE")).lookup(word("pMin"))) ext_Info() << "Creating turbulence model\n" << nl from Foam import compressible turbulence = compressible.turbulenceModel.New(rho, U, phi, thermo()) # initialMass = fvc.domainIntegrate(rho) ext_Info() << "Creating field DpDt\n" << nl from Foam import fvc from Foam.finiteVolume import surfaceScalarField DpDt = fvc.DDt( surfaceScalarField(word("phiU"), phi / fvc.interpolate(rho)), p) from Foam.finiteVolume import MRFZones mrfZones = MRFZones(mesh) mrfZones.correctBoundaryVelocity(U) from Foam.finiteVolume import porousZones pZones = porousZones(mesh) from Foam.OpenFOAM import Switch pressureImplicitPorosity = Switch(False) return thermo, turbulence, p, h, psi, rho, U, phi, pMin, DpDt, mrfZones, pZones, pressureImplicitPorosity
def create_fields(runTime, mesh): from Foam.OpenFOAM import ext_Info, nl ext_Info() << "Reading field p\n" << nl from Foam.OpenFOAM import IOobject, word, fileName from Foam.finiteVolume import volScalarField p = volScalarField( IOobject(word("p"), fileName(runTime.timeName()), mesh, IOobject.MUST_READ, IOobject.AUTO_WRITE), mesh) ext_Info() << "Reading field U\n" << nl from Foam.finiteVolume import volVectorField U = volVectorField( IOobject(word("U"), fileName(runTime.timeName()), mesh, IOobject.MUST_READ, IOobject.AUTO_WRITE), mesh) from Foam.finiteVolume.cfdTools.incompressible import createPhi phi = createPhi(runTime, mesh, U) pRefCell = 0 pRefValue = 0.0 from Foam.finiteVolume import setRefCell pRefCell, pRefValue = setRefCell( p, mesh.solutionDict().subDict(word("SIMPLE")), pRefCell, pRefValue) from Foam.transportModels import singlePhaseTransportModel laminarTransport = singlePhaseTransportModel(U, phi) from Foam import incompressible turbulence = incompressible.RASModel.New(U, phi, laminarTransport) from Foam.finiteVolume import porousZones pZones = porousZones(mesh) from Foam.OpenFOAM import Switch pressureImplicitPorosity = Switch(False) nUCorr = 0 if pZones.size(): # nUCorrectors for pressureImplicitPorosity if (mesh.solutionDict().subDict(word("SIMPLE")).found( word("nUCorrectors"))): from Foam.OpenFOAM import readInt nUCorr = readInt(mesh.solutionDict().subDict( word("SIMPLE")).lookup(word("nUCorrectors"))) pass if nUCorr > 0: pressureImplicitPorosity = True pass pass return p, U, phi, pRefCell, pRefValue, laminarTransport, turbulence, pZones, pressureImplicitPorosity, nUCorr
def _createFields(runTime, mesh): from Foam.OpenFOAM import ext_Info, nl ext_Info() << "Reading thermophysical properties\n" << nl from Foam.thermophysicalModels import basicThermo, autoPtr_basicThermo thermo = basicThermo.New(mesh) from Foam.OpenFOAM import IOdictionary, IOobject, word, fileName from Foam.finiteVolume import volScalarField rho = volScalarField( IOobject(word("rho"), fileName(runTime.timeName()), mesh, IOobject.READ_IF_PRESENT, IOobject.AUTO_WRITE), thermo.rho()) p = thermo.p() h = thermo.h() ext_Info() << "Reading field U\n" << nl from Foam.finiteVolume import volVectorField U = volVectorField( IOobject(word("U"), fileName(runTime.timeName()), mesh, IOobject.MUST_READ, IOobject.AUTO_WRITE), mesh) from Foam.finiteVolume.cfdTools.compressible import compressibleCreatePhi phi = compressibleCreatePhi(runTime, mesh, rho, U) pRefCell = 0 pRefValue = 0.0 from Foam.finiteVolume import setRefCell pRefCell, pRefValue = setRefCell( p, mesh.solutionDict().subDict(word("SIMPLE")), pRefCell, pRefValue) from Foam.OpenFOAM import dimensionedScalar pMin = dimensionedScalar(mesh.solutionDict().subDict( word("SIMPLE")).lookup(word("pMin"))) ext_Info() << "Creating turbulence model\n" << nl from Foam import compressible turbulence = compressible.RASModel.New(rho, U, phi, thermo()) from Foam import fvc initialMass = fvc.domainIntegrate(rho) from Foam.finiteVolume import porousZones pZones = porousZones(mesh) from Foam.OpenFOAM import Switch pressureImplicitPorosity = Switch(False) nUCorr = 0 if pZones.size(): # nUCorrectors for pressureImplicitPorosity if (mesh.solutionDict().subDict(word("SIMPLE")).found( word("nUCorrectors"))): from Foam.OpenFOAM import readInt nUCorr = readInt(mesh.solutionDict().subDict( word("SIMPLE")).lookup(word("nUCorrectors"))) pass if nUCorr > 0: pressureImplicitPorosity = True pass pass return turbulence, p, h, rho, U, phi, thermo, pZones, pMin, pressureImplicitPorosity, initialMass, nUCorr, pRefCell, pRefValue
def _createFields(runTime, mesh): from Foam.OpenFOAM import ext_Info, nl ext_Info() << "Reading thermophysical properties\n" << nl from Foam.thermophysicalModels import basicThermo, autoPtr_basicThermo thermo = basicThermo.New(mesh) from Foam.OpenFOAM import IOdictionary, IOobject, word, fileName from Foam.finiteVolume import volScalarField rho = volScalarField( IOobject(word("rho"), fileName(runTime.timeName()), mesh, IOobject.READ_IF_PRESENT, IOobject.AUTO_WRITE), thermo.rho(), ) p = thermo.p() h = thermo.h() ext_Info() << "Reading field U\n" << nl from Foam.finiteVolume import volVectorField U = volVectorField( IOobject(word("U"), fileName(runTime.timeName()), mesh, IOobject.MUST_READ, IOobject.AUTO_WRITE), mesh ) from Foam.finiteVolume.cfdTools.compressible import compressibleCreatePhi phi = compressibleCreatePhi(runTime, mesh, rho, U) pRefCell = 0 pRefValue = 0.0 from Foam.finiteVolume import setRefCell pRefCell, pRefValue = setRefCell(p, mesh.solutionDict().subDict(word("SIMPLE")), pRefCell, pRefValue) from Foam.OpenFOAM import dimensionedScalar pMin = dimensionedScalar(mesh.solutionDict().subDict(word("SIMPLE")).lookup(word("pMin"))) # ext_Info() << "Creating turbulence model\n" << nl # from Foam import compressible # turbulence = compressible.turbulenceModel.New( rho, U, phi, thermo() ) from Foam import fvc initialMass = fvc.domainIntegrate(rho) from Foam.finiteVolume import porousZones pZones = porousZones(mesh) from Foam.OpenFOAM import Switch pressureImplicitPorousity = Switch(False) nUCorr = 0 if pZones.size(): mesh.solutionDict().subDict(word("SIMPLE")).lookup( word("pressureImplicitPorousity") ) >> pressureImplicitPorousity pass return p, h, rho, U, phi, thermo, pZones, pMin, pressureImplicitPorousity, initialMass, nUCorr, pRefCell, pRefValue