diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C index 0defd8cd73aac8e0df719ccc82d13e1c35086d7b..b289adb034604b84b08d59c888c2baa6fbefe7d4 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C @@ -188,6 +188,9 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField if (!this->readValueEntry(dict)) { + // Ensure field has reasonable initial values + this->extrapolateInternal(); + // Evaluate to assign a value this->evaluate(Pstream::commsTypes::blocking); } diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H index c398dc61313a6345f06c6a0235cbd44058de78d4..438acf74ce304932e93cfaf058a8a9663629b4d7 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H @@ -31,6 +31,9 @@ Description Constructs on-the-fly a new boundary condition (derived from fixedValuePointPatchField) which is then used to evaluate. + The \c value entry (optional) is used for the initial values. + Otherwise the code is executed. + The code entries: \plaintable codeInclude | include files diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchFields.C b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchFields.C index 486d38dc8efe6fcaa64259d68a60bb0a79fa528c..4b5b841ecd09c33f5f4670df0d6222d3b0b19dc0 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchFields.C +++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchFields.C @@ -25,21 +25,17 @@ License \*---------------------------------------------------------------------------*/ -#include "codedFixedValuePointPatchFields.H" -#include "pointPatchFields.H" +#include "codedFixedValuePointPatchField.H" #include "addToRunTimeSelectionTable.H" +#include "fieldTypes.H" +#include "pointPatchFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makePointPatchFields(codedFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam + makePointPatchFieldTypedefs(codedFixedValue); + makePointPatchFields(codedFixedValue); +} // ************************************************************************* // diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchFields.H b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchFields.H deleted file mode 100644 index 01eb26d7311e6915fb6e084ce444152a0477a063..0000000000000000000000000000000000000000 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchFields.H +++ /dev/null @@ -1,51 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2012 OpenFOAM Foundation -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#ifndef codedFixedValuePointPatchFields_H -#define codedFixedValuePointPatchFields_H - -#include "codedFixedValuePointPatchField.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePointPatchFieldTypedefs(codedFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValuePointPatchFields.C b/src/OpenFOAM/fields/pointPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValuePointPatchFields.C index eb0a7174294472db3f581df4a0c565b109fac8ad..d00560a32c56677abffd1fed1ee35478346ec692 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValuePointPatchFields.C +++ b/src/OpenFOAM/fields/pointPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValuePointPatchFields.C @@ -25,21 +25,16 @@ License \*---------------------------------------------------------------------------*/ -#include "timeVaryingUniformFixedValuePointPatchFields.H" -#include "pointPatchFields.H" +#include "timeVaryingUniformFixedValuePointPatchField.H" #include "addToRunTimeSelectionTable.H" +#include "pointPatchFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makePointPatchFields(timeVaryingUniformFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam + makePointPatchFieldTypedefs(timeVaryingUniformFixedValue); + makePointPatchFields(timeVaryingUniformFixedValue); +} // ************************************************************************* // diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValuePointPatchFields.H b/src/OpenFOAM/fields/pointPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValuePointPatchFields.H deleted file mode 100644 index 0a853e19edb49a3c295d0ae0cd1d3acdf8a697e2..0000000000000000000000000000000000000000 --- a/src/OpenFOAM/fields/pointPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValuePointPatchFields.H +++ /dev/null @@ -1,59 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011 OpenFOAM Foundation -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -InClass - Foam::timeVaryingUniformFixedValuePointPatchFields - -Description - -SourceFiles - timeVaryingUniformFixedValuePointPatchFields.C - -\*---------------------------------------------------------------------------*/ - -#ifndef timeVaryingUniformFixedValuePointPatchFields_H -#define timeVaryingUniformFixedValuePointPatchFields_H - -#include "timeVaryingUniformFixedValuePointPatchField.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePointPatchFieldTypedefs(timeVaryingUniformFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C index da6fc26d91b1bf055ba487610b81de461e731452..6ab7e77e16754ac4c35e8577cbd2f2518e51e5ee 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C @@ -56,7 +56,7 @@ Foam::fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField fixedValueFvPatchVectorField(p, iF, dict, IOobjectOption::NO_READ), tau0_(dict.getOrDefault<vector>("tau", Zero)) { - fvPatchField<vector>::patchInternalField(*this); + this->extrapolateInternal(); // Zero-gradient patch values } diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index b4175b385bc1b0f2652f95647c4c652e5e0ee831..61c67a8726d4832a31e80d1ec8c8fce00b22a697 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -366,7 +366,7 @@ epsilonWallFunctionFvPatchScalarField cornerWeights_() { // Apply zero-gradient condition on start-up - fvPatchField<scalar>::patchInternalField(*this); + this->extrapolateInternal(); } diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index ec53d93776fb5db298b9c3cd4b3cbf08ada4f740..7339e1bd883d08a92aae07e44e19202034d4461f 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -358,8 +358,8 @@ Foam::omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField omega_(), cornerWeights_() { - // apply zero-gradient condition on start-up - fvPatchField<scalar>::patchInternalField(*this); + // Apply zero-gradient condition on start-up + this->extrapolateInternal(); } diff --git a/src/dynamicFaMesh/interfaceTrackingFvMesh/fvPatchFields/freeSurfaceVelocity/freeSurfaceVelocityFvPatchVectorField.C b/src/dynamicFaMesh/interfaceTrackingFvMesh/fvPatchFields/freeSurfaceVelocity/freeSurfaceVelocityFvPatchVectorField.C index 2091fb1a566e9f2f82393b7d66a54479ac250788..64a3d3136ac670d8b7d16de7880ab15cd5b17ce0 100644 --- a/src/dynamicFaMesh/interfaceTrackingFvMesh/fvPatchFields/freeSurfaceVelocity/freeSurfaceVelocityFvPatchVectorField.C +++ b/src/dynamicFaMesh/interfaceTrackingFvMesh/fvPatchFields/freeSurfaceVelocity/freeSurfaceVelocityFvPatchVectorField.C @@ -70,7 +70,8 @@ freeSurfaceVelocityFvPatchVectorField fixedGradientFvPatchVectorField(p, iF) { fvPatchFieldBase::readDict(dict); - fvPatchField<vector>::patchInternalField(*this); + // Apply zero-gradient condition on start-up + this->extrapolateInternal(); } diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.C b/src/dynamicMesh/motionSolvers/displacement/solidBody/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.C index e2c2ce7f8eeb862ab89f7d0d63e1c73a2edc0556..b2a84771c64ecdef83f746bb0803180314e545d1 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.C +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.C @@ -59,7 +59,7 @@ solidBodyMotionDisplacementPointPatchVectorField const dictionary& dict ) : - fixedValuePointPatchVectorField(p, iF, dict, false), + fixedValuePointPatchVectorField(p, iF, dict, IOobjectOption::NO_READ), SBMFPtr_(solidBodyMotionFunction::New(dict, this->db().time())), localPoints0Ptr_(nullptr) { diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C index fe31f3761ca014c2deb191a2920354263053cce1..429fccf4f04f4dde4337380d2ed831a247fcf1fa 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C @@ -120,7 +120,7 @@ Foam::processorFaPatchField<Type>::processorFaPatchField // Use 'value' supplied, or set to internal field if (!this->readValueEntry(dict)) { - faPatchField<Type>::patchInternalField(*this); + this->extrapolateInternal(); // Zero-gradient patch values } } diff --git a/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.C index f7bf73b38409f1cb2a004021069075b54a624a69..41f9a88f196868bbac897f43d1313b32f66dfb32 100644 --- a/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.C @@ -58,8 +58,7 @@ clampedPlateFaPatchField<Type>::clampedPlateFaPatchField : faPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ) { - // Set to the internal field - faPatchField<Type>::patchInternalField(*this); + this->extrapolateInternal(); // Zero-gradient patch values } diff --git a/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchField.C index cf626198f4739de7fac8693989142005f9a43349..9e485dae5e3930c4110b0ddb64c3e0c6ccd0730c 100644 --- a/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchField.C @@ -74,14 +74,13 @@ Foam::inletOutletFaPatchField<Type>::inletOutletFaPatchField { // Require inletValue (MUST_READ) this->refValue().assign("inletValue", dict, p.size()); + this->refGrad() = Zero; + this->valueFraction() = 0; if (!this->readValueEntry(dict)) { - faPatchField<Type>::operator=(this->refValue()); + faPatchField<Type>::extrapolateInternal(); } - - this->refGrad() = Zero; - this->valueFraction() = 0.0; } diff --git a/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchField.H b/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchField.H index 85e2c34108c72cb1fe478b017d8271808d11db5d..88abbde9c844168c870eba4cd02156171dc24621 100644 --- a/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchField.H @@ -39,6 +39,7 @@ Usage Property | Description | Required | Default value phi | Flux field name | no | phi inletValue | Inlet value for reverse flow | yes | + value | initial field value | optional | \endtable Example of the boundary condition specification: @@ -55,7 +56,6 @@ Usage The mode of operation is determined by the sign of the flux across the patch edges. - Note Sign conventions: - Positive flux (out of domain): apply zero-gradient condition diff --git a/src/finiteArea/fields/faPatchFields/derived/outletInlet/outletInletFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/outletInlet/outletInletFaPatchField.C index be919d76fb05f45740ec61b886be6919c03461ef..8702efcc85f14c457c618098b6f77525c9c83fa9 100644 --- a/src/finiteArea/fields/faPatchFields/derived/outletInlet/outletInletFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/derived/outletInlet/outletInletFaPatchField.C @@ -41,7 +41,7 @@ Foam::outletInletFaPatchField<Type>::outletInletFaPatchField { this->refValue() = *this; this->refGrad() = Zero; - this->valueFraction() = 0.0; + this->valueFraction() = 0; } @@ -72,15 +72,15 @@ Foam::outletInletFaPatchField<Type>::outletInletFaPatchField { faPatchFieldBase::readDict(dict); + // Require outletValue (MUST_READ) this->refValue().assign("outletValue", dict, p.size()); + this->refGrad() = Zero; + this->valueFraction() = 0; if (!this->readValueEntry(dict)) { - faPatchField<Type>::operator=(this->refValue()); + faPatchField<Type>::extrapolateInternal(); } - - this->refGrad() = Zero; - this->valueFraction() = 0.0; } diff --git a/src/finiteArea/fields/faPatchFields/derived/outletInlet/outletInletFaPatchField.H b/src/finiteArea/fields/faPatchFields/derived/outletInlet/outletInletFaPatchField.H index 47ba41fba796bdd84f751bf65997701f40f1573a..3b9187c63bc6a85ff234171d0f6df59388497a81 100644 --- a/src/finiteArea/fields/faPatchFields/derived/outletInlet/outletInletFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/derived/outletInlet/outletInletFaPatchField.H @@ -38,6 +38,7 @@ Usage Property | Description | Required | Default value phi | Flux field name | no | phi outletValue | Outlet value for reverse flow | yes | + value | initial field value | optional | \endtable Example of the boundary condition specification: @@ -92,7 +93,7 @@ protected: // Protected Data - //- Name of flux field + //- Name of flux field (default: phi) word phiName_; diff --git a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.C index 3aeb93c44017e36ad5fe1bfe2a190dda3b27bcb7..2486bd621a3a79fda672a6cc43533e2de9d3e656 100644 --- a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.C @@ -58,6 +58,9 @@ timeVaryingUniformFixedValueFaPatchField { if (!this->readValueEntry(dict)) { + // Ensure field has reasonable initial values + this->extrapolateInternal(); + updateCoeffs(); } diff --git a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C index fa19e8c9d892ba5c9e6897e77be2bb484222e7de..b3894d4a8dddaf745e758246e42e1294ab6a30a6 100644 --- a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C +++ b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C @@ -26,21 +26,16 @@ License \*---------------------------------------------------------------------------*/ -#include "timeVaryingUniformFixedValueFaPatchFields.H" +#include "timeVaryingUniformFixedValueFaPatchField.H" #include "addToRunTimeSelectionTable.H" #include "areaFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makeFaPatchFields(timeVaryingUniformFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam + makeFaPatchTypeFieldTypedefs(timeVaryingUniformFixedValue); + makeFaPatchFields(timeVaryingUniformFixedValue); +} // ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.H b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.H deleted file mode 100644 index d99c594ba6cc42b307826e75601e8f71c02ff84c..0000000000000000000000000000000000000000 --- a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.H +++ /dev/null @@ -1,51 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2020 OpenCFD Ltd. -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#ifndef Foam_timeVaryingUniformFixedValueFaPatchFields_H -#define Foam_timeVaryingUniformFixedValueFaPatchFields_H - -#include "timeVaryingUniformFixedValueFaPatchField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makeFaPatchTypeFieldTypedefs(timeVaryingUniformFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchField.C index f74667880c15522bcf58086fa5436a1ac26bd460..650cdbef1afecc7056faaf3948bb77ec428fbd3f 100644 --- a/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchField.C @@ -73,7 +73,14 @@ Foam::uniformFixedGradientFaPatchField<Type>::uniformFixedGradientFaPatchField ) ) { - this->evaluate(); + if (!this->readValueEntry(dict)) + { + // Ensure field has reasonable initial values + this->extrapolateInternal(); + + // Evaluate to assign a value + this->evaluate(); + } } diff --git a/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchField.H b/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchField.H index 52e0f026b63304cb8af0115e9e05da48ca799d19..7340d59a201ce3b1524ae7b259a3f9210ff77541 100644 --- a/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchField.H @@ -36,6 +36,7 @@ Usage \table Property | Description | Required | Default uniformGradient | uniform gradient | yes | + value | initial field value | optional | \endtable Example of the boundary condition specification: @@ -51,6 +52,11 @@ Note The uniformGradient entry is a Function1 type. The example above gives the usage for supplying a constant value. + The \c value entry (optional) is used for the initial values. + Otherwise the \c uniformGradient is used for the evaluation. + In some cases (eg, coded or expression entries with references to other + fields) this can be problematic and the \c value entry will be needed. + See also Foam::Function1Types Foam::fixedGradientFaPatchField diff --git a/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchFields.C b/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchFields.C index 2e6a854e5ce3b1eefc27680c61ce4117bc72e41e..1e96ea89572f0e048ad90fa1fd44fa6b40183683 100644 --- a/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchFields.C +++ b/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchFields.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ -#include "uniformFixedGradientFaPatchFields.H" +#include "uniformFixedGradientFaPatchField.H" #include "addToRunTimeSelectionTable.H" #include "areaFields.H" #include "edgeFields.H" @@ -34,6 +34,7 @@ License namespace Foam { + makeFaPatchTypeFieldTypedefs(uniformFixedGradient); makeFaPatchFields(uniformFixedGradient); } diff --git a/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchFields.H b/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchFields.H deleted file mode 100644 index 7e7a2973d648f29d6a9583985af86f251df580e1..0000000000000000000000000000000000000000 --- a/src/finiteArea/fields/faPatchFields/derived/uniformFixedGradient/uniformFixedGradientFaPatchFields.H +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2023 OpenCFD Ltd. -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#ifndef Foam_uniformFixedGradientFaPatchFields_H -#define Foam_uniformFixedGradientFaPatchFields_H - -#include "uniformFixedGradientFaPatchField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makeFaPatchTypeFieldTypedefs(uniformFixedGradient); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchField.C index 804b049a5f52d4f61f87336e8da4f54da11bb3bf..b7cef206c5a3632409e96aca015ba016b1650372 100644 --- a/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchField.C @@ -75,6 +75,10 @@ Foam::uniformFixedValueFaPatchField<Type>::uniformFixedValueFaPatchField { if (!this->readValueEntry(dict)) { + // Ensure field has reasonable initial values + this->extrapolateInternal(); + + // Evaluate to assign a value this->evaluate(); } } diff --git a/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchField.H b/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchField.H index 77612197790e546a10dad5ddc5f849d779be79b2..4af170d7b80533075a3fdea3e8f5704cbee04c23 100644 --- a/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchField.H @@ -36,6 +36,7 @@ Usage \table Property | Description | Required | Default uniformValue | uniform value | yes | + value | initial field value | optional | \endtable Example of the boundary condition specification: @@ -52,6 +53,11 @@ Note able to describe time varying functions. The example above gives the usage for supplying a constant value. + The \c value entry (optional) is used for the initial values. + Otherwise the \c uniformValue is evaluated. + In some cases (eg, coded or expression entries with references to other + fields) this can be problematic and the \c value entry will be needed. + See also Foam::Function1Types Foam::fixedValueFaPatchField diff --git a/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchFields.C b/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchFields.C index 8bacac29afd1647911439900aabb389801c94fde..aa666b756c8abf11cfe2d37ec07bcdb065c514ec 100644 --- a/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchFields.C +++ b/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchFields.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ -#include "uniformFixedValueFaPatchFields.H" +#include "uniformFixedValueFaPatchField.H" #include "addToRunTimeSelectionTable.H" #include "areaFields.H" #include "edgeFields.H" @@ -34,6 +34,7 @@ License namespace Foam { + makeFaPatchTypeFieldTypedefs(uniformFixedValue); makeFaPatchFields(uniformFixedValue); } diff --git a/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchFields.H b/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchFields.H deleted file mode 100644 index a4cd5cf48f469d4bab5b9124885a3969a725b798..0000000000000000000000000000000000000000 --- a/src/finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchFields.H +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2023 OpenCFD Ltd. -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#ifndef Foam_uniformFixedValueFaPatchFields_H -#define Foam_uniformFixedValueFaPatchFields_H - -#include "uniformFixedValueFaPatchField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makeFaPatchTypeFieldTypedefs(uniformFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchField.C index cf9c1dd88d3a97a4c2d857bf5ec9d319f1cef056..8f29c0f425d72f74c50cf53349b55f5e2e922144 100644 --- a/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchField.C @@ -120,6 +120,10 @@ Foam::uniformMixedFaPatchField<Type>::uniformMixedFaPatchField // Use restart value if provided... if (!this->readValueEntry(dict)) { + // Ensure field has reasonable initial values + this->extrapolateInternal(); + + // Evaluate to assign a value this->evaluate(); } } @@ -240,7 +244,7 @@ void Foam::uniformMixedFaPatchField<Type>::write(Ostream& os) const valueFractionFunc_->writeData(os); } - // Eg, for visualisation + // For visualisation / restart faPatchField<Type>::writeValueEntry(os); } diff --git a/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchField.H b/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchField.H index bd2819f6f422d43a28f47f5ec812731d4cc59cdb..620a16dbad649fc9a826a99950e4ae03e8ef0e7b 100644 --- a/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchField.H @@ -41,6 +41,7 @@ Usage uniformValue | uniform value | partly | 0 uniformGradient | uniform gradient | partly | 0 uniformValueFraction | uniform valueFraction | partly | depends + value | initial field value | optional | \endtable Example of the boundary condition specification: @@ -67,6 +68,11 @@ Note If both \c uniformValue and \c uniformGradient are defined, the \c uniformValueFraction must also be defined. + The \c value entry (optional) is used for the initial values. + Otherwise the function(s) are used for the evaluation. + In some cases (eg, coded or expression entries with references to other + fields) this can be problematic and the \c value entry will be needed. + See also Foam::Function1Types Foam::mixedFaPatchField diff --git a/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchFields.C b/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchFields.C index d7f518c1a11f306f91658e48576e702fbab6cf47..17c8df4ff6773bb15edc324579fa34421898dae2 100644 --- a/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchFields.C +++ b/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchFields.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ -#include "uniformMixedFaPatchFields.H" +#include "uniformMixedFaPatchField.H" #include "addToRunTimeSelectionTable.H" #include "areaFields.H" #include "edgeFields.H" @@ -34,6 +34,7 @@ License namespace Foam { + makeFaPatchTypeFieldTypedefs(uniformMixed); makeFaPatchFields(uniformMixed); } diff --git a/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchFields.H b/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchFields.H deleted file mode 100644 index 4f91619e41d27e597f347783de5ea19fd4e4cdb8..0000000000000000000000000000000000000000 --- a/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchFields.H +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2023 OpenCFD Ltd. -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#ifndef Foam_uniformMixedFaPatchFields_H -#define Foam_uniformMixedFaPatchFields_H - -#include "uniformMixedFaPatchField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makeFaPatchTypeFieldTypedefs(uniformMixed); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.C b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.C index c3cf0df50c57a934fbf74948cd5ae75492201086..1616af6fbb813c5652bff7f6c3b844abbcffa2fb 100644 --- a/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.C +++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.C @@ -128,15 +128,10 @@ Foam::exprFixedValueFvPatchField<Type>::exprFixedValueFvPatchField // Since we bypassed dictionary constructor fvPatchFieldBase::readDict(dict); - const auto* hasValue = dict.findEntry("value", keyType::LITERAL); - - if (hasValue) - { - Field<Type>::assign(*hasValue, p.size()); - } - else + if (!this->readValueEntry(dict)) { - (*this) == this->patchInternalField(); + // Ensure field has reasonable initial values + this->extrapolateInternal(); #ifdef FULLDEBUG WarningInFunction diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.H b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.H index f922e6c6ac84837d7f67c20bd795583210acddb1..69395b5c62aaf15d0336de49002104331421e114 100644 --- a/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.H +++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.H @@ -32,11 +32,14 @@ Description Usage \table Property | Description | Required | Default - value | fixed value | yes | valueExpr | expression for uniformValue | yes | + value | initial field value | optional | \endtable Note + The \c value entry (optional) is used for the initial values. + Otherwise uses a zero-gradient condition for the initial value. + This boundary condition is deprecated in favour of Foam::uniformFixedValueFvPatchField with expression entries. diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.C b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.C index 80e4db62ba8ebefd2413fa4f6e15fd7000ece872..8907e0141caa6d6615d32ab4b80e765b825f42f2 100644 --- a/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.C +++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.C @@ -169,7 +169,6 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField // Since we bypassed dictionary constructor fvPatchFieldBase::readDict(dict); - const auto* hasValue = dict.findEntry("value", keyType::LITERAL); const auto* hasRefValue = dict.findEntry("refValue", keyType::LITERAL); const auto* hasRefGradient @@ -184,10 +183,8 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField this->refValue().assign(*hasRefValue, p.size()); } - if (hasValue) + if (this->readValueEntry(dict)) { - Field<Type>::assign(*hasValue, p.size()); - if (!hasRefValue) { // Ensure refValue has a sensible value for the "update" below diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.H b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.H index 437d0dc4c58fd5f980d05085f98a8980f5ddbad9..32bfa068db9b6f8c0ebe48b6e9e29ec20f9998d5 100644 --- a/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.H +++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.H @@ -35,9 +35,14 @@ Usage valueExpr | expression for uniformValue | partly | 0 gradientExpr | expression for uniformGradient | partly | 0 fractionExpr | expression for valueFraction | partly | depends + value | initial field value | optional | \endtable Note + The \c value entry (optional) is used for the initial values. + Otherwise uses some heuristics of other entries + (not properly documented now since this boundary condition is deprecated). + This boundary condition is deprecated in favour of Foam::uniformMixedFvPatchField, Foam::uniformFixedValueFvPatchField, diff --git a/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.C b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.C index 1fdce54c392660597bd6a60d3c604051d3668881..f3e64884e26be243047027655a2f4e47e6840e80 100644 --- a/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.C +++ b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.C @@ -115,6 +115,11 @@ Foam::exprValuePointPatchField<Type>::exprValuePointPatchField dict_ ) { + //FUTURE? + //DeprecatedInFunction(2212) + // << "Use uniformFixedValue with an expression Function1 instead." << nl + // << " This boundary condition will be removed in the future" << endl; + // Require valueExpr if (this->valueExpr_.empty()) { @@ -125,18 +130,10 @@ Foam::exprValuePointPatchField<Type>::exprValuePointPatchField driver_.readDict(dict_); - const auto* hasValue = dict.findEntry("value", keyType::LITERAL); - - if (hasValue) + if (!this->readValueEntry(dict)) { - Field<Type>::assign(*hasValue, p.size()); - } - else - { - // Note: valuePointPatchField defaults to Zero - // but internalField might be better - - Field<Type>::operator=(Zero); + // Ensure field has reasonable initial values + this->extrapolateInternal(); } if (this->evalOnConstruct_) diff --git a/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.H b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.H index 0c286e2028b94d2d2f2f460caf66f2ec1f994e83..fa328a54289769e366c19bc6fc0684cf3a912ea0 100644 --- a/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.H +++ b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.H @@ -32,10 +32,13 @@ Description Usage \table Property | Description | Required | Default - value | fixed value | yes | valueExpr | expression for uniformValue | yes | + value | initial field value | optional | \endtable + The \c value entry (optional) is used for the initial values. + Otherwise uses zero-gradient values. + SourceFiles exprValuePointPatchField.C diff --git a/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchFields.C b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchFields.C index e9cca570dd01603e881dfa283d9a1cefcc7c66ea..068e4272132a85b18644d559296d4289bc49b734 100644 --- a/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchFields.C +++ b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchFields.C @@ -25,21 +25,17 @@ License \*---------------------------------------------------------------------------*/ -#include "exprValuePointPatchFields.H" -#include "pointPatchFields.H" +#include "exprValuePointPatchField.H" #include "addToRunTimeSelectionTable.H" +#include "fieldTypes.H" +#include "pointPatchFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makePointPatchFields(exprValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam + makePointPatchFieldTypedefs(exprValue); + makePointPatchFields(exprValue); +} // ************************************************************************* // diff --git a/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchFields.H b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchFields.H deleted file mode 100644 index b0035fcac80d18a491fbef43037df5849c3d439d..0000000000000000000000000000000000000000 --- a/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchFields.H +++ /dev/null @@ -1,51 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#ifndef exprValuePointPatchFields_H -#define exprValuePointPatchFields_H - -#include "exprValuePointPatchField.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePointPatchFieldTypedefs(exprValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C index e2ba9698b8d8d74ef095ea9ffb165fd92c5e1710..ae2ed8a07a3cabed0e658923bf0d4078f06b21a5 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C @@ -77,7 +77,7 @@ Foam::cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField } else { - fvPatchField<Type>::patchInternalField(*this); + this->extrapolateInternal(); // Zero-gradient patch values } } } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C index 19da597026a1e7dd645813c953e5dd04715115a2..a4c1e57ea735ef100f17465d418d6e1550d47daf 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C @@ -89,7 +89,7 @@ Foam::processorFvPatchField<Type>::processorFvPatchField // Use 'value' supplied, or set to internal field if (!this->readValueEntry(dict)) { - fvPatchField<Type>::patchInternalField(*this); + this->extrapolateInternal(); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C index 47285e9e8fa8348e4f049786d21b0194aad01786..250b46a0eace0db06f83dc41d58662dfe18cece6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C @@ -91,12 +91,12 @@ Foam::advectiveFvPatchField<Type>::advectiveFvPatchField // Use 'value' supplied, or set to internal field if (!this->readValueEntry(dict)) { - fvPatchField<Type>::patchInternalField(*this); + this->extrapolateInternal(); // Zero-gradient patch values } this->refValue() = *this; this->refGrad() = Zero; - this->valueFraction() = 0.0; + this->valueFraction() = 0; if (dict.readIfPresent("lInf", lInf_)) { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C index 1eb67876572e6a6282ab374b3c882d80e54539b8..fad36642e65b46b2b8240c393106b03feff2d0d0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C @@ -188,9 +188,10 @@ Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField if (!this->readValueEntry(dict)) { - // Assign dummy value to get redirectPatchField not fail - fvPatchField<Type>::patchInternalField(*this); + // Ensure field has reasonable initial values + this->extrapolateInternal(); + // Evaluate to assign a value this->evaluate(Pstream::commsTypes::blocking); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H index 4daf935f7a3eac4ceb4bdb8ff93bfe8b5da79504..0c747c5cb839606e4f00e4c083dfb51701ad59a6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H @@ -34,6 +34,9 @@ Description Constructs on-the-fly a new boundary condition (derived from fixedValueFvPatchField) which is then used to evaluate. + The \c value entry (optional) is used for the initial values. + Otherwise the code is executed. + The code entries: \plaintable codeInclude | include files diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchFields.C index ff73d00582a606826a7490554588e12d672d50d0..9cef5b1e591dd7901d96e7925a0d9877e8d6ca68 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchFields.C @@ -25,21 +25,17 @@ License \*---------------------------------------------------------------------------*/ -#include "codedFixedValueFvPatchFields.H" +#include "codedFixedValueFvPatchField.H" #include "addToRunTimeSelectionTable.H" +#include "fieldTypes.H" #include "volFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makePatchFields(codedFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam + makePatchTypeFieldTypedefs(codedFixedValue); + makePatchFields(codedFixedValue); +} // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchFields.H deleted file mode 100644 index e50357bd1dd931d099da0d0cfc6de1dcbc9c14ad..0000000000000000000000000000000000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchFields.H +++ /dev/null @@ -1,51 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011 OpenFOAM Foundation -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#ifndef codedFixedValueFvPatchFields_H -#define codedFixedValueFvPatchFields_H - -#include "codedFixedValueFvPatchField.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeFieldTypedefs(codedFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H index 89bbc2320d1868e6a704446f1e9495a37ad83d0a..821b473d23e4fcfea673117bcf72f587b5da9d66 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H @@ -107,8 +107,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef codedMixedFvPatchField_H -#define codedMixedFvPatchField_H +#ifndef Foam_codedMixedFvPatchField_H +#define Foam_codedMixedFvPatchField_H #include "mixedFvPatchFields.H" #include "codedBase.H" diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchFields.C index 701cbc491ee35d789feb39bd430b93df52fd1a7a..675fe1ea22b213b61827f77c1ae79839789bbaab 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchFields.C @@ -25,21 +25,17 @@ License \*---------------------------------------------------------------------------*/ -#include "codedMixedFvPatchFields.H" +#include "codedMixedFvPatchField.H" #include "addToRunTimeSelectionTable.H" +#include "fieldTypes.H" #include "volFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makePatchFields(codedMixed); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam + makePatchTypeFieldTypedefs(codedMixed); + makePatchFields(codedMixed); +} // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchFields.H deleted file mode 100644 index 6b6f74088db956a73ade85dc83eebf83ecdd8954..0000000000000000000000000000000000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchFields.H +++ /dev/null @@ -1,51 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011 OpenFOAM Foundation -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#ifndef codedMixedFvPatchFields_H -#define codedMixedFvPatchFields_H - -#include "codedMixedFvPatchField.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeFieldTypedefs(codedMixed); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C index 7ee4400f5000630e4dd9d268000874e8af869691..2ffd8892c115a97624240ce9e50727eaa33c2feb 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C @@ -208,7 +208,7 @@ electrostaticDepositionFvPatchScalarField { if (!this->readValueEntry(dict)) { - fvPatchField<scalar>::patchInternalField(*this); + this->extrapolateInternal(); // Zero-gradient patch values } // If flow is multiphase diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C index 820552d8b8ccd07a0c434b774f9e0c2fb9a23b06..72a2dab920b010e85881b92e607c5be2e8525041 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C @@ -70,13 +70,10 @@ fluxCorrectedVelocityFvPatchVectorField const dictionary& dict ) : - zeroGradientFvPatchVectorField(p, iF), + zeroGradientFvPatchVectorField(p, iF, dict), phiName_(dict.getOrDefault<word>("phi", "phi")), rhoName_(dict.getOrDefault<word>("rho", "rho")) -{ - fvPatchFieldBase::readDict(dict); - fvPatchField<vector>::patchInternalField(*this); -} +{} Foam::fluxCorrectedVelocityFvPatchVectorField:: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C index c9265694100fad076c4499f53e6fd61611154ece..202c3911185327dcbd1da308f0eb56e2d7182eff 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C @@ -73,15 +73,15 @@ Foam::inletOutletFvPatchField<Type>::inletOutletFvPatchField { fvPatchFieldBase::readDict(dict); + // Require inletValue (MUST_READ) this->refValue().assign("inletValue", dict, p.size()); + this->refGrad() = Zero; + this->valueFraction() = 0; if (!this->readValueEntry(dict)) { - fvPatchField<Type>::operator=(this->refValue()); + fvPatchField<Type>::extrapolateInternal(); } - - this->refGrad() = Zero; - this->valueFraction() = 0.0; } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.H index ac1e29355be3e3ccb400a34ee76164f2d2f4d1ee..fbf117c729f3fadc78c0cc5e6a9801ec679abc59 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.H @@ -38,6 +38,7 @@ Usage Property | Description | Required | Default value phi | Flux field name | no | phi inletValue | Inlet value for reverse flow | yes | + value | initial field value | optional | \endtable Example of the boundary condition specification: @@ -88,10 +89,9 @@ class inletOutletFvPatchField : public mixedFvPatchField<Type> { - protected: - // Protected data + // Protected Data //- Name of flux field word phiName_; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/outletInlet/outletInletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/outletInlet/outletInletFvPatchField.C index 37455d8f865a88499baa17e03769ba5e5318393c..a111bb8f4870cdb7755f9fa9fa0957d6ad46a16a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/outletInlet/outletInletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/outletInlet/outletInletFvPatchField.C @@ -42,7 +42,7 @@ Foam::outletInletFvPatchField<Type>::outletInletFvPatchField { this->refValue() = *this; this->refGrad() = Zero; - this->valueFraction() = 0.0; + this->valueFraction() = 0; } @@ -73,15 +73,15 @@ Foam::outletInletFvPatchField<Type>::outletInletFvPatchField { fvPatchFieldBase::readDict(dict); + // Require outletValue (MUST_READ) this->refValue().assign("outletValue", dict, p.size()); + this->refGrad() = Zero; + this->valueFraction() = 0; if (!this->readValueEntry(dict)) { - fvPatchField<Type>::operator=(this->refValue()); + fvPatchField<Type>::extrapolateInternal(); } - - this->refGrad() = Zero; - this->valueFraction() = 0.0; } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/outletInlet/outletInletFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/outletInlet/outletInletFvPatchField.H index 1d192b571b5793726fe8ce3eb4f83689836baf7c..1f7e51e3c896857b8a03ec9515deb397623c9aa9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/outletInlet/outletInletFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/outletInlet/outletInletFvPatchField.H @@ -38,6 +38,7 @@ Usage Property | Description | Required | Default value phi | Flux field name | no | phi outletValue | Outlet value for reverse flow | yes | + value | initial field value | optional | \endtable Example of the boundary condition specification: @@ -88,12 +89,11 @@ class outletInletFvPatchField : public mixedFvPatchField<Type> { - protected: - // Protected data + // Protected Data - //- Name of flux field + //- Name of flux field (default: phi) word phiName_; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/outletMappedUniformInlet/outletMappedUniformInletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/outletMappedUniformInlet/outletMappedUniformInletFvPatchField.C index 9c3ac4ac2e01a3e3eb3876209b1fbd94e3349693..72ae806e5a789e5d3062299d42d8165d05e5ddc2 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/outletMappedUniformInlet/outletMappedUniformInletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/outletMappedUniformInlet/outletMappedUniformInletFvPatchField.C @@ -171,7 +171,7 @@ outletMappedUniformInletFvPatchField if (!this->readValueEntry(dict)) { // Fallback: set to the internal field - fvPatchField<Type>::patchInternalField(*this); + this->extrapolateInternal(); } } @@ -205,7 +205,7 @@ outletMappedUniformInletFvPatchField else { // Fallback: set to the internal field - fvPatchField<Type>::patchInternalField(*this); + this->extrapolateInternal(); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C index 4f9e0f9036545ebe768b32a768530020884b50f0..6d90bf382be803413d74ea7d8d6432079c7f7f2a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C @@ -82,11 +82,11 @@ Foam::outletPhaseMeanVelocityFvPatchVectorField refValue() = Zero; refGrad() = Zero; - valueFraction() = 0.0; + valueFraction() = 0; if (!this->readValueEntry(dict)) { - fvPatchField<vector>::patchInternalField(*this); + this->extrapolateInternal(); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C index 4962f0bf827a1f34a1458435211932bdd48605bb..82e5da352f9c83030d30c4d7dbef0ba44ed3b937 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C @@ -76,7 +76,7 @@ supersonicFreestreamFvPatchVectorField if (!this->readValueEntry(dict)) { - fvPatchField<vector>::patchInternalField(*this); + this->extrapolateInternal(); } refValue() = *this; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.C index dece9ac093527cba7b5a46b3cf7a3d821802a7a4..0118c3d73ac70daf3a8bbee958569ca272e6a75f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.C @@ -25,21 +25,16 @@ License \*---------------------------------------------------------------------------*/ -#include "timeVaryingMappedFixedValueFvPatchFields.H" +#include "timeVaryingMappedFixedValueFvPatchField.H" #include "addToRunTimeSelectionTable.H" #include "volFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makePatchFields(timeVaryingMappedFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam + makePatchTypeFieldTypedefs(timeVaryingMappedFixedValue); + makePatchFields(timeVaryingMappedFixedValue); +} // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.H deleted file mode 100644 index a25c560f9d603d58a07f0508837405dc0211d88d..0000000000000000000000000000000000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.H +++ /dev/null @@ -1,51 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011 OpenFOAM Foundation -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#ifndef timeVaryingMappedFixedValueFvPatchFields_H -#define timeVaryingMappedFixedValueFvPatchFields_H - -#include "timeVaryingMappedFixedValueFvPatchField.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeFieldTypedefs(timeVaryingMappedFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C index 1e4b44e7565b9b46c04d88b5a12d1d7568226bee..09ffae29c760819b969f287d1016ce031bc45d29 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C @@ -62,7 +62,7 @@ Foam::turbulentInletFvPatchField<Type>::turbulentInletFvPatchField { if (!this->readValueEntry(dict)) { - fixedValueFvPatchField<Type>::operator==(referenceField_); + fvPatchField<Type>::operator=(referenceField_); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C index d265cadd197dc2d346ae59850e58ebc11827423d..6908ce378ddb5756e8b91e4227f58b3dea9d1f4b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C @@ -70,7 +70,15 @@ Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField ) { fvPatchFieldBase::readDict(dict); - this->evaluate(); + + if (!this->readValueEntry(dict)) + { + // Ensure field has initialised values + this->extrapolateInternal(); + + // Evaluate to assign a value + this->evaluate(); + } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H index 34bdbb50a0cbe59b86f60ddb91283c264db0be16..8b0cb4129b2e8c2dc6375999edae7294312d96a2 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H @@ -37,6 +37,7 @@ Usage \table Property | Description | Required | Default uniformGradient | uniform gradient | yes | + value | initial field value | optional | \endtable Example of the boundary condition specification: @@ -53,6 +54,11 @@ Note able to describe time and spatial varying functions. The example above gives the usage for supplying a constant value. + The \c value entry (optional) is used for the initial values. + Otherwise the \c uniformGradient is used for the evaluation. + In some cases (eg, coded or expression entries with references to other + fields) this can be problematic and the \c value entry will be needed. + See also Foam::Function1Types Foam::fixedGradientFvPatchField diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.C index a8f054cb16a87c5896f1dbffd88bc4e51831939a..9de644cc319a78142d01f8dd6c7abd636fb27d10 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.C @@ -25,21 +25,17 @@ License \*---------------------------------------------------------------------------*/ -#include "uniformFixedGradientFvPatchFields.H" +#include "uniformFixedGradientFvPatchField.H" #include "addToRunTimeSelectionTable.H" +#include "fieldTypes.H" #include "volFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makePatchFields(uniformFixedGradient); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam + makePatchTypeFieldTypedefs(uniformFixedGradient); + makePatchFields(uniformFixedGradient); +} // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.H deleted file mode 100644 index fd835e1462b74b09514fa6398c84f241adfca100..0000000000000000000000000000000000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.H +++ /dev/null @@ -1,51 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2013 OpenFOAM Foundation -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#ifndef uniformFixedGradientFvPatchFields_H -#define uniformFixedGradientFvPatchFields_H - -#include "uniformFixedGradientFvPatchField.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeFieldTypedefs(uniformFixedGradient); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C index 4e876b1a07582fcdb5a975a1a865dce4ec3d2b9f..2ad1312c4ed2cd6832958a60ef29e7f44591d2f3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C @@ -68,6 +68,10 @@ Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField { if (!this->readValueEntry(dict)) { + // Ensure field has reasonable initial values + this->extrapolateInternal(); + + // Evaluate to assign a value this->evaluate(); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H index fa5f8a344205b1eb998d0570beb12c91bdec7da5..68e8e90021b65c494cc75938a77db4a335abb884 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H @@ -37,6 +37,7 @@ Usage \table Property | Description | Required | Default uniformValue | uniform value | yes | + value | initial field value | optional | \endtable Example of the boundary condition specification: @@ -53,6 +54,11 @@ Note able to describe time and spatial varying functions. The example above gives the usage for supplying a constant value. + The \c value entry (optional) is used for the initial values. + Otherwise the \c uniformValue is evaluated. + In some cases (eg, coded or expression entries with references to other + fields) this can be problematic and the \c value entry will be needed. + See also Foam::Function1Types Foam::fixedValueFvPatchField diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchFields.C index 10bb316d17d4e8b6ae9f466258196d26a4626b65..179ab87e23c4f0f895c80b09125064442f72c32f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchFields.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ -#include "uniformFixedValueFvPatchFields.H" +#include "uniformFixedValueFvPatchField.H" #include "addToRunTimeSelectionTable.H" #include "volFields.H" @@ -33,6 +33,7 @@ License namespace Foam { + makePatchTypeFieldTypedefs(uniformFixedValue); makePatchFields(uniformFixedValue); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchFields.H deleted file mode 100644 index 761395c42e4b93d4d73e012ce46551f41dd7c89f..0000000000000000000000000000000000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchFields.H +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011 OpenFOAM Foundation -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#ifndef Foam_uniformFixedValueFvPatchFields_H -#define Foam_uniformFixedValueFvPatchFields_H - -#include "uniformFixedValueFvPatchField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeFieldTypedefs(uniformFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchField.C index ca2817148a9de9980dd15ba97a45c32db52c7306..9d017c0a14a2d6f7ec10282cf1d942e9923bb0c8 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchField.C @@ -110,6 +110,10 @@ Foam::uniformMixedFvPatchField<Type>::uniformMixedFvPatchField // Use restart value if provided... if (!this->readValueEntry(dict)) { + // Ensure field has reasonable initial values + this->extrapolateInternal(); + + // Evaluate to assign a value this->evaluate(); } } @@ -230,7 +234,7 @@ void Foam::uniformMixedFvPatchField<Type>::write(Ostream& os) const valueFractionFunc_->writeData(os); } - // Eg, for visualisation + // For visualisation / restart fvPatchField<Type>::writeValueEntry(os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchField.H index ccaa055b31af3332ba6973c8bf31d1331edad5eb..9d1bdd895459c430c6555ba9621f744ccb303ff0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchField.H @@ -44,6 +44,7 @@ Usage uniformValue | uniform value | partly | 0 uniformGradient | uniform gradient | partly | 0 uniformValueFraction | uniform valueFraction | partly | depends + value | initial field value | optional | \endtable Example of the boundary condition specification: @@ -70,6 +71,11 @@ Note If both \c uniformValue and \c uniformGradient are defined, the \c uniformValueFraction must also be defined. + The \c value entry (optional) is used for the initial values. + Otherwise the function(s) are used for the evaluation. + In some cases (eg, coded or expression entries with references to other + fields) this can be problematic and the \c value entry will be needed. + See also Foam::Function1Types Foam::mixedFvPatchField diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchFields.C index e307da0c6577790d688b9e365efba6b3eeb7cb13..0f0ea8e0c341623cdad4e0a4f56056a60ae1f786 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchFields.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ -#include "uniformMixedFvPatchFields.H" +#include "uniformMixedFvPatchField.H" #include "addToRunTimeSelectionTable.H" #include "volFields.H" @@ -33,6 +33,7 @@ License namespace Foam { + makePatchTypeFieldTypedefs(uniformMixed); makePatchFields(uniformMixed); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchFields.H deleted file mode 100644 index 25eac16d840c66754631d85aa8925e2539c2e592..0000000000000000000000000000000000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchFields.H +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2023 OpenCFD Ltd. -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#ifndef Foam_uniformMixedFvPatchFields_H -#define Foam_uniformMixedFvPatchFields_H - -#include "uniformMixedFvPatchField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeFieldTypedefs(uniformMixed); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C index a569a669dc6eb568cf4ec541fe87b596ceaa0485..d75750e956fb4bd9b2d4e27c3014fd10bf3593d8 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C @@ -86,7 +86,7 @@ Foam::variableHeightFlowRateFvPatchScalarField if (!this->readValueEntry(dict)) { // Fallback: set to the internal field - fvPatchField<scalar>::patchInternalField(*this); + this->extrapolateInternal(); } this->refValue() = 0.0; diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index 0590efeb01d11a2d873cd3f94e8ed49b9a07814f..ada91e0d510c419ca2cd43ef06fa1caf553d16e9 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -176,7 +176,7 @@ Foam::fvPatchField<Type>::fvPatchField // For unmapped faces set to internal field value (zero-gradient) if (notNull(iF) && mapper.hasUnmapped()) { - fvPatchField<Type>::patchInternalField(*this); + this->extrapolateInternal(); } this->map(ptf, mapper); } diff --git a/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C b/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C index 7dad1746968dc8ae6e31cf449d25bd641d0daa24..a872e8724b9c475fbc4423550392adc5d4c321d5 100644 --- a/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C +++ b/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C @@ -160,7 +160,7 @@ externalCoupledTemperatureMixedFvPatchScalarField // or extrapolated value if (!this->readValueEntry(dict)) { - fvPatchField<scalar>::patchInternalField(*this); + fvPatchField<scalar>::extrapolateInternal(); } // Initialise as a fixed value @@ -254,7 +254,7 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeData const scalarField& Twall = *this; // Fluid temperature [K] - tmp<scalarField> tfluid; + scalarField Tfluid(size()); if (refTempType_ == refTemperatureType::USER) { @@ -262,16 +262,14 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeData const scalar currTref = Tref_->value(this->db().time().timeOutputValue()); - tfluid = tmp<scalarField>::New(size(), currTref); + Tfluid = currTref; } else { // Near wall cell temperature - tfluid = patchInternalField(); + this->patchInternalField(Tfluid); } - const scalarField Tfluid(tfluid); - // Heat transfer coefficient [W/m2/K] // This htc needs to be always larger or equal to zero //const scalarField htc(qDot/max(Twall - Tfluid, 1e-3)); diff --git a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C index c9618353cc43ad0c9227420be3a59672dff7a73e..e2475907e113c52c7f39c2bc06f4615ded5a24fe 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C @@ -64,7 +64,7 @@ timeVaryingMappedFixedValuePointPatchField const dictionary& dict ) : - fixedValuePointPatchField<Type>(p, iF, dict, false), + fixedValuePointPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ), setAverage_(dict.getOrDefault("setAverage", false)), perturb_(dict.getOrDefault("perturb", 1e-5)), fieldTableName_(iF.name()), diff --git a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchFields.C b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchFields.C index 3eb48c72dccf3a0a0924db094cdc0f11ced47821..223b099c360e9de09e26d2a7a040888fb6e9dc2c 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchFields.C +++ b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchFields.C @@ -25,21 +25,16 @@ License \*---------------------------------------------------------------------------*/ -#include "timeVaryingMappedFixedValuePointPatchFields.H" -#include "pointPatchFields.H" +#include "timeVaryingMappedFixedValuePointPatchField.H" #include "addToRunTimeSelectionTable.H" +#include "pointPatchFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makePointPatchFields(timeVaryingMappedFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam + makePointPatchFieldTypedefs(timeVaryingMappedFixedValue); + makePointPatchFields(timeVaryingMappedFixedValue); +} // ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchFields.H b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchFields.H deleted file mode 100644 index 00d45b81e653d1135540bc07b895d2b0e3a5e229..0000000000000000000000000000000000000000 --- a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchFields.H +++ /dev/null @@ -1,59 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2012 OpenFOAM Foundation -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -InClass - Foam::timeVaryingMappedFixedValuePointPatchFields - -Description - -SourceFiles - timeVaryingMappedFixedValuePointPatchFields.C - -\*---------------------------------------------------------------------------*/ - -#ifndef timeVaryingMappedFixedValuePointPatchFields_H -#define timeVaryingMappedFixedValuePointPatchFields_H - -#include "timeVaryingMappedFixedValuePointPatchField.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePointPatchFieldTypedefs(timeVaryingMappedFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchField.C b/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchField.C index 2f291298c06021fe492dece7c9dcfb5de50e4487..8ff95a4c48ad93a1fb538572e1ba26e28baef00e 100644 --- a/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchField.C +++ b/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchField.C @@ -32,6 +32,9 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // +// Alternative +// refCast<const facePointPatch>(p).patch() + template<class Type> const Foam::polyPatch& Foam::uniformFixedValuePointPatchField<Type>::getPatch(const pointPatch& p) @@ -87,6 +90,10 @@ uniformFixedValuePointPatchField { if (!this->readValueEntry(dict)) { + // Ensure field has reasonable initial values + this->extrapolateInternal(); + + // Evaluate to assign a value this->evaluate(); } } @@ -194,7 +201,7 @@ void Foam::uniformFixedValuePointPatchField<Type>::updateCoeffs() } const scalar t = this->db().time().timeOutputValue(); - fixedValuePointPatchField<Type>::operator==(refValueFunc_->value(t)); + valuePointPatchField<Type>::operator=(refValueFunc_->value(t)); fixedValuePointPatchField<Type>::updateCoeffs(); } diff --git a/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchField.H b/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchField.H index 3a4ce68d21f49a41c374cf291b8d08ed4d0b9ffd..c98e567de39491eb6acb2a781956f842888d5a01 100644 --- a/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchField.H +++ b/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchField.H @@ -28,7 +28,14 @@ Class Foam::uniformFixedValuePointPatchField Description - Enables the specification of a uniform fixed value boundary condition. + Enables the specification of a uniform fixed value condition. + +Usage + \table + Property | Description | Required | Default + uniformValue | uniform value | yes | + value | initial field value | optional | + \endtable Example of the boundary condition specification: \verbatim @@ -39,10 +46,16 @@ Description } \endverbatim +Note The uniformValue entry is a PatchFunction1 type, able to describe time and spatial varying functions. The example above gives the usage for supplying a constant value. + The \c value entry (optional) is used for the initial values. + Otherwise the \c uniformValue is evaluated. + In some cases (eg, coded or expression entries with references to other + fields) this can be problematic and the \c value entry will be needed. + SourceFiles uniformFixedValuePointPatchField.C diff --git a/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchFields.C b/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchFields.C index 0595cf72944b85d678dcdb05e5b01e205509349b..fb3de7a60b17e2c14c945999506be76317220a10 100644 --- a/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchFields.C +++ b/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchFields.C @@ -25,14 +25,15 @@ License \*---------------------------------------------------------------------------*/ -#include "uniformFixedValuePointPatchFields.H" -#include "pointPatchFields.H" +#include "uniformFixedValuePointPatchField.H" #include "addToRunTimeSelectionTable.H" +#include "pointPatchFields.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { + makePointPatchFieldTypedefs(uniformFixedValue); makePointPatchFields(uniformFixedValue); } diff --git a/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchFields.H b/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchFields.H deleted file mode 100644 index de229bc32f76485ef3af3a6cfadacd79fd935440..0000000000000000000000000000000000000000 --- a/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchFields.H +++ /dev/null @@ -1,58 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011 OpenFOAM Foundation -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -InClass - Foam::uniformFixedValuePointPatchFields - -Description - -SourceFiles - uniformFixedValuePointPatchFields.C - -\*---------------------------------------------------------------------------*/ - -#ifndef Foam_uniformFixedValuePointPatchFields_H -#define Foam_uniformFixedValuePointPatchFields_H - -#include "uniformFixedValuePointPatchField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePointPatchFieldTypedefs(uniformFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetFvPatchField.C b/src/overset/oversetPolyPatch/oversetFvPatchField.C index 0329d406fcd04bfd3ed53e63b94f520663f7f682..3beba4a72f3c05bf72e76fceebd70ee225bcd590 100644 --- a/src/overset/oversetPolyPatch/oversetFvPatchField.C +++ b/src/overset/oversetPolyPatch/oversetFvPatchField.C @@ -113,7 +113,7 @@ Foam::oversetFvPatchField<Type>::oversetFvPatchField // Use 'value' supplied, or set to internal field if (!this->readValueEntry(dict)) { - fvPatchField<Type>::patchInternalField(*this); + fvPatchField<Type>::extrapolateInternal(); } } diff --git a/src/phaseSystemModels/multiphaseInter/phasesSystem/derivedFvPatchFields/timeVaryingMassSorption/timeVaryingMassSorptionFvPatchScalarField.C b/src/phaseSystemModels/multiphaseInter/phasesSystem/derivedFvPatchFields/timeVaryingMassSorption/timeVaryingMassSorptionFvPatchScalarField.C index 9c2ccd71b37f9fa22c43f2ee06ef914fdcfb6aea..771d7e0b77c7947d3a55a0a6bf76a91e1bd0716a 100644 --- a/src/phaseSystemModels/multiphaseInter/phasesSystem/derivedFvPatchFields/timeVaryingMassSorption/timeVaryingMassSorptionFvPatchScalarField.C +++ b/src/phaseSystemModels/multiphaseInter/phasesSystem/derivedFvPatchFields/timeVaryingMassSorption/timeVaryingMassSorptionFvPatchScalarField.C @@ -80,7 +80,7 @@ timeVaryingMassSorptionFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict, false), + fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ), kabs_(dict.getCheck<scalar>("kabs", scalarMinMax::ge(0))), max_(dict.getCheck<scalar>("max", scalarMinMax::ge(0))), kdes_(dict.getCheckOrDefault<scalar>("kdes", 0, scalarMinMax::ge(0))) diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C index 764b071fe9840094369f63702453006d379e8285..16ec7886561c4613357623db7de0c40b37cdee04 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C @@ -69,7 +69,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict, false), + fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ), qro_("qro", dict, p.size()) { if (!this->readValueEntry(dict)) diff --git a/src/transportModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C b/src/transportModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C index 71b2a02c5dfaf26e5349c4ce0f6fae03ea04d85c..d7fa1c573ab6847207ef65332bc15f4954ba0d2f 100644 --- a/src/transportModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C +++ b/src/transportModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C @@ -69,7 +69,8 @@ alphaFixedPressureFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict, false), + // The 'value' is optional (handled below) + fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ), p_("p", dict, p.size()) { if (!this->readValueEntry(dict)) diff --git a/src/waveModels/derivedPointPatchFields/waveMaker/waveMakerPointPatchVectorField.C b/src/waveModels/derivedPointPatchFields/waveMaker/waveMakerPointPatchVectorField.C index 9db52d95928656f216977cc762970b349dfff12a..332d62a412c96de6fcd49283f3bd324a6dbc5f9c 100644 --- a/src/waveModels/derivedPointPatchFields/waveMaker/waveMakerPointPatchVectorField.C +++ b/src/waveModels/derivedPointPatchFields/waveMaker/waveMakerPointPatchVectorField.C @@ -166,7 +166,7 @@ Foam::waveMakerPointPatchVectorField::waveMakerPointPatchVectorField const dictionary& dict ) : - fixedValuePointPatchField<vector>(p, iF, dict, false), + fixedValuePointPatchField<vector>(p, iF, dict, IOobjectOption::NO_READ), motionType_(motionTypeNames.get("motionType", dict)), n_(dict.get<vector>("n")), gHat_(Zero),