void Foam::prghPressureFvPatchScalarField::updateCoeffs() { if (updated()) { return; } const scalarField& rhop = patch().lookupPatchField<volScalarField, scalar> ( rhoName_ ); const uniformDimensionedVectorField& g = db().lookupObject<uniformDimensionedVectorField>("g"); const uniformDimensionedScalarField& hRef = db().lookupObject<uniformDimensionedScalarField>("hRef"); dimensionedScalar ghRef ( mag(g.value()) > SMALL ? g & (cmptMag(g.value())/mag(g.value()))*hRef : dimensionedScalar("ghRef", g.dimensions()*dimLength, 0) ); operator==(p_ - rhop*((g.value() & patch().Cf()) - ghRef.value())); fixedValueFvPatchScalarField::updateCoeffs(); }
void Foam::fv::tabulatedAccelerationSource::addSup ( const RhoFieldType& rho, fvMatrix<vector>& eqn, const label fieldi ) { Vector<vector> acceleration(motion_.acceleration()); // If gravitational force is present combine with the linear acceleration if (mesh_.foundObject<uniformDimensionedVectorField>("g")) { uniformDimensionedVectorField& g = mesh_.lookupObjectRef<uniformDimensionedVectorField>("g"); const uniformDimensionedScalarField& hRef = mesh_.lookupObject<uniformDimensionedScalarField>("hRef"); g = g0_ - dimensionedVector("a", dimAcceleration, acceleration.x()); dimensionedScalar ghRef ( mag(g.value()) > SMALL ? g & (cmptMag(g.value())/mag(g.value()))*hRef : dimensionedScalar("ghRef", g.dimensions()*dimLength, 0) ); mesh_.lookupObjectRef<volScalarField>("gh") = (g & mesh_.C()) - ghRef; mesh_.lookupObjectRef<surfaceScalarField>("ghf") = (g & mesh_.Cf()) - ghRef; } // ... otherwise include explicitly in the momentum equation else { eqn -= rho*dimensionedVector("a", dimAcceleration, acceleration.x()); } dimensionedVector Omega ( "Omega", dimensionSet(0, 0, -1, 0, 0), acceleration.y() ); dimensionedVector dOmegaDT ( "dOmegaDT", dimensionSet(0, 0, -2, 0, 0), acceleration.z() ); eqn -= ( rho*(2*Omega ^ eqn.psi()) // Coriolis force + rho*(Omega ^ (Omega ^ mesh_.C())) // Centrifugal force + rho*(dOmegaDT ^ mesh_.C()) // Angular tabulatedAcceleration force ); }
void Foam::prghTotalPressureFvPatchScalarField::updateCoeffs() { if (updated()) { return; } const scalarField& rhop = patch().lookupPatchField<volScalarField, scalar>(rhoName_); const scalarField& phip = patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); const vectorField& Up = patch().lookupPatchField<volVectorField, vector>(UName_); const uniformDimensionedVectorField& g = db().lookupObject<uniformDimensionedVectorField>("g"); const uniformDimensionedScalarField& hRef = db().lookupObject<uniformDimensionedScalarField>("hRef"); dimensionedScalar ghRef ( mag(g.value()) > SMALL ? g & (cmptMag(g.value())/mag(g.value()))*hRef : dimensionedScalar("ghRef", g.dimensions()*dimLength, 0) ); operator== ( p0_ - 0.5*rhop*(1.0 - pos(phip))*magSqr(Up) - rhop*((g.value() & patch().Cf()) - ghRef.value()) ); fixedValueFvPatchScalarField::updateCoeffs(); }