74 return phase1.
index() < phase2.
index() ? phase2 : phase1;
80 if (
findIndex(headSeparators_, separator) == -1)
82 headSeparators_.append(separator);
94 const word& oldSeparator,
98 return oldSeparatorToSeparator_.insert(oldSeparator, separator);
111 <<
"Could not parse interface name \""
120 label nPhaseNameParts = 0;
127 const word& phaseName =
128 fluid.
phases()[phasei].name();
131 phaseNamePart.size() < phaseName.size()
132 &&
name.size() - i >= phaseName.size()
133 &&
name(i, phaseName.size()) == phaseName
137 phaseNamePart = phaseName;
143 nameParts.
append(phaseNamePart);
144 i += phaseNamePart.size();
147 if (i ==
name.size())
break;
158 if (nPhaseNameParts == 0)
error();
161 if (i ==
name.size())
break;
165 if (j == word::npos)
error();
184 const wordList nameParts = nameToNameParts(fluid,
name);
187 forAll(separators, separatori)
189 separators[separatori] = nameParts[2*separatori + 1];
202 wordList separators(separatorsUnsorted);
209 static const word phaseName =
"<phase>";
210 word typeName = phaseName;
211 forAll(separators, separatori)
216 + separators[separatori]
217 + (separators[separatori].empty() ?
"" :
"_")
232 return separatorsToTypeName(nameToSeparators(fluid,
name));
248 name.append(nameParts[i] +
"_");
269 name.append(oldNameParts[i] +
"_");
275 const word& oldSeparator = oldNameParts[i];
276 const word& separator = oldSeparatorToSeparator_[oldSeparator];
280 name.append(separator +
"_");
297 const wordList nameParts = nameToNameParts(fluid,
name);
299 label nameParti = -1;
300 bool multiple =
false;
301 for (
label namePartj = 1; namePartj < nameParts.
size() - 1; namePartj += 2)
303 forAll(separators, separatori)
305 if (nameParts[namePartj] == separators[separatori])
307 multiple = multiple || nameParti != -1;
308 nameParti = namePartj;
316 <<
"No matches identified in \"" <<
name
323 <<
"Multiple matches identified in \"" <<
name
330 fluid.
phases()[nameParts[nameParti - 1]],
331 fluid.
phases()[nameParts[nameParti + 1]]
344 phase1_(getPhase1(phase1, phase2)),
345 phase2_(getPhase2(phase1, phase2)),
399 wordConstructorTable::iterator cstrIter =
400 wordConstructorTablePtr_->find(nameToTypeName(fluid,
name));
402 if (cstrIter == wordConstructorTablePtr_->end())
405 <<
"Unknown phaseInterface type "
407 <<
"Valid phaseInterface types are : " <<
endl
408 << wordConstructorTablePtr_->sortedToc()
412 return cstrIter()(fluid,
name);
427 <<
"Could not combine interfaces " << interface1.
name()
432 const wordList nameParts1 = nameToNameParts(fluid, interface1.
name());
433 const wordList nameParts2 = nameToNameParts(fluid, interface2.
name());
436 const Pair<word> headNames1(nameParts1[0], nameParts1[2]);
437 const Pair<word> headNames2(nameParts2[0], nameParts2[2]);
438 const word& headSeparator1 = nameParts1[1];
439 const word& headSeparator2 = nameParts2[1];
441 const bool haveBothHeadSeparators =
445 (headNamesCompare == 0)
446 || (haveBothHeadSeparators && headSeparator1 != headSeparator2)
447 || (haveBothHeadSeparators && headNamesCompare != 1)
458 headSeparator1 !=
word::null ? nameParts1 : nameParts2,
464 for (
label i1 = 3; i1 < nameParts1.
size(); i1 += 2)
466 nameParts.
append(nameParts1[i1]);
467 nameParts.
append(nameParts1[i1 + 1]);
471 for (
label i2 = 3; i2 < nameParts2.
size(); i2 += 2)
474 for (
label i1 = 3; i1 < nameParts1.
size(); i1 += 2)
476 if (nameParts1[i1] == nameParts2[i2])
478 if (nameParts1[i1 + 1] != nameParts2[i2 + 1])
error();
484 nameParts.
append(nameParts2[i2]);
485 nameParts.
append(nameParts2[i2 + 1]);
490 return New(fluid, namePartsToName(fluid, nameParts));
498 return phase1().name() +
"_" + phase2().name();
504 return phase1()*phase1().rho() + phase2()*phase2().rho();
510 if (phase1().stationary())
512 return mag(phase2().
U());
514 else if (phase2().stationary())
516 return mag(phase1().
U());
520 return mag(phase1().
U() - phase2().
U());
527 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 Pairs.
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.
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< volScalarField > sigma() const
Surface tension coefficient.
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.
label index() const
Return the index of the phase.
Class to represent a system of phases and model interfacial transfers between them.
const phaseModelList & phases() const
Return the phase models.
A class for managing temporary objects.
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.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
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.
word name(const bool)
Return a word representation of a bool.
defineTypeNameAndDebugWithName(dispersedDisplacedPhaseInterface, separatorsToTypeName({ dispersedPhaseInterface::separator(), displacedPhaseInterface::separator() }).c_str(), 0)
labelList second(const UList< labelPair > &p)
labelList first(const UList< labelPair > &p)
bool phaseInterfaceAddedHeadSeparator
dimensioned< scalar > mag(const dimensioned< Type > &)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.