saturated.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) 2015-2023 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 "saturated.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace interfaceCompositionModels
34 {
37  (
39  saturated,
41  );
42 }
43 }
44 
45 
46 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
47 
50 {
51  const dimensionedScalar Wi
52  (
53  "W",
56  );
57 
58  return Wi/thermo().W()/thermo().p();
59 }
60 
61 
62 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
63 
65 (
66  const dictionary& dict,
67  const phaseInterface& interface
68 )
69 :
70  interfaceCompositionModel(dict, interface),
71  saturatedName_(species()[0]),
72  saturatedIndex_(composition().species()[saturatedName_]),
73  saturationModel_(saturationPressureModel::New("pSat", dict))
74 {
75  if (species().size() != 1)
76  {
78  << "saturated model is suitable for one species only."
79  << exit(FatalError);
80  }
81 }
82 
83 
84 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
85 
87 {}
88 
89 
90 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
91 
93 (
94  const volScalarField& Tf
95 )
96 {}
97 
98 
100 (
101  const word& speciesName,
102  const volScalarField& Tf
103 ) const
104 {
105  if (saturatedName_ == speciesName)
106  {
107  return wRatioByP()*saturationModel_->pSat(Tf);
108  }
109  else
110  {
111  const label speciesIndex = composition().species()[speciesName];
112 
113  return
114  composition().Y()[speciesIndex]
115  *(scalar(1) - wRatioByP()*saturationModel_->pSat(Tf))
116  /max(scalar(1) - composition().Y()[saturatedIndex_], small);
117  }
118 }
119 
120 
123 (
124  const word& speciesName,
125  const volScalarField& Tf
126 ) const
127 {
128  if (saturatedName_ == speciesName)
129  {
130  return wRatioByP()*saturationModel_->pSatPrime(Tf);
131  }
132  else
133  {
134  const label speciesIndex = composition().species()[speciesName];
135 
136  return
137  - composition().Y()[speciesIndex]
138  *wRatioByP()*saturationModel_->pSatPrime(Tf)
139  /max(scalar(1) - composition().Y()[saturatedIndex_], small);
140  }
141 }
142 
143 
144 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Generic GeometricField class.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
virtual tmp< volScalarField > W() const =0
Molecular weight [kg/kmol].
virtual volScalarField & p()=0
Pressure [Pa].
Generic base class for interface composition models. These models describe the composition in phase 1...
const rhoMulticomponentThermo & thermo() const
Return the thermo.
const basicSpecieMixture & composition() const
Return the composition.
const hashedWordList & species() const
Return the transferring species names.
Model which uses a saturation pressure model for a single species to calculate the interface composit...
Definition: saturated.H:55
virtual void update(const volScalarField &Tf)
Update the composition.
Definition: saturated.C:93
tmp< volScalarField > wRatioByP() const
Constant of proportionality between partial pressure and mass.
Definition: saturated.C:49
label saturatedIndex_
saturated species index
Definition: saturated.H:64
virtual tmp< volScalarField > Yf(const word &speciesName, const volScalarField &Tf) const
The interface species fraction.
Definition: saturated.C:100
virtual tmp< volScalarField > YfPrime(const word &speciesName, const volScalarField &Tf) const
The interface species fraction derivative w.r.t. temperature.
Definition: saturated.C:123
saturated(const dictionary &dict, const phaseInterface &interface)
Construct from a dictionary and an interface.
Definition: saturated.C:65
Class to represent an interface between phases. Derivations can further specify the configuration of ...
Model to describe the dependence of saturation pressure on temperature, and vice versa.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
addToRunTimeSelectionTable(interfaceCompositionModel, Henry, dictionary)
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const dimensionSet dimMoles
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimMass
error FatalError
dictionary dict
basicSpecieMixture & composition
PtrList< volScalarField > & Y