From ba772772550b378c1d5d40f89f2684ba4c6e28ef Mon Sep 17 00:00:00 2001 From: Henry <Henry> Date: Mon, 24 Sep 2012 13:40:26 +0100 Subject: [PATCH] Thermodynamics: Added initial dictionary selection mechanism --- src/thermophysicalModels/basic/Make/files | 3 - .../basic/basicThermo/basicThermo.H | 4 -- .../basic/basicThermo/basicThermoNew.C | 71 ------------------- .../basic/fluidThermo/fluidThermo.H | 4 -- .../basic/fluidThermo/fluidThermoNew.C | 71 ------------------- .../basic/psiThermo/psiThermo/psiThermoNew.C | 55 +++++++++----- 6 files changed, 38 insertions(+), 170 deletions(-) delete mode 100644 src/thermophysicalModels/basic/basicThermo/basicThermoNew.C delete mode 100644 src/thermophysicalModels/basic/fluidThermo/fluidThermoNew.C diff --git a/src/thermophysicalModels/basic/Make/files b/src/thermophysicalModels/basic/Make/files index f49b474762a..d4ae65f2c14 100644 --- a/src/thermophysicalModels/basic/Make/files +++ b/src/thermophysicalModels/basic/Make/files @@ -2,10 +2,7 @@ mixtures/basicMixture/basicMixture.C mixtures/basicMixture/basicMixtures.C basicThermo/basicThermo.C -basicThermo/basicThermoNew.C - fluidThermo/fluidThermo.C -fluidThermo/fluidThermoNew.C psiThermo/psiThermo/psiThermo.C psiThermo/psiThermo/psiThermoNew.C diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index d25c9c1ef49..1d614b4d189 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -29,7 +29,6 @@ Description SourceFiles basicThermo.C - basicThermoNew.C \*---------------------------------------------------------------------------*/ @@ -102,9 +101,6 @@ public: basicThermo(const fvMesh&, const dictionary&); - //- Selector - static autoPtr<basicThermo> New(const fvMesh&); - //- Destructor virtual ~basicThermo(); diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermoNew.C b/src/thermophysicalModels/basic/basicThermo/basicThermoNew.C deleted file mode 100644 index e7dda0d9d54..00000000000 --- a/src/thermophysicalModels/basic/basicThermo/basicThermoNew.C +++ /dev/null @@ -1,71 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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/>. - -\*---------------------------------------------------------------------------*/ - -#include "basicThermo.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -Foam::autoPtr<Foam::basicThermo> Foam::basicThermo::New -( - const fvMesh& mesh -) -{ - // get model name, but do not register the dictionary - // otherwise it is registered in the database twice - const word modelType - ( - IOdictionary - ( - IOobject - ( - "thermophysicalProperties", - mesh.time().constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ).lookup("thermoType") - ); - - Info<< "Selecting thermodynamics package " << modelType << endl; - - fvMeshConstructorTable::iterator cstrIter = - fvMeshConstructorTablePtr_->find(modelType); - - if (cstrIter == fvMeshConstructorTablePtr_->end()) - { - FatalErrorIn("basicThermo::New(const fvMesh&)") - << "Unknown basicThermo type " << modelType << nl << nl - << "Valid basicThermo types are:" << nl - << fvMeshConstructorTablePtr_->sortedToc() << nl - << exit(FatalError); - } - - return autoPtr<basicThermo>(cstrIter()(mesh)); -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H index d1b7f23bdfb..8e3ba8f2dc2 100644 --- a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H +++ b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H @@ -29,7 +29,6 @@ Description SourceFiles fluidThermo.C - fluidThermoNew.C \*---------------------------------------------------------------------------*/ @@ -77,9 +76,6 @@ public: fluidThermo(const fvMesh&, const dictionary&); - //- Selector - static autoPtr<fluidThermo> New(const fvMesh&); - //- Destructor virtual ~fluidThermo(); diff --git a/src/thermophysicalModels/basic/fluidThermo/fluidThermoNew.C b/src/thermophysicalModels/basic/fluidThermo/fluidThermoNew.C deleted file mode 100644 index d6977a542a0..00000000000 --- a/src/thermophysicalModels/basic/fluidThermo/fluidThermoNew.C +++ /dev/null @@ -1,71 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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/>. - -\*---------------------------------------------------------------------------*/ - -#include "fluidThermo.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -Foam::autoPtr<Foam::fluidThermo> Foam::fluidThermo::New -( - const fvMesh& mesh -) -{ - // get model name, but do not register the dictionary - // otherwise it is registered in the database twice - const word modelType - ( - IOdictionary - ( - IOobject - ( - "thermophysicalProperties", - mesh.time().constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ).lookup("thermoType") - ); - - Info<< "Selecting thermodynamics package " << modelType << endl; - - fvMeshConstructorTable::iterator cstrIter = - fvMeshConstructorTablePtr_->find(modelType); - - if (cstrIter == fvMeshConstructorTablePtr_->end()) - { - FatalErrorIn("fluidThermo::New(const fvMesh&)") - << "Unknown fluidThermo type " << modelType << nl << nl - << "Valid fluidThermo types are:" << nl - << fvMeshConstructorTablePtr_->sortedToc() << nl - << exit(FatalError); - } - - return autoPtr<fluidThermo>(cstrIter()(mesh)); -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo/psiThermoNew.C b/src/thermophysicalModels/basic/psiThermo/psiThermo/psiThermoNew.C index 0329b366197..674cac054b9 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo/psiThermoNew.C +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo/psiThermoNew.C @@ -32,33 +32,54 @@ Foam::autoPtr<Foam::psiThermo> Foam::psiThermo::New const fvMesh& mesh ) { - // get model name, but do not register the dictionary - // otherwise it is registered in the database twice - const word modelType + IOdictionary thermoDict ( - IOdictionary + IOobject ( - IOobject - ( - "thermophysicalProperties", - mesh.time().constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ).lookup("thermoType") + "thermophysicalProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false + ) ); - Info<< "Selecting thermodynamics package " << modelType << endl; + word thermoTypeName; + + if (thermoDict.isDict("thermoType")) + { + const dictionary& thermoTypeDict(thermoDict.subDict("thermoType")); + + word type(thermoTypeDict.lookup("type")); + word mixture(thermoTypeDict.lookup("mixture")); + word transport(thermoTypeDict.lookup("transport")); + word thermo(thermoTypeDict.lookup("thermo")); + word equationOfState(thermoTypeDict.lookup("equationOfState")); + word energy(thermoTypeDict.lookup("energy")); + + thermoTypeName = + type + '<' + + mixture + '<' + + transport + "<specieThermo<" + + thermo + '<' + + equationOfState + ">," + + energy + ">>>>"; + } + else + { + thermoTypeName = word(thermoDict.lookup("thermoType")); + } + + Info<< "Selecting thermodynamics package " << thermoTypeName << endl; fvMeshConstructorTable::iterator cstrIter = - fvMeshConstructorTablePtr_->find(modelType); + fvMeshConstructorTablePtr_->find(thermoTypeName); if (cstrIter == fvMeshConstructorTablePtr_->end()) { FatalErrorIn("psiThermo::New(const fvMesh&)") - << "Unknown psiThermo type " << modelType << nl << nl + << "Unknown psiThermo type " << thermoTypeName << nl << nl << "Valid psiThermo types are:" << nl << fvMeshConstructorTablePtr_->sortedToc() << nl << exit(FatalError); -- GitLab