ENH: more consistent handling/documentation of 'value' entry (#2703)

- for boundary conditions such as uniformFixed, uniformMixed etc the
  optional 'value' entry (optional) is used for the initial values and
  restarts.  Otherwise the various Function1 or PatchFunction1 entries
  are evaluated and used determine the boundary condition values.

  In most cases this is OK, but in some case such coded or expression
  entries with references to other fields it can be problematic since
  they may reference fields (eg, phi) that have not yet been created.

  For these cases the 'value' entry will be needed: documentation
  updated accordingly.

STYLE: eliminate some unneeded/unused declaration headers
This commit is contained in:
Mark Olesen 2023-06-16 15:59:07 +02:00
parent fc86e52451
commit 97459771ad
89 changed files with 269 additions and 990 deletions

View File

@ -188,6 +188,9 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
if (!this->readValueEntry(dict))
{
// Ensure field has reasonable initial values
this->extrapolateInternal();
// Evaluate to assign a value
this->evaluate(Pstream::commsTypes::blocking);
}

View File

@ -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

View File

@ -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);
}
// ************************************************************************* //

View File

@ -1,51 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef codedFixedValuePointPatchFields_H
#define codedFixedValuePointPatchFields_H
#include "codedFixedValuePointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(codedFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -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);
}
// ************************************************************************* //

View File

@ -1,59 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::timeVaryingUniformFixedValuePointPatchFields
Description
SourceFiles
timeVaryingUniformFixedValuePointPatchFields.C
\*---------------------------------------------------------------------------*/
#ifndef timeVaryingUniformFixedValuePointPatchFields_H
#define timeVaryingUniformFixedValuePointPatchFields_H
#include "timeVaryingUniformFixedValuePointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(timeVaryingUniformFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -56,7 +56,7 @@ Foam::fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
fixedValueFvPatchVectorField(p, iF, dict, IOobjectOption::NO_READ),
tau0_(dict.getOrDefault<vector>("tau", Zero))
{
fvPatchField<vector>::patchInternalField(*this);
this->extrapolateInternal(); // Zero-gradient patch values
}

View File

@ -366,7 +366,7 @@ epsilonWallFunctionFvPatchScalarField
cornerWeights_()
{
// Apply zero-gradient condition on start-up
fvPatchField<scalar>::patchInternalField(*this);
this->extrapolateInternal();
}

View File

@ -358,8 +358,8 @@ Foam::omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
omega_(),
cornerWeights_()
{
// apply zero-gradient condition on start-up
fvPatchField<scalar>::patchInternalField(*this);
// Apply zero-gradient condition on start-up
this->extrapolateInternal();
}

View File

@ -70,7 +70,8 @@ freeSurfaceVelocityFvPatchVectorField
fixedGradientFvPatchVectorField(p, iF)
{
fvPatchFieldBase::readDict(dict);
fvPatchField<vector>::patchInternalField(*this);
// Apply zero-gradient condition on start-up
this->extrapolateInternal();
}

View File

@ -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)
{

View File

@ -120,7 +120,7 @@ Foam::processorFaPatchField<Type>::processorFaPatchField
// Use 'value' supplied, or set to internal field
if (!this->readValueEntry(dict))
{
faPatchField<Type>::patchInternalField(*this);
this->extrapolateInternal(); // Zero-gradient patch values
}
}

View File

@ -58,8 +58,7 @@ clampedPlateFaPatchField<Type>::clampedPlateFaPatchField
:
faPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
{
// Set to the internal field
faPatchField<Type>::patchInternalField(*this);
this->extrapolateInternal(); // Zero-gradient patch values
}

View File

@ -74,14 +74,13 @@ Foam::inletOutletFaPatchField<Type>::inletOutletFaPatchField
{
// Require inletValue (MUST_READ)
this->refValue().assign("inletValue", dict, p.size());
this->refGrad() = Zero;
this->valueFraction() = 0;
if (!this->readValueEntry(dict))
{
faPatchField<Type>::operator=(this->refValue());
faPatchField<Type>::extrapolateInternal();
}
this->refGrad() = Zero;
this->valueFraction() = 0.0;
}

