Foam::tmp<Foam::volScalarField> Foam::saturationModels::polynomial::Tsat ( const volScalarField& p ) const { tmp<volScalarField> tTsat ( new volScalarField ( IOobject ( "Tsat", p.mesh().time().timeName(), p.mesh(), IOobject::NO_READ, IOobject::NO_WRITE ), p.mesh(), dimensionedScalar("zero", dimTemperature, 0) ) ); volScalarField& Tsat = tTsat(); forAll(Tsat,celli) { Tsat[celli] = C_.value(p[celli]); }
Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressureTools::rho ( const volScalarField& p ) const { if (p.dimensions() == dimPressure) { return p.mesh().lookupObject<volScalarField>(rhoName_); } else { return tmp<volScalarField> ( new volScalarField ( IOobject ( "rho", p.mesh().time().timeName(), p.mesh(), IOobject::NO_READ, IOobject::NO_WRITE ), p.mesh(), dimensionedScalar("zero", dimDensity, rhoInf_) ) ); } }
Foam::tmp<Foam::fvScalarMatrix> Foam::populationBalanceSubModels::diffusionModels::noDiffusion ::momentDiff ( const volScalarField& moment ) const { tmp<volScalarField> noDiff ( new volScalarField ( IOobject ( "noDiff", moment.mesh().time().timeName(), moment.mesh(), IOobject::NO_READ, IOobject::NO_WRITE, false ), moment.mesh(), dimensionedScalar("zero", inv(dimTime), 0.0) ) ); return fvm::Sp(noDiff, moment); }
void lcFaceMaximumPluginFunction::doCellCalculation(volScalarField &field) { const cellList &cl=field.mesh().cells(); const surfaceScalarField &o=original_(); forAll(field,cellI) { scalar maxVal=-1e30; const cell &c=cl[cellI]; forAll(c,i) { const label faceI=c[i]; if(faceI<field.mesh().nInternalFaces()) { maxVal=max(maxVal,o[faceI]); } else { label patchID=field.mesh().boundaryMesh().whichPatch(faceI); label startI=field.mesh().boundaryMesh()[patchID].start(); maxVal=max( maxVal, o.boundaryField()[patchID][faceI-startI] ); } } field[cellI]=maxVal; }
Foam::XiEqModels::basicSubGrid::basicSubGrid ( const dictionary& XiEqProperties, const hhuCombustionThermo& thermo, const compressible::RASModel& turbulence, const volScalarField& Su ) : XiEqModel(XiEqProperties, thermo, turbulence, Su), B_ ( IOobject ( "B", Su.mesh().facesInstance(), Su.mesh(), IOobject::MUST_READ, IOobject::NO_WRITE ), Su.mesh() ), XiEqModel_(XiEqModel::New(XiEqModelCoeffs_, thermo, turbulence, Su)) {}
virtualMassForce::virtualMassForce ( const dictionary& multiphaseSurfaceForcesDict, const multiphase::transport& mtm, const PtrList<volScalarField>& alpha, const volScalarField& beta ) : multiphaseSurfaceForcesDict_(multiphaseSurfaceForcesDict), alpha_(alpha), beta_(beta), mtm_(mtm), virtualMassForce_ ( IOobject ( "virtualMassForce", beta.time().timeName(), beta.mesh(), IOobject::NO_READ, IOobject::AUTO_WRITE ), beta.mesh(), dimensionedVector("zero", dimensionSet(0, 0, 0, 0, 0), vector(0.0, 0.0, 0.0)) ) {}
Foam::tmp<Foam::volScalarField> Foam::SrivastavaSundaresanFrictionalStress::muf ( const volScalarField& alpha, const volScalarField& Theta, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax, const volScalarField& pf, const volSymmTensorField& D, const dimensionedScalar& phi ) const { const scalar I2Dsmall = 1.0e-35; //Creating muf assuming it should be 0 on the boundary which may not be // true tmp<volScalarField> tmuf ( new volScalarField ( IOobject ( "muf", alpha.mesh().time().timeName(), alpha.mesh() ), alpha.mesh(), dimensionedScalar("muf", dimensionSet(1, -1, -1, 0, 0), 1e30) ) ); volScalarField& muff = tmuf(); forAll (D, celli) { if (alpha[celli] >= alphaMinFriction.value()) { muff[celli] = 0.5*pf[celli]*sin(phi.value()) /( sqrt(1.0/6.0*(sqr(D[celli].xx() - D[celli].yy()) + sqr(D[celli].yy() - D[celli].zz()) + sqr(D[celli].zz() - D[celli].xx())) + sqr(D[celli].xy()) + sqr(D[celli].xz()) + sqr(D[celli].yz())) + I2Dsmall ); } if (alpha[celli] < alphaMinFriction.value()) { muff[celli] = 0.0; } } muff.correctBoundaryConditions(); return tmuf; }
Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::nu ( const volScalarField& alpha1, const dimensionedScalar& alphaMax, const volScalarField& pf, const volSymmTensorField& D ) const { const scalar I2Dsmall = 1.0e-15; // Creating nu assuming it should be 0 on the boundary which may not be // true tmp<volScalarField> tnu ( new volScalarField ( IOobject ( "Schaeffer:nu", alpha1.mesh().time().timeName(), alpha1.mesh(), IOobject::NO_READ, IOobject::NO_WRITE, false ), alpha1.mesh(), dimensionedScalar("nu", dimensionSet(0, 2, -1, 0, 0), 0.0) ) ); volScalarField& nuf = tnu(); forAll (D, celli) { if (alpha1[celli] > alphaMax.value() - 5e-2) { nuf[celli] = 0.5*pf[celli]*sin(phi_.value()) /( sqrt(1.0/6.0*(sqr(D[celli].xx() - D[celli].yy()) + sqr(D[celli].yy() - D[celli].zz()) + sqr(D[celli].zz() - D[celli].xx())) + sqr(D[celli].xy()) + sqr(D[celli].xz()) + sqr(D[celli].yz())) + I2Dsmall ); } } // Correct coupled BCs nuf.correctBoundaryConditions(); return tnu; }
interfaceProperties::interfaceProperties ( const volScalarField& gamma, const volVectorField& U, const IOdictionary& dict ) : transportPropertiesDict_(dict), cGamma_ ( readScalar ( gamma.mesh().solutionDict().subDict("PISO").lookup("cGamma") ) ), sigma_(dict.lookup("sigma")), deltaN_ ( "deltaN", 1e-8/pow(average(gamma.mesh().V()), 1.0/3.0) ), gamma_(gamma), U_(U), nHatf_ ( IOobject ( "nHatf", gamma_.time().timeName(), gamma_.mesh() ), gamma_.mesh(), dimensionedScalar("nHatf", dimArea, 0.0) ), K_ ( IOobject ( "K", gamma_.time().timeName(), gamma_.mesh() ), gamma_.mesh(), dimensionedScalar("K", dimless/dimLength, 0.0) ) { calculateK(); }
Foam::tmp<Foam::volScalarField> Foam::SchaefferFrictionalStress::muf ( const volScalarField& alpha, const dimensionedScalar& alphaMax, const volScalarField& pf, const volTensorField& D, const dimensionedScalar& phi ) const { const scalar I2Dsmall = 1.0e-15; // Creating muf assuming it should be 0 on the boundary which may not be // true tmp<volScalarField> tmuf ( new volScalarField ( IOobject ( "muf", alpha.mesh().time().timeName(), alpha.mesh() ), alpha.mesh(), dimensionedScalar("muf", dimensionSet(1, -1, -1, 0, 0), 0.0) ) ); volScalarField& muff = tmuf(); forAll (D, celli) { if (alpha[celli] > alphaMax.value()-5e-2) { muff[celli] = 0.5*pf[celli]*sin(phi.value()) /( sqrt(1.0/6.0*(sqr(D[celli].xx() - D[celli].yy()) + sqr(D[celli].yy() - D[celli].zz()) + sqr(D[celli].zz() - D[celli].xx())) + sqr(D[celli].xy()) + sqr(D[celli].xz()) + sqr(D[celli].yz())) + I2Dsmall ); } } return tmuf; }
Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::adiabaticPerfectFluid::psi ( const volScalarField& p, const volScalarField& T ) const { return tmp<Foam::volScalarField> ( new volScalarField ( IOobject ( "psi", p.time().timeName(), p.mesh(), IOobject::NO_READ, IOobject::NO_WRITE, false ), (rho0_/(gamma_*(p0_ + B_))) *pow((p + B_)/(p0_ + B_), 1.0/gamma_ - 1.0) ) ); }
Foam::tmp<Foam::volScalarField> Foam::consumptionSpeed::omega0Sigma ( const volScalarField& sigma ) { tmp<volScalarField> tomega0 ( new volScalarField ( IOobject ( "omega0", sigma.time().timeName(), sigma.db(), IOobject::NO_READ, IOobject::NO_WRITE ), sigma.mesh(), dimensionedScalar ( "omega0", dimensionSet(1, -2, -1, 0, 0, 0, 0), 0 ) ) ); volScalarField& omega0 = tomega0(); volScalarField::InternalField& iomega0 = omega0.internalField(); forAll(iomega0, celli) { iomega0[celli] = omega0Sigma(sigma[celli], 1.0); }
Foam::tmp<Foam::fvScalarMatrix> Foam::diameterModels::IATEsources::phaseChange::R ( const volScalarField& alphai, volScalarField& kappai ) const { if (!iDmdtPtr_) { iDmdtPtr_ = &alphai.mesh().lookupObject<volScalarField> ( IOobject::groupName("iDmdt", pairName_) ); } const volScalarField& iDmdt = *iDmdtPtr_; return -fvm::SuSp ( (1.0/3.0) *iDmdt() /(alphai()*phase().rho()()), kappai ); }
Foam::tmp<Foam::volScalarField> Foam::laminarModels::generalizedNewtonianViscosityModels::strainRateFunction:: nu ( const volScalarField& nu0, const volScalarField& strainRate ) const { tmp<volScalarField> tnu ( volScalarField::New ( IOobject::groupName(type() + ":nu", nu0.group()), nu0.mesh(), dimensionedScalar(dimViscosity, 0) ) ); tnu.ref().primitiveFieldRef() = strainRateFunction_->value(strainRate); volScalarField::Boundary& nuBf = tnu.ref().boundaryFieldRef(); const volScalarField::Boundary& sigmaBf = strainRate.boundaryField(); forAll(nuBf, patchi) { nuBf[patchi] = strainRateFunction_->value(sigmaBf[patchi]); }
Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::Gulders::Su0pTphi ( const volScalarField& p, const volScalarField& Tu, scalar phi ) const { tmp<volScalarField> tSu0 ( new volScalarField ( IOobject ( "Su0", p.time().timeName(), p.db(), IOobject::NO_READ, IOobject::NO_WRITE ), p.mesh(), dimensionedScalar("Su0", dimVelocity, 0.0) ) ); volScalarField& Su0 = tSu0(); forAll(Su0, celli) { Su0[celli] = Su0pTphi(p[celli], Tu[celli], phi, 0.0); }
Foam::tmp<Foam::volVectorField> Foam::fv::faceLimitedGrad<Foam::scalar>::calcGrad ( const volScalarField& vsf, const word& name ) const { const fvMesh& mesh = vsf.mesh(); tmp<volVectorField> tGrad = basicGradScheme_().calcGrad(vsf, name); if (k_ < SMALL) { return tGrad; } volVectorField& g = tGrad(); const labelUList& owner = mesh.owner(); const labelUList& neighbour = mesh.neighbour(); const volVectorField& C = mesh.C(); const surfaceVectorField& Cf = mesh.Cf(); // create limiter scalarField limiter(vsf.internalField().size(), 1.0); scalar rk = (1.0/k_ - 1.0); forAll(owner, facei) { label own = owner[facei]; label nei = neighbour[facei]; scalar vsfOwn = vsf[own]; scalar vsfNei = vsf[nei]; scalar maxFace = max(vsfOwn, vsfNei); scalar minFace = min(vsfOwn, vsfNei); scalar maxMinFace = rk*(maxFace - minFace); maxFace += maxMinFace; minFace -= maxMinFace; // owner side limitFace ( limiter[own], maxFace - vsfOwn, minFace - vsfOwn, (Cf[facei] - C[own]) & g[own] ); // neighbour side limitFace ( limiter[nei], maxFace - vsfNei, minFace - vsfNei, (Cf[facei] - C[nei]) & g[nei] ); }
Foam::tmp<Foam::volScalarField> Foam::populationBalanceSubModels::aggregationKernels::Fuchs::D ( const volScalarField& abscissa ) const { const fluidThermo& flThermo = abscissa.mesh().lookupObject<fluidThermo>(basicThermo::dictName); return Foam::constant::physicoChemical::k*flThermo.T()/(3.0*Foam::constant::mathematical::pi*flThermo.mu()*dc(abscissa))*(5.0+4.0*Kn(abscissa)+6.0*Kn(abscissa)*Kn(abscissa)+8.0*pow3(Kn(abscissa)))/(5.0-Kn(abscissa)+(8.0+Foam::constant::mathematical::pi)*Kn(abscissa)*Kn(abscissa)); }
Foam::tmp<Foam::volScalarField> Foam::populationBalanceSubModels::aggregationKernels::Fuchs::velocity ( const volScalarField& abscissa ) const { const fluidThermo& flThermo = abscissa.mesh().lookupObject<fluidThermo>(basicThermo::dictName); return sqrt(8.0*Foam::constant::physicoChemical::k*flThermo.T()/(sqr(Foam::constant::mathematical::pi)*rhoSoot_/6.0*pow3(abscissa))); }
void Foam::mulesWithDiffusionImplicitLimiter ( const volScalarField& rho, volScalarField& Y, const surfaceScalarField& phiPos, const surfaceScalarField& phiNeg, scalarField& lambdaFace, surfaceScalarField& rhoPhif, surfaceScalarField& diffFlux, const surfaceScalarField& Dmi, const fvScalarMatrix& SuSp ) { const fvMesh& mesh = rho.mesh(); const dictionary& MULEScontrols = mesh.solverDict("Yi"); label nLimiterIter ( readLabel(MULEScontrols.lookup("nLimiterIter")) ); upwind<scalar> UDsPos(mesh, phiPos); upwind<scalar> UDsNeg(mesh, phiNeg); fvScalarMatrix YConvection ( fv::gaussConvectionScheme<scalar>(mesh, phiPos, UDsPos).fvmDiv(phiPos, Y) + fv::gaussConvectionScheme<scalar>(mesh, phiNeg, UDsPos).fvmDiv(phiNeg, Y) ); surfaceScalarField rhoPhifBD = YConvection.flux(); surfaceScalarField& rhoPhifCorr = rhoPhif; rhoPhifCorr -= rhoPhifBD; volScalarField Su ( "Su", SuSp & Y ); MULES::limiter ( lambdaFace, 1.0/mesh.time().deltaTValue(), rho, Y, rhoPhifBD, rhoPhifCorr, zeroField(), Su, 1.0, //psiMax, 0.0, //psiMin, nLimiterIter ); }
void Foam::MULES::explicitSolve ( const RhoType& rho, volScalarField& psi, const surfaceScalarField& phi, surfaceScalarField& phiPsi, const SpType& Sp, const SuType& Su, const scalar psiMax, const scalar psiMin ) { const fvMesh& mesh = psi.mesh(); psi.correctBoundaryConditions(); if (fv::localEulerDdt::enabled(mesh)) { const volScalarField& rDeltaT = fv::localEulerDdt::localRDeltaT(mesh); limit ( rDeltaT, rho, psi, phi, phiPsi, Sp, Su, psiMax, psiMin, false ); explicitSolve(rDeltaT, rho, psi, phiPsi, Sp, Su); } else { const scalar rDeltaT = 1.0/mesh.time().deltaTValue(); limit ( rDeltaT, rho, psi, phi, phiPsi, Sp, Su, psiMax, psiMin, false ); explicitSolve(rDeltaT, rho, psi, phiPsi, Sp, Su); } }
Foam::flameletModel::flameletModel ( volScalarField& rho ) : ProdRateForSigma_ ( IOobject ( "ProdRateForSigma", rho.mesh().time().timeName(), rho.mesh(), IOobject::NO_READ, IOobject::NO_WRITE ), rho.mesh(), dimensionSet(1, -3, -1, 0, 0) ), DestrRateForSigma_ ( IOobject ( "DestrRateForSigma", rho.mesh().time().timeName(), rho.mesh(), IOobject::NO_READ, IOobject::NO_WRITE ), rho.mesh(), dimensionSet(1, -3, -1, 0, 0) ), I0_ ( IOobject ( "I0", rho.mesh().time().timeName(), rho.mesh(), IOobject::NO_READ, IOobject::NO_WRITE ), rho.mesh(), dimensionSet(0, 0, 0, 0, 0) ) {}
Foam::barotropicCompressibilityModel::barotropicCompressibilityModel ( const dictionary& compressibilityProperties, const volScalarField& gamma, const word& psiName ) : compressibilityProperties_(compressibilityProperties), psi_ ( IOobject ( psiName, gamma.mesh().time().timeName(), gamma.mesh() ), gamma.mesh(), dimensionedScalar(psiName, dimensionSet(0, -2, 2, 0, 0), 0) ), gamma_(gamma) {}
void Foam::MULES::explicitSolve ( const RhoType& rho, volScalarField& psi, const surfaceScalarField& phiPsi, const SpType& Sp, const SuType& Su ) { const fvMesh& mesh = psi.mesh(); const scalar rDeltaT = 1.0/mesh.time().deltaTValue(); explicitSolve(rDeltaT, rho, psi, phiPsi, Sp, Su); }
Foam::radiation::blackBodyEmission::blackBodyEmission ( const label nLambda, const volScalarField& T ) : table_ ( emissivePowerTable, interpolationTable<scalar>::CLAMP, "blackBodyEmissivePower" ), C1_("C1", dimensionSet(1, 4, 3, 0, 0, 0, 0), 3.7419e-16), C2_("C2", dimensionSet(0, 1, 0, 1, 0, 0, 0), 14.388e-6), bLambda_(nLambda), T_(T) { forAll(bLambda_, lambdaI) { bLambda_.set ( lambdaI, new volScalarField ( IOobject ( "bLambda_" + Foam::name(lambdaI) , T.mesh().time().timeName(), T.mesh(), IOobject::NO_READ, IOobject::NO_WRITE ), radiation::sigmaSB*pow4(T) ) ); }
Foam::coalCloudList::coalCloudList ( const volScalarField& rho, const volVectorField& U, const dimensionedVector& g, const SLGThermo& slgThermo ) : PtrList<coalCloud>(), mesh_(rho.mesh()) { IOdictionary props ( IOobject ( "coalCloudList", mesh_.time().constant(), mesh_, IOobject::MUST_READ ) ); const wordHashSet cloudNames(wordList(props.lookup("clouds"))); setSize(cloudNames.size()); label i = 0; forAllConstIter(wordHashSet, cloudNames, iter) { const word& name = iter.key(); Info<< "creating cloud: " << name << endl; set ( i++, new coalCloud ( name, rho, U, g, slgThermo ) ); Info<< endl; } }
Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::linear::psi ( const volScalarField& p, const volScalarField& T ) const { return tmp<Foam::volScalarField> ( new volScalarField ( IOobject ( "psi", p.time().timeName(), p.mesh(), IOobject::NO_READ, IOobject::NO_WRITE, false ), p.mesh(), psi_ ) ); }
void writeCellGraph ( const volScalarField& vsf, const word& graphFormat ) { fileName path(vsf.time().path()/"graphs"/vsf.time().timeName()); mkDir(path); graph ( vsf.name(), "x", vsf.name(), vsf.mesh().C().primitiveField().component(vector::X), vsf.primitiveField() ).write(path/vsf.name(), graphFormat); }
Foam::tmp<Foam::volScalarField> Foam::monitorFunctionFromNone::baseToMonitor ( const volScalarField& b ) const { const fvMesh& mesh = b.mesh(); tmp<volScalarField> tmonitor ( new volScalarField ( IOobject(name(), b.instance(), mesh), mesh, dimensionedScalar("ones", dimless, scalar(1)) ) ); return tmonitor; }
Foam::phaseModel::phaseModel ( const word& phaseName, const volScalarField& p, const volScalarField& T ) : volScalarField ( IOobject ( IOobject::groupName("alpha", phaseName), p.mesh().time().timeName(), p.mesh(), IOobject::MUST_READ, IOobject::AUTO_WRITE ), p.mesh() ), name_(phaseName), p_(p), T_(T), thermo_(NULL), dgdt_ ( IOobject ( IOobject::groupName("dgdt", phaseName), p.mesh().time().timeName(), p.mesh(), IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), p.mesh(), dimensionedScalar("0", dimless/dimTime, 0) ) { { volScalarField Tp(IOobject::groupName("T", phaseName), T); Tp.write(); } thermo_ = rhoThermo::New(p.mesh(), phaseName); thermo_->validate(phaseName, "e"); correct(); }
void Foam::MULES::explicitSolve ( const RhoType& rho, volScalarField& psi, const surfaceScalarField& phi, surfaceScalarField& phiPsi, const SpType& Sp, const SuType& Su, const scalar psiMax, const scalar psiMin ) { const fvMesh& mesh = psi.mesh(); const scalar rDeltaT = 1.0/mesh.time().deltaTValue(); psi.correctBoundaryConditions(); limit(rDeltaT, rho, psi, phi, phiPsi, Sp, Su, psiMax, psiMin, 3, false); explicitSolve(rDeltaT, rho, psi, phiPsi, Sp, Su); }