diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C index 1e4f3ffcc5cc79cd6af1201c0748a38de3a55519..0ef1c8e35a4bcf691c0cb3fb1f700c187d3f40ff 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C @@ -84,7 +84,7 @@ activeBaffleVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(p, iF), - pName_("p"), + pName_(dict.lookupOrDefault<word>("p", "p")), cyclicPatchName_(dict.lookup("cyclicPatch")), cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)), orientation_(readLabel(dict.lookup("orientation"))), @@ -96,11 +96,6 @@ activeBaffleVelocityFvPatchVectorField curTimeIndex_(-1) { fvPatchVectorField::operator=(vector::zero); - - if (dict.found("p")) - { - dict.lookup("p") >> pName_; - } } @@ -219,15 +214,21 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs() } openFraction_ = - max(min( - openFraction_ - + max + max + ( + min ( - this->db().time().deltaTValue()/openingTime_, - maxOpenFractionDelta_ - ) - *(orientation_*sign(forceDiff)), - 1 - 1e-6), 1e-6); + openFraction_ + + max + ( + this->db().time().deltaTValue()/openingTime_, + maxOpenFractionDelta_ + ) + *(orientation_*sign(forceDiff)), + 1 - 1e-6 + ), + 1e-6 + ); Info<< "openFraction = " << openFraction_ << endl; @@ -264,8 +265,7 @@ void Foam::activeBaffleVelocityFvPatchVectorField::write(Ostream& os) const << maxOpenFractionDelta_ << token::END_STATEMENT << nl; os.writeKeyword("openFraction") << openFraction_ << token::END_STATEMENT << nl; - os.writeKeyword("p") - << pName_ << token::END_STATEMENT << nl; + writeEntryIfDifferent<word>(os, "p", "p", pName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C index 526ee9563942db8faa264ef3930a138e50f5c93f..0d1a344e0383acafcccb3c1dc3b9b5b14656cdad 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C @@ -46,7 +46,7 @@ directMappedVelocityFluxFixedValueFvPatchField ) : fixedValueFvPatchVectorField(p, iF), - phiName_("undefinedPhi") + phiName_("phi") {} @@ -93,22 +93,22 @@ directMappedVelocityFluxFixedValueFvPatchField ) : fixedValueFvPatchVectorField(p, iF, dict), - phiName_(dict.lookup("phi")) + phiName_(dict.lookupOrDefault<word>("phi", "phi")) { if (!isA<directMappedPatchBase>(this->patch().patch())) { FatalErrorIn ( "directMappedVelocityFluxFixedValueFvPatchField::" - "directMappedVelocityFluxFixedValueFvPatchField\n" - "(\n" - " const fvPatch& p,\n" - " const DimensionedField<vector, volMesh>& iF,\n" - " const dictionary& dict\n" - ")\n" - ) << "\n patch type '" << p.type() + "directMappedVelocityFluxFixedValueFvPatchField" + "(" + "const fvPatch&, " + "const DimensionedField<vector, volMesh>& iF, " + "const dictionary&" + ")" + ) << "patch type '" << p.type() << "' not type '" << directMappedPatchBase::typeName << "'" - << "\n for patch " << p.name() + << " for patch " << p.name() << " of field " << dimensionedInternalField().name() << " in file " << dimensionedInternalField().objectPath() << exit(FatalError); @@ -274,7 +274,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs() void directMappedVelocityFluxFixedValueFvPatchField::write(Ostream& os) const { fvPatchVectorField::write(os); - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; + writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C index 8c20f2922c8edb6cbcd6658dffb5d9335bfd62ad..ac55d86ee2cf4984c14da59b2305a0390fa16dc3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C @@ -161,18 +161,9 @@ void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs() void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); - 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; - } + writeEntryIfDifferent<word>(os, "U", "U", UName_); + writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); + writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl; gradient().writeEntry("gradient", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C index 0f01c960b00ee684bfa99b2b51eb0fb2e2c0aa16..a89929e42800b03f90e2c51f75467b5ca07da03c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C @@ -45,7 +45,7 @@ fixedPressureCompressibleDensityFvPatchScalarField ) : fixedValueFvPatchField<scalar>(p, iF), - pName_("pNameIsUndefined") + pName_("p") {} @@ -72,7 +72,7 @@ fixedPressureCompressibleDensityFvPatchScalarField ) : fixedValueFvPatchField<scalar>(p, iF, dict), - pName_(dict.lookup("p")) + pName_(dict.lookupOrDefault<word>("p", "p")) {} @@ -134,7 +134,7 @@ void fixedPressureCompressibleDensityFvPatchScalarField::write ) const { fvPatchField<scalar>::write(os); - os.writeKeyword("p") << pName_ << token::END_STATEMENT << nl; + writeEntryIfDifferent<word>(os, "p", "p", pName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C index 7de0e1f9d8da4647fcda74c9eb66910e6e5e2115..675762c7387d78a2929416407aa39ce22f79d380 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C @@ -143,14 +143,8 @@ void Foam::fluxCorrectedVelocityFvPatchVectorField::evaluate void Foam::fluxCorrectedVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } - if (rhoName_ != "rho") - { - os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); + writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C index d6a83b07cbd6e53f16793b3b6e62fd55e5aa2315..1d9141aa10a64f5bb9b10079972869429d87ec2f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C @@ -30,8 +30,6 @@ License #include "volFields.H" #include "surfaceFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::inletOutletTotalTemperatureFvPatchScalarField:: @@ -193,18 +191,9 @@ void Foam::inletOutletTotalTemperatureFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); - 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; - } + writeEntryIfDifferent<word>(os, "U", "U", UName_); + writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); + writeEntryIfDifferent<word>(os, "psi", "psi", psiName_); os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; T0_.writeEntry("T0", os); writeEntry("value", os); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C index 9c24dae9ccf1137da9bba5f629f3148e752aaafc..ebffe092db3f4486b40b1a574efccf4770bc381d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C @@ -43,7 +43,8 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField const DimensionedField<vector, volMesh>& iF ) : - fixedValueFvPatchVectorField(p, iF) + fixedValueFvPatchVectorField(p, iF), + UName_("U") {} @@ -55,7 +56,8 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField const fvPatchFieldMapper& mapper ) : - fixedValueFvPatchVectorField(ptf, p, iF, mapper) + fixedValueFvPatchVectorField(ptf, p, iF, mapper), + UName_(ptf.UName_) {} @@ -66,7 +68,8 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField const dictionary& dict ) : - fixedValueFvPatchVectorField(p, iF) + fixedValueFvPatchVectorField(p, iF), + UName_(dict.lookupOrDefault<word>("U", "U")) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); } @@ -74,20 +77,22 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField ( - const movingWallVelocityFvPatchVectorField& pivpvf + const movingWallVelocityFvPatchVectorField& mwvpvf ) : - fixedValueFvPatchVectorField(pivpvf) + fixedValueFvPatchVectorField(mwvpvf), + UName_(mwvpvf.UName_) {} movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField ( - const movingWallVelocityFvPatchVectorField& pivpvf, + const movingWallVelocityFvPatchVectorField& mwvpvf, const DimensionedField<vector, volMesh>& iF ) : - fixedValueFvPatchVectorField(pivpvf, iF) + fixedValueFvPatchVectorField(mwvpvf, iF), + UName_(mwvpvf.UName_) {} @@ -114,7 +119,7 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs() vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaTValue(); - const volVectorField& U = db().lookupObject<volVectorField>("U"); + const volVectorField& U = db().lookupObject<volVectorField>(UName_); scalarField phip = p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U)); @@ -132,6 +137,7 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs() void movingWallVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); + writeEntryIfDifferent<word>(os, "U", "U", UName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H index 11118714be55b34803f4397b7ce69128be3de6e0..ba76e373f3a506eb38ad3d7a61a110fcb6236be4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H @@ -52,6 +52,11 @@ class movingWallVelocityFvPatchVectorField : public fixedValueFvPatchVectorField { + // Private data + + //- Name of velocity field + word UName_; + public: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C index 49923ea891a7a8c8f88e1021afaf005838716b1f..432a8f0c51eba0ec4e416c37571b81898d5b737d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C @@ -196,14 +196,8 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField:: write(Ostream& os) const { fvPatchVectorField::write(os); - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } - if (rhoName_ != "rho") - { - os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); + writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); 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 287bb5b4b0c1aac0d5c788a8c88e684ee1b6d43e..af47c957884acd5ba6cae16b699b57176f96de88 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C @@ -184,14 +184,8 @@ void pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs() void pressureDirectedInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } - if (rhoName_ != "rho") - { - os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); + writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); 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 9b78fe83f8ba4b299248eaf7aa495d6e11603cf1..c4cd883748eb5b28db1fec6811a6bbfeb5281238 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C @@ -188,10 +188,7 @@ void pressureInletOutletVelocityFvPatchVectorField::updateCoeffs() void pressureInletOutletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); 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 d6bcbf8e8d0e6e02f865f72c98662bd5c77afe7b..2c0775523b8647253573bf606d336cb767fa3863 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C @@ -146,14 +146,8 @@ void pressureInletVelocityFvPatchVectorField::updateCoeffs() void pressureInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } - if (rhoName_ != "rho") - { - os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); + writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.C index 1ee28c88a3af1547e5b51a5737608b8ed6c56883..ef5a22a6bf620500341a507077e74e2c3fa8bf3f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.C @@ -218,14 +218,8 @@ void Foam::timeVaryingUniformTotalPressureFvPatchScalarField:: write(Ostream& os) const { fvPatchScalarField::write(os); - if (UName_ != "U") - { - os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; - } - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent<word>(os, "U", "U", UName_); + writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C index 402ed3325f53ff1a03c6522a602b16082ddb884e..7554aa281d6ab95378b58f3a6bd7b8b868defc3a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C @@ -30,8 +30,6 @@ License #include "volFields.H" #include "surfaceFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField @@ -180,18 +178,9 @@ void Foam::totalTemperatureFvPatchScalarField::updateCoeffs() void Foam::totalTemperatureFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); - if (UName_ != "U") - { - os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; - } - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } - if (psiName_ != "psi") - { - os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; - } + writeEntryIfDifferent<word>(os, "U", "U", UName_); + writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); + writeEntryIfDifferent<word>(os, "psi", "psi", psiName_); os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; T0_.writeEntry("T0", os); writeEntry("value", os); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C index c81934c111cc704fd9e32bd20d87b7eb622d3325..3aa3fccdae35dca262d2f16029c3419e1c056f5d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C @@ -40,6 +40,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField ) : fixedValueFvPatchField<scalar>(p, iF), + UName_("U"), intensity_(0.05) {} @@ -53,6 +54,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField ) : fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), + UName_(ptf.UName_), intensity_(ptf.intensity_) {} @@ -65,6 +67,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField ) : fixedValueFvPatchField<scalar>(p, iF, dict), + UName_(dict.lookupOrDefault<word>("U", "U")), intensity_(readScalar(dict.lookup("intensity"))) { if (intensity_ < 0 || intensity_ > 1) @@ -92,6 +95,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField ) : fixedValueFvPatchField<scalar>(ptf), + UName_(ptf.UName_), intensity_(ptf.intensity_) {} @@ -104,6 +108,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField ) : fixedValueFvPatchField<scalar>(ptf, iF), + UName_(ptf.UName_), intensity_(ptf.intensity_) {} @@ -119,7 +124,7 @@ updateCoeffs() } const fvPatchField<vector>& Up = - patch().lookupPatchField<volVectorField, vector>("U"); + patch().lookupPatchField<volVectorField, vector>(UName_); operator==(1.5*sqr(intensity_)*magSqr(Up)); @@ -133,6 +138,7 @@ void Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::write ) const { fvPatchField<scalar>::write(os); + writeEntryIfDifferent<word>(os, "U", "U", UName_); os.writeKeyword("intensity") << intensity_ << token::END_STATEMENT << nl; writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.H index 6b4dfdb1833e54e73fff44bbb8f0223632337b44..894f2b45208e5372c1b2055da8b9ed203f918645 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.H @@ -34,6 +34,7 @@ Description inlet { type turbulentIntensityKineticEnergyInlet; + U U; // Name of U field (optional) intensity 0.05; // 5% turbulence value uniform 1; // placeholder } @@ -64,6 +65,9 @@ class turbulentIntensityKineticEnergyInletFvPatchScalarField { // Private data + //- Name of belocity field + word UName_; + //- Turbulent intensity as fraction of mean velocity scalar intensity_;