1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "hReactionThermo.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 Foam::autoPtr<Foam::hReactionThermo> Foam::hReactionThermo::New
37 word hReactionThermoTypeName;
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") >> hReactionThermoTypeName;
58 Info<< "Selecting thermodynamics package " << hReactionThermoTypeName
61 fvMeshConstructorTable::iterator cstrIter =
62 fvMeshConstructorTablePtr_->find(hReactionThermoTypeName);
64 if (cstrIter == fvMeshConstructorTablePtr_->end())
66 FatalErrorIn("hReactionThermo::New(const fvMesh&)")
67 << "Unknown hReactionThermo type "
68 << hReactionThermoTypeName << nl << nl
69 << "Valid hReactionThermo types are:" << nl
70 << fvMeshConstructorTablePtr_->toc() << nl
74 return autoPtr<hReactionThermo>(cstrIter()(mesh));
78 Foam::autoPtr<Foam::hReactionThermo> Foam::hReactionThermo::NewType
81 const word& thermoType
84 word hReactionThermoTypeName;
86 // Enclose the creation of the thermophysicalProperties to ensure it is
87 // deleted before the turbulenceModel is created otherwise the dictionary
88 // is entered in the database twice
90 IOdictionary thermoDict
94 "thermophysicalProperties",
95 mesh.time().constant(),
102 thermoDict.lookup("thermoType") >> hReactionThermoTypeName;
104 if (hReactionThermoTypeName.find(thermoType) == string::npos)
106 wordList allModels = fvMeshConstructorTablePtr_->toc();
107 DynamicList<word> validModels;
110 if (allModels[i].find(thermoType) != string::npos)
112 validModels.append(allModels[i]);
118 "autoPtr<hReactionThermo> hReactionThermo::NewType"
123 ) << "Inconsistent thermo package selected:" << nl << nl
124 << hReactionThermoTypeName << nl << nl << "Please select a "
125 << "thermo package based on " << thermoType
126 << ". Valid options include:" << nl << validModels << nl
131 Info<< "Selecting thermodynamics package " << hReactionThermoTypeName
134 fvMeshConstructorTable::iterator cstrIter =
135 fvMeshConstructorTablePtr_->find(hReactionThermoTypeName);
137 if (cstrIter == fvMeshConstructorTablePtr_->end())
139 FatalErrorIn("hReactionThermo::New(const fvMesh&)")
140 << "Unknown hReactionThermo type "
141 << hReactionThermoTypeName << nl << nl
142 << "Valid hReactionThermo types are:" << nl
143 << fvMeshConstructorTablePtr_->toc() << nl
147 return autoPtr<hReactionThermo>(cstrIter()(mesh));
151 // ************************************************************************* //