fvConstraints: Remove 'Constraint' from constraint names

The fact that these names refer to constraints is clear in context, so
the name does not need to contain 'Constraint'.

Having 'Constraint' in the name is a historic convention that dates back
to when fvConstraints and fvModels were combined in a single fvOptions
interface. In this interface, disambiguation between sources and
constraints was necessary.

This change has been applied to the 'fixedValue' and 'fixedTemperature'
constraints, which were formerly named 'fixedValueConstraint' and
'fixedTemperatureConstraint', respectively.

The old names are still available for backwards compatibility.
This commit is contained in:
Will Bainbridge
2023-10-12 15:25:47 +01:00
parent ad3d25dc30
commit 16ecc4fe08
12 changed files with 70 additions and 61 deletions

View File

@ -16,7 +16,8 @@ FoamFile
/* /*
fixedTemperature fixedTemperature
{ {
type fixedTemperatureConstraint; type fixedTemperature;
select all; select all;
mode uniform; mode uniform;

View File

@ -1,5 +1,5 @@
fixedValue/fixedValueConstraint.C fixedValue/fixedValueConstraint.C
fixedTemperature/fixedTemperatureConstraint.C fixedTemperature/fixedTemperature.C
limitTemperature/limitTemperature.C limitTemperature/limitTemperature.C
limitPressure/limitPressure.C limitPressure/limitPressure.C
limitMag/limitMag.C limitMag/limitMag.C

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fixedTemperatureConstraint.H" #include "fixedTemperature.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "fvMatrices.H" #include "fvMatrices.H"
#include "basicThermo.H" #include "basicThermo.H"
@ -33,33 +33,41 @@ License
namespace Foam namespace Foam
{ {
namespace fv namespace fv
{ {
defineTypeNameAndDebug(fixedTemperatureConstraint, 0); defineTypeNameAndDebug(fixedTemperature, 0);
addToRunTimeSelectionTable addToRunTimeSelectionTable
( (
fvConstraint, fvConstraint,
fixedTemperatureConstraint, fixedTemperature,
dictionary dictionary
); );
} addBackwardCompatibleToRunTimeSelectionTable
(
template<> fvConstraint,
const char* NamedEnum<fv::fixedTemperatureConstraint::temperatureMode, 2>:: fixedTemperature,
names[] = dictionary,
{ fixedTemperatureConstraint,
"uniform", "fixedTemperatureConstraint"
"lookup" );
}; }
} }
const Foam::NamedEnum<Foam::fv::fixedTemperatureConstraint::temperatureMode, 2>
Foam::fv::fixedTemperatureConstraint::modeNames_; namespace Foam
{
template<>
const char* NamedEnum<fv::fixedTemperature::temperatureMode, 2>::names[] =
{"uniform", "lookup"};
}
const Foam::NamedEnum<Foam::fv::fixedTemperature::temperatureMode, 2>
Foam::fv::fixedTemperature::modeNames_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::fv::fixedTemperatureConstraint::readCoeffs() void Foam::fv::fixedTemperature::readCoeffs()
{ {
mode_ = modeNames_.read(coeffs().lookup("mode")); mode_ = modeNames_.read(coeffs().lookup("mode"));
@ -91,7 +99,7 @@ void Foam::fv::fixedTemperatureConstraint::readCoeffs()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::fixedTemperatureConstraint::fixedTemperatureConstraint Foam::fv::fixedTemperature::fixedTemperature
( (
const word& name, const word& name,
const word& modelType, const word& modelType,
@ -112,7 +120,7 @@ Foam::fv::fixedTemperatureConstraint::fixedTemperatureConstraint
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::wordList Foam::fv::fixedTemperatureConstraint::constrainedFields() const Foam::wordList Foam::fv::fixedTemperature::constrainedFields() const
{ {
const basicThermo& thermo = const basicThermo& thermo =
mesh().lookupObject<basicThermo> mesh().lookupObject<basicThermo>
@ -124,7 +132,7 @@ Foam::wordList Foam::fv::fixedTemperatureConstraint::constrainedFields() const
} }
bool Foam::fv::fixedTemperatureConstraint::constrain bool Foam::fv::fixedTemperature::constrain
( (
fvMatrix<scalar>& eqn, fvMatrix<scalar>& eqn,
const word& fieldName const word& fieldName
@ -192,38 +200,32 @@ bool Foam::fv::fixedTemperatureConstraint::constrain
} }
bool Foam::fv::fixedTemperatureConstraint::movePoints() bool Foam::fv::fixedTemperature::movePoints()
{ {
set_.movePoints(); set_.movePoints();
return true; return true;
} }
void Foam::fv::fixedTemperatureConstraint::topoChange void Foam::fv::fixedTemperature::topoChange(const polyTopoChangeMap& map)
(
const polyTopoChangeMap& map
)
{ {
set_.topoChange(map); set_.topoChange(map);
} }
void Foam::fv::fixedTemperatureConstraint::mapMesh(const polyMeshMap& map) void Foam::fv::fixedTemperature::mapMesh(const polyMeshMap& map)
{ {
set_.mapMesh(map); set_.mapMesh(map);
} }
void Foam::fv::fixedTemperatureConstraint::distribute void Foam::fv::fixedTemperature::distribute(const polyDistributionMap& map)
(
const polyDistributionMap& map
)
{ {
set_.distribute(map); set_.distribute(map);
} }
bool Foam::fv::fixedTemperatureConstraint::read(const dictionary& dict) bool Foam::fv::fixedTemperature::read(const dictionary& dict)
{ {
if (fvConstraint::read(dict)) if (fvConstraint::read(dict))
{ {

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::fv::fixedTemperatureConstraint Foam::fv::fixedTemperature
Description Description
Fixed temperature equation constraint Fixed temperature equation constraint
@ -31,7 +31,7 @@ Usage
\verbatim \verbatim
fixedTemperature fixedTemperature
{ {
type fixedTemperatureConstraint; type fixedTemperature;
select all; select all;
@ -51,12 +51,12 @@ Usage
temperature by means of the Function1 type. temperature by means of the Function1 type.
SourceFiles SourceFiles
fixedTemperatureConstraint.C fixedTemperature.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef fixedTemperatureConstraint_H #ifndef fixedTemperature_H
#define fixedTemperatureConstraint_H #define fixedTemperature_H
#include "fvConstraint.H" #include "fvConstraint.H"
#include "fvCellSet.H" #include "fvCellSet.H"
@ -71,10 +71,10 @@ namespace fv
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class fixedTemperatureConstraint Declaration Class fixedTemperature Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class fixedTemperatureConstraint class fixedTemperature
: :
public fvConstraint public fvConstraint
{ {
@ -125,13 +125,13 @@ private:
public: public:
//- Runtime type information //- Runtime type information
TypeName("fixedTemperatureConstraint"); TypeName("fixedTemperature");
// Constructors // Constructors
//- Construct from components //- Construct from components
fixedTemperatureConstraint fixedTemperature
( (
const word& name, const word& name,
const word& modelType, const word& modelType,
@ -140,11 +140,11 @@ public:
); );
//- Disallow default bitwise copy construction //- Disallow default bitwise copy construction
fixedTemperatureConstraint(const fixedTemperatureConstraint&) = delete; fixedTemperature(const fixedTemperature&) = delete;
//- Destructor //- Destructor
virtual ~fixedTemperatureConstraint() virtual ~fixedTemperature()
{} {}
@ -179,7 +179,7 @@ public:
// Member Operators // Member Operators
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const fixedTemperatureConstraint&) = delete; void operator=(const fixedTemperature&) = delete;
}; };

View File

@ -43,6 +43,14 @@ namespace fv
fixedValueConstraint, fixedValueConstraint,
dictionary dictionary
); );
addBackwardCompatibleToRunTimeSelectionTable
(
fvConstraint,
fixedValueConstraint,
dictionary,
fixedValueConstraint,
"fixedValueConstraint"
);
} }
} }

View File

@ -104,7 +104,7 @@ class fixedValueConstraint
public: public:
//- Runtime type information //- Runtime type information
TypeName("fixedValueConstraint"); TypeName("fixedValue");
// Constructors // Constructors

View File

@ -4,9 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions # Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions . $WM_PROJECT_DIR/bin/tools/RunFunctions
application=$(getApplication)
runApplication blockMesh -dict $FOAM_TUTORIALS/resources/blockMesh/angledDuct runApplication blockMesh -dict $FOAM_TUTORIALS/resources/blockMesh/angledDuct
runApplication $application runApplication $(getApplication)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -24,7 +24,7 @@ limitp
fixedTemperature fixedTemperature
{ {
type fixedTemperatureConstraint; type fixedTemperature;
cellZone porosity; cellZone porosity;
@ -32,10 +32,9 @@ fixedTemperature
temperature 350; temperature 350;
} }
porosityTurbulence porosityTurbulence
{ {
type fixedValueConstraint; type fixedValue;
cellZone porosity; cellZone porosity;

View File

@ -24,7 +24,7 @@ limitp
source1 source1
{ {
type fixedTemperatureConstraint; type fixedTemperature;
cellZone porosity; cellZone porosity;

View File

@ -16,7 +16,8 @@ FoamFile
/* /*
fixedTemperature fixedTemperature
{ {
type fixedTemperatureConstraint; type fixedTemperature;
select all; select all;
mode uniform; mode uniform;

View File

@ -16,7 +16,7 @@ FoamFile
ignition ignition
{ {
type fixedTemperatureConstraint; type fixedTemperature;
cellSet ignition; cellSet ignition;

View File

@ -16,7 +16,7 @@ FoamFile
source1 source1
{ {
type fixedTemperatureConstraint; type fixedTemperature;
timeStart 0.1; timeStart 0.1;
duration 0.4; duration 0.4;