def _createFields(runTime, mesh): ref.ext_Info() << "Reading field T\n" << ref.nl T = man.volScalarField( man.IOobject(ref.word("T"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh) ref.ext_Info() << "Reading field U\n" << ref.nl U = man.volVectorField( man.IOobject(ref.word("U"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh) ref.ext_Info() << "Reading transportProperties\n" << ref.nl transportProperties = man.IOdictionary( man.IOobject(ref.word("transportProperties"), ref.fileName(runTime.constant()), mesh, ref.IOobject.MUST_READ_IF_MODIFIED, ref.IOobject.NO_WRITE)) ref.ext_Info() << "Reading diffusivity D\n" << ref.nl DT = ref.dimensionedScalar(transportProperties.lookup(ref.word("DT"))) phi = man.createPhi(runTime, mesh, U) return T, U, transportProperties, DT, phi
def _createFields(runTime, mesh): ref.ext_Info() << "Reading field U\n" << ref.nl U = man.volVectorField( man.IOobject(ref.word("U"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh) ref.ext_Info() << "Creating face flux\n" << ref.nl phi = man.surfaceScalarField( man.IOobject(ref.word("phi"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.NO_READ, ref.IOobject.NO_WRITE), mesh, ref.dimensionedScalar(ref.word("zero"), mesh.Sf().dimensions() * U.dimensions(), 0.0)) laminarTransport = man.singlePhaseTransportModel(U, phi) turbulence = man.incompressible.RASModel.New(U, phi, laminarTransport) transportProperties = man.IOdictionary( man.IOobject(ref.word("transportProperties"), ref.fileName(runTime.constant()), mesh, ref.IOobject.MUST_READ, ref.IOobject.NO_WRITE)) Ubar = ref.dimensionedVector(transportProperties.lookup(ref.word("Ubar"))) flowDirection = (Ubar / Ubar.mag()).ext_value() flowMask = flowDirection.sqr() gradP = ref.dimensionedVector(ref.word("gradP"), ref.dimensionSet(0.0, 1.0, -2.0, 0.0, 0.0), ref.vector(0.0, 0.0, 0.0)) return U, phi, laminarTransport, turbulence, Ubar, gradP, flowDirection, flowMask
def readTransportProperties(runTime, mesh): ref.ext_Info() << "Reading transportProperties\n" << ref.nl transportProperties = man.IOdictionary( man.IOobject(ref.word("transportProperties"), ref.fileName(runTime.constant()), mesh, ref.IOobject.MUST_READ_IF_MODIFIED, ref.IOobject.NO_WRITE)) mu = ref.dimensionedScalar(transportProperties.lookup(ref.word("mu"))) return transportProperties, mu
def readThermophysicalProperties(runTime, mesh): ref.ext_Info() << "Reading thermophysicalProperties\n" << ref.nl # Pr defined as a separate constant to enable calculation of k, currently # inaccessible through thermo thermophysicalProperties = man.IOdictionary( man.IOobject(ref.word("thermophysicalProperties"), ref.fileName(runTime.constant()), mesh, ref.IOobject.MUST_READ, ref.IOobject.NO_WRITE)) Pr = ref.dimensionedScalar.lookupOrDefault(ref.word("Pr"), thermophysicalProperties(), 1.0) return thermophysicalProperties, Pr
def readTurbulenceProperties(runTime, mesh, U): ref.ext_Info() << "Reading turbulenceProperties\n" << ref.nl turbulenceProperties = man.IOdictionary( man.IOobject(ref.word("turbulenceProperties"), ref.fileName(runTime.constant()), mesh, ref.IOobject.MUST_READ_IF_MODIFIED, ref.IOobject.NO_WRITE)) force = U / ref.dimensionedScalar(ref.word("dt"), ref.dimTime, runTime.deltaTValue()) K = man.Kmesh(mesh) forceGen = man.UOprocess(K, runTime.deltaTValue(), turbulenceProperties) return turbulenceProperties, force, K, forceGen
def readThermodynamicProperties(runTime, mesh): ref.ext_Info() << "Reading thermodynamicProperties\n" << ref.nl thermodynamicProperties = man.IOdictionary( man.IOobject(ref.word("thermodynamicProperties"), ref.fileName(runTime.constant()), mesh, ref.IOobject.MUST_READ_IF_MODIFIED, ref.IOobject.NO_WRITE)) rho0 = ref.dimensionedScalar( thermodynamicProperties.lookup(ref.word("rho0"))) p0 = ref.dimensionedScalar(thermodynamicProperties.lookup(ref.word("p0"))) psi = ref.dimensionedScalar(thermodynamicProperties.lookup( ref.word("psi"))) # Density offset, i.e. the constant part of the density rhoO = ref.dimensionedScalar(ref.word("rhoO"), rho0 - psi * p0) return thermodynamicProperties, rho0, p0, psi, rhoO
def readGravitationalAcceleration(runTime, mesh): ref.ext_Info() << "\nReading gravitationalProperties" << ref.nl gravitationalProperties = man.IOdictionary( man.IOobject(ref.word("gravitationalProperties"), ref.fileName(runTime.constant()), mesh, ref.IOobject.MUST_READ_IF_MODIFIED, ref.IOobject.NO_WRITE)) g = ref.dimensionedVector(gravitationalProperties.lookup(ref.word("g"))) rotating = ref.Switch(gravitationalProperties.lookup(ref.word("rotating"))) if rotating: Omega = ref.dimensionedVector( gravitationalProperties.lookup(ref.word("Omega"))) else: Omega = ref.dimensionedVector(ref.word("Omega"), -ref.dimTime, ref.vector(0, 0, 0)) magg = g.mag() gHat = g / magg return gravitationalProperties, g, rotating, Omega, magg, gHat