View File

@ -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

View File

@ -41,7 +41,7 @@ Foam::outletInletFaPatchField<Type>::outletInletFaPatchField
{
this->refValue() = *this;
this->refGrad() = Zero;
this->valueFraction() = 0.0;
this->valueFraction() = 0;
}
@ -72,15 +72,15 @@ Foam::outletInletFaPatchField<Type>::outletInletFaPatchField
{
faPatchFieldBase::readDict(dict);
// Require outletValue (MUST_READ)
this->refValue().assign("outletValue", dict, p.size());
this->refGrad() = Zero;
this->valueFraction() = 0;
if (!this->readValueEntry(dict))
{
faPatchField<Type>::operator=(this->refValue());
faPatchField<Type>::extrapolateInternal();
}
this->refGrad() = Zero;
this->valueFraction() = 0.0;
}

View File

@ -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_;

View File

@ -58,6 +58,9 @@ timeVaryingUniformFixedValueFaPatchField
{
if (!this->readValueEntry(dict))
{
// Ensure field has reasonable initial values
this->extrapolateInternal();
updateCoeffs();
}

View File

@ -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);
}
// ************************************************************************* //

View File

@ -1,51 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef Foam_timeVaryingUniformFixedValueFaPatchFields_H
#define Foam_timeVaryingUniformFixedValueFaPatchFields_H
#include "timeVaryingUniformFixedValueFaPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaPatchTypeFieldTypedefs(timeVaryingUniformFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -73,7 +73,14 @@ Foam::uniformFixedGradientFaPatchField<Type>::uniformFixedGradientFaPatchField
)
)
{
this->evaluate();
if (!this->readValueEntry(dict))
{
// Ensure field has reasonable initial values
this->extrapolateInternal();
// Evaluate to assign a value
this->evaluate();
}
}

View File

@ -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

View File

@ -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);
}

View File

@ -1,50 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef Foam_uniformFixedGradientFaPatchFields_H
#define Foam_uniformFixedGradientFaPatchFields_H
#include "uniformFixedGradientFaPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaPatchTypeFieldTypedefs(uniformFixedGradient);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -75,6 +75,10 @@ Foam::uniformFixedValueFaPatchField<Type>::uniformFixedValueFaPatchField
{
if (!this->readValueEntry(dict))
{
// Ensure field has reasonable initial values
this->extrapolateInternal();
// Evaluate to assign a value
this->evaluate();
}
}

View File

@ -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

View File

@ -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);
}

View File

@ -1,50 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef Foam_uniformFixedValueFaPatchFields_H
#define Foam_uniformFixedValueFaPatchFields_H
#include "uniformFixedValueFaPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaPatchTypeFieldTypedefs(uniformFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -120,6 +120,10 @@ Foam::uniformMixedFaPatchField<Type>::uniformMixedFaPatchField
// Use restart value if provided...
if (!this->readValueEntry(dict))
{
// Ensure field has reasonable initial values
this->extrapolateInternal();
// Evaluate to assign a value
this->evaluate();
}
}
@ -240,7 +244,7 @@ void Foam::uniformMixedFaPatchField<Type>::write(Ostream& os) const
valueFractionFunc_->writeData(os);
}
// Eg, for visualisation
// For visualisation / restart
faPatchField<Type>::writeValueEntry(os);
}

View File

@ -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

View File

@ -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);
}

View File

