31 template<
class ModelType>
34 const phaseInterface& interface
37 if (interface.phase1().stationary() || interface.phase2().stationary())
40 <<
"A " << ModelType::typeName <<
" was specified for pair " 41 << interface.name() <<
", but one of these phases is stationary. " 42 <<
"Mass transfer is not supported on stationary phases" 62 wordListAndType(Istream& is)
70 inline Istream&
operator>>(Istream& is, wordListAndType<Type>& wlat)
72 return is >> wlat.wl >> wlat.t;
76 inline Ostream& operator<<(Ostream& os, const wordListAndType<Type>& wlat)
78 return os << wlat.wl << wlat.t;
82 inline bool operator==
84 const wordListAndType<Type>& a,
85 const wordListAndType<Type>&
b 88 return a.wl ==
b.wl && a.t ==
b.t;
92 inline bool operator!=
94 const wordListAndType<Type>& a,
95 const wordListAndType<Type>&
b 114 dict.merge(this->
subDict(name));
118 auto add = [&](
const word& sidePhaseName)
120 const word nameSidePhaseName =
123 if (!this->
found(nameSidePhaseName))
return;
127 List<wordListAndType<Type>> wlats(this->
lookup(nameSidePhaseName));
145 dict.add(keyword, wlats[i].t);
173 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
177 const dimensionSet& dims,
178 PtrList<GeometricField<Type, PatchField, GeoMesh>>& fieldList
183 if (fieldList.set(
phasei))
193 new GeometricField<Type, PatchField, GeoMesh>
202 dimensioned<Type>(
"zero", dims, pTraits<Type>::zero)
209 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
213 const dimensionSet& dims,
214 HashPtrTable<GeometricField<Type, PatchField, GeoMesh>>& fieldTable
221 if (fieldTable.set(phase.name()))
229 new GeometricField<Type, PatchField, GeoMesh>
238 dimensioned<Type>(
"zero", dims, pTraits<Type>::zero)
245 template<
class ModelType>
248 word name = ModelType::typeName;
252 if (i0 != word::npos)
255 if (i1 != word::npos)
257 name =
name(i0 + 1, i1 - i0 - 1);
262 if (
name(name.size() - 5, 5) ==
"Model")
264 name =
name(name.size() - 5);
271 template<
class ModelType,
class ... InterfaceTypes>
275 const phaseInterface& interface,
276 PtrList<phaseInterface>& interfaces,
277 PtrList<ModelType>& models
281 hashedWordList names;
282 PtrList<dictionary> dicts;
287 autoPtr<phaseInterface> modelInterfacePtr =
291 autoPtr<phaseInterface> interfacePtr;
295 && isA<InterfaceTypes>(modelInterfacePtr())
301 refCast<InterfaceTypes>(modelInterfacePtr())
308 if (!interfacePtr.valid())
311 <<
"Interface " << modelInterfacePtr->name()
312 <<
" is not of suitable type for construction of a " 313 << ModelType::typeName
326 const word name = interfacePtr->name();
327 if (!names.found(name))
331 interfaces.append(interfacePtr.ptr());
332 models.append(
nullptr);
336 dicts[names[
name]].add
338 modelInterfacePtr->name(),
351 template<
class ModelType>
359 phaseInterfaceKey::hash
364 PtrList<phaseInterface> listInterfaces;
365 PtrList<ModelType> listModels;
366 generateInterfacialModels<ModelType, phaseInterface>
369 NullObjectRef<phaseInterface>(),
377 models.insert(listInterfaces[i], listModels.set(i,
nullptr));
383 template<
class ModelType>
390 phaseInterfaceKey::hash
396 interfacialDict<dictionary>(modelName<ModelType>()),
402 template<
class ValueType>
406 HashTable<ValueType, phaseInterfaceKey, phaseInterfaceKey::hash>& values
411 autoPtr<phaseInterface> interfacePtr =
414 const ValueType value(pTraits<ValueType>(iter().stream()));
416 values.insert(interfacePtr(), value);
421 template<
class ValueType>
424 const word& valueName,
425 HashTable<ValueType, phaseInterfaceKey, phaseInterfaceKey::hash>& values
432 template<
class ModelType>
438 if (dict.size() != 1)
441 <<
"Too many matching entries for construction of a " 442 << ModelType::typeName <<
nl << dict.toc()
446 if (!dict.first()->isDict())
449 <<
"Non-sub-dictionary entries found for specification of a " 450 << ModelType::typeName
454 return dict.first()->dict();
458 template<
class ModelType>
461 const phaseInterface& interface
472 template<
class ModelType>
475 const phaseInterface& interface
493 template<
class GeoField,
class Group>
499 PtrList<GeoField>& fieldList
502 if (fieldList.set(group.index()))
504 fieldList[group.index()] +=
field;
521 template<
class GeoField,
class Group>
526 const GeoField& field,
527 PtrList<GeoField>& fieldList
530 addField(group, name, tmp<GeoField>(field), fieldList);
534 template<
class GeoField,
class Group>
540 HashPtrTable<GeoField>& fieldTable
543 if (fieldTable.found(group.name()))
545 *fieldTable[group.name()] +=
field;
562 template<
class GeoField,
class Group>
567 const GeoField& field,
568 HashPtrTable<GeoField>& fieldTable
571 addField(group, name, tmp<GeoField>(field), fieldTable);
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
static autoPtr< phaseInterface > New(const phaseSystem &fluid, const word &name)
Select given fluid and name.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
autoPtr< T > set(const label, const word &key, T *)
Set element to pointer provided and return old element.
friend Istream & operator>>(Istream &, dictionary &)
Read dictionary from Istream.
IOobject(const word &name, const fileName &instance, const objectRegistry ®istry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true)
Construct from name, instance, registry, io options.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m K].
bool foundObject(const word &name) const
Is the named Type found?
const Time & time() const
Return the top-level database.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
bool isDict(const word &) const
Check if entry is a sub-dictionary.
phaseModelList phaseModels_
Phase models.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
static const dictionary & modelSubDict(const dictionary &dict)
Return the dictionary from which to construct a low-level.
static word separator()
Return the separator that delimits this interface's name.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
dictionary()
Construct top-level dictionary null.
const phaseModelList & phases() const
Return the phase models.
const fileName & name() const
Return the dictionary name.
void generateInterfacialModels(const dictionary &dict, const phaseInterface &interface, PtrList< phaseInterface > &interfaces, PtrList< ModelType > &models) const
Generate interfacial-model lists.
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
A class for handling words, derived from string.
static word groupName(Name name, const word &group)
bool foundInterfacialModel(const phaseInterface &interface) const
Check availability of a sub model for a given interface.
static const word null
An empty word.
const fvMesh & mesh_
Reference to the mesh.
graph_traits< Graph >::vertices_size_type size_type
void generateInterfacialValues(const dictionary &dict, HashTable< ValueType, phaseInterfaceKey, phaseInterfaceKey::hash > &values) const
Generate interfacial-model tables.
static word oldNamePartsToName(const phaseSystem &fluid, const wordList &oldNameParts)
Convert old-format interface name parts to an interface name. Used.
dictionary interfacialDict(const word &name) const
Return the dictionary containing interfacial model or value.
bool notNull(const T &t)
Return true if t is not a reference to the nullObject of type T.
List< word > wordList
A List of words.
void fillFields(const word &name, const dimensionSet &dims, PtrList< GeometricField< Type, PatchField, GeoMesh >> &fieldList) const
Fill up gaps in a phase-indexed list of fields with zeros.
const ModelType & lookupInterfacialModel(const phaseInterface &interface) const
Return a sub model for an interface.
void validateMassTransfer(const phaseInterface &interface) const
Check that mass transfer is supported across the given interface.
const fvMesh & mesh() const
Return the mesh.
word modelName() const
Return the model name. This is the same as the model's typename.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.