diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C index 0defd8cd73..b289adb034 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::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 c398dc6131..438acf74ce 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 486d38dc8e..4b5b841ecd 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" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ +#include "fieldTypes.H" +#include "pointPatchFields.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makePointPatchFields(codedFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam +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 01eb26d731..0000000000 --- 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 . - -\*---------------------------------------------------------------------------*/ - -#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 eb0a717429..d00560a32c 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" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ +#include "pointPatchFields.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makePointPatchFields(timeVaryingUniformFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam +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 0a853e19ed..0000000000 --- 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 . - -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 da6fc26d91..6ab7e77e16 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("tau", Zero)) { - fvPatchField::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 b4175b385b..61c67a8726 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::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 ec53d93776..7339e1bd88 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::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 2091fb1a56..64a3d3136a 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::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 e2c2ce7f8e..b2a84771c6 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 fe31f3761c..429fccf4f0 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::processorFaPatchField // Use 'value' supplied, or set to internal field if (!this->readValueEntry(dict)) { - faPatchField::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 f7bf73b384..41f9a88f19 100644 --- a/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.C @@ -58,8 +58,7 @@ clampedPlateFaPatchField::clampedPlateFaPatchField : faPatchField(p, iF, dict, IOobjectOption::NO_READ) { - // Set to the internal field - faPatchField::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 cf626198f4..9e485dae5e 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::inletOutletFaPatchField { // Require inletValue (MUST_READ) this->refValue().assign("inletValue", dict, p.size()); + this->refGrad() = Zero; + this->valueFraction() = 0; if (!this->readValueEntry(dict)) { - faPatchField::operator=(this->refValue()); + faPatchField::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 85e2c34108..88abbde9c8 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 be919d76fb..8702efcc85 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::outletInletFaPatchField { this->refValue() = *this; this->refGrad() = Zero; - this->valueFraction() = 0.0; + this->valueFraction() = 0; } @@ -72,15 +72,15 @@ Foam::outletInletFaPatchField::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::operator=(this->refValue()); + faPatchField::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 47ba41fba7..3b9187c63b 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 3aeb93c440..2486bd621a 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 fa19e8c9d8..b3894d4a8d 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 d99c594ba6..0000000000 --- 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 . - -\*---------------------------------------------------------------------------*/ - -#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 f74667880c..650cdbef1a 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::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 52e0f026b6..7340d59a20 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 2e6a854e5c..1e96ea8957 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 7e7a2973d6..0000000000 --- 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 . - -\*---------------------------------------------------------------------------*/ - -#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 804b049a5f..b7cef206c5 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::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 7761219779..4af170d7b8 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 8bacac29af..aa666b756c 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 a4cd5cf48f..0000000000 --- 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 . - -\*---------------------------------------------------------------------------*/ - -#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 cf9c1dd88d..8f29c0f425 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::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::write(Ostream& os) const valueFractionFunc_->writeData(os); } - // Eg, for visualisation + // For visualisation / restart faPatchField::writeValueEntry(os); } diff --git a/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchField.H b/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchField.H index bd2819f6f4..620a16dbad 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 d7f518c1a1..17c8df4ff6 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 4f91619e41..0000000000 --- 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 . - -\*---------------------------------------------------------------------------*/ - -#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 c3cf0df50c..1616af6fbb 100644 --- a/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.C +++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.C @@ -128,15 +128,10 @@ Foam::exprFixedValueFvPatchField::exprFixedValueFvPatchField // Since we bypassed dictionary constructor fvPatchFieldBase::readDict(dict); - const auto* hasValue = dict.findEntry("value", keyType::LITERAL); - - if (hasValue) + if (!this->readValueEntry(dict)) { - Field::assign(*hasValue, p.size()); - } - else - { - (*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 f922e6c6ac..69395b5c62 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 80e4db62ba..8907e0141c 100644 --- a/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.C +++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.C @@ -169,7 +169,6 @@ Foam::exprMixedFvPatchField::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::exprMixedFvPatchField this->refValue().assign(*hasRefValue, p.size()); } - if (hasValue) + if (this->readValueEntry(dict)) { - Field::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 437d0dc4c5..32bfa068db 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 1fdce54c39..f3e64884e2 100644 --- a/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.C +++ b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.C @@ -115,6 +115,11 @@ Foam::exprValuePointPatchField::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::exprValuePointPatchField driver_.readDict(dict_); - const auto* hasValue = dict.findEntry("value", keyType::LITERAL); - - if (hasValue) + if (!this->readValueEntry(dict)) { - Field::assign(*hasValue, p.size()); - } - else - { - // Note: valuePointPatchField defaults to Zero - // but internalField might be better - - Field::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 0c286e2028..fa328a5428 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 e9cca570dd..068e427213 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" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ +#include "fieldTypes.H" +#include "pointPatchFields.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makePointPatchFields(exprValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam +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 b0035fcac8..0000000000 --- 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 . - -\*---------------------------------------------------------------------------*/ - -#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 e2ba9698b8..ae2ed8a07a 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::cyclicAMIFvPatchField } else { - fvPatchField::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 19da597026..a4c1e57ea7 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::processorFvPatchField // Use 'value' supplied, or set to internal field if (!this->readValueEntry(dict)) { - fvPatchField::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 47285e9e8f..250b46a0ea 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::advectiveFvPatchField // Use 'value' supplied, or set to internal field if (!this->readValueEntry(dict)) { - fvPatchField::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 1eb6787657..fad36642e6 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::codedFixedValueFvPatchField if (!this->readValueEntry(dict)) { - // Assign dummy value to get redirectPatchField not fail - fvPatchField::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 4daf935f7a..0c747c5cb8 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 ff73d00582..9cef5b1e59 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" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makePatchFields(codedFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam +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 e50357bd1d..0000000000 --- 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 . - -\*---------------------------------------------------------------------------*/ - -#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 89bbc2320d..821b473d23 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 701cbc491e..675fe1ea22 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" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makePatchFields(codedMixed); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam +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 6b6f74088d..0000000000 --- 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 . - -\*---------------------------------------------------------------------------*/ - -#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 7ee4400f50..2ffd8892c1 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::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 820552d8b8..72a2dab920 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("phi", "phi")), rhoName_(dict.getOrDefault("rho", "rho")) -{ - fvPatchFieldBase::readDict(dict); - fvPatchField::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 c926569410..202c391118 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::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::operator=(this->refValue()); + fvPatchField::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 ac1e29355b..fbf117c729 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 { - 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 37455d8f86..a111bb8f48 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::outletInletFvPatchField { this->refValue() = *this; this->refGrad() = Zero; - this->valueFraction() = 0.0; + this->valueFraction() = 0; } @@ -73,15 +73,15 @@ Foam::outletInletFvPatchField::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::operator=(this->refValue()); + fvPatchField::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 1d192b571b..1f7e51e3c8 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 { - 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 9c3ac4ac2e..72ae806e5a 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::patchInternalField(*this); + this->extrapolateInternal(); } } @@ -205,7 +205,7 @@ outletMappedUniformInletFvPatchField else { // Fallback: set to the internal field - fvPatchField::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 4f9e0f9036..6d90bf382b 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::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 4962f0bf82..82e5da352f 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::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 dece9ac093..0118c3d73a 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 a25c560f9d..0000000000 --- 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 . - -\*---------------------------------------------------------------------------*/ - -#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 1e4b44e756..09ffae29c7 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::turbulentInletFvPatchField { if (!this->readValueEntry(dict)) { - fixedValueFvPatchField::operator==(referenceField_); + fvPatchField::operator=(referenceField_); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C index d265cadd19..6908ce378d 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::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 34bdbb50a0..8b0cb4129b 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 a8f054cb16..9de644cc31 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" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makePatchFields(uniformFixedGradient); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam +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 fd835e1462..0000000000 --- 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 . - -\*---------------------------------------------------------------------------*/ - -#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 4e876b1a07..2ad1312c4e 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::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 fa5f8a3442..68e8e90021 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 10bb316d17..179ab87e23 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 761395c42e..0000000000 --- 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 . - -\*---------------------------------------------------------------------------*/ - -#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 ca2817148a..9d017c0a14 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::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::write(Ostream& os) const valueFractionFunc_->writeData(os); } - // Eg, for visualisation + // For visualisation / restart fvPatchField::writeValueEntry(os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchField.H index ccaa055b31..9d1bdd8954 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 e307da0c65..0f0ea8e0c3 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 25eac16d84..0000000000 --- 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 . - -\*---------------------------------------------------------------------------*/ - -#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 a569a669dc..d75750e956 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::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 0590efeb01..ada91e0d51 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -176,7 +176,7 @@ Foam::fvPatchField::fvPatchField // For unmapped faces set to internal field value (zero-gradient) if (notNull(iF) && mapper.hasUnmapped()) { - fvPatchField::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 7dad174696..a872e8724b 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::patchInternalField(*this); + fvPatchField::extrapolateInternal(); } // Initialise as a fixed value @@ -254,7 +254,7 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeData const scalarField& Twall = *this; // Fluid temperature [K] - tmp 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::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 c9618353cc..e2475907e1 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(p, iF, dict, false), + fixedValuePointPatchField(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 3eb48c72dc..223b099c36 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" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ +#include "pointPatchFields.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makePointPatchFields(timeVaryingMappedFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam +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 00d45b81e6..0000000000 --- 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 . - -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 2f291298c0..8ff95a4c48 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(p).patch() + template const Foam::polyPatch& Foam::uniformFixedValuePointPatchField::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::updateCoeffs() } const scalar t = this->db().time().timeOutputValue(); - fixedValuePointPatchField::operator==(refValueFunc_->value(t)); + valuePointPatchField::operator=(refValueFunc_->value(t)); fixedValuePointPatchField::updateCoeffs(); } diff --git a/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchField.H b/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchField.H index 3a4ce68d21..c98e567de3 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 0595cf7294..fb3de7a60b 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 de229bc32f..0000000000 --- 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 . - -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 0329d406fc..3beba4a72f 100644 --- a/src/overset/oversetPolyPatch/oversetFvPatchField.C +++ b/src/overset/oversetPolyPatch/oversetFvPatchField.C @@ -113,7 +113,7 @@ Foam::oversetFvPatchField::oversetFvPatchField // Use 'value' supplied, or set to internal field if (!this->readValueEntry(dict)) { - fvPatchField::patchInternalField(*this); + fvPatchField::extrapolateInternal(); } } diff --git a/src/phaseSystemModels/multiphaseInter/phasesSystem/derivedFvPatchFields/timeVaryingMassSorption/timeVaryingMassSorptionFvPatchScalarField.C b/src/phaseSystemModels/multiphaseInter/phasesSystem/derivedFvPatchFields/timeVaryingMassSorption/timeVaryingMassSorptionFvPatchScalarField.C index 9c2ccd71b3..771d7e0b77 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("kabs", scalarMinMax::ge(0))), max_(dict.getCheck("max", scalarMinMax::ge(0))), kdes_(dict.getCheckOrDefault("kdes", 0, scalarMinMax::ge(0))) diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C index 764b071fe9..16ec788656 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 71b2a02c5d..d7fa1c573a 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 9db52d9592..332d62a412 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(p, iF, dict, false), + fixedValuePointPatchField(p, iF, dict, IOobjectOption::NO_READ), motionType_(motionTypeNames.get("motionType", dict)), n_(dict.get("n")), gHat_(Zero),