All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sidedPhaseInterface.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-2022 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 
26 #include "sidedPhaseInterface.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
34  (
35  sidedPhaseInterface,
36  separatorsToTypeName
37  ({
39  separator()
40  }).c_str(),
41  0
42  );
43  addToRunTimeSelectionTable(phaseInterface, sidedPhaseInterface, word);
44 }
45 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
50 (
51  const phaseModel& phase,
52  const phaseModel& otherPhase
53 )
54 :
55  phaseInterface(phase, otherPhase),
56  phase_(phase)
57 {}
58 
59 
61 (
62  const phaseSystem& fluid,
63  const word& name
64 )
65 :
66  phaseInterface(fluid, name),
67  phase_(identifyPhases(fluid, name, {separator()}).second())
68 {
69  if (!contains(phase_))
70  {
72  << "Interface " << name << " is not valid. An interface cannot "
73  << "have a side that is not one of its own phases."
74  << exit(FatalError);
75  }
76 }
77 
78 
79 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
80 
82 {}
83 
84 
85 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
86 
88 {
89  return phaseInterface::name() + '_' + separator() + '_' + phase().name();
90 }
91 
92 
94 {
95  return phase_;
96 }
97 
98 
100 {
101  return phaseInterface::otherPhase(phase_);
102 }
103 
104 
105 // ************************************************************************* //
virtual word name() const
Name.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
virtual word name() const
Name.
phaseInterface(const phaseModel &phase1, const phaseModel &phase2)
Construct from phases.
static word separator()
Return the separator that delimits this interface&#39;s name.
const word & name() const
Definition: phaseModel.H:110
static word separator()
Return the separator that delimits this interface&#39;s name.
virtual word name() const
Name.
Macros for easy insertion into run-time selection tables.
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.
A class for handling words, derived from string.
Definition: word.H:59
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
sidedPhaseInterface(const phaseModel &phase, const phaseModel &otherPhase)
Construct from phases.
labelList second(const UList< labelPair > &p)
Definition: patchToPatch.C:48
const phaseSystem & fluid() const
Return the phase system.
bool contains(const phaseModel &phase) const
Return true if this phaseInterface contains the given phase.
virtual ~sidedPhaseInterface()
Destructor.
const phaseModel & otherPhase() const
Phase on the other side of the interface.
const phaseModel & phase() const
Phase on the this side of the interface.
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:53
const phaseModel & otherPhase(const phaseModel &phase) const
Return the other phase relative to the given phase.
#define defineTypeNameAndDebugWithName(Type, Name, DebugSwitch)
Define the typeName and debug information, lookup as Name.
Definition: className.H:124
Namespace for OpenFOAM.