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-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 "saturated.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace interfaceCompositionModels
34 {
35  defineTypeNameAndDebug(saturated, 0);
37  (
38  interfaceCompositionModel,
39  saturated,
40  dictionary
41  );
42 }
43 }
44 
45 
46 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
47 
50 {
51  const dimensionedScalar Wi
52  (
53  "W",
55  composition().Wi(saturatedIndex_)
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_
74  (
75  saturationModel::New
76  (
77  dict.subDict("saturationPressure"),
78  interface,
79  false
80  )
81  )
82 {
83  if (species().size() != 1)
84  {
86  << "saturated model is suitable for one species only."
87  << exit(FatalError);
88  }
89 }
90 
91 
92 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
93 
95 {}
96 
97 
98 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
99 
101 (
102  const volScalarField& Tf
103 )
104 {}
105 
106 
108 (
109  const word& speciesName,
110  const volScalarField& Tf
111 ) const
112 {
113  if (saturatedName_ == speciesName)
114  {
115  return wRatioByP()*saturationModel_->pSat(Tf);
116  }
117  else
118  {
119  const label speciesIndex = composition().species()[speciesName];
120 
121  return
122  composition().Y()[speciesIndex]
123  *(scalar(1) - wRatioByP()*saturationModel_->pSat(Tf))
124  /max(scalar(1) - composition().Y()[saturatedIndex_], small);
125  }
126 }
127 
128 
131 (
132  const word& speciesName,
133  const volScalarField& Tf
134 ) const
135 {
136  if (saturatedName_ == speciesName)
137  {
138  return wRatioByP()*saturationModel_->pSatPrime(Tf);
139  }
140  else
141  {
142  const label speciesIndex = composition().species()[speciesName];
143 
144  return
145  - composition().Y()[speciesIndex]
146  *wRatioByP()*saturationModel_->pSatPrime(Tf)
147  /max(scalar(1) - composition().Y()[saturatedIndex_], small);
148  }
149 }
150 
151 
152 // ************************************************************************* //
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
const hashedWordList & species() const
Return the transferring species names.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
fluidReactionThermo & thermo
Definition: createFields.H:28
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
basicSpecieMixture & composition
virtual tmp< volScalarField > Yf(const word &speciesName, const volScalarField &Tf) const
The interface species fraction.
Macros for easy insertion into run-time selection tables.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:58
virtual void update(const volScalarField &Tf)
Update the composition.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
virtual tmp< volScalarField > YfPrime(const word &speciesName, const volScalarField &Tf) const
The interface species fraction derivative w.r.t. temperature.
const dimensionSet dimMass
const basicSpecieMixture & composition() const
Return the composition.
saturated(const dictionary &dict, const phaseInterface &interface)
Construct from a dictionary and an interface.
const dimensionSet dimMoles
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
PtrList< volScalarField > & Y
A class for managing temporary objects.
Definition: PtrList.H:53
PtrList< volScalarField > & Y()
Return the mass-fraction fields.
tmp< volScalarField > wRatioByP() const
Constant of proportionality between partial pressure and mass.
Namespace for OpenFOAM.
const speciesTable & species() const
Return the table of species.