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-2021 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  defineTypeNameAndDebug(interfaceCompositionModel, 0);
37  defineRunTimeSelectionTable(interfaceCompositionModel, dictionary);
38 }
39 
40 
43 {
44  { modelVariable::T, "temperature" },
45  { modelVariable::P, "pressure" },
46  { modelVariable::Y, "massFraction" },
47  { modelVariable::alpha, "alphaVolumeFraction" },
48 };
49 
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
54 (
55  const dictionary& dict,
56  const phasePair& pair
57 )
58 :
59  modelVariable_
60  (
61  modelVariableNames_.getOrDefault
62  (
63  "variable",
64  dict,
66  )
67  ),
68  includeVolChange_(dict.getOrDefault("includeVolChange", true)),
69  pair_(pair),
70  speciesName_(dict.getOrDefault<word>("species", "none")),
71  mesh_(pair_.from().mesh())
72 {}
73 
74 
75 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
76 
79 (
80  const dictionary& dict,
81  const phasePair& pair
82 )
83 {
84  const word modelType
85  (
86  dict.get<word>("type")
87  + "<"
88  + pair.phase1().thermo().type()
89  + ","
90  + pair.phase2().thermo().type()
91  + ">"
92  );
93 
94  Info<< "Selecting interfaceCompositionModel for "
95  << pair << ": " << modelType << endl;
96 
97  auto* ctorPtr = dictionaryConstructorTable(modelType);
98 
99  if (!ctorPtr)
100  {
102  (
103  dict,
104  "interfaceCompositionModel",
105  modelType,
106  *dictionaryConstructorTablePtr_
107  ) << exit(FatalIOError);
108  }
109 
110  return ctorPtr(dict, pair);
111 }
112 
113 
114 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
115 
117 {
118  return speciesName_;
119 }
120 
121 
123 {
124  return pair_;
125 }
126 
127 
129 {
130  return modelVariableNames_[modelVariable_];
131 }
132 
133 
135 {
136  return true;
137 }
138 
139 
141 {
142  return includeVolChange_;
143 }
144 
145 
146 // ************************************************************************* //
Foam::phasePair
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
Definition: phasePair.H:53
Foam::interfaceCompositionModel::New
static autoPtr< interfaceCompositionModel > New(const dictionary &dict, const phasePair &pair)
Definition: interfaceCompositionModel.C:79
Foam::Enum
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: IOstreamOption.H:57
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
interfaceCompositionModel.H
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::interfaceCompositionModel::pair
const phasePair & pair() const
The phase pair.
Definition: interfaceCompositionModel.C:122
Foam::interfaceCompositionModel::modelVariableNames_
static const Enum< modelVariable > modelVariableNames_
Selection names for the modelVariable.
Definition: interfaceCompositionModel.H:79
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::phaseModel::thermo
virtual const rhoThermo & thermo() const =0
Access const to phase thermo.
Foam::interfaceCompositionModel::transferSpecie
const word transferSpecie() const
Return the transferring species name.
Definition: interfaceCompositionModel.C:116
Foam::interfaceCompositionModel::speciesName_
word speciesName_
Names of the transferring specie.
Definition: interfaceCompositionModel.H:91
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::interfaceCompositionModel::includeDivU
virtual bool includeDivU() const noexcept
Definition: interfaceCompositionModel.C:134
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::interfaceCompositionModel::includeVolChange
bool includeVolChange()
Add volume change in pEq.
Definition: interfaceCompositionModel.C:140
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::interfaceCompositionModel::variable
const word & variable() const
Returns the variable on which the model is based.
Definition: interfaceCompositionModel.C:128
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
T
const volScalarField & T
Definition: createFieldRefs.H:2
Y
PtrList< volScalarField > & Y
Definition: createFieldRefs.H:7
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::autoPtr< Foam::interfaceCompositionModel >
Foam::interfaceCompositionModel::interfaceCompositionModel
interfaceCompositionModel(const dictionary &dict, const phasePair &pair)
Construct from a dictionary and a phase pair.
Definition: interfaceCompositionModel.C:54
Foam::phasePair::phase2
const phaseModel & phase2() const
Definition: phasePairI.H:36
Foam::phasePair::phase1
const phaseModel & phase1() const
Definition: phasePairI.H:30
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)