fvPatchFields: Removed all fvPatchFields requiring user specified data from the null-constructor table

This avoids potential hidden run-time errors caused by solvers running with
boundary conditions which are not fully specified.  Note that "null-constructor"
here means the constructor from patch and internal field only, no data is
provided.

Constraint and simple BCs such as 'calculated', 'zeroGradient' and others which
do not require user input to fully specify their operation remain on the
null-constructor table for the construction of fields with for example all
'calculated' or all 'zeroGradient' BCs.

A special version of the 'inletOutlet' fvPatchField named 'zeroInletOutlet' has
been added in which the inlet value is hard-coded to zero which allows this BC
to be included on the null-constructor table.  This is useful for the 'age'
functionObject to avoid the need to provide the 'age' volScalarField at time 0
unless special inlet or outlet BCs are required.  Also for isothermalFilm in
which the 'alpha' field is created automatically from the 'delta' field if it is
not present and can inherit 'zeroInletOutlet' from 'delta' if appropriate.  If a
specific 'inletValue' is require or other more complex BCs then the 'alpha'
field file must be provided to specify these BCs as before.

Following this improvement it will now be possible to remove the
null-constructors from all fvPatchFields not added to the null-constructor
table, which is most of them, thus reducing the amount of code and maintenance
overhead and making easier and more obvious to write new fvPatchField types.
This commit is contained in:
Henry Weller
2023-05-27 16:56:10 +01:00
parent 4f7c114039
commit ca72b0a963
74 changed files with 500 additions and 333 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2018-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -29,7 +29,7 @@ License
#include "fvModels.H"
#include "fvConstraints.H"
#include "momentumTransportModel.H"
#include "inletOutletFvPatchField.H"
#include "zeroInletOutletFvPatchField.H"
#include "wallFvPatch.H"
#include "zeroGradientFvPatchField.H"
#include "addToRunTimeSelectionTable.H"
@ -53,7 +53,7 @@ Foam::wordList Foam::functionObjects::age::patchTypes() const
wordList result
(
mesh_.boundary().size(),
inletOutletFvPatchField<scalar>::typeName
zeroInletOutletFvPatchField<scalar>::typeName
);
forAll(mesh_.boundary(), patchi)
@ -167,12 +167,6 @@ bool Foam::functionObjects::age::execute()
Foam::fvConstraints::New(mesh_)
);
// This only works because the null constructed inletValue for an
// inletOutletFvPatchField is zero. If we needed any other value we would
// have to loop over the inletOutlet patches and explicitly set the
// inletValues. We would need to change the interface of inletOutlet in
// order to do this.
const surfaceScalarField& phi =
mesh_.lookupObject<surfaceScalarField>(phiName_);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -76,7 +76,7 @@ Usage
\endtable
Note:
Cp and rho are required only for incompressible flow calclulations.
Cp and rho are required only for incompressible flow calculations.
SourceFiles
ReynoldsAnalogy.C