@ -1,50 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef Foam_uniformMixedFaPatchFields_H
#define Foam_uniformMixedFaPatchFields_H
#include "uniformMixedFaPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaPatchTypeFieldTypedefs(uniformMixed);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -128,15 +128,10 @@ Foam::exprFixedValueFvPatchField<Type>::exprFixedValueFvPatchField
// Since we bypassed dictionary constructor
fvPatchFieldBase::readDict(dict);
const auto* hasValue = dict.findEntry("value", keyType::LITERAL);
if (hasValue)
if (!this->readValueEntry(dict))
{
Field<Type>::assign(*hasValue, p.size());
}
else
{
(*this) == this->patchInternalField();
// Ensure field has reasonable initial values
this->extrapolateInternal();
#ifdef FULLDEBUG
WarningInFunction

View File

@ -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.

View File

@ -169,7 +169,6 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
// Since we bypassed dictionary constructor
fvPatchFieldBase::readDict(dict);
const auto* hasValue = dict.findEntry("value", keyType::LITERAL);
const auto* hasRefValue = dict.findEntry("refValue", keyType::LITERAL);
const auto* hasRefGradient
@ -184,10 +183,8 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
this->refValue().assign(*hasRefValue, p.size());
}
if (hasValue)
if (this->readValueEntry(dict))
{
Field<Type>::assign(*hasValue, p.size());
if (!hasRefValue)
{
// Ensure refValue has a sensible value for the "update" below

View File

@ -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,

View File

@ -115,6 +115,11 @@ Foam::exprValuePointPatchField<Type>::exprValuePointPatchField
dict_
)
{
//FUTURE?
//DeprecatedInFunction(2212)
// << "Use uniformFixedValue with an expression Function1 instead." << nl
// << " This boundary condition will be removed in the future" << endl;
// Require valueExpr
if (this->valueExpr_.empty())
{
@ -125,18 +130,10 @@ Foam::exprValuePointPatchField<Type>::exprValuePointPatchField
driver_.readDict(dict_);
const auto* hasValue = dict.findEntry("value", keyType::LITERAL);
if (hasValue)
if (!this->readValueEntry(dict))
{
Field<Type>::assign(*hasValue, p.size());
}
else
{
// Note: valuePointPatchField defaults to Zero
// but internalField might be better
Field<Type>::operator=(Zero);
// Ensure field has reasonable initial values
this->extrapolateInternal();
}
if (this->evalOnConstruct_)

View File

@ -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

View File

@ -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);
}
// ************************************************************************* //

View File

@ -1,51 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef exprValuePointPatchFields_H
#define exprValuePointPatchFields_H
#include "exprValuePointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(exprValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -77,7 +77,7 @@ Foam::cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField
}
else
{
fvPatchField<Type>::patchInternalField(*this);
this->extrapolateInternal(); // Zero-gradient patch values
}
}
}

View File

@ -89,7 +89,7 @@ Foam::processorFvPatchField<Type>::processorFvPatchField
// Use 'value' supplied, or set to internal field
if (!this->readValueEntry(dict))
{
fvPatchField<Type>::patchInternalField(*this);
this->extrapolateInternal();
}
}

View File

@ -91,12 +91,12 @@ Foam::advectiveFvPatchField<Type>::advectiveFvPatchField
// Use 'value' supplied, or set to internal field
if (!this->readValueEntry(dict))
{
fvPatchField<Type>::patchInternalField(*this);
this->extrapolateInternal(); // Zero-gradient patch values
}
this->refValue() = *this;
this->refGrad() = Zero;
this->valueFraction() = 0.0;
this->valueFraction() = 0;
if (dict.readIfPresent("lInf", lInf_))
{

View File

@ -188,9 +188,10 @@ Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
if (!this->readValueEntry(dict))
{
// Assign dummy value to get redirectPatchField not fail
fvPatchField<Type>::patchInternalField(*this);
// Ensure field has reasonable initial values
this->extrapolateInternal();
// Evaluate to assign a value
this->evaluate(Pstream::commsTypes::blocking);
}
}

View File

@ -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

View File

@ -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);
}
// ************************************************************************* //

View File

@ -1,51 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef codedFixedValueFvPatchFields_H
#define codedFixedValueFvPatchFields_H
#include "codedFixedValueFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(codedFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -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"

View File

@ -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);
}
// ************************************************************************* //

View File

