Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "hsCombustionThermo.H"
00027 #include <finiteVolume/fvMesh.H>
00028
00029
00030
00031 Foam::autoPtr<Foam::hsCombustionThermo> Foam::hsCombustionThermo::New
00032 (
00033 const fvMesh& mesh
00034 )
00035 {
00036 word hsCombustionThermoTypeName;
00037
00038
00039
00040
00041 {
00042 IOdictionary thermoDict
00043 (
00044 IOobject
00045 (
00046 "thermophysicalProperties",
00047 mesh.time().constant(),
00048 mesh,
00049 IOobject::MUST_READ,
00050 IOobject::NO_WRITE
00051 )
00052 );
00053
00054 thermoDict.lookup("thermoType") >> hsCombustionThermoTypeName;
00055 }
00056
00057 Info<< "Selecting thermodynamics package " << hsCombustionThermoTypeName
00058 << endl;
00059
00060 fvMeshConstructorTable::iterator cstrIter =
00061 fvMeshConstructorTablePtr_->find(hsCombustionThermoTypeName);
00062
00063 if (cstrIter == fvMeshConstructorTablePtr_->end())
00064 {
00065 FatalErrorIn("hsCombustionThermo::New(const fvMesh&)")
00066 << "Unknown hsCombustionThermo type "
00067 << hsCombustionThermoTypeName << nl << nl
00068 << "Valid hsCombustionThermo types are:" << nl
00069 << fvMeshConstructorTablePtr_->sortedToc() << nl
00070 << exit(FatalError);
00071 }
00072
00073 return autoPtr<hsCombustionThermo>(cstrIter()(mesh));
00074 }
00075
00076
00077 Foam::autoPtr<Foam::hsCombustionThermo> Foam::hsCombustionThermo::NewType
00078 (
00079 const fvMesh& mesh,
00080 const word& thermoType
00081 )
00082 {
00083 word hsCombustionThermoTypeName;
00084
00085
00086
00087
00088 {
00089 IOdictionary thermoDict
00090 (
00091 IOobject
00092 (
00093 "thermophysicalProperties",
00094 mesh.time().constant(),
00095 mesh,
00096 IOobject::MUST_READ,
00097 IOobject::NO_WRITE
00098 )
00099 );
00100
00101 thermoDict.lookup("thermoType") >> hsCombustionThermoTypeName;
00102
00103 if (hsCombustionThermoTypeName.find(thermoType) == string::npos)
00104 {
00105 wordList allModels = fvMeshConstructorTablePtr_->sortedToc();
00106 DynamicList<word> validModels;
00107 forAll(allModels, i)
00108 {
00109 if (allModels[i].find(thermoType) != string::npos)
00110 {
00111 validModels.append(allModels[i]);
00112 }
00113 }
00114
00115 FatalErrorIn
00116 (
00117 "autoPtr<hsCombustionThermo> hsCombustionThermo::NewType"
00118 "("
00119 "const fvMesh&, "
00120 "const word&"
00121 ")"
00122 ) << "Inconsistent thermo package selected:" << nl << nl
00123 << hsCombustionThermoTypeName << nl << nl << "Please select a "
00124 << "thermo package based on " << thermoType
00125 << ". Valid options include:" << nl << validModels << nl
00126 << exit(FatalError);
00127 }
00128 }
00129
00130 Info<< "Selecting thermodynamics package " << hsCombustionThermoTypeName
00131 << endl;
00132
00133 fvMeshConstructorTable::iterator cstrIter =
00134 fvMeshConstructorTablePtr_->find(hsCombustionThermoTypeName);
00135
00136 if (cstrIter == fvMeshConstructorTablePtr_->end())
00137 {
00138 FatalErrorIn("hsCombustionThermo::New(const fvMesh&)")
00139 << "Unknown hsCombustionThermo type "
00140 << hsCombustionThermoTypeName << nl << nl
00141 << "Valid hsCombustionThermo types are:" << nl
00142 << fvMeshConstructorTablePtr_->sortedToc() << nl
00143 << exit(FatalError);
00144 }
00145
00146 return autoPtr<hsCombustionThermo>(cstrIter()(mesh));
00147 }
00148
00149
00150