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 "rhoChemistryModel.H"
29 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
31 Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
36 word rhoChemistryModelType;
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("rhoChemistryModel") >> 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 rhoChemistryModelType =
67 className + '<' + typeName + ',' + thermoTypeName + '>';
72 Info<< "Selecting rhoChemistryModel " << rhoChemistryModelType << endl;
76 Info<< "Selecting rhoChemistryModel " << userModel << endl;
79 fvMeshConstructorTable::iterator cstrIter =
80 fvMeshConstructorTablePtr_->find(rhoChemistryModelType);
82 if (cstrIter == fvMeshConstructorTablePtr_->end())
86 FatalErrorIn("rhoChemistryModelBase::New(const mesh&)")
87 << "Unknown rhoChemistryModel type " << rhoChemistryModelType
88 << nl << nl << "Valid rhoChemistryModel types are:" << nl
89 << fvMeshConstructorTablePtr_->toc() << nl << exit(FatalError);
93 wordList models = fvMeshConstructorTablePtr_->toc();
96 models[i] = models[i].replace(typeName + ',', "");
99 FatalErrorIn("rhoChemistryModelBase::New(const mesh&)")
100 << "Unknown rhoChemistryModel type " << userModel
101 << nl << nl << "Valid rhoChemistryModel types are:" << nl
102 << models << nl << exit(FatalError);
106 return autoPtr<rhoChemistryModel>
107 (cstrIter()(mesh, typeName, thermoTypeName));
111 // ************************************************************************* //