38 const fileName& baseDir,
40 const word& solverType
46 Info<<
" Reading boundary templates" <<
endl;
48 fileName BCDir(baseDir/
"boundaryConditions");
50 IOdictionary regionBCs
54 fileName(BCDir/
"boundaries"),
60 for (
const entry& dEntry : regionBCs)
62 const word& regionType = dEntry.keyword();
89 fileName(BCDir/regionType/solverType/
patchTypes[i]),
94 if (
io.typeHeaderOk<IOdictionary>(
true))
104 fileName optFile(BCDir/regionType/
patchTypes[i] +
"Options");
106 IFstream is(optFile);
131 BCDir/regionType/solverType/
patchTypes[i] +
"Options" 134 IFstream is(optFile);
152 templates_.add(regionType, regionTemplate);
153 options_.add(regionType, regionOptions);
168 const word& regionPrefix,
169 const word& fieldName,
170 const word& condition,
171 const word& category,
172 const word& patchType,
173 const dictionary& conditionOptions
176 const dictionary& regionTemplates = templates_.subDict(regionPrefix);
179 if (regionTemplates.found(category))
181 const dictionary& categoryDict = regionTemplates.subDict(category);
184 if (categoryDict.found(patchType))
186 dictionary patchDict = categoryDict.subDict(patchType);
189 if (patchDict.found(
"OPTIONS"))
192 options_.subDict(regionPrefix);
194 if (!regionOptions.found(category))
197 <<
"No options available for category " 203 const wordList requiredOptions(patchDict.lookup(
"OPTIONS"));
205 for (
const word& option : requiredOptions)
208 if (!conditionOptions.readIfPresent(option, selected))
211 <<
"Condition " << condition <<
": " 212 <<
"No option '" << option
213 <<
"' available for category '" << category
214 <<
"' and patch type '" << patchType
215 <<
"'. Valid options are: " 216 << conditionOptions.toc()
223 <<
"Condition " << condition <<
": " 224 <<
"No option '" << option
225 <<
"' available for category '" << category
226 <<
"' and patch type '" << patchType
227 <<
"'. Valid options are " <<
dict.
toc()
233 if (!optionDict.found(selected))
236 <<
"Condition " << condition <<
": " 237 <<
"No option '" << selected
238 <<
"' available for category '" << category
239 <<
"' and patch type '" << patchType
240 <<
"'. Valid options are " << optionDict.toc()
251 if (patchDict.found(fieldName))
254 const dictionary& fieldDict = patchDict.subDict(fieldName);
256 for (
const entry& dEntry : fieldDict)
262 s.replace(dEntry.keyword(),
"");
266 "boundaryConditions." + condition +
".values" 268 dict.
add(dEntry.keyword(),
s.c_str());
276 <<
"Condition " << condition <<
": " 277 <<
"No '" << patchType
278 <<
"' condition found for field '" << fieldName
279 <<
"' in category type '" << category <<
"'" 286 <<
"Condition " << condition <<
": " 287 <<
"No '" << patchType <<
"' boundary types defined in " 288 << categoryDict.dictName() <<
" templates. " 289 <<
"Available types are: " << categoryDict.toc()
296 <<
"Condition " << condition <<
": " 297 <<
"Invalid boundary condition type '" << patchType
298 <<
"'. Valid types are:" << regionTemplates.toc()
308 const word& regionPrefix,
309 const word& condition,
310 const word& category,
311 const word& patchType
314 const dictionary& regionTemplates = templates_.subDict(regionPrefix);
316 if (!regionTemplates.found(category))
319 <<
"Condition " << condition <<
": " 320 <<
"Unknown category '" << category
321 <<
"'. Valid categories are: " << regionTemplates.toc()
325 const dictionary& categoryDict = regionTemplates.subDict(category);
327 if (!categoryDict.found(patchType))
330 <<
"Condition " << condition <<
": " 331 <<
"Unknown type '" << patchType <<
"' in category '" 332 << category <<
"'. Valid types are: " << categoryDict.toc()
340 const word& regionPrefix,
341 const word& category,
342 const word& patchType
345 const dictionary& regionTemplates = templates_.subDict(regionPrefix);
347 if (regionTemplates.found(category))
349 const dictionary& categoryDict = regionTemplates.subDict(category);
351 if (categoryDict.found(patchType))
353 const dictionary& patchDict = categoryDict.subDict(patchType);
355 if (patchDict.found(
"OPTIONS"))
363 <<
"No type '" << patchType <<
"' found in category '" 364 << category <<
"'. Valid types are " 365 << categoryDict.toc()
372 <<
"No category '" << category <<
"' found in templates. " 373 <<
"Valid categories are " << templates_.toc()
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
Input/output from string buffers.
wordList patchTypes(nPatches)
Ostream & endl(Ostream &os)
Add newline and flush stream.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
boundaryTemplates(const fileName &baseDir, const Time &runTime, const word &solverType)
Constructor.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
wordList toc() const
Return the table of contents.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
#define forAll(list, i)
Loop across all elements in list.
bool merge(const dictionary &dict)
Merge entries from the given dictionary.
dictionary generatePatchDict(const word ®ionPrefix, const word &fieldName, const word &condition, const word &category, const word &patchType, const dictionary &conditionOptions) const
Generate a dictionary representation of patch boundary condition.
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
bool optionsRequired(const word ®ionPrefix, const word &category, const word &patchType) const
Return true if condition requires additional user options.
const dictionary & templates() const
Return the dictionary of boundary templates.
List< word > wordList
List of word.
messageStream Info
Information stream (stdout output on master, null elsewhere)
void checkPatch(const word ®ionPrefix, const word &condition, const word &category, const word &patchType) const
Check that user supplied patch info is valid.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))