1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "hCombustionThermo.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 Foam::autoPtr<Foam::hCombustionThermo> Foam::hCombustionThermo::New
36 // get model name, but do not register the dictionary
37 // otherwise it is registered in the database twice
44 "thermophysicalProperties",
45 mesh.time().constant(),
47 IOobject::MUST_READ_IF_MODIFIED,
51 ).lookup("thermoType")
54 Info<< "Selecting thermodynamics package " << modelType << endl;
56 fvMeshConstructorTable::iterator cstrIter =
57 fvMeshConstructorTablePtr_->find(modelType);
59 if (cstrIter == fvMeshConstructorTablePtr_->end())
61 FatalErrorIn("hCombustionThermo::New(const fvMesh&)")
62 << "Unknown hCombustionThermo type "
63 << modelType << nl << nl
64 << "Valid hCombustionThermo types are:" << nl
65 << fvMeshConstructorTablePtr_->sortedToc() << nl
69 return autoPtr<hCombustionThermo>(cstrIter()(mesh));
73 Foam::autoPtr<Foam::hCombustionThermo> Foam::hCombustionThermo::NewType
76 const word& thermoType
79 // get model name, but do not register the dictionary
80 // otherwise it is registered in the database twice
87 "thermophysicalProperties",
88 mesh.time().constant(),
90 IOobject::MUST_READ_IF_MODIFIED,
94 ).lookup("thermoType")
98 if (modelType.find(thermoType) == string::npos)
100 wordList allModels = fvMeshConstructorTablePtr_->sortedToc();
101 DynamicList<word> validModels;
104 if (allModels[i].find(thermoType) != string::npos)
106 validModels.append(allModels[i]);
112 "autoPtr<hCombustionThermo> hCombustionThermo::NewType"
117 ) << "Inconsistent thermo package selected:" << nl << nl
118 << modelType << nl << nl << "Please select a "
119 << "thermo package based on " << thermoType
120 << ". Valid options include:" << nl << validModels << nl
124 Info<< "Selecting thermodynamics package " << modelType << endl;
126 fvMeshConstructorTable::iterator cstrIter =
127 fvMeshConstructorTablePtr_->find(modelType);
129 if (cstrIter == fvMeshConstructorTablePtr_->end())
133 "autoPtr<hCombustionThermo> hCombustionThermo::NewType"
138 ) << "Unknown hCombustionThermo type "
139 << modelType << nl << nl
140 << "Valid hCombustionThermo types are:" << nl
141 << fvMeshConstructorTablePtr_->sortedToc() << nl
145 return autoPtr<hCombustionThermo>(cstrIter()(mesh));
149 // ************************************************************************* //