derived bcs: consistent treatment of "phi" and "rho" lookups, etc

This commit is contained in:
Mark Olesen
2008-09-19 11:13:44 +02:00
parent 7f0b671aba
commit 84d30b99d7
23 changed files with 309 additions and 288 deletions

View File

@ -47,8 +47,8 @@ advectiveFvPatchField<Type>::advectiveFvPatchField
) )
: :
mixedFvPatchField<Type>(p, iF), mixedFvPatchField<Type>(p, iF),
phiName_("Undefined"), phiName_("phi"),
rhoName_("Undefined"), rhoName_("rho"),
fieldInf_(pTraits<Type>::zero), fieldInf_(pTraits<Type>::zero),
lInf_(0.0) lInf_(0.0)
{ {
@ -84,8 +84,8 @@ advectiveFvPatchField<Type>::advectiveFvPatchField
) )
: :
mixedFvPatchField<Type>(p, iF), mixedFvPatchField<Type>(p, iF),
phiName_(dict.lookup("phi")), phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_("Undefined"), rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
fieldInf_(pTraits<Type>::zero), fieldInf_(pTraits<Type>::zero),
lInf_(0.0) lInf_(0.0)
{ {
@ -105,15 +105,9 @@ advectiveFvPatchField<Type>::advectiveFvPatchField
this->refGrad() = pTraits<Type>::zero; this->refGrad() = pTraits<Type>::zero;
this->valueFraction() = 0.0; this->valueFraction() = 0.0;
if (dict.found("rho")) if (dict.readIfPresent("lInf", lInf_))
{
dict.lookup("rho") >> rhoName_;
}
if (dict.found("lInf"))
{ {
dict.lookup("fieldInf") >> fieldInf_; dict.lookup("fieldInf") >> fieldInf_;
dict.lookup("lInf") >> lInf_;
if (lInf_ < 0.0) if (lInf_ < 0.0)
{ {
@ -123,8 +117,8 @@ advectiveFvPatchField<Type>::advectiveFvPatchField
"advectiveFvPatchField" "advectiveFvPatchField"
"(const fvPatch&, const Field<Type>&, const dictionary&)", "(const fvPatch&, const Field<Type>&, const dictionary&)",
dict dict
) << "unphysical lInf_ specified (lInf_ < 0)" ) << "unphysical lInf specified (lInf < 0)\n"
<< "\n on patch " << this->patch().name() << " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError); << exit(FatalIOError);
@ -167,7 +161,7 @@ advectiveFvPatchField<Type>::advectiveFvPatchField
template<class Type> template<class Type>
tmp<scalarField> advectiveFvPatchField<Type>::advectionSpeed() const tmp<scalarField> advectiveFvPatchField<Type>::advectionSpeed() const
{ {
const surfaceScalarField& phi = const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField>(phiName_); this->db().objectRegistry::lookupObject<surfaceScalarField>(phiName_);
fvsPatchField<scalar> phip = this->patch().lookupPatchField fvsPatchField<scalar> phip = this->patch().lookupPatchField
@ -210,7 +204,7 @@ void advectiveFvPatchField<Type>::updateCoeffs()
); );
scalar deltaT = this->db().time().deltaT().value(); scalar deltaT = this->db().time().deltaT().value();
const GeometricField<Type, fvPatchField, volMesh>& field = const GeometricField<Type, fvPatchField, volMesh>& field =
this->db().objectRegistry:: this->db().objectRegistry::
lookupObject<GeometricField<Type, fvPatchField, volMesh> > lookupObject<GeometricField<Type, fvPatchField, volMesh> >
( (
@ -239,7 +233,7 @@ void advectiveFvPatchField<Type>::updateCoeffs()
|| ddtScheme == fv::CrankNicholsonDdtScheme<scalar>::typeName || ddtScheme == fv::CrankNicholsonDdtScheme<scalar>::typeName
) )
{ {
this->refValue() = this->refValue() =
( (
field.oldTime().boundaryField()[patchi] + k*fieldInf_ field.oldTime().boundaryField()[patchi] + k*fieldInf_
)/(1.0 + k); )/(1.0 + k);
@ -314,9 +308,12 @@ template<class Type>
void advectiveFvPatchField<Type>::write(Ostream& os) const void advectiveFvPatchField<Type>::write(Ostream& os) const
{ {
fvPatchField<Type>::write(os); fvPatchField<Type>::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
if (rhoName_ != "Undefined") if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{ {
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
} }
@ -324,9 +321,9 @@ void advectiveFvPatchField<Type>::write(Ostream& os) const
if (lInf_ > SMALL) if (lInf_ > SMALL)
{ {
os.writeKeyword("fieldInf") << fieldInf_ os.writeKeyword("fieldInf") << fieldInf_
<< token::END_STATEMENT << endl; << token::END_STATEMENT << nl;
os.writeKeyword("lInf") << lInf_ os.writeKeyword("lInf") << lInf_
<< token::END_STATEMENT << endl; << token::END_STATEMENT << nl;
} }
this->writeEntry("value", os); this->writeEntry("value", os);

View File

@ -238,11 +238,11 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
const word& fieldName = dimensionedInternalField().name(); const word& fieldName = dimensionedInternalField().name();
const volVectorField& UField = db().lookupObject<volVectorField>(fieldName); const volVectorField& UField = db().lookupObject<volVectorField>(fieldName);
surfaceScalarField& phiField =
const_cast<surfaceScalarField&> surfaceScalarField& phiField = const_cast<surfaceScalarField&>
( (
db().lookupObject<surfaceScalarField>(phiName_) db().lookupObject<surfaceScalarField>(phiName_)
); );
switch (mpp.mode()) switch (mpp.mode())
{ {

View File

@ -52,11 +52,9 @@ void fanFvPatchField<scalar>::updateCoeffs()
if (f_.size() > 1) if (f_.size() > 1)
{ {
const surfaceScalarField& phi = db().lookupObject<surfaceScalarField> const surfaceScalarField& phi =
( db().lookupObject<surfaceScalarField>("phi");
"phi"
);
const fvsPatchField<scalar>& phip = const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi); patch().patchField<surfaceScalarField, scalar>(phi);

View File

@ -30,28 +30,23 @@ License
#include "surfaceFields.H" #include "surfaceFields.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedGradientFvPatchScalarField(p, iF), fixedGradientFvPatchScalarField(p, iF),
UName_("Undefined"), UName_("U"),
phiName_("Undefined"), phiName_("phi"),
rhoName_("Undefined"), rhoName_("rho"),
adjoint_(false) adjoint_(false)
{} {}
fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
( (
const fixedFluxPressureFvPatchScalarField& ptf, const fixedFluxPressureFvPatchScalarField& ptf,
const fvPatch& p, const fvPatch& p,
@ -67,7 +62,7 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
{} {}
fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF, const DimensionedField<scalar, volMesh>& iF,
@ -75,9 +70,9 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
) )
: :
fixedGradientFvPatchScalarField(p, iF), fixedGradientFvPatchScalarField(p, iF),
UName_(dict.lookup("U")), UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookup("phi")), phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookup("rho")), rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
adjoint_(dict.lookup("adjoint")) adjoint_(dict.lookup("adjoint"))
{ {
if (dict.found("gradient")) if (dict.found("gradient"))
@ -94,7 +89,7 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
} }
fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
( (
const fixedFluxPressureFvPatchScalarField& wbppsf const fixedFluxPressureFvPatchScalarField& wbppsf
) )
@ -107,7 +102,7 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
{} {}
fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
( (
const fixedFluxPressureFvPatchScalarField& wbppsf, const fixedFluxPressureFvPatchScalarField& wbppsf,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
@ -123,7 +118,7 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void fixedFluxPressureFvPatchScalarField::updateCoeffs() void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
{ {
if (updated()) if (updated())
{ {
@ -133,8 +128,9 @@ void fixedFluxPressureFvPatchScalarField::updateCoeffs()
const fvPatchField<vector>& Up = const fvPatchField<vector>& Up =
patch().lookupPatchField<volVectorField, vector>(UName_); patch().lookupPatchField<volVectorField, vector>(UName_);
const surfaceScalarField& phi = const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_); db().lookupObject<surfaceScalarField>(phiName_);
fvsPatchField<scalar> phip = fvsPatchField<scalar> phip =
patch().patchField<surfaceScalarField, scalar>(phi); patch().patchField<surfaceScalarField, scalar>(phi);
@ -162,12 +158,21 @@ void fixedFluxPressureFvPatchScalarField::updateCoeffs()
} }
void fixedFluxPressureFvPatchScalarField::write(Ostream& os) const void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; if (UName_ != "U")
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; {
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl; os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl;
gradient().writeEntry("gradient", os); gradient().writeEntry("gradient", os);
} }
@ -175,10 +180,13 @@ void fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, fixedFluxPressureFvPatchScalarField); namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // makePatchTypeField
(
} // End namespace Foam fvPatchScalarField,
fixedFluxPressureFvPatchScalarField
);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -75,19 +75,9 @@ flowRateInletVelocityFvPatchVectorField
: :
fixedValueFvPatchField<vector>(p, iF, dict), fixedValueFvPatchField<vector>(p, iF, dict),
flowRate_(readScalar(dict.lookup("flowRate"))), flowRate_(readScalar(dict.lookup("flowRate"))),
phiName_("phi"), phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_("rho") rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{ {}
if (dict.found("phi"))
{
dict.lookup("phi") >> phiName_;
}
if (dict.found("rho"))
{
dict.lookup("rho") >> rhoName_;
}
}
Foam:: Foam::
@ -133,10 +123,8 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
vectorField n = patch().nf(); vectorField n = patch().nf();
const surfaceScalarField& phi = db().lookupObject<surfaceScalarField> const surfaceScalarField& phi =
( db().lookupObject<surfaceScalarField>(phiName_);
phiName_
);
if (phi.dimensions() == dimVelocity*dimArea) if (phi.dimensions() == dimVelocity*dimArea)
{ {
@ -170,20 +158,15 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
void Foam::flowRateInletVelocityFvPatchVectorField::write(Ostream& os) const void Foam::flowRateInletVelocityFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchField<vector>::write(os); fvPatchField<vector>::write(os);
os.writeKeyword("flowRate") << flowRate_ << token::END_STATEMENT << nl;
os.writeKeyword("flowRate") << flowRate_
<< token::END_STATEMENT << nl;
if (phiName_ != "phi") if (phiName_ != "phi")
{ {
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
} }
if (rhoName_ != "rho") if (rhoName_ != "rho")
{ {
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
} }
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -32,12 +32,9 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
fluxCorrectedVelocityFvPatchVectorField:: Foam::fluxCorrectedVelocityFvPatchVectorField::
fluxCorrectedVelocityFvPatchVectorField fluxCorrectedVelocityFvPatchVectorField
( (
const fvPatch& p, const fvPatch& p,
@ -50,7 +47,7 @@ fluxCorrectedVelocityFvPatchVectorField
{} {}
fluxCorrectedVelocityFvPatchVectorField:: Foam::fluxCorrectedVelocityFvPatchVectorField::
fluxCorrectedVelocityFvPatchVectorField fluxCorrectedVelocityFvPatchVectorField
( (
const fluxCorrectedVelocityFvPatchVectorField& ptf, const fluxCorrectedVelocityFvPatchVectorField& ptf,
@ -65,7 +62,7 @@ fluxCorrectedVelocityFvPatchVectorField
{} {}
fluxCorrectedVelocityFvPatchVectorField:: Foam::fluxCorrectedVelocityFvPatchVectorField::
fluxCorrectedVelocityFvPatchVectorField fluxCorrectedVelocityFvPatchVectorField
( (
const fvPatch& p, const fvPatch& p,
@ -81,7 +78,7 @@ fluxCorrectedVelocityFvPatchVectorField
} }
fluxCorrectedVelocityFvPatchVectorField:: Foam::fluxCorrectedVelocityFvPatchVectorField::
fluxCorrectedVelocityFvPatchVectorField fluxCorrectedVelocityFvPatchVectorField
( (
const fluxCorrectedVelocityFvPatchVectorField& fcvpvf, const fluxCorrectedVelocityFvPatchVectorField& fcvpvf,
@ -96,7 +93,7 @@ fluxCorrectedVelocityFvPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void fluxCorrectedVelocityFvPatchVectorField::evaluate void Foam::fluxCorrectedVelocityFvPatchVectorField::evaluate
( (
const Pstream::commsTypes const Pstream::commsTypes
) )
@ -130,9 +127,12 @@ void fluxCorrectedVelocityFvPatchVectorField::evaluate
} }
else else
{ {
FatalErrorIn("fluxCorrectedVelocityFvPatchVectorField::evaluate()") FatalErrorIn
<< "dimensions of phi are not correct" (
<< "\n on patch " << this->patch().name() "fluxCorrectedVelocityFvPatchVectorField::evaluate()"
)
<< "dimensions of phi are incorrect\n"
<< " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError); << exit(FatalError);
@ -140,25 +140,30 @@ void fluxCorrectedVelocityFvPatchVectorField::evaluate
} }
void fluxCorrectedVelocityFvPatchVectorField::write(Ostream& os) const void Foam::fluxCorrectedVelocityFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; if (phiName_ != "phi")
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; {
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
writeEntry("value", os); writeEntry("value", os);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField namespace Foam
( {
fvPatchVectorField, makePatchTypeField
fluxCorrectedVelocityFvPatchVectorField (
); fvPatchVectorField,
fluxCorrectedVelocityFvPatchVectorField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // );
}
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -72,7 +72,7 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
) )
: :
mixedFvPatchField<Type>(p, iF), mixedFvPatchField<Type>(p, iF),
phiName_("phi") phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{ {
this->refValue() = Field<Type>("inletValue", dict, p.size()); this->refValue() = Field<Type>("inletValue", dict, p.size());
@ -90,11 +90,6 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
this->refGrad() = pTraits<Type>::zero; this->refGrad() = pTraits<Type>::zero;
this->valueFraction() = 0.0; this->valueFraction() = 0.0;
if (dict.found("phi"))
{
dict.lookup("phi") >> phiName_;
}
} }
@ -150,8 +145,7 @@ void inletOutletFvPatchField<Type>::write(Ostream& os) const
fvPatchField<Type>::write(os); fvPatchField<Type>::write(os);
if (phiName_ != "phi") if (phiName_ != "phi")
{ {
os.writeKeyword("phi") os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
<< phiName_ << token::END_STATEMENT << nl;
} }
this->refValue().writeEntry("inletValue", os); this->refValue().writeEntry("inletValue", os);
this->writeEntry("value", os); this->writeEntry("value", os);

View File

@ -32,12 +32,9 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inletOutletTotalTemperatureFvPatchScalarField:: Foam::inletOutletTotalTemperatureFvPatchScalarField::
inletOutletTotalTemperatureFvPatchScalarField inletOutletTotalTemperatureFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
@ -45,9 +42,9 @@ inletOutletTotalTemperatureFvPatchScalarField
) )
: :
mixedFvPatchScalarField(p, iF), mixedFvPatchScalarField(p, iF),
UName_(), UName_("U"),
phiName_(), phiName_("phi"),
psiName_(), psiName_("psi"),
gamma_(0.0), gamma_(0.0),
T0_(p.size(), 0.0) T0_(p.size(), 0.0)
{ {
@ -57,7 +54,7 @@ inletOutletTotalTemperatureFvPatchScalarField
} }
inletOutletTotalTemperatureFvPatchScalarField:: Foam::inletOutletTotalTemperatureFvPatchScalarField::
inletOutletTotalTemperatureFvPatchScalarField inletOutletTotalTemperatureFvPatchScalarField
( (
const inletOutletTotalTemperatureFvPatchScalarField& ptf, const inletOutletTotalTemperatureFvPatchScalarField& ptf,
@ -75,7 +72,7 @@ inletOutletTotalTemperatureFvPatchScalarField
{} {}
inletOutletTotalTemperatureFvPatchScalarField:: Foam::inletOutletTotalTemperatureFvPatchScalarField::
inletOutletTotalTemperatureFvPatchScalarField inletOutletTotalTemperatureFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
@ -84,9 +81,9 @@ inletOutletTotalTemperatureFvPatchScalarField
) )
: :
mixedFvPatchScalarField(p, iF), mixedFvPatchScalarField(p, iF),
UName_(dict.lookup("U")), UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookup("phi")), phiName_(dict.lookupOrDefault<word>("phi", "phi")),
psiName_(dict.lookup("psi")), psiName_(dict.lookupOrDefault<word>("psi", "psi")),
gamma_(readScalar(dict.lookup("gamma"))), gamma_(readScalar(dict.lookup("gamma"))),
T0_("T0", dict, p.size()) T0_("T0", dict, p.size())
{ {
@ -108,7 +105,7 @@ inletOutletTotalTemperatureFvPatchScalarField
} }
inletOutletTotalTemperatureFvPatchScalarField:: Foam::inletOutletTotalTemperatureFvPatchScalarField::
inletOutletTotalTemperatureFvPatchScalarField inletOutletTotalTemperatureFvPatchScalarField
( (
const inletOutletTotalTemperatureFvPatchScalarField& tppsf const inletOutletTotalTemperatureFvPatchScalarField& tppsf
@ -123,7 +120,7 @@ inletOutletTotalTemperatureFvPatchScalarField
{} {}
inletOutletTotalTemperatureFvPatchScalarField:: Foam::inletOutletTotalTemperatureFvPatchScalarField::
inletOutletTotalTemperatureFvPatchScalarField inletOutletTotalTemperatureFvPatchScalarField
( (
const inletOutletTotalTemperatureFvPatchScalarField& tppsf, const inletOutletTotalTemperatureFvPatchScalarField& tppsf,
@ -141,7 +138,7 @@ inletOutletTotalTemperatureFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void inletOutletTotalTemperatureFvPatchScalarField::autoMap void Foam::inletOutletTotalTemperatureFvPatchScalarField::autoMap
( (
const fvPatchFieldMapper& m const fvPatchFieldMapper& m
) )
@ -151,7 +148,7 @@ void inletOutletTotalTemperatureFvPatchScalarField::autoMap
} }
void inletOutletTotalTemperatureFvPatchScalarField::rmap void Foam::inletOutletTotalTemperatureFvPatchScalarField::rmap
( (
const fvPatchScalarField& ptf, const fvPatchScalarField& ptf,
const labelList& addr const labelList& addr
@ -166,7 +163,7 @@ void inletOutletTotalTemperatureFvPatchScalarField::rmap
} }
void inletOutletTotalTemperatureFvPatchScalarField::updateCoeffs() void Foam::inletOutletTotalTemperatureFvPatchScalarField::updateCoeffs()
{ {
if (updated()) if (updated())
{ {
@ -192,13 +189,22 @@ void inletOutletTotalTemperatureFvPatchScalarField::updateCoeffs()
} }
void inletOutletTotalTemperatureFvPatchScalarField::write(Ostream& os) const void Foam::inletOutletTotalTemperatureFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; if (UName_ != "U")
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; {
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << endl; }
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "psi")
{
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
T0_.writeEntry("T0", os); T0_.writeEntry("T0", os);
writeEntry("value", os); writeEntry("value", os);
} }
@ -206,14 +212,13 @@ void inletOutletTotalTemperatureFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField namespace Foam
( {
fvPatchScalarField, makePatchTypeField
inletOutletTotalTemperatureFvPatchScalarField (
); fvPatchScalarField,
inletOutletTotalTemperatureFvPatchScalarField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // );
}
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -128,10 +128,8 @@ void Foam::massFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
vectorField n = patch().nf(); vectorField n = patch().nf();
const surfaceScalarField& phi = db().lookupObject<surfaceScalarField> const surfaceScalarField& phi =
( db().lookupObject<surfaceScalarField>(phiName_);
phiName_
);
if (phi.dimensions() == dimVelocity*dimArea) if (phi.dimensions() == dimVelocity*dimArea)
{ {

View File

@ -115,7 +115,7 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs()
vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaT().value(); vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaT().value();
const volVectorField& U = db().lookupObject<volVectorField>("U"); const volVectorField& U = db().lookupObject<volVectorField>("U");
scalarField phip = scalarField phip =
p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U)); p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U));
vectorField n = p.nf(); vectorField n = p.nf();

View File

@ -196,8 +196,14 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField::
write(Ostream& os) const write(Ostream& os) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; if (phiName_ != "phi")
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; {
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
inletDir_.writeEntry("inletDirection", os); inletDir_.writeEntry("inletDirection", os);
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -184,8 +184,14 @@ void pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs()
void pressureDirectedInletVelocityFvPatchVectorField::write(Ostream& os) const void pressureDirectedInletVelocityFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; if (phiName_ != "phi")
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; {
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
inletDir_.writeEntry("inletDirection", os); inletDir_.writeEntry("inletDirection", os);
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -80,15 +80,10 @@ pressureInletOutletVelocityFvPatchVectorField
) )
: :
directionMixedFvPatchVectorField(p, iF), directionMixedFvPatchVectorField(p, iF),
phiName_("phi") phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{ {
fvPatchVectorField::operator=(vectorField("value", dict, p.size())); fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
if (dict.found("phi"))
{
dict.lookup("phi") >> phiName_;
}
if (dict.found("tangentialVelocity")) if (dict.found("tangentialVelocity"))
{ {
setTangentialVelocity setTangentialVelocity
@ -193,7 +188,10 @@ void pressureInletOutletVelocityFvPatchVectorField::updateCoeffs()
void pressureInletOutletVelocityFvPatchVectorField::write(Ostream& os) const void pressureInletOutletVelocityFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (tangentialVelocity_.size()) if (tangentialVelocity_.size())
{ {
tangentialVelocity_.writeEntry("tangentialVelocity", os); tangentialVelocity_.writeEntry("tangentialVelocity", os);

View File

@ -109,10 +109,8 @@ void pressureInletVelocityFvPatchVectorField::updateCoeffs()
return; return;
} }
const surfaceScalarField& phi = db().lookupObject<surfaceScalarField> const surfaceScalarField& phi =
( db().lookupObject<surfaceScalarField>(phiName_);
phiName_
);
const fvsPatchField<scalar>& phip = const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi); patch().patchField<surfaceScalarField, scalar>(phi);
@ -148,8 +146,14 @@ void pressureInletVelocityFvPatchVectorField::updateCoeffs()
void pressureInletVelocityFvPatchVectorField::write(Ostream& os) const void pressureInletVelocityFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; if (phiName_ != "phi")
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; {
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -123,7 +123,7 @@ void pressureNormalInletOutletVelocityFvPatchVectorField::updateCoeffs()
} }
const surfaceScalarField& phi = const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_); db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip = const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi); patch().patchField<surfaceScalarField, scalar>(phi);

View File

@ -198,10 +198,8 @@ void syringePressureFvPatchScalarField::updateCoeffs()
scalar t = db().time().value(); scalar t = db().time().value();
scalar deltaT = db().time().deltaT().value(); scalar deltaT = db().time().deltaT().value();
const surfaceScalarField& phi = db().lookupObject<surfaceScalarField> const surfaceScalarField& phi =
( db().lookupObject<surfaceScalarField>("phi");
"phi"
);
const fvsPatchField<scalar>& phip = const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi); patch().patchField<surfaceScalarField, scalar>(phi);

View File

@ -95,7 +95,7 @@ timeVaryingMappedFixedValueFvPatchField
{ {
if (debug) if (debug)
{ {
Pout<< "timeVarying<appedFixedValue" Pout<< "timeVaryingMappedFixedValue"
<< " : construct from mappedFixedValue and mapper" << endl; << " : construct from mappedFixedValue and mapper" << endl;
} }
} }

View File

@ -40,13 +40,13 @@ timeVaryingUniformTotalPressureFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(p, iF), fixedValueFvPatchScalarField(p, iF),
UName_("undefined"), UName_("U"),
phiName_("undefined"), phiName_("phi"),
rhoName_("undefined"), rhoName_("none"),
psiName_("undefined"), psiName_("none"),
gamma_(0.0), gamma_(0.0),
p0_(0.0), p0_(0.0),
totalPressureTimeSeries_() timeSeries_()
{} {}
@ -59,13 +59,13 @@ timeVaryingUniformTotalPressureFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(p, iF), fixedValueFvPatchScalarField(p, iF),
UName_(dict.lookup("U")), UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookup("phi")), phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookup("rho")), rhoName_(dict.lookupOrDefault<word>("rho", "none")),
psiName_(dict.lookup("psi")), psiName_(dict.lookupOrDefault<word>("psi", "none")),
gamma_(readScalar(dict.lookup("gamma"))), gamma_(readScalar(dict.lookup("gamma"))),
p0_(readScalar(dict.lookup("p0"))), p0_(readScalar(dict.lookup("p0"))),
totalPressureTimeSeries_(dict) timeSeries_(dict)
{ {
if (dict.found("value")) if (dict.found("value"))
{ {
@ -97,7 +97,7 @@ timeVaryingUniformTotalPressureFvPatchScalarField
psiName_(ptf.psiName_), psiName_(ptf.psiName_),
gamma_(ptf.gamma_), gamma_(ptf.gamma_),
p0_(ptf.p0_), p0_(ptf.p0_),
totalPressureTimeSeries_(ptf.totalPressureTimeSeries_) timeSeries_(ptf.timeSeries_)
{} {}
@ -114,7 +114,7 @@ timeVaryingUniformTotalPressureFvPatchScalarField
psiName_(tppsf.psiName_), psiName_(tppsf.psiName_),
gamma_(tppsf.gamma_), gamma_(tppsf.gamma_),
p0_(tppsf.p0_), p0_(tppsf.p0_),
totalPressureTimeSeries_(tppsf.totalPressureTimeSeries_) timeSeries_(tppsf.timeSeries_)
{} {}
@ -132,7 +132,7 @@ timeVaryingUniformTotalPressureFvPatchScalarField
psiName_(tppsf.psiName_), psiName_(tppsf.psiName_),
gamma_(tppsf.gamma_), gamma_(tppsf.gamma_),
p0_(tppsf.p0_), p0_(tppsf.p0_),
totalPressureTimeSeries_(tppsf.totalPressureTimeSeries_) timeSeries_(tppsf.timeSeries_)
{} {}
@ -148,7 +148,7 @@ void Foam::timeVaryingUniformTotalPressureFvPatchScalarField::updateCoeffs
return; return;
} }
p0_ = totalPressureTimeSeries_(this->db().time().timeOutputValue()); p0_ = timeSeries_(this->db().time().timeOutputValue());
const fvsPatchField<scalar>& phip = const fvsPatchField<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
@ -194,11 +194,11 @@ void Foam::timeVaryingUniformTotalPressureFvPatchScalarField::updateCoeffs
( (
"timeVaryingUniformTotalPressureFvPatchScalarField::updateCoeffs()" "timeVaryingUniformTotalPressureFvPatchScalarField::updateCoeffs()"
) << " rho or psi set inconsitently, rho = " << rhoName_ ) << " rho or psi set inconsitently, rho = " << rhoName_
<< ", psi = " << psiName_ << '.' << nl << ", psi = " << psiName_ << ".\n"
<< " Set either rho or psi or neither depending on the " << " Set either rho or psi or neither depending on the "
"definition of total pressure." << nl "definition of total pressure.\n"
<< " Set the unused variables to 'none'." << " Set the unused variables to 'none'.\n"
<< "\n on patch " << this->patch().name() << " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError); << exit(FatalError);
@ -218,13 +218,19 @@ void Foam::timeVaryingUniformTotalPressureFvPatchScalarField::
write(Ostream& os) const write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; if (UName_ != "U")
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; {
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
os.writeKeyword("p0") << p0_ << token::END_STATEMENT << endl; os.writeKeyword("p0") << p0_ << token::END_STATEMENT << nl;
totalPressureTimeSeries_.write(os); timeSeries_.write(os);
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -77,8 +77,8 @@ class timeVaryingUniformTotalPressureFvPatchScalarField
//- Total pressure //- Total pressure
scalar p0_; scalar p0_;
//- Table of time vs total pressure //- Table of time vs total pressure, including the bounding treatment
interpolationTable<scalar> totalPressureTimeSeries_; interpolationTable<scalar> timeSeries_;
public: public:
@ -192,7 +192,7 @@ public:
//- Return the time series used //- Return the time series used
const interpolationTable<scalar>& totalPressureTimeSeries() const const interpolationTable<scalar>& totalPressureTimeSeries() const
{ {
return totalPressureTimeSeries_; return timeSeries_;
} }

View File

@ -32,28 +32,25 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
totalPressureFvPatchScalarField::totalPressureFvPatchScalarField Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchScalarField(p, iF), fixedValueFvPatchScalarField(p, iF),
UName_("undefined"), UName_("U"),
phiName_("undefined"), phiName_("phi"),
rhoName_("undefined"), rhoName_("none"),
psiName_("undefined"), psiName_("none"),
gamma_(0.0), gamma_(0.0),
p0_(p.size(), 0.0) p0_(p.size(), 0.0)
{} {}
totalPressureFvPatchScalarField::totalPressureFvPatchScalarField Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF, const DimensionedField<scalar, volMesh>& iF,
@ -61,10 +58,10 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(p, iF), fixedValueFvPatchScalarField(p, iF),
UName_(dict.lookup("U")), UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookup("phi")), phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookup("rho")), rhoName_(dict.lookupOrDefault<word>("rho", "none")),
psiName_(dict.lookup("psi")), psiName_(dict.lookupOrDefault<word>("psi", "none")),
gamma_(readScalar(dict.lookup("gamma"))), gamma_(readScalar(dict.lookup("gamma"))),
p0_("p0", dict, p.size()) p0_("p0", dict, p.size())
{ {
@ -82,7 +79,7 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
} }
totalPressureFvPatchScalarField::totalPressureFvPatchScalarField Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
( (
const totalPressureFvPatchScalarField& ptf, const totalPressureFvPatchScalarField& ptf,
const fvPatch& p, const fvPatch& p,
@ -100,7 +97,7 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
{} {}
totalPressureFvPatchScalarField::totalPressureFvPatchScalarField Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
( (
const totalPressureFvPatchScalarField& tppsf const totalPressureFvPatchScalarField& tppsf
) )
@ -115,7 +112,7 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
{} {}
totalPressureFvPatchScalarField::totalPressureFvPatchScalarField Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
( (
const totalPressureFvPatchScalarField& tppsf, const totalPressureFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
@ -133,7 +130,7 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void totalPressureFvPatchScalarField::autoMap void Foam::totalPressureFvPatchScalarField::autoMap
( (
const fvPatchFieldMapper& m const fvPatchFieldMapper& m
) )
@ -143,7 +140,7 @@ void totalPressureFvPatchScalarField::autoMap
} }
void totalPressureFvPatchScalarField::rmap void Foam::totalPressureFvPatchScalarField::rmap
( (
const fvPatchScalarField& ptf, const fvPatchScalarField& ptf,
const labelList& addr const labelList& addr
@ -158,7 +155,7 @@ void totalPressureFvPatchScalarField::rmap
} }
void totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up) void Foam::totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up)
{ {
if (updated()) if (updated())
{ {
@ -208,12 +205,12 @@ void totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up)
FatalErrorIn FatalErrorIn
( (
"totalPressureFvPatchScalarField::updateCoeffs()" "totalPressureFvPatchScalarField::updateCoeffs()"
) << " rho or psi set inconsitently, rho = " << rhoName_ ) << " rho or psi set inconsistently, rho = " << rhoName_
<< ", psi = " << psiName_ << '.' << nl << ", psi = " << psiName_ << ".\n"
<< " Set either rho or psi or neither depending on the " << " Set either rho or psi or neither depending on the "
"definition of total pressure." << nl "definition of total pressure." << nl
<< " Set the unused variables to 'none'." << " Set the unused variable(s) to 'none'.\n"
<< "\n on patch " << this->patch().name() << " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError); << exit(FatalError);
@ -223,20 +220,26 @@ void totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up)
} }
void totalPressureFvPatchScalarField::updateCoeffs() void Foam::totalPressureFvPatchScalarField::updateCoeffs()
{ {
updateCoeffs(patch().lookupPatchField<volVectorField, vector>(UName_)); updateCoeffs(patch().lookupPatchField<volVectorField, vector>(UName_));
} }
void totalPressureFvPatchScalarField::write(Ostream& os) const void Foam::totalPressureFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; if (UName_ != "U")
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; {
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << endl; os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
p0_.writeEntry("p0", os); p0_.writeEntry("p0", os);
writeEntry("value", os); writeEntry("value", os);
} }
@ -244,10 +247,13 @@ void totalPressureFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, totalPressureFvPatchScalarField); namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // makePatchTypeField
(
} // End namespace Foam fvPatchScalarField,
totalPressureFvPatchScalarField
);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -32,27 +32,24 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchScalarField(p, iF), fixedValueFvPatchScalarField(p, iF),
UName_("Undefined"), UName_("U"),
phiName_("Undefined"), phiName_("phi"),
psiName_("Undefined"), psiName_("psi"),
gamma_(0.0), gamma_(0.0),
T0_(p.size(), 0.0) T0_(p.size(), 0.0)
{} {}
totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
( (
const totalTemperatureFvPatchScalarField& ptf, const totalTemperatureFvPatchScalarField& ptf,
const fvPatch& p, const fvPatch& p,
@ -69,7 +66,7 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
{} {}
totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF, const DimensionedField<scalar, volMesh>& iF,
@ -77,9 +74,9 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(p, iF), fixedValueFvPatchScalarField(p, iF),
UName_(dict.lookup("U")), UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookup("phi")), phiName_(dict.lookupOrDefault<word>("phi", "phi")),
psiName_(dict.lookup("psi")), psiName_(dict.lookupOrDefault<word>("psi", "psi")),
gamma_(readScalar(dict.lookup("gamma"))), gamma_(readScalar(dict.lookup("gamma"))),
T0_("T0", dict, p.size()) T0_("T0", dict, p.size())
{ {
@ -97,7 +94,7 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
} }
totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
( (
const totalTemperatureFvPatchScalarField& tppsf const totalTemperatureFvPatchScalarField& tppsf
) )
@ -111,7 +108,7 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
{} {}
totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
( (
const totalTemperatureFvPatchScalarField& tppsf, const totalTemperatureFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
@ -128,7 +125,7 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void totalTemperatureFvPatchScalarField::autoMap void Foam::totalTemperatureFvPatchScalarField::autoMap
( (
const fvPatchFieldMapper& m const fvPatchFieldMapper& m
) )
@ -138,7 +135,7 @@ void totalTemperatureFvPatchScalarField::autoMap
} }
void totalTemperatureFvPatchScalarField::rmap void Foam::totalTemperatureFvPatchScalarField::rmap
( (
const fvPatchScalarField& ptf, const fvPatchScalarField& ptf,
const labelList& addr const labelList& addr
@ -153,7 +150,7 @@ void totalTemperatureFvPatchScalarField::rmap
} }
void totalTemperatureFvPatchScalarField::updateCoeffs() void Foam::totalTemperatureFvPatchScalarField::updateCoeffs()
{ {
if (updated()) if (updated())
{ {
@ -180,13 +177,22 @@ void totalTemperatureFvPatchScalarField::updateCoeffs()
} }
void totalTemperatureFvPatchScalarField::write(Ostream& os) const void Foam::totalTemperatureFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; if (UName_ != "U")
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; {
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << endl; }
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "psi")
{
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
T0_.writeEntry("T0", os); T0_.writeEntry("T0", os);
writeEntry("value", os); writeEntry("value", os);
} }
@ -194,10 +200,13 @@ void totalTemperatureFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, totalTemperatureFvPatchScalarField); namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // makePatchTypeField
(
} // End namespace Foam fvPatchScalarField,
totalTemperatureFvPatchScalarField
);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -30,14 +30,9 @@ License
#include "surfaceFields.H" #include "surfaceFields.H"
#include "volFields.H" #include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
turbulentIntensityKineticEnergyInletFvPatchScalarField:: Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
turbulentIntensityKineticEnergyInletFvPatchScalarField turbulentIntensityKineticEnergyInletFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
@ -48,7 +43,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
intensity_(0.05) intensity_(0.05)
{} {}
turbulentIntensityKineticEnergyInletFvPatchScalarField:: Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
turbulentIntensityKineticEnergyInletFvPatchScalarField turbulentIntensityKineticEnergyInletFvPatchScalarField
( (
const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf, const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf,
@ -61,7 +56,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
intensity_(ptf.intensity_) intensity_(ptf.intensity_)
{} {}
turbulentIntensityKineticEnergyInletFvPatchScalarField:: Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
turbulentIntensityKineticEnergyInletFvPatchScalarField turbulentIntensityKineticEnergyInletFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
@ -90,7 +85,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
} }
} }
turbulentIntensityKineticEnergyInletFvPatchScalarField:: Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
turbulentIntensityKineticEnergyInletFvPatchScalarField turbulentIntensityKineticEnergyInletFvPatchScalarField
( (
const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf
@ -100,7 +95,8 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
intensity_(ptf.intensity_) intensity_(ptf.intensity_)
{} {}
turbulentIntensityKineticEnergyInletFvPatchScalarField::
Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
turbulentIntensityKineticEnergyInletFvPatchScalarField turbulentIntensityKineticEnergyInletFvPatchScalarField
( (
const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf, const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf,
@ -114,7 +110,8 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void turbulentIntensityKineticEnergyInletFvPatchScalarField::updateCoeffs() void Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
updateCoeffs()
{ {
if (updated()) if (updated())
{ {
@ -130,7 +127,7 @@ void turbulentIntensityKineticEnergyInletFvPatchScalarField::updateCoeffs()
} }
void turbulentIntensityKineticEnergyInletFvPatchScalarField::write void Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::write
( (
Ostream& os Ostream& os
) const ) const
@ -143,15 +140,13 @@ void turbulentIntensityKineticEnergyInletFvPatchScalarField::write
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField namespace Foam
( {
fvPatchScalarField, makePatchTypeField
turbulentIntensityKineticEnergyInletFvPatchScalarField (
); fvPatchScalarField,
turbulentIntensityKineticEnergyInletFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // }
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -47,7 +47,7 @@ waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
) )
: :
advectiveFvPatchField<Type>(p, iF), advectiveFvPatchField<Type>(p, iF),
psiName_("Undefined"), psiName_("psi"),
gamma_(0.0) gamma_(0.0)
{} {}
@ -76,7 +76,7 @@ waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
) )
: :
advectiveFvPatchField<Type>(p, iF, dict), advectiveFvPatchField<Type>(p, iF, dict),
psiName_(dict.lookup("psi")), psiName_(dict.lookupOrDefault<word>("psi", "psi")),
gamma_(readScalar(dict.lookup("gamma"))) gamma_(readScalar(dict.lookup("gamma")))
{} {}
@ -119,7 +119,7 @@ tmp<scalarField> waveTransmissiveFvPatchField<Type>::advectionSpeed() const
reinterpret_cast<const scalar*>(NULL) reinterpret_cast<const scalar*>(NULL)
); );
const surfaceScalarField& phi = const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField> this->db().objectRegistry::lookupObject<surfaceScalarField>
(this->phiName_); (this->phiName_);
@ -153,22 +153,27 @@ template<class Type>
void waveTransmissiveFvPatchField<Type>::write(Ostream& os) const void waveTransmissiveFvPatchField<Type>::write(Ostream& os) const
{ {
fvPatchField<Type>::write(os); fvPatchField<Type>::write(os);
os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl;
if (this->rhoName_ != "Undefined") if (this->phiName_ != "phi")
{
os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl;
}
if (this->rhoName_ != "rho")
{ {
os.writeKeyword("rho") << this->rhoName_ << token::END_STATEMENT << nl; os.writeKeyword("rho") << this->rhoName_ << token::END_STATEMENT << nl;
} }
if (psiName_ != "psi")
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; {
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << endl; os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
if (this->lInf_ > SMALL) if (this->lInf_ > SMALL)
{ {
os.writeKeyword("fieldInf") << this->fieldInf_ os.writeKeyword("fieldInf") << this->fieldInf_
<< token::END_STATEMENT << endl; << token::END_STATEMENT << nl;
os.writeKeyword("lInf") << this->lInf_ os.writeKeyword("lInf") << this->lInf_
<< token::END_STATEMENT << endl; << token::END_STATEMENT << nl;
} }
this->writeEntry("value", os); this->writeEntry("value", os);