43 { solverType::stCompressible,
"compressible" },
44 { solverType::stIncompressible,
"incompressible" },
45 { solverType::stBuoyant,
"buoyant" },
46 { solverType::stUnknown,
"unknown" },
58 if (!dictHeader.typeHeaderOk<IOdictionary>(
true))
61 <<
"Unable to open file " 62 << dictHeader.objectPath()
66 IOdictionary
dict(dictHeader);
67 return dict.get<word>(entryName);
74 const fileName& baseDir,
75 const dictionary& solverDict,
79 Info<<
" Reading fluid field templates";
87 dictionary fieldTemplates = solverDict.subDict(
"fluidFields");
89 const fileName turbModelDir(baseDir/
"models"/
"turbulence");
91 const dictionary fieldModels(solverDict.subDict(
"fluidModels"));
93 word turbModel(
"laminar");
94 word turbType(
"none");
96 if (fieldModels.readIfPresent(
"turbulenceModel", turbType))
98 if (turbType ==
"turbulenceModel")
100 IOdictionary turbPropDict
105 "turbulenceProperties",
115 const word modelType(turbPropDict.get<word>(
"simulationType"));
117 if (modelType ==
"laminar")
121 else if (modelType ==
"RAS")
124 turbPropDict.subDict(modelType)
125 .readCompat(
"model", {{
"RASModel", -2006}}, turbModel);
127 else if (modelType ==
"LES")
130 turbPropDict.subDict(modelType)
131 .readCompat(
"model", {{
"LESModel", -2006}}, turbModel);
136 <<
"Unhandled turbulence model option " << modelType
137 <<
". Valid options are laminar, RAS, LES" 144 <<
"Unhandled turbulence model option " << turbType
145 <<
". Valid options are turbulenceModel" 150 Info<<
" Selecting " << turbType <<
": " << turbModel <<
endl;
152 IOdictionary turbModelDict
156 fileName(turbModelDir/turbModel),
163 fieldTemplates.merge(turbModelDict.subDict(
"fluidFields"));
168 case stIncompressible:
170 fieldTemplates.merge(turbModelDict.subDict(
"incompressibleFields"));
176 fieldTemplates.merge(turbModelDict.subDict(
"compressibleFields"));
185 return fieldTemplates;
192 const dictionary& solverDict
199 return solverDict.subDict(
"solidFields");
203 void Foam::solverTemplate::setRegionProperties
205 const dictionary& fieldDict,
206 const word& regionType,
211 regionTypes_[regionI] = regionType,
213 fieldNames_[regionI] = fieldDict.toc();
214 fieldTypes_[regionI].setSize(fieldNames_[regionI].size());
215 fieldDimensions_[regionI].setSize(fieldNames_[regionI].size());
217 forAll(fieldNames_[regionI], i)
219 const word& fieldName = fieldNames_[regionI][i];
223 fieldDimensions_[regionI].set
226 new dimensionSet(
"dimensions",
dict)
236 const fileName& baseDir,
238 const word& solverName
241 solverType_(stUnknown),
248 IOdictionary solverDict
252 fileName(baseDir/
"solvers"/solverName),
258 Info<<
"Selecting " << solverName <<
": ";
260 solverType_ = solverTypeNames_.get(
"solverType", solverDict);
261 multiRegion_ = solverDict.get<
bool>(
"multiRegion");
263 Info<< solverTypeNames_[solverType_];
266 Info<<
", multi-region";
270 Info<<
", single-region";
285 regionTypes_.setSize(nRegion);
286 regionNames_.setSize(nRegion);
287 fieldNames_.setSize(nRegion);
288 fieldTypes_.setSize(nRegion);
289 fieldDimensions_.setSize(nRegion);
299 readFluidFieldTemplates
308 setRegionProperties(fieldDict,
"fluid",
fluidNames[i], regionI++);
315 readSolidFieldTemplates
321 setRegionProperties(fieldDict,
"solid",
solidNames[i], regionI++);
326 regionTypes_.setSize(1);
327 regionNames_.setSize(1);
328 fieldNames_.setSize(1);
329 fieldTypes_.setSize(1);
330 fieldDimensions_.setSize(1);
337 readFluidFieldTemplates
346 setRegionProperties(fieldDict,
"fluid",
word::null, 0);
355 return solverTypeNames_[solverType_];
367 return regionTypes_.size();
373 return regionTypes_[regionI];
379 return regionNames_[regionI];
388 return fieldNames_[regionI];
397 return fieldTypes_[regionI];
406 return fieldDimensions_[regionI];
errorManipArg< error, int > exit(error &err, const int errNo=1)
solverTemplate(const fileName &baseDir, const Time &runTime, const word ®ionName)
Constructor.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
word type() const
Solver type name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const word & regionType(const label regionI) const
Return the region type.
const wordList solidNames(rp["solid"])
Ignore writing from objectRegistry::writeObject()
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
label nRegion() const
Return the number of regions.
#define forAll(list, i)
Loop across all elements in list.
const wordList & fieldNames(const label regionI) const
Return the field names.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect...
A class for handling words, derived from Foam::string.
static const Enum< solverType > solverTypeNames_
Solver type names.
regionProperties rp(runTime)
const PtrList< dimensionSet > & fieldDimensions(const label regionI) const
Return the field dimensions.
bool multiRegion() const
Return the multi-region flag.
static const word null
An empty word.
const word & constant() const noexcept
Return constant name.
List< word > wordList
List of word.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
messageStream Info
Information stream (stdout output on master, null elsewhere)
const wordList & fieldTypes(const label regionI) const
Return the field types.
const wordList fluidNames(rp["fluid"])
Do not request registration (bool: false)
const word & regionName(const label regionI) const
Return the region name.