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
{
type fixedTemperatureConstraint;
type fixedTemperature;
select all;
mode uniform;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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