interfaceCompositionModel.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017-2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 #include "phaseModel.H"
30 #include "phasePair.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace multiphaseInter
37 {
40 }
41 }
42 
43 const Foam::Enum
44 <
46 >
48 {
49  { modelVariable::T, "temperature" },
50  { modelVariable::P, "pressure" },
51  { modelVariable::Y, "massFraction" },
52  { modelVariable::alpha, "alphaVolumeFraction" },
53 };
54 
55 
56 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
57 
59 (
60  const dictionary& dict,
61  const phasePair& pair
62 )
63 :
64  modelVariable_
65  (
66  modelVariableNames_.getOrDefault
67  (
68  "variable",
69  dict,
70  modelVariable::T
71  )
72  ),
73  includeVolChange_(dict.getOrDefault("includeVolChange", true)),
74  pair_(pair),
75  speciesName_(dict.getOrDefault<word>("species", "none")),
76  mesh_(pair_.from().mesh())
77 {}
78 
79 
80 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
81 
84 (
85  const dictionary& dict,
86  const phasePair& pair
87 )
88 {
89  const word modelType
90  (
91  dict.get<word>("type")
92  + "<"
93  + pair.phase1().thermo().type()
94  + ","
95  + pair.phase2().thermo().type()
96  + ">"
97  );
98 
99  Info<< "Selecting interfaceCompositionModel for "
100  << pair << ": " << modelType << endl;
101 
102  auto* ctorPtr = dictionaryConstructorTable(modelType);
103 
104  if (!ctorPtr)
105  {
107  (
108  dict,
109  "interfaceCompositionModel",
110  modelType,
111  *dictionaryConstructorTablePtr_
112  ) << exit(FatalIOError);
113  }
114 
115  return ctorPtr(dict, pair);
116 }
117 
118 
119 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
120 
123 {
124  return speciesName_;
125 }
126 
127 
129 ::pair() const
130 {
131  return pair_;
132 }
133 
134 
137 {
138  return pair().to().fluid();
139 }
140 
141 
143 ::variable() const
144 {
145  return modelVariableNames_[modelVariable_];
146 }
147 
148 
150 const noexcept
151 {
152  return true;
153 }
154 
155 
157 {
158  return includeVolChange_;
159 }
160 
161 
162 // ************************************************************************* //
twoPhaseSystem & fluid
dictionary dict
static const Enum< modelVariable > modelVariableNames_
Selection names for the modelVariable.
virtual const rhoThermo & thermo() const =0
Access const to phase thermo.
const multiphaseInter::phaseModel & phase2() const
Definition: phasePairI.H:29
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
modelVariable
Enumeration for variable based mass transfer models.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
const multiphaseInter::phaseModel & phase1() const
Definition: phasePairI.H:23
virtual bool includeDivU() const noexcept
Add/subtract alpha*div(U) as a source term for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2) ...
const word & variable() const
Returns the variable on which the model is based.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
virtual const multiphaseInter::phaseModel & to() const
To phase.
Definition: phasePair.C:52
const word transferSpecie() const
Return the transferring species name.
dynamicFvMesh & mesh
A class for handling words, derived from Foam::string.
Definition: word.H:63
interfaceCompositionModel(const dictionary &dict, const phasePair &pair)
Construct from a dictionary and a phase pair.
const direction noexcept
Definition: Scalar.H:258
defineTypeNameAndDebug(interfaceCompositionModel, 0)
const phasePair & pair() const
The phase pair.
const multiphaseInterSystem & fluid() const
Return the system to which this phase belongs.
Definition: phaseModel.C:97
const volScalarField & T
static autoPtr< interfaceCompositionModel > New(const dictionary &dict, const phasePair &pair)
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: error.H:64
PtrList< volScalarField > & Y
messageStream Info
Information stream (stdout output on master, null elsewhere)
defineRunTimeSelectionTable(interfaceCompositionModel, dictionary)
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:635
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
Definition: phasePair.H:49
Namespace for OpenFOAM.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...