75 return phase1.
index() < phase2.
index() ? phase2 : phase1;
81 if (
findIndex(headSeparators_, separator) == -1)
83 headSeparators_.append(separator);
95 const word& oldSeparator,
99 return oldSeparatorToSeparator_.insert(oldSeparator, separator);
112 <<
"Could not parse interface name \""
121 label nPhaseNameParts = 0;
128 const word& phaseName =
129 fluid.
phases()[phasei].name();
132 phaseNamePart.size() < phaseName.size()
133 &&
name.size() - i >= phaseName.size()
134 &&
name(i, phaseName.size()) == phaseName
138 phaseNamePart = phaseName;
144 nameParts.
append(phaseNamePart);
145 i += phaseNamePart.size();
148 if (i ==
name.size())
break;
159 if (nPhaseNameParts == 0)
error();
162 if (i ==
name.size())
break;
166 if (j == word::npos)
error();
185 const wordList nameParts = nameToNameParts(fluid,
name);
188 forAll(separators, separatori)
190 separators[separatori] = nameParts[2*separatori + 1];
203 wordList separators(separatorsUnsorted);
210 static const word phaseName =
"<phase>";
212 forAll(separators, separatori)
217 + separators[separatori]
218 + (separators[separatori].empty() ?
"" :
"_")
233 return separatorsToTypeName(nameToSeparators(fluid,
name));
249 name.append(nameParts[i] +
"_");
270 name.append(oldNameParts[i] +
"_");
276 const word& oldSeparator = oldNameParts[i];
277 const word& separator = oldSeparatorToSeparator_[oldSeparator];
281 name.append(separator +
"_");
298 const wordList nameParts = nameToNameParts(fluid,
name);
300 label nameParti = -1;
301 bool multiple =
false;
302 for (
label namePartj = 1; namePartj < nameParts.
size() - 1; namePartj += 2)
304 forAll(separators, separatori)
306 if (nameParts[namePartj] == separators[separatori])
308 multiple = multiple || nameParti != -1;
309 nameParti = namePartj;
317 <<
"No matches identified in \"" <<
name
324 <<
"Multiple matches identified in \"" <<
name
331 fluid.
phases()[nameParts[nameParti - 1]],
332 fluid.
phases()[nameParts[nameParti + 1]]
346 (!strict || isType<phaseInterface>(interface))
347 && &phase1_ == &interface.phase1_
348 && &phase2_ == &interface.phase2_;
360 phase1_(getPhase1(phase1, phase2)),
361 phase2_(getPhase2(phase1, phase2))
414 wordConstructorTable::iterator cstrIter =
415 wordConstructorTablePtr_->find(nameToTypeName(fluid,
name));
417 if (cstrIter == wordConstructorTablePtr_->end())
420 <<
"Unknown phaseInterface type "
422 <<
"Valid phaseInterface types are : " <<
endl
423 << wordConstructorTablePtr_->sortedToc()
427 return cstrIter()(fluid,
name);
442 <<
"Could not combine interfaces " << interface1.
name()
447 const wordList nameParts1 = nameToNameParts(fluid, interface1.
name());
448 const wordList nameParts2 = nameToNameParts(fluid, interface2.
name());
451 const Pair<word> headNames1(nameParts1[0], nameParts1[2]);
452 const Pair<word> headNames2(nameParts2[0], nameParts2[2]);
453 const word& headSeparator1 = nameParts1[1];
454 const word& headSeparator2 = nameParts2[1];
456 const bool haveBothHeadSeparators =
460 (headNamesCompare == 0)
461 || (haveBothHeadSeparators && headSeparator1 != headSeparator2)
462 || (haveBothHeadSeparators && headNamesCompare != 1)
473 headSeparator1 !=
word::null ? nameParts1 : nameParts2,
479 for (
label i1 = 3; i1 < nameParts1.
size(); i1 += 2)
481 nameParts.
append(nameParts1[i1]);
482 nameParts.
append(nameParts1[i1 + 1]);
486 for (
label i2 = 3; i2 < nameParts2.
size(); i2 += 2)
489 for (
label i1 = 3; i1 < nameParts1.
size(); i1 += 2)
491 if (nameParts1[i1] == nameParts2[i2])
493 if (nameParts1[i1 + 1] != nameParts2[i2 + 1])
error();
499 nameParts.
append(nameParts2[i2]);
500 nameParts.
append(nameParts2[i2 + 1]);
505 return New(fluid, namePartsToName(fluid, nameParts));
513 return phase1().name() +
"_" + phase2().name();
519 return phase1()*phase1().rho() + phase2()*phase2().rho();
528 const phaseModel& otherPhase = this->otherPhase(phase);
536 return - otherPhase.
U();
540 return phase.
U() - otherPhase.
U();
547 return mag(Ur(phase1()));
556 const phaseModel& otherPhase = this->otherPhase(phase);
560 return phase.
DUDt() & phase.
U();
564 return - (otherPhase.
DUDt() & phase.
U());
569 (phase.
DUDt() & phase.
U())
570 - (otherPhase.
DUDt() & otherPhase.
U());
577 return fluid().sigma(*
this);
graph_traits< Graph >::vertices_size_type size_type
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
bool found(const word &) const
Search DictionaryBase for given keyword.
An STL-conforming hash table.
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
static int compare(const Pair< Type > &a, const Pair< Type > &b)
Compare two pairs. Return 0 if they are different, +1 if they are.
A List obtained as a section of another List.
A 2-tuple for storing two objects of different types.
T & last()
Return the last element of the list.
Class to handle errors and exceptions in a simple, consistent stream-based manner.
Word-pair based class used for keying interface models in hash tables.
Class to represent an interface between phases. Derivations can further specify the configuration of ...
static word oldNamePartsToName(const phaseSystem &fluid, const wordList &oldNameParts)
Convert old-format interface name parts to an interface name. Used.
static const phaseModel & getPhase1(const phaseModel &phase1, const phaseModel &phase2)
Get a reference to phase1 after sorting the phases by index.
static Tuple2< const phaseModel &, const phaseModel & > identifyPhases(const phaseSystem &fluid, const word &name, const wordList &separators)
Return references to the phases associated with a given name, and a.
const phaseSystem & fluid() const
Return the phase system.
virtual autoPtr< phaseInterface > clone() const
Clone function.
virtual word name() const
Name.
static wordList nameToNameParts(const phaseSystem &fluid, const word &name)
Split an interface name and return all its parts.
static word nameToTypeName(const phaseSystem &fluid, const word &name)
Convert an interface name into a type name. Essentially just.
static bool addHeadSeparator(const word &separator)
Add a head separator to the list.
virtual ~phaseInterface()
Destructor.
tmp< volScalarField > magUr() const
Relative velocity magnitude.
virtual bool same(const phaseInterface &interface, bool strict) const
Return true if the phase interfaces are the same.
static word separatorsToTypeName(const wordList &separators)
Convert a list of separators into a type name.
static const phaseModel & getPhase2(const phaseModel &phase1, const phaseModel &phase2)
Get a reference to phase2 after sorting the phases by index.
tmp< volVectorField > DUDtr(const phaseModel &phase) const
Convective acceleration of the phase relative to the other phase.
tmp< volScalarField > sigma() const
Surface tension coefficient.
tmp< volVectorField > Ur(const phaseModel &phase) const
Velocity of the phase relative to the other phase.
static wordList nameToSeparators(const phaseSystem &fluid, const word &name)
Split an interface name and return its separators.
phaseInterface(const phaseModel &phase1, const phaseModel &phase2)
Construct from phases.
static bool addOldSeparatorToSeparator(const word &oldSeparator, const word &separator)
Add a old separator to separator to the table.
tmp< volScalarField > rho() const
Average density.
static word namePartsToName(const phaseSystem &fluid, const wordList &nameParts)
Convert interface name parts to an interface name.
static autoPtr< phaseInterface > New(const phaseSystem &fluid, const word &name)
Select given fluid and name.
const phaseModel & phase1() const
Return phase 1.
const phaseModel & phase2() const
Return phase 2.
virtual tmp< fvVectorMatrix > DUDt() const =0
Return the substantive acceleration matrix.
virtual bool stationary() const =0
Return whether the phase is stationary.
label index() const
Return the index of the phase.
virtual tmp< volVectorField > U() const =0
Return the velocity.
Class to represent a system of phases.
const phaseModelList & phases() const
Return the phase models.
A class for managing temporary objects.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
static const word null
An empty word.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< word > wordList
A List of words.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
Ostream & endl(Ostream &os)
Add newline and flush stream.
defineTypeNameAndDebugWithName(dispersedDisplacedPhaseInterface, separatorsToTypeName({ dispersedPhaseInterface::separator(), displacedPhaseInterface::separator() }).c_str(), 0)
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
labelList second(const UList< labelPair > &p)
labelList first(const UList< labelPair > &p)
bool phaseInterfaceAddedHeadSeparator
defineRunTimeSelectionTable(fvConstraint, dictionary)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)