diff --git a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C index 84d78fcd83..c661cca69a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C @@ -47,8 +47,8 @@ advectiveFvPatchField::advectiveFvPatchField ) : mixedFvPatchField(p, iF), - phiName_("Undefined"), - rhoName_("Undefined"), + phiName_("phi"), + rhoName_("rho"), fieldInf_(pTraits::zero), lInf_(0.0) { @@ -84,8 +84,8 @@ advectiveFvPatchField::advectiveFvPatchField ) : mixedFvPatchField(p, iF), - phiName_(dict.lookup("phi")), - rhoName_("Undefined"), + phiName_(dict.lookupOrDefault("phi", "phi")), + rhoName_(dict.lookupOrDefault("rho", "rho")), fieldInf_(pTraits::zero), lInf_(0.0) { @@ -105,15 +105,9 @@ advectiveFvPatchField::advectiveFvPatchField this->refGrad() = pTraits::zero; this->valueFraction() = 0.0; - if (dict.found("rho")) - { - dict.lookup("rho") >> rhoName_; - } - - if (dict.found("lInf")) + if (dict.readIfPresent("lInf", lInf_)) { dict.lookup("fieldInf") >> fieldInf_; - dict.lookup("lInf") >> lInf_; if (lInf_ < 0.0) { @@ -123,8 +117,8 @@ advectiveFvPatchField::advectiveFvPatchField "advectiveFvPatchField" "(const fvPatch&, const Field&, const dictionary&)", dict - ) << "unphysical lInf_ specified (lInf_ < 0)" - << "\n on patch " << this->patch().name() + ) << "unphysical lInf specified (lInf < 0)\n" + << " on patch " << this->patch().name() << " of field " << this->dimensionedInternalField().name() << " in file " << this->dimensionedInternalField().objectPath() << exit(FatalIOError); @@ -167,7 +161,7 @@ advectiveFvPatchField::advectiveFvPatchField template tmp advectiveFvPatchField::advectionSpeed() const { - const surfaceScalarField& phi = + const surfaceScalarField& phi = this->db().objectRegistry::lookupObject(phiName_); fvsPatchField phip = this->patch().lookupPatchField @@ -210,7 +204,7 @@ void advectiveFvPatchField::updateCoeffs() ); scalar deltaT = this->db().time().deltaT().value(); - const GeometricField& field = + const GeometricField& field = this->db().objectRegistry:: lookupObject > ( @@ -239,7 +233,7 @@ void advectiveFvPatchField::updateCoeffs() || ddtScheme == fv::CrankNicholsonDdtScheme::typeName ) { - this->refValue() = + this->refValue() = ( field.oldTime().boundaryField()[patchi] + k*fieldInf_ )/(1.0 + k); @@ -314,9 +308,12 @@ template void advectiveFvPatchField::write(Ostream& os) const { fvPatchField::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; } @@ -324,9 +321,9 @@ void advectiveFvPatchField::write(Ostream& os) const if (lInf_ > SMALL) { os.writeKeyword("fieldInf") << fieldInf_ - << token::END_STATEMENT << endl; + << token::END_STATEMENT << nl; os.writeKeyword("lInf") << lInf_ - << token::END_STATEMENT << endl; + << token::END_STATEMENT << nl; } this->writeEntry("value", os); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C index e77e698533..8e7a8b92fa 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C @@ -238,11 +238,11 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs() const word& fieldName = dimensionedInternalField().name(); const volVectorField& UField = db().lookupObject(fieldName); - surfaceScalarField& phiField = - const_cast - ( - db().lookupObject(phiName_) - ); + + surfaceScalarField& phiField = const_cast + ( + db().lookupObject(phiName_) + ); switch (mpp.mode()) { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C index b02db5c7dd..33eec56864 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C @@ -52,11 +52,9 @@ void fanFvPatchField::updateCoeffs() if (f_.size() > 1) { - const surfaceScalarField& phi = db().lookupObject - ( - "phi" - ); - + const surfaceScalarField& phi = + db().lookupObject("phi"); + const fvsPatchField& phip = patch().patchField(phi); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C index 7f24742db0..8b7ba7ddf1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C @@ -30,28 +30,23 @@ License #include "surfaceFields.H" #include "addToRunTimeSelectionTable.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField +Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF ) : fixedGradientFvPatchScalarField(p, iF), - UName_("Undefined"), - phiName_("Undefined"), - rhoName_("Undefined"), + UName_("U"), + phiName_("phi"), + rhoName_("rho"), adjoint_(false) {} -fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField +Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField ( const fixedFluxPressureFvPatchScalarField& ptf, const fvPatch& p, @@ -67,7 +62,7 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField {} -fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField +Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF, @@ -75,9 +70,9 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField ) : fixedGradientFvPatchScalarField(p, iF), - UName_(dict.lookup("U")), - phiName_(dict.lookup("phi")), - rhoName_(dict.lookup("rho")), + UName_(dict.lookupOrDefault("U", "U")), + phiName_(dict.lookupOrDefault("phi", "phi")), + rhoName_(dict.lookupOrDefault("rho", "rho")), adjoint_(dict.lookup("adjoint")) { if (dict.found("gradient")) @@ -94,7 +89,7 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField } -fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField +Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField ( const fixedFluxPressureFvPatchScalarField& wbppsf ) @@ -107,7 +102,7 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField {} -fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField +Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField ( const fixedFluxPressureFvPatchScalarField& wbppsf, const DimensionedField& iF @@ -123,7 +118,7 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void fixedFluxPressureFvPatchScalarField::updateCoeffs() +void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs() { if (updated()) { @@ -133,8 +128,9 @@ void fixedFluxPressureFvPatchScalarField::updateCoeffs() const fvPatchField& Up = patch().lookupPatchField(UName_); - const surfaceScalarField& phi = + const surfaceScalarField& phi = db().lookupObject(phiName_); + fvsPatchField phip = patch().patchField(phi); @@ -162,12 +158,21 @@ void fixedFluxPressureFvPatchScalarField::updateCoeffs() } -void fixedFluxPressureFvPatchScalarField::write(Ostream& os) const +void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); - os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; + if (UName_ != "U") + { + 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; gradient().writeEntry("gradient", os); } @@ -175,10 +180,13 @@ void fixedFluxPressureFvPatchScalarField::write(Ostream& os) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeField(fvPatchScalarField, fixedFluxPressureFvPatchScalarField); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + fixedFluxPressureFvPatchScalarField + ); +} // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C index 2d2f6f204c..1df1c91969 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C @@ -75,19 +75,9 @@ flowRateInletVelocityFvPatchVectorField : fixedValueFvPatchField(p, iF, dict), flowRate_(readScalar(dict.lookup("flowRate"))), - phiName_("phi"), - rhoName_("rho") -{ - if (dict.found("phi")) - { - dict.lookup("phi") >> phiName_; - } - - if (dict.found("rho")) - { - dict.lookup("rho") >> rhoName_; - } -} + phiName_(dict.lookupOrDefault("phi", "phi")), + rhoName_(dict.lookupOrDefault("rho", "rho")) +{} Foam:: @@ -133,10 +123,8 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs() vectorField n = patch().nf(); - const surfaceScalarField& phi = db().lookupObject - ( - phiName_ - ); + const surfaceScalarField& phi = + db().lookupObject(phiName_); if (phi.dimensions() == dimVelocity*dimArea) { @@ -170,20 +158,15 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs() void Foam::flowRateInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchField::write(os); - - os.writeKeyword("flowRate") << flowRate_ - << token::END_STATEMENT << nl; - + os.writeKeyword("flowRate") << flowRate_ << 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; } - writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C index 7082962d9f..2a858f4fa1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C @@ -32,12 +32,9 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -fluxCorrectedVelocityFvPatchVectorField:: +Foam::fluxCorrectedVelocityFvPatchVectorField:: fluxCorrectedVelocityFvPatchVectorField ( const fvPatch& p, @@ -50,7 +47,7 @@ fluxCorrectedVelocityFvPatchVectorField {} -fluxCorrectedVelocityFvPatchVectorField:: +Foam::fluxCorrectedVelocityFvPatchVectorField:: fluxCorrectedVelocityFvPatchVectorField ( const fluxCorrectedVelocityFvPatchVectorField& ptf, @@ -65,7 +62,7 @@ fluxCorrectedVelocityFvPatchVectorField {} -fluxCorrectedVelocityFvPatchVectorField:: +Foam::fluxCorrectedVelocityFvPatchVectorField:: fluxCorrectedVelocityFvPatchVectorField ( const fvPatch& p, @@ -81,7 +78,7 @@ fluxCorrectedVelocityFvPatchVectorField } -fluxCorrectedVelocityFvPatchVectorField:: +Foam::fluxCorrectedVelocityFvPatchVectorField:: fluxCorrectedVelocityFvPatchVectorField ( const fluxCorrectedVelocityFvPatchVectorField& fcvpvf, @@ -96,7 +93,7 @@ fluxCorrectedVelocityFvPatchVectorField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void fluxCorrectedVelocityFvPatchVectorField::evaluate +void Foam::fluxCorrectedVelocityFvPatchVectorField::evaluate ( const Pstream::commsTypes ) @@ -130,9 +127,12 @@ void fluxCorrectedVelocityFvPatchVectorField::evaluate } else { - FatalErrorIn("fluxCorrectedVelocityFvPatchVectorField::evaluate()") - << "dimensions of phi are not correct" - << "\n on patch " << this->patch().name() + FatalErrorIn + ( + "fluxCorrectedVelocityFvPatchVectorField::evaluate()" + ) + << "dimensions of phi are incorrect\n" + << " on patch " << this->patch().name() << " of field " << this->dimensionedInternalField().name() << " in file " << this->dimensionedInternalField().objectPath() << 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); - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - os.writeKeyword("rho") << rhoName_ << 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; + } writeEntry("value", os); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeField -( - fvPatchVectorField, - fluxCorrectedVelocityFvPatchVectorField -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + fluxCorrectedVelocityFvPatchVectorField + ); +} // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C index c41d207724..8031001a57 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C @@ -72,7 +72,7 @@ inletOutletFvPatchField::inletOutletFvPatchField ) : mixedFvPatchField(p, iF), - phiName_("phi") + phiName_(dict.lookupOrDefault("phi", "phi")) { this->refValue() = Field("inletValue", dict, p.size()); @@ -90,11 +90,6 @@ inletOutletFvPatchField::inletOutletFvPatchField this->refGrad() = pTraits::zero; this->valueFraction() = 0.0; - - if (dict.found("phi")) - { - dict.lookup("phi") >> phiName_; - } } @@ -150,8 +145,7 @@ void inletOutletFvPatchField::write(Ostream& os) const fvPatchField::write(os); if (phiName_ != "phi") { - os.writeKeyword("phi") - << phiName_ << token::END_STATEMENT << nl; + os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; } this->refValue().writeEntry("inletValue", os); this->writeEntry("value", os); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C index 0a2dff4a4c..255f3b4117 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C @@ -32,12 +32,9 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -inletOutletTotalTemperatureFvPatchScalarField:: +Foam::inletOutletTotalTemperatureFvPatchScalarField:: inletOutletTotalTemperatureFvPatchScalarField ( const fvPatch& p, @@ -45,9 +42,9 @@ inletOutletTotalTemperatureFvPatchScalarField ) : mixedFvPatchScalarField(p, iF), - UName_(), - phiName_(), - psiName_(), + UName_("U"), + phiName_("phi"), + psiName_("psi"), gamma_(0.0), T0_(p.size(), 0.0) { @@ -57,7 +54,7 @@ inletOutletTotalTemperatureFvPatchScalarField } -inletOutletTotalTemperatureFvPatchScalarField:: +Foam::inletOutletTotalTemperatureFvPatchScalarField:: inletOutletTotalTemperatureFvPatchScalarField ( const inletOutletTotalTemperatureFvPatchScalarField& ptf, @@ -75,7 +72,7 @@ inletOutletTotalTemperatureFvPatchScalarField {} -inletOutletTotalTemperatureFvPatchScalarField:: +Foam::inletOutletTotalTemperatureFvPatchScalarField:: inletOutletTotalTemperatureFvPatchScalarField ( const fvPatch& p, @@ -84,9 +81,9 @@ inletOutletTotalTemperatureFvPatchScalarField ) : mixedFvPatchScalarField(p, iF), - UName_(dict.lookup("U")), - phiName_(dict.lookup("phi")), - psiName_(dict.lookup("psi")), + UName_(dict.lookupOrDefault("U", "U")), + phiName_(dict.lookupOrDefault("phi", "phi")), + psiName_(dict.lookupOrDefault("psi", "psi")), gamma_(readScalar(dict.lookup("gamma"))), T0_("T0", dict, p.size()) { @@ -108,7 +105,7 @@ inletOutletTotalTemperatureFvPatchScalarField } -inletOutletTotalTemperatureFvPatchScalarField:: +Foam::inletOutletTotalTemperatureFvPatchScalarField:: inletOutletTotalTemperatureFvPatchScalarField ( const inletOutletTotalTemperatureFvPatchScalarField& tppsf @@ -123,7 +120,7 @@ inletOutletTotalTemperatureFvPatchScalarField {} -inletOutletTotalTemperatureFvPatchScalarField:: +Foam::inletOutletTotalTemperatureFvPatchScalarField:: inletOutletTotalTemperatureFvPatchScalarField ( const inletOutletTotalTemperatureFvPatchScalarField& tppsf, @@ -141,7 +138,7 @@ inletOutletTotalTemperatureFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void inletOutletTotalTemperatureFvPatchScalarField::autoMap +void Foam::inletOutletTotalTemperatureFvPatchScalarField::autoMap ( const fvPatchFieldMapper& m ) @@ -151,7 +148,7 @@ void inletOutletTotalTemperatureFvPatchScalarField::autoMap } -void inletOutletTotalTemperatureFvPatchScalarField::rmap +void Foam::inletOutletTotalTemperatureFvPatchScalarField::rmap ( const fvPatchScalarField& ptf, const labelList& addr @@ -166,7 +163,7 @@ void inletOutletTotalTemperatureFvPatchScalarField::rmap } -void inletOutletTotalTemperatureFvPatchScalarField::updateCoeffs() +void Foam::inletOutletTotalTemperatureFvPatchScalarField::updateCoeffs() { 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); - os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; - os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << endl; + if (UName_ != "U") + { + os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; + } + 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); writeEntry("value", os); } @@ -206,14 +212,13 @@ void inletOutletTotalTemperatureFvPatchScalarField::write(Ostream& os) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeField -( - fvPatchScalarField, - inletOutletTotalTemperatureFvPatchScalarField -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + inletOutletTotalTemperatureFvPatchScalarField + ); +} // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/massFlowRateInletVelocity/massFlowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/massFlowRateInletVelocity/massFlowRateInletVelocityFvPatchVectorField.C index 99e07855ae..e950d87663 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/massFlowRateInletVelocity/massFlowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/massFlowRateInletVelocity/massFlowRateInletVelocityFvPatchVectorField.C @@ -128,10 +128,8 @@ void Foam::massFlowRateInletVelocityFvPatchVectorField::updateCoeffs() vectorField n = patch().nf(); - const surfaceScalarField& phi = db().lookupObject - ( - phiName_ - ); + const surfaceScalarField& phi = + db().lookupObject(phiName_); if (phi.dimensions() == dimVelocity*dimArea) { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C index 08c795f90b..1284b361aa 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C @@ -115,7 +115,7 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs() vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaT().value(); const volVectorField& U = db().lookupObject("U"); - scalarField phip = + scalarField phip = p.patchField(fvc::meshPhi(U)); vectorField n = p.nf(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C index afbccbd03a..6784821e78 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C @@ -196,8 +196,14 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField:: write(Ostream& os) const { fvPatchVectorField::write(os); - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - os.writeKeyword("rho") << rhoName_ << 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; + } inletDir_.writeEntry("inletDirection", os); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C index fa9b68f545..4a0930f65d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C @@ -184,8 +184,14 @@ void pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs() void pressureDirectedInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - os.writeKeyword("rho") << rhoName_ << 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; + } inletDir_.writeEntry("inletDirection", os); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C index fb80ec7db4..529ed22363 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C @@ -80,15 +80,10 @@ pressureInletOutletVelocityFvPatchVectorField ) : directionMixedFvPatchVectorField(p, iF), - phiName_("phi") + phiName_(dict.lookupOrDefault("phi", "phi")) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); - if (dict.found("phi")) - { - dict.lookup("phi") >> phiName_; - } - if (dict.found("tangentialVelocity")) { setTangentialVelocity @@ -193,7 +188,10 @@ void pressureInletOutletVelocityFvPatchVectorField::updateCoeffs() void pressureInletOutletVelocityFvPatchVectorField::write(Ostream& os) const { 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()) { tangentialVelocity_.writeEntry("tangentialVelocity", os); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C index 75242aabb5..8c4ee51e27 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C @@ -109,10 +109,8 @@ void pressureInletVelocityFvPatchVectorField::updateCoeffs() return; } - const surfaceScalarField& phi = db().lookupObject - ( - phiName_ - ); + const surfaceScalarField& phi = + db().lookupObject(phiName_); const fvsPatchField& phip = patch().patchField(phi); @@ -148,8 +146,14 @@ void pressureInletVelocityFvPatchVectorField::updateCoeffs() void pressureInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - os.writeKeyword("rho") << rhoName_ << 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; + } writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C index 30b7b12ff7..9704a65ca9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C @@ -123,7 +123,7 @@ void pressureNormalInletOutletVelocityFvPatchVectorField::updateCoeffs() } const surfaceScalarField& phi = - db().lookupObject(phiName_); + db().lookupObject(phiName_); const fvsPatchField& phip = patch().patchField(phi); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/syringePressure/syringePressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/syringePressure/syringePressureFvPatchScalarField.C index fee0fa2bf2..51f5c01834 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/syringePressure/syringePressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/syringePressure/syringePressureFvPatchScalarField.C @@ -198,10 +198,8 @@ void syringePressureFvPatchScalarField::updateCoeffs() scalar t = db().time().value(); scalar deltaT = db().time().deltaT().value(); - const surfaceScalarField& phi = db().lookupObject - ( - "phi" - ); + const surfaceScalarField& phi = + db().lookupObject("phi"); const fvsPatchField& phip = patch().patchField(phi); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index d78f497e84..91473124c0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -95,7 +95,7 @@ timeVaryingMappedFixedValueFvPatchField { if (debug) { - Pout<< "timeVarying("U", "U")), + phiName_(dict.lookupOrDefault("phi", "phi")), + rhoName_(dict.lookupOrDefault("rho", "none")), + psiName_(dict.lookupOrDefault("psi", "none")), gamma_(readScalar(dict.lookup("gamma"))), p0_(readScalar(dict.lookup("p0"))), - totalPressureTimeSeries_(dict) + timeSeries_(dict) { if (dict.found("value")) { @@ -97,7 +97,7 @@ timeVaryingUniformTotalPressureFvPatchScalarField psiName_(ptf.psiName_), gamma_(ptf.gamma_), p0_(ptf.p0_), - totalPressureTimeSeries_(ptf.totalPressureTimeSeries_) + timeSeries_(ptf.timeSeries_) {} @@ -114,7 +114,7 @@ timeVaryingUniformTotalPressureFvPatchScalarField psiName_(tppsf.psiName_), gamma_(tppsf.gamma_), p0_(tppsf.p0_), - totalPressureTimeSeries_(tppsf.totalPressureTimeSeries_) + timeSeries_(tppsf.timeSeries_) {} @@ -132,7 +132,7 @@ timeVaryingUniformTotalPressureFvPatchScalarField psiName_(tppsf.psiName_), gamma_(tppsf.gamma_), p0_(tppsf.p0_), - totalPressureTimeSeries_(tppsf.totalPressureTimeSeries_) + timeSeries_(tppsf.timeSeries_) {} @@ -148,7 +148,7 @@ void Foam::timeVaryingUniformTotalPressureFvPatchScalarField::updateCoeffs return; } - p0_ = totalPressureTimeSeries_(this->db().time().timeOutputValue()); + p0_ = timeSeries_(this->db().time().timeOutputValue()); const fvsPatchField& phip = patch().lookupPatchField(phiName_); @@ -194,11 +194,11 @@ void Foam::timeVaryingUniformTotalPressureFvPatchScalarField::updateCoeffs ( "timeVaryingUniformTotalPressureFvPatchScalarField::updateCoeffs()" ) << " rho or psi set inconsitently, rho = " << rhoName_ - << ", psi = " << psiName_ << '.' << nl + << ", psi = " << psiName_ << ".\n" << " Set either rho or psi or neither depending on the " - "definition of total pressure." << nl - << " Set the unused variables to 'none'." - << "\n on patch " << this->patch().name() + "definition of total pressure.\n" + << " Set the unused variables to 'none'.\n" + << " on patch " << this->patch().name() << " of field " << this->dimensionedInternalField().name() << " in file " << this->dimensionedInternalField().objectPath() << exit(FatalError); @@ -218,13 +218,19 @@ void Foam::timeVaryingUniformTotalPressureFvPatchScalarField:: write(Ostream& os) const { fvPatchScalarField::write(os); - os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; + if (UName_ != "U") + { + 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("psi") << psiName_ << token::END_STATEMENT << nl; os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; - os.writeKeyword("p0") << p0_ << token::END_STATEMENT << endl; - totalPressureTimeSeries_.write(os); + os.writeKeyword("p0") << p0_ << token::END_STATEMENT << nl; + timeSeries_.write(os); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.H index 8d02bcefeb..b7e65eee3d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.H @@ -77,8 +77,8 @@ class timeVaryingUniformTotalPressureFvPatchScalarField //- Total pressure scalar p0_; - //- Table of time vs total pressure - interpolationTable totalPressureTimeSeries_; + //- Table of time vs total pressure, including the bounding treatment + interpolationTable timeSeries_; public: @@ -192,7 +192,7 @@ public: //- Return the time series used const interpolationTable& totalPressureTimeSeries() const { - return totalPressureTimeSeries_; + return timeSeries_; } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C index 881ebdad50..be3f8125b5 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C @@ -32,28 +32,25 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -totalPressureFvPatchScalarField::totalPressureFvPatchScalarField +Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF ) : fixedValueFvPatchScalarField(p, iF), - UName_("undefined"), - phiName_("undefined"), - rhoName_("undefined"), - psiName_("undefined"), + UName_("U"), + phiName_("phi"), + rhoName_("none"), + psiName_("none"), gamma_(0.0), p0_(p.size(), 0.0) {} -totalPressureFvPatchScalarField::totalPressureFvPatchScalarField +Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF, @@ -61,10 +58,10 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField ) : fixedValueFvPatchScalarField(p, iF), - UName_(dict.lookup("U")), - phiName_(dict.lookup("phi")), - rhoName_(dict.lookup("rho")), - psiName_(dict.lookup("psi")), + UName_(dict.lookupOrDefault("U", "U")), + phiName_(dict.lookupOrDefault("phi", "phi")), + rhoName_(dict.lookupOrDefault("rho", "none")), + psiName_(dict.lookupOrDefault("psi", "none")), gamma_(readScalar(dict.lookup("gamma"))), p0_("p0", dict, p.size()) { @@ -82,7 +79,7 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField } -totalPressureFvPatchScalarField::totalPressureFvPatchScalarField +Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField ( const totalPressureFvPatchScalarField& ptf, const fvPatch& p, @@ -100,7 +97,7 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField {} -totalPressureFvPatchScalarField::totalPressureFvPatchScalarField +Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField ( const totalPressureFvPatchScalarField& tppsf ) @@ -115,7 +112,7 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField {} -totalPressureFvPatchScalarField::totalPressureFvPatchScalarField +Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField ( const totalPressureFvPatchScalarField& tppsf, const DimensionedField& iF @@ -133,7 +130,7 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void totalPressureFvPatchScalarField::autoMap +void Foam::totalPressureFvPatchScalarField::autoMap ( const fvPatchFieldMapper& m ) @@ -143,7 +140,7 @@ void totalPressureFvPatchScalarField::autoMap } -void totalPressureFvPatchScalarField::rmap +void Foam::totalPressureFvPatchScalarField::rmap ( const fvPatchScalarField& ptf, 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()) { @@ -208,12 +205,12 @@ void totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up) FatalErrorIn ( "totalPressureFvPatchScalarField::updateCoeffs()" - ) << " rho or psi set inconsitently, rho = " << rhoName_ - << ", psi = " << psiName_ << '.' << nl + ) << " rho or psi set inconsistently, rho = " << rhoName_ + << ", psi = " << psiName_ << ".\n" << " Set either rho or psi or neither depending on the " "definition of total pressure." << nl - << " Set the unused variables to 'none'." - << "\n on patch " << this->patch().name() + << " Set the unused variable(s) to 'none'.\n" + << " on patch " << this->patch().name() << " of field " << this->dimensionedInternalField().name() << " in file " << this->dimensionedInternalField().objectPath() << exit(FatalError); @@ -223,20 +220,26 @@ void totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up) } -void totalPressureFvPatchScalarField::updateCoeffs() +void Foam::totalPressureFvPatchScalarField::updateCoeffs() { updateCoeffs(patch().lookupPatchField(UName_)); } -void totalPressureFvPatchScalarField::write(Ostream& os) const +void Foam::totalPressureFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); - os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; + if (UName_ != "U") + { + 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("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); writeEntry("value", os); } @@ -244,10 +247,13 @@ void totalPressureFvPatchScalarField::write(Ostream& os) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeField(fvPatchScalarField, totalPressureFvPatchScalarField); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + totalPressureFvPatchScalarField + ); +} // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C index afa6a9dc49..d0b4137644 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C @@ -32,27 +32,24 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField +Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF ) : fixedValueFvPatchScalarField(p, iF), - UName_("Undefined"), - phiName_("Undefined"), - psiName_("Undefined"), + UName_("U"), + phiName_("phi"), + psiName_("psi"), gamma_(0.0), T0_(p.size(), 0.0) {} -totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField +Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField ( const totalTemperatureFvPatchScalarField& ptf, const fvPatch& p, @@ -69,7 +66,7 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField {} -totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField +Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF, @@ -77,9 +74,9 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField ) : fixedValueFvPatchScalarField(p, iF), - UName_(dict.lookup("U")), - phiName_(dict.lookup("phi")), - psiName_(dict.lookup("psi")), + UName_(dict.lookupOrDefault("U", "U")), + phiName_(dict.lookupOrDefault("phi", "phi")), + psiName_(dict.lookupOrDefault("psi", "psi")), gamma_(readScalar(dict.lookup("gamma"))), T0_("T0", dict, p.size()) { @@ -97,7 +94,7 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField } -totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField +Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField ( const totalTemperatureFvPatchScalarField& tppsf ) @@ -111,7 +108,7 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField {} -totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField +Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField ( const totalTemperatureFvPatchScalarField& tppsf, const DimensionedField& iF @@ -128,7 +125,7 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void totalTemperatureFvPatchScalarField::autoMap +void Foam::totalTemperatureFvPatchScalarField::autoMap ( const fvPatchFieldMapper& m ) @@ -138,7 +135,7 @@ void totalTemperatureFvPatchScalarField::autoMap } -void totalTemperatureFvPatchScalarField::rmap +void Foam::totalTemperatureFvPatchScalarField::rmap ( const fvPatchScalarField& ptf, const labelList& addr @@ -153,7 +150,7 @@ void totalTemperatureFvPatchScalarField::rmap } -void totalTemperatureFvPatchScalarField::updateCoeffs() +void Foam::totalTemperatureFvPatchScalarField::updateCoeffs() { 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); - os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; - os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << endl; + if (UName_ != "U") + { + os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; + } + 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); writeEntry("value", os); } @@ -194,10 +200,13 @@ void totalTemperatureFvPatchScalarField::write(Ostream& os) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeField(fvPatchScalarField, totalTemperatureFvPatchScalarField); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + totalTemperatureFvPatchScalarField + ); +} // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C index 540a938f7d..b08c9a23f8 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C @@ -30,14 +30,9 @@ License #include "surfaceFields.H" #include "volFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -turbulentIntensityKineticEnergyInletFvPatchScalarField:: +Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField:: turbulentIntensityKineticEnergyInletFvPatchScalarField ( const fvPatch& p, @@ -48,7 +43,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField intensity_(0.05) {} -turbulentIntensityKineticEnergyInletFvPatchScalarField:: +Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField:: turbulentIntensityKineticEnergyInletFvPatchScalarField ( const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf, @@ -61,7 +56,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField intensity_(ptf.intensity_) {} -turbulentIntensityKineticEnergyInletFvPatchScalarField:: +Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField:: turbulentIntensityKineticEnergyInletFvPatchScalarField ( const fvPatch& p, @@ -90,7 +85,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField } } -turbulentIntensityKineticEnergyInletFvPatchScalarField:: +Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField:: turbulentIntensityKineticEnergyInletFvPatchScalarField ( const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf @@ -100,7 +95,8 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField intensity_(ptf.intensity_) {} -turbulentIntensityKineticEnergyInletFvPatchScalarField:: + +Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField:: turbulentIntensityKineticEnergyInletFvPatchScalarField ( const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf, @@ -114,7 +110,8 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void turbulentIntensityKineticEnergyInletFvPatchScalarField::updateCoeffs() +void Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField:: +updateCoeffs() { if (updated()) { @@ -130,7 +127,7 @@ void turbulentIntensityKineticEnergyInletFvPatchScalarField::updateCoeffs() } -void turbulentIntensityKineticEnergyInletFvPatchScalarField::write +void Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::write ( Ostream& os ) const @@ -143,15 +140,13 @@ void turbulentIntensityKineticEnergyInletFvPatchScalarField::write // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeField -( - fvPatchScalarField, - turbulentIntensityKineticEnergyInletFvPatchScalarField -); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + turbulentIntensityKineticEnergyInletFvPatchScalarField + ); +} // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C index eb255068b1..acff82ef2f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C @@ -47,7 +47,7 @@ waveTransmissiveFvPatchField::waveTransmissiveFvPatchField ) : advectiveFvPatchField(p, iF), - psiName_("Undefined"), + psiName_("psi"), gamma_(0.0) {} @@ -76,7 +76,7 @@ waveTransmissiveFvPatchField::waveTransmissiveFvPatchField ) : advectiveFvPatchField(p, iF, dict), - psiName_(dict.lookup("psi")), + psiName_(dict.lookupOrDefault("psi", "psi")), gamma_(readScalar(dict.lookup("gamma"))) {} @@ -119,7 +119,7 @@ tmp waveTransmissiveFvPatchField::advectionSpeed() const reinterpret_cast(NULL) ); - const surfaceScalarField& phi = + const surfaceScalarField& phi = this->db().objectRegistry::lookupObject (this->phiName_); @@ -153,22 +153,27 @@ template void waveTransmissiveFvPatchField::write(Ostream& os) const { fvPatchField::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("psi") << psiName_ << token::END_STATEMENT << nl; - os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << endl; + if (psiName_ != "psi") + { + os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; + } + os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; if (this->lInf_ > SMALL) { os.writeKeyword("fieldInf") << this->fieldInf_ - << token::END_STATEMENT << endl; - os.writeKeyword("lInf") << this->lInf_ - << token::END_STATEMENT << endl; + << token::END_STATEMENT << nl; + os.writeKeyword("lInf") << this->lInf_ + << token::END_STATEMENT << nl; } this->writeEntry("value", os);