1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "hCombustionThermo.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 Foam::autoPtr<Foam::hCombustionThermo> Foam::hCombustionThermo::New
34 const objectRegistry& obj
37 word hCombustionThermoTypeName;
39 // Enclose the creation of the thermophysicalProperties to ensure it is
40 // deleted before the turbulenceModel is created otherwise the dictionary
41 // is entered in the database twice
43 IOdictionary thermoDict
47 "thermophysicalProperties",
48 mesh.time().constant(),
55 thermoDict.lookup("thermoType") >> hCombustionThermoTypeName;
58 Info<< "Selecting thermodynamics package " << hCombustionThermoTypeName
61 fvMeshConstructorTable::iterator cstrIter =
62 fvMeshConstructorTablePtr_->find(hCombustionThermoTypeName);
64 if (cstrIter == fvMeshConstructorTablePtr_->end())
66 FatalErrorIn("hCombustionThermo::New(const fvMesh&, const objectRegistry&)")
67 << "Unknown hCombustionThermo type "
68 << hCombustionThermoTypeName << nl << nl
69 << "Valid hCombustionThermo types are:" << nl
70 << fvMeshConstructorTablePtr_->sortedToc() << nl
74 return autoPtr<hCombustionThermo>(cstrIter()(mesh, obj));
78 Foam::autoPtr<Foam::hCombustionThermo> Foam::hCombustionThermo::NewType
81 const objectRegistry& obj,
82 const word& thermoType
85 word hCombustionThermoTypeName;
87 // Enclose the creation of the thermophysicalProperties to ensure it is
88 // deleted before the turbulenceModel is created otherwise the dictionary
89 // is entered in the database twice
91 IOdictionary thermoDict
95 "thermophysicalProperties",
96 mesh.time().constant(),
103 thermoDict.lookup("thermoType") >> hCombustionThermoTypeName;
105 if (hCombustionThermoTypeName.find(thermoType) == string::npos)
107 wordList allModels = fvMeshConstructorTablePtr_->sortedToc();
108 DynamicList<word> validModels;
111 if (allModels[i].find(thermoType) != string::npos)
113 validModels.append(allModels[i]);
119 "autoPtr<hCombustionThermo> hCombustionThermo::NewType"
122 "const objectRegistry& obj, "
125 ) << "Inconsistent thermo package selected:" << nl << nl
126 << hCombustionThermoTypeName << nl << nl << "Please select a "
127 << "thermo package based on " << thermoType
128 << ". Valid options include:" << nl << validModels << nl
133 Info<< "Selecting thermodynamics package " << hCombustionThermoTypeName
136 fvMeshConstructorTable::iterator cstrIter =
137 fvMeshConstructorTablePtr_->find(hCombustionThermoTypeName);
139 if (cstrIter == fvMeshConstructorTablePtr_->end())
141 FatalErrorIn("hCombustionThermo::New(const fvMesh&, const objectRegistry&)")
142 << "Unknown hCombustionThermo type "
143 << hCombustionThermoTypeName << nl << nl
144 << "Valid hCombustionThermo types are:" << nl
145 << fvMeshConstructorTablePtr_->sortedToc() << nl
149 return autoPtr<hCombustionThermo>(cstrIter()(mesh, obj));
153 // ************************************************************************* //