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 "psiChemistryModel.H"
29 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
31 Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
36 word psiChemistryModelType;
40 // Enclose the creation of the chemistrtyProperties to ensure it is
41 // deleted before the chemistrtyProperties is created otherwise the
42 // dictionary is entered in the database twice
44 IOdictionary chemistryPropertiesDict
48 "chemistryProperties",
49 mesh.time().constant(),
56 chemistryPropertiesDict.lookup("psiChemistryModel") >> userModel;
58 // construct chemistry model type name by inserting first template
60 label tempOpen = userModel.find('<');
61 label tempClose = userModel.find('>');
63 word className = userModel(0, tempOpen);
64 thermoTypeName = userModel(tempOpen + 1, tempClose - tempOpen - 1);
66 psiChemistryModelType =
67 className + '<' + typeName + ',' + thermoTypeName + '>';
72 Info<< "Selecting psiChemistryModel " << psiChemistryModelType << endl;
76 Info<< "Selecting psiChemistryModel " << userModel << endl;
79 fvMeshConstructorTable::iterator cstrIter =
80 fvMeshConstructorTablePtr_->find(psiChemistryModelType);
82 if (cstrIter == fvMeshConstructorTablePtr_->end())
86 FatalErrorIn("psiChemistryModelBase::New(const mesh&)")
87 << "Unknown psiChemistryModel type " << psiChemistryModelType
88 << nl << nl << "Valid psiChemistryModel types are:" << nl
89 << fvMeshConstructorTablePtr_->toc() << nl << exit(FatalError);
93 wordList models = fvMeshConstructorTablePtr_->toc();
96 models[i] = models[i].replace(typeName + ',', "");
99 FatalErrorIn("psiChemistryModelBase::New(const mesh&)")
100 << "Unknown psiChemistryModel type " << userModel
101 << nl << nl << "Valid psiChemistryModel types are:" << nl
102 << models << nl << exit(FatalError);
106 return autoPtr<psiChemistryModel>
107 (cstrIter()(mesh, typeName, thermoTypeName));
111 // ************************************************************************* //