@ -1,51 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef codedMixedFvPatchFields_H
#define codedMixedFvPatchFields_H
#include "codedMixedFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(codedMixed);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -208,7 +208,7 @@ electrostaticDepositionFvPatchScalarField
{
if (!this->readValueEntry(dict))
{
fvPatchField<scalar>::patchInternalField(*this);
this->extrapolateInternal(); // Zero-gradient patch values
}
// If flow is multiphase

View File

@ -70,13 +70,10 @@ fluxCorrectedVelocityFvPatchVectorField
const dictionary& dict
)
:
zeroGradientFvPatchVectorField(p, iF),
zeroGradientFvPatchVectorField(p, iF, dict),
phiName_(dict.getOrDefault<word>("phi", "phi")),
rhoName_(dict.getOrDefault<word>("rho", "rho"))
{
fvPatchFieldBase::readDict(dict);
fvPatchField<vector>::patchInternalField(*this);
}
{}
Foam::fluxCorrectedVelocityFvPatchVectorField::

View File

@ -73,15 +73,15 @@ Foam::inletOutletFvPatchField<Type>::inletOutletFvPatchField
{
fvPatchFieldBase::readDict(dict);
// Require inletValue (MUST_READ)
this->refValue().assign("inletValue", dict, p.size());
this->refGrad() = Zero;
this->valueFraction() = 0;
if (!this->readValueEntry(dict))
{
fvPatchField<Type>::operator=(this->refValue());
fvPatchField<Type>::extrapolateInternal();
}
this->refGrad() = Zero;
this->valueFraction() = 0.0;
}

View File

@ -38,6 +38,7 @@ Usage
Property | Description | Required | Default value
phi | Flux field name | no | phi
inletValue | Inlet value for reverse flow | yes |
value | initial field value | optional |
\endtable
Example of the boundary condition specification:
@ -88,10 +89,9 @@ class inletOutletFvPatchField
:
public mixedFvPatchField<Type>
{
protected:
// Protected data
// Protected Data
//- Name of flux field
word phiName_;

View File

@ -42,7 +42,7 @@ Foam::outletInletFvPatchField<Type>::outletInletFvPatchField
{
this->refValue() = *this;
this->refGrad() = Zero;
this->valueFraction() = 0.0;
this->valueFraction() = 0;
}
@ -73,15 +73,15 @@ Foam::outletInletFvPatchField<Type>::outletInletFvPatchField
{
fvPatchFieldBase::readDict(dict);
// Require outletValue (MUST_READ)
this->refValue().assign("outletValue", dict, p.size());
this->refGrad() = Zero;
this->valueFraction() = 0;
if (!this->readValueEntry(dict))
{
fvPatchField<Type>::operator=(this->refValue());
fvPatchField<Type>::extrapolateInternal();
}
this->refGrad() = Zero;
this->valueFraction() = 0.0;
}

View File

@ -38,6 +38,7 @@ Usage
Property | Description | Required | Default value
phi | Flux field name | no | phi
outletValue | Outlet value for reverse flow | yes |
value | initial field value | optional |
\endtable
Example of the boundary condition specification:
@ -88,12 +89,11 @@ class outletInletFvPatchField
:
public mixedFvPatchField<Type>
{
protected:
// Protected data
// Protected Data
//- Name of flux field
//- Name of flux field (default: phi)
word phiName_;

View File

@ -171,7 +171,7 @@ outletMappedUniformInletFvPatchField
if (!this->readValueEntry(dict))
{
// Fallback: set to the internal field
fvPatchField<Type>::patchInternalField(*this);
this->extrapolateInternal();
}
}
@ -205,7 +205,7 @@ outletMappedUniformInletFvPatchField
else
{
// Fallback: set to the internal field
fvPatchField<Type>::patchInternalField(*this);
this->extrapolateInternal();
}
}

View File

@ -82,11 +82,11 @@ Foam::outletPhaseMeanVelocityFvPatchVectorField
refValue() = Zero;
refGrad() = Zero;
valueFraction() = 0.0;
valueFraction() = 0;
if (!this->readValueEntry(dict))
{
fvPatchField<vector>::patchInternalField(*this);
this->extrapolateInternal();
}
}

