def createPhi(runTime, hU, mesh): ref.ext_Info() << "Reading/calculating face flux field phi\n" << ref.nl phi = man.surfaceScalarField( man.IOobject(ref.word("phi"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.READ_IF_PRESENT, ref.IOobject.AUTO_WRITE), man.linearInterpolate(hU) & man.surfaceVectorField(mesh.Sf(), man.Deps(mesh))) return phi
def createPhi( runTime, hU, mesh ): ref.ext_Info() << "Reading/calculating face flux field phi\n" << ref.nl phi = man.surfaceScalarField( man.IOobject( ref.word( "phi" ), ref.fileName( runTime.timeName() ), mesh, ref.IOobject.READ_IF_PRESENT, ref.IOobject.AUTO_WRITE ), man.linearInterpolate( hU ) & man.surfaceVectorField( mesh.Sf(), man.Deps( mesh ) ) ) return phi
def createFluidFields( fluidRegions, runTime ) : # Initialise fluid field pointer lists thermoFluid = list() rhoFluid = list() KFluid = list() UFluid = list() phiFluid = list() gFluid = list() turbulence =list() p_rghFluid = list() ghFluid = list() ghfFluid = list() radiation =list() DpDtFluid =list() initialMassFluid = list() #Populate fluid field pointer lists for index in range( fluidRegions.__len__() ) : ref.ext_Info() << "*** Reading fluid mesh thermophysical properties for region " \ << fluidRegions[ index ].name() << ref.nl << ref.nl ref.ext_Info()<< " Adding to thermoFluid\n" << ref.nl thermo = man.basicRhoThermo.New( fluidRegions[ index ] ) thermoFluid.append( thermo ) ref.ext_Info()<< " Adding to rhoFluid\n" << ref.nl rhoFluid.append( man.volScalarField( man.IOobject( ref.word( "rho" ), ref.fileName( runTime.timeName() ), fluidRegions[ index ], ref.IOobject.NO_READ, ref.IOobject.AUTO_WRITE ), man.volScalarField( thermoFluid[ index ].rho(), man.Deps( thermoFluid[ index ] ) ) ) ) ref.ext_Info()<< " Adding to KFluid\n" << ref.nl KFluid.append( man.volScalarField( man.IOobject( ref.word( "K" ), ref.fileName( runTime.timeName() ), fluidRegions[ index ], ref.IOobject.NO_READ, ref.IOobject.NO_WRITE ), man.volScalarField( thermoFluid[ index ].Cp() * thermoFluid[ index ].alpha(), man.Deps( thermoFluid[ index ] ) ) ) ) ref.ext_Info()<< " Adding to UFluid\n" << ref.nl UFluid.append( man.volVectorField( man.IOobject( ref.word( "U" ), ref.fileName( runTime.timeName() ), fluidRegions[ index ], ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE ), fluidRegions[ index ] ) ) ref.ext_Info()<< " Adding to phiFluid\n" << ref.nl phiFluid.append( man.surfaceScalarField( man.IOobject( ref.word( "phi" ), ref.fileName( runTime.timeName() ), fluidRegions[ index ], ref.IOobject.READ_IF_PRESENT, ref.IOobject.AUTO_WRITE), man.linearInterpolate( rhoFluid[ index ] * UFluid[ index ] ) & man.surfaceVectorField( fluidRegions[ index ].Sf(), man.Deps( fluidRegions[ index ] ) ) ) ) ref.ext_Info()<< " Adding to gFluid\n" << ref.nl gFluid.append( man.uniformDimensionedVectorField( man.IOobject( ref.word( "g" ), ref.fileName( runTime.constant() ), fluidRegions[ index ], ref.IOobject.MUST_READ, ref.IOobject.NO_WRITE ) ) ) ref.ext_Info()<< " Adding to turbulence\n" << ref.nl turbulence.append( man.compressible.turbulenceModel.New( rhoFluid[ index ], UFluid[ index ], phiFluid[ index ], thermoFluid[ index ] ) ) ref.ext_Info() << " Adding to ghFluid\n" << ref.nl ghFluid.append( man.volScalarField( ref.word( "gh" ) , gFluid[ index ] & man.volVectorField( fluidRegions[ index ].C(), man.Deps( fluidRegions[ index ] ) ) ) ) ref.ext_Info() << " Adding to ghfFluid\n" << ref.nl ghfFluid.append( man.surfaceScalarField( ref.word( "ghf" ), gFluid[ index ] & man.surfaceVectorField( fluidRegions[ index ].Cf(), man.Deps( fluidRegions[ index ] ) ) ) ) p_rghFluid.append( man.volScalarField( man.IOobject( ref.word( "p_rgh" ), ref.fileName( runTime.timeName() ), fluidRegions[ index ], ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE ), fluidRegions[ index ] ) ) # Force p_rgh to be consistent with p p_rghFluid[ index ] << thermoFluid[ index ].p()() - rhoFluid[ index ] * ghFluid[ index ] radiation.append( man.radiation.radiationModel.New( man.volScalarField( thermoFluid[ index ].T(), man.Deps( thermoFluid[ index ] ) ) ) ) initialMassFluid.append( ref.fvc.domainIntegrate( rhoFluid[ index ] ).value() ) ref.ext_Info()<< " Adding to DpDtFluid\n" << ref.nl DpDtFluid.append( man.volScalarField( ref.word( "DpDt" ), man.fvc.DDt( man.surfaceScalarField( ref.word( "phiU" ), phiFluid[ index ] / man.fvc.interpolate( rhoFluid[ index ] ) ), man.volScalarField( thermoFluid[ index ].p(), man.Deps( thermoFluid[ index ] ) ) ) ) ) return thermoFluid, rhoFluid, KFluid, UFluid, phiFluid, gFluid, turbulence, DpDtFluid, initialMassFluid, ghFluid, ghfFluid, p_rghFluid, radiation
def createFluidFields(fluidRegions, runTime): # Initialise fluid field pointer lists thermoFluid = list() rhoFluid = list() KFluid = list() UFluid = list() phiFluid = list() gFluid = list() turbulence = list() p_rghFluid = list() ghFluid = list() ghfFluid = list() radiation = list() DpDtFluid = list() initialMassFluid = list() #Populate fluid field pointer lists for index in range(fluidRegions.__len__()): ref.ext_Info() << "*** Reading fluid mesh thermophysical properties for region " \ << fluidRegions[ index ].name() << ref.nl << ref.nl ref.ext_Info() << " Adding to thermoFluid\n" << ref.nl thermo = man.basicRhoThermo.New(fluidRegions[index]) thermoFluid.append(thermo) ref.ext_Info() << " Adding to rhoFluid\n" << ref.nl rhoFluid.append( man.volScalarField( man.IOobject(ref.word("rho"), ref.fileName(runTime.timeName()), fluidRegions[index], ref.IOobject.NO_READ, ref.IOobject.AUTO_WRITE), man.volScalarField(thermoFluid[index].rho(), man.Deps(thermoFluid[index])))) ref.ext_Info() << " Adding to KFluid\n" << ref.nl KFluid.append( man.volScalarField( man.IOobject(ref.word("K"), ref.fileName(runTime.timeName()), fluidRegions[index], ref.IOobject.NO_READ, ref.IOobject.NO_WRITE), man.volScalarField( thermoFluid[index].Cp() * thermoFluid[index].alpha(), man.Deps(thermoFluid[index])))) ref.ext_Info() << " Adding to UFluid\n" << ref.nl UFluid.append( man.volVectorField( man.IOobject(ref.word("U"), ref.fileName(runTime.timeName()), fluidRegions[index], ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), fluidRegions[index])) ref.ext_Info() << " Adding to phiFluid\n" << ref.nl phiFluid.append( man.surfaceScalarField( man.IOobject(ref.word("phi"), ref.fileName(runTime.timeName()), fluidRegions[index], ref.IOobject.READ_IF_PRESENT, ref.IOobject.AUTO_WRITE), man.linearInterpolate(rhoFluid[index] * UFluid[index]) & man.surfaceVectorField(fluidRegions[index].Sf(), man.Deps(fluidRegions[index])))) ref.ext_Info() << " Adding to gFluid\n" << ref.nl gFluid.append( man.uniformDimensionedVectorField( man.IOobject(ref.word("g"), ref.fileName(runTime.constant()), fluidRegions[index], ref.IOobject.MUST_READ, ref.IOobject.NO_WRITE))) ref.ext_Info() << " Adding to turbulence\n" << ref.nl turbulence.append( man.compressible.turbulenceModel.New(rhoFluid[index], UFluid[index], phiFluid[index], thermoFluid[index])) ref.ext_Info() << " Adding to ghFluid\n" << ref.nl ghFluid.append( man.volScalarField( ref.word("gh"), gFluid[index] & man.volVectorField( fluidRegions[index].C(), man.Deps(fluidRegions[index])))) ref.ext_Info() << " Adding to ghfFluid\n" << ref.nl ghfFluid.append( man.surfaceScalarField( ref.word("ghf"), gFluid[index] & man.surfaceVectorField( fluidRegions[index].Cf(), man.Deps(fluidRegions[index])))) p_rghFluid.append( man.volScalarField( man.IOobject(ref.word("p_rgh"), ref.fileName(runTime.timeName()), fluidRegions[index], ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), fluidRegions[index])) # Force p_rgh to be consistent with p p_rghFluid[index] << thermoFluid[index].p()( ) - rhoFluid[index] * ghFluid[index] radiation.append( man.radiation.radiationModel.New( man.volScalarField(thermoFluid[index].T(), man.Deps(thermoFluid[index])))) initialMassFluid.append( ref.fvc.domainIntegrate(rhoFluid[index]).value()) ref.ext_Info() << " Adding to DpDtFluid\n" << ref.nl DpDtFluid.append( man.volScalarField( ref.word("DpDt"), man.fvc.DDt( man.surfaceScalarField( ref.word("phiU"), phiFluid[index] / man.fvc.interpolate(rhoFluid[index])), man.volScalarField(thermoFluid[index].p(), man.Deps(thermoFluid[index]))))) return thermoFluid, rhoFluid, KFluid, UFluid, phiFluid, gFluid, turbulence, DpDtFluid, initialMassFluid, ghFluid, ghfFluid, p_rghFluid, radiation