displacedPhaseInterface.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2021-2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
34  (
36  separatorsToTypeName
37  ({
39  separator()
40  }).c_str(),
41  0
42  );
44 }
45 
46 
47 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
48 
50 (
51  const phaseInterface& interface,
52  bool strict
53 ) const
54 {
55  return
56  (!strict || isType<displacedPhaseInterface>(interface))
57  && (strict || isA<displacedPhaseInterface>(interface))
58  && &displacing_
59  == &refCast<const displacedPhaseInterface>(interface).displacing_
60  && phaseInterface::same(interface, false);
61 }
62 
63 
64 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
65 
67 (
68  const phaseModel& phase1,
69  const phaseModel& phase2,
70  const phaseModel& displacing
71 )
72 :
73  phaseInterface(phase1, phase2),
74  displacing_(displacing)
75 {}
76 
77 
79 (
80  const phaseSystem& fluid,
81  const word& name
82 )
83 :
84  phaseInterface(fluid, name),
85  displacing_(identifyPhases(fluid, name, {separator()}).second())
86 {
87  if (contains(displacing_))
88  {
90  << "Interface " << name << " is not valid. An interface cannot "
91  << "be displaced by one of its own phases." << exit(FatalError);
92  }
93 }
94 
95 
96 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
97 
99 {}
100 
101 
102 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
103 
105 {
106  return
108  + '_'
109  + separator()
110  + '_'
111  + displacing().name();
112 }
113 
114 
116 {
117  return displacing_;
118 }
119 
120 
121 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Class to represent an interface between phases which has been displaced to some extent by a third pha...
displacedPhaseInterface(const phaseModel &phase1, const phaseModel &phase2, const phaseModel &displacing)
Construct from phases.
virtual ~displacedPhaseInterface()
Destructor.
static word separator()
Return the separator that delimits this interface's name.
virtual bool same(const phaseInterface &interface, bool strict) const
Return true if the phase interfaces are the same.
const phaseModel & displacing() const
Displacing phase.
Class to represent an interface between phases. Derivations can further specify the configuration of ...
static word separator()
Return the separator that delimits this interface's name.
virtual word name() const
Name.
virtual bool same(const phaseInterface &interface, bool strict) const
Return true if the phase interfaces are the same.
Class to represent a system of phases.
Definition: phaseSystem.H:74
A class for handling words, derived from string.
Definition: word.H:62
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
defineTypeNameAndDebugWithName(dispersedDisplacedPhaseInterface, separatorsToTypeName({ dispersedPhaseInterface::separator(), displacedPhaseInterface::separator() }).c_str(), 0)
labelList second(const UList< labelPair > &p)
Definition: patchToPatch.C:49
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
error FatalError