View File

@ -76,7 +76,7 @@ supersonicFreestreamFvPatchVectorField
if (!this->readValueEntry(dict))
{
fvPatchField<vector>::patchInternalField(*this);
this->extrapolateInternal();
}
refValue() = *this;

View File

@ -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);
}
// ************************************************************************* //

View File

@ -1,51 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef timeVaryingMappedFixedValueFvPatchFields_H
#define timeVaryingMappedFixedValueFvPatchFields_H
#include "timeVaryingMappedFixedValueFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(timeVaryingMappedFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -62,7 +62,7 @@ Foam::turbulentInletFvPatchField<Type>::turbulentInletFvPatchField
{
if (!this->readValueEntry(dict))
{
fixedValueFvPatchField<Type>::operator==(referenceField_);
fvPatchField<Type>::operator=(referenceField_);
}
}

View File

@ -70,7 +70,15 @@ Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
)
{
fvPatchFieldBase::readDict(dict);
this->evaluate();
if (!this->readValueEntry(dict))
{
// Ensure field has initialised values
this->extrapolateInternal();
// Evaluate to assign a value
this->evaluate();
}
}

View File

@ -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

View File

@ -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);
}
// ************************************************************************* //

View File

@ -1,51 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef uniformFixedGradientFvPatchFields_H
#define uniformFixedGradientFvPatchFields_H
#include "uniformFixedGradientFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(uniformFixedGradient);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -68,6 +68,10 @@ Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
{
if (!this->readValueEntry(dict))
{
// Ensure field has reasonable initial values
this->extrapolateInternal();
// Evaluate to assign a value
this->evaluate();
}
}

View File

@ -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

View File

@ -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);
}

View File

@ -1,50 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef Foam_uniformFixedValueFvPatchFields_H
#define Foam_uniformFixedValueFvPatchFields_H
#include "uniformFixedValueFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(uniformFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -110,6 +110,10 @@ Foam::uniformMixedFvPatchField<Type>::uniformMixedFvPatchField
// Use restart value if provided...
if (!this->readValueEntry(dict))
{
// Ensure field has reasonable initial values
this->extrapolateInternal();
// Evaluate to assign a value
this->evaluate();
}
}
@ -230,7 +234,7 @@ void Foam::uniformMixedFvPatchField<Type>::write(Ostream& os) const
valueFractionFunc_->writeData(os);
}
// Eg, for visualisation
// For visualisation / restart
fvPatchField<Type>::writeValueEntry(os);
}

View File

@ -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

View File

@ -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);
}

View File

@ -1,50 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef Foam_uniformMixedFvPatchFields_H
#define Foam_uniformMixedFvPatchFields_H
#include "uniformMixedFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(uniformMixed);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -86,7 +86,7 @@ Foam::variableHeightFlowRateFvPatchScalarField
if (!this->readValueEntry(dict))
{
// Fallback: set to the internal field
fvPatchField<scalar>::patchInternalField(*this);
this->extrapolateInternal();
}
this->refValue() = 0.0;

View File

@ -176,7 +176,7 @@ Foam::fvPatchField<Type>::fvPatchField
// For unmapped faces set to internal field value (zero-gradient)
if (notNull(iF) && mapper.hasUnmapped())
{
fvPatchField<Type>::patchInternalField(*this);
this->extrapolateInternal();
}
this->map(ptf, mapper);
}

View File

