From 16ecc4fe08c27e7976f27a9dbe1ea3aae3adb190 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Thu, 12 Oct 2023 15:25:47 +0100 Subject: [PATCH] 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. --- .../templates/system/solid/fvConstraints | 3 +- src/fvConstraints/Make/files | 2 +- ...eratureConstraint.C => fixedTemperature.C} | 74 ++++++++++--------- ...eratureConstraint.H => fixedTemperature.H} | 24 +++--- .../fixedValue/fixedValueConstraint.C | 8 ++ .../fixedValue/fixedValueConstraint.H | 2 +- .../fluid/angledDuctExplicitFixedCoeff/Allrun | 4 +- .../system/fvConstraints | 5 +- .../angledDuctImplicit/system/fvConstraints | 2 +- .../templates/system/solid/fvConstraints | 3 +- .../reverseBurner/system/gas/fvConstraints | 2 +- .../simplifiedSiwek/system/fvConstraints | 2 +- 12 files changed, 70 insertions(+), 61 deletions(-) rename src/fvConstraints/fixedTemperature/{fixedTemperatureConstraint.C => fixedTemperature.C} (80%) rename src/fvConstraints/fixedTemperature/{fixedTemperatureConstraint.H => fixedTemperature.H} (89%) diff --git a/etc/templates/singleFluidCHT/templates/system/solid/fvConstraints b/etc/templates/singleFluidCHT/templates/system/solid/fvConstraints index 0c3aedf6ab..6ed01f19cd 100644 --- a/etc/templates/singleFluidCHT/templates/system/solid/fvConstraints +++ b/etc/templates/singleFluidCHT/templates/system/solid/fvConstraints @@ -16,7 +16,8 @@ FoamFile /* fixedTemperature { - type fixedTemperatureConstraint; + type fixedTemperature; + select all; mode uniform; diff --git a/src/fvConstraints/Make/files b/src/fvConstraints/Make/files index c1f91a76fc..eaec65c5b3 100644 --- a/src/fvConstraints/Make/files +++ b/src/fvConstraints/Make/files @@ -1,5 +1,5 @@ fixedValue/fixedValueConstraint.C -fixedTemperature/fixedTemperatureConstraint.C +fixedTemperature/fixedTemperature.C limitTemperature/limitTemperature.C limitPressure/limitPressure.C limitMag/limitMag.C diff --git a/src/fvConstraints/fixedTemperature/fixedTemperatureConstraint.C b/src/fvConstraints/fixedTemperature/fixedTemperature.C similarity index 80% rename from src/fvConstraints/fixedTemperature/fixedTemperatureConstraint.C rename to src/fvConstraints/fixedTemperature/fixedTemperature.C index 87183fefbe..04cdcc6af1 100644 --- a/src/fvConstraints/fixedTemperature/fixedTemperatureConstraint.C +++ b/src/fvConstraints/fixedTemperature/fixedTemperature.C @@ -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:: - names[] = - { - "uniform", - "lookup" - }; +namespace fv +{ + defineTypeNameAndDebug(fixedTemperature, 0); + addToRunTimeSelectionTable + ( + fvConstraint, + fixedTemperature, + dictionary + ); + addBackwardCompatibleToRunTimeSelectionTable + ( + fvConstraint, + fixedTemperature, + dictionary, + fixedTemperatureConstraint, + "fixedTemperatureConstraint" + ); +} } -const Foam::NamedEnum - Foam::fv::fixedTemperatureConstraint::modeNames_; + +namespace Foam +{ + template<> + const char* NamedEnum::names[] = + {"uniform", "lookup"}; +} + +const Foam::NamedEnum + 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 @@ -124,7 +132,7 @@ Foam::wordList Foam::fv::fixedTemperatureConstraint::constrainedFields() const } -bool Foam::fv::fixedTemperatureConstraint::constrain +bool Foam::fv::fixedTemperature::constrain ( fvMatrix& 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)) { diff --git a/src/fvConstraints/fixedTemperature/fixedTemperatureConstraint.H b/src/fvConstraints/fixedTemperature/fixedTemperature.H similarity index 89% rename from src/fvConstraints/fixedTemperature/fixedTemperatureConstraint.H rename to src/fvConstraints/fixedTemperature/fixedTemperature.H index 75c6bbae8e..d9b4ebd260 100644 --- a/src/fvConstraints/fixedTemperature/fixedTemperatureConstraint.H +++ b/src/fvConstraints/fixedTemperature/fixedTemperature.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . 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; }; diff --git a/src/fvConstraints/fixedValue/fixedValueConstraint.C b/src/fvConstraints/fixedValue/fixedValueConstraint.C index 646bc2efea..b58400e4f1 100644 --- a/src/fvConstraints/fixedValue/fixedValueConstraint.C +++ b/src/fvConstraints/fixedValue/fixedValueConstraint.C @@ -43,6 +43,14 @@ namespace fv fixedValueConstraint, dictionary ); + addBackwardCompatibleToRunTimeSelectionTable + ( + fvConstraint, + fixedValueConstraint, + dictionary, + fixedValueConstraint, + "fixedValueConstraint" + ); } } diff --git a/src/fvConstraints/fixedValue/fixedValueConstraint.H b/src/fvConstraints/fixedValue/fixedValueConstraint.H index d4e1f4a635..747a40aa9e 100644 --- a/src/fvConstraints/fixedValue/fixedValueConstraint.H +++ b/src/fvConstraints/fixedValue/fixedValueConstraint.H @@ -104,7 +104,7 @@ class fixedValueConstraint public: //- Runtime type information - TypeName("fixedValueConstraint"); + TypeName("fixedValue"); // Constructors diff --git a/tutorials/fluid/angledDuctExplicitFixedCoeff/Allrun b/tutorials/fluid/angledDuctExplicitFixedCoeff/Allrun index b1ec4b5486..3684922ac6 100755 --- a/tutorials/fluid/angledDuctExplicitFixedCoeff/Allrun +++ b/tutorials/fluid/angledDuctExplicitFixedCoeff/Allrun @@ -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) #------------------------------------------------------------------------------ diff --git a/tutorials/fluid/angledDuctExplicitFixedCoeff/system/fvConstraints b/tutorials/fluid/angledDuctExplicitFixedCoeff/system/fvConstraints index b95c0ac330..9ebb4489b8 100644 --- a/tutorials/fluid/angledDuctExplicitFixedCoeff/system/fvConstraints +++ b/tutorials/fluid/angledDuctExplicitFixedCoeff/system/fvConstraints @@ -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; diff --git a/tutorials/legacy/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvConstraints b/tutorials/legacy/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvConstraints index 0f5add094e..9f08a2f385 100644 --- a/tutorials/legacy/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvConstraints +++ b/tutorials/legacy/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvConstraints @@ -24,7 +24,7 @@ limitp source1 { - type fixedTemperatureConstraint; + type fixedTemperature; cellZone porosity; diff --git a/tutorials/multiRegion/CHT/coolingSphere/templates/system/solid/fvConstraints b/tutorials/multiRegion/CHT/coolingSphere/templates/system/solid/fvConstraints index 0c3aedf6ab..6ed01f19cd 100644 --- a/tutorials/multiRegion/CHT/coolingSphere/templates/system/solid/fvConstraints +++ b/tutorials/multiRegion/CHT/coolingSphere/templates/system/solid/fvConstraints @@ -16,7 +16,8 @@ FoamFile /* fixedTemperature { - type fixedTemperatureConstraint; + type fixedTemperature; + select all; mode uniform; diff --git a/tutorials/multiRegion/CHT/reverseBurner/system/gas/fvConstraints b/tutorials/multiRegion/CHT/reverseBurner/system/gas/fvConstraints index e5ec76194e..d957ef6a96 100644 --- a/tutorials/multiRegion/CHT/reverseBurner/system/gas/fvConstraints +++ b/tutorials/multiRegion/CHT/reverseBurner/system/gas/fvConstraints @@ -16,7 +16,7 @@ FoamFile ignition { - type fixedTemperatureConstraint; + type fixedTemperature; cellSet ignition; diff --git a/tutorials/multicomponentFluid/simplifiedSiwek/system/fvConstraints b/tutorials/multicomponentFluid/simplifiedSiwek/system/fvConstraints index c509a9f234..dcf29a5ff3 100644 --- a/tutorials/multicomponentFluid/simplifiedSiwek/system/fvConstraints +++ b/tutorials/multicomponentFluid/simplifiedSiwek/system/fvConstraints @@ -16,7 +16,7 @@ FoamFile source1 { - type fixedTemperatureConstraint; + type fixedTemperature; timeStart 0.1; duration 0.4;