@ -160,7 +160,7 @@ externalCoupledTemperatureMixedFvPatchScalarField
// or extrapolated value
if (!this->readValueEntry(dict))
{
fvPatchField<scalar>::patchInternalField(*this);
fvPatchField<scalar>::extrapolateInternal();
}
// Initialise as a fixed value
@ -254,7 +254,7 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeData
const scalarField& Twall = *this;
// Fluid temperature [K]
tmp<scalarField> tfluid;
scalarField Tfluid(size());
if (refTempType_ == refTemperatureType::USER)
{
@ -262,16 +262,14 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeData
const scalar currTref =
Tref_->value(this->db().time().timeOutputValue());
tfluid = tmp<scalarField>::New(size(), currTref);
Tfluid = currTref;
}
else
{
// Near wall cell temperature
tfluid = patchInternalField();
this->patchInternalField(Tfluid);
}
const scalarField Tfluid(tfluid);
// Heat transfer coefficient [W/m2/K]
// This htc needs to be always larger or equal to zero
//const scalarField htc(qDot/max(Twall - Tfluid, 1e-3));

View File

@ -64,7 +64,7 @@ timeVaryingMappedFixedValuePointPatchField
const dictionary& dict
)
:
fixedValuePointPatchField<Type>(p, iF, dict, false),
fixedValuePointPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
setAverage_(dict.getOrDefault("setAverage", false)),
perturb_(dict.getOrDefault("perturb", 1e-5)),
fieldTableName_(iF.name()),

View File

@ -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);
}
// ************************************************************************* //

View File

@ -1,59 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::timeVaryingMappedFixedValuePointPatchFields
Description
SourceFiles
timeVaryingMappedFixedValuePointPatchFields.C
\*---------------------------------------------------------------------------*/
#ifndef timeVaryingMappedFixedValuePointPatchFields_H
#define timeVaryingMappedFixedValuePointPatchFields_H
#include "timeVaryingMappedFixedValuePointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(timeVaryingMappedFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -32,6 +32,9 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
// Alternative
// refCast<const facePointPatch>(p).patch()
template<class Type>
const Foam::polyPatch&
Foam::uniformFixedValuePointPatchField<Type>::getPatch(const pointPatch& p)
@ -87,6 +90,10 @@ uniformFixedValuePointPatchField
{
if (!this->readValueEntry(dict))
{
// Ensure field has reasonable initial values
this->extrapolateInternal();
// Evaluate to assign a value
this->evaluate();
}
}
@ -194,7 +201,7 @@ void Foam::uniformFixedValuePointPatchField<Type>::updateCoeffs()
}
const scalar t = this->db().time().timeOutputValue();
fixedValuePointPatchField<Type>::operator==(refValueFunc_->value(t));
valuePointPatchField<Type>::operator=(refValueFunc_->value(t));
fixedValuePointPatchField<Type>::updateCoeffs();
}

View File

@ -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

View File

@ -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);
}

View File

@ -1,58 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::uniformFixedValuePointPatchFields
Description
SourceFiles
uniformFixedValuePointPatchFields.C
\*---------------------------------------------------------------------------*/
#ifndef Foam_uniformFixedValuePointPatchFields_H
#define Foam_uniformFixedValuePointPatchFields_H
#include "uniformFixedValuePointPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(uniformFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -113,7 +113,7 @@ Foam::oversetFvPatchField<Type>::oversetFvPatchField
// Use 'value' supplied, or set to internal field
if (!this->readValueEntry(dict))
{
fvPatchField<Type>::patchInternalField(*this);
fvPatchField<Type>::extrapolateInternal();
}
}

View File

@ -80,7 +80,7 @@ timeVaryingMassSorptionFvPatchScalarField
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict, false),
fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ),
kabs_(dict.getCheck<scalar>("kabs", scalarMinMax::ge(0))),
max_(dict.getCheck<scalar>("max", scalarMinMax::ge(0))),
kdes_(dict.getCheckOrDefault<scalar>("kdes", 0, scalarMinMax::ge(0)))

View File

@ -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))

View File

@ -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))

View File

@ -166,7 +166,7 @@ Foam::waveMakerPointPatchVectorField::waveMakerPointPatchVectorField
const dictionary& dict
)
:
fixedValuePointPatchField<vector>(p, iF, dict, false),
fixedValuePointPatchField<vector>(p, iF, dict, IOobjectOption::NO_READ),
motionType_(motionTypeNames.get("motionType", dict)),
n_(dict.get<vector>("n")),
gHat_(Zero),