phaseModel.H
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) 2013-2020 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 Class
25  Foam::phaseModel
26 
27 Description
28  Single incompressible phase derived from the phase-fraction.
29  Used as part of the multiPhaseMixture for interface-capturing multi-phase
30  simulations.
31 
32 SourceFiles
33  phaseModel.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef phaseModel_H
38 #define phaseModel_H
39 
40 #include "rhoThermo.H"
41 #include "volFields.H"
42 #include "dictionaryEntry.H"
43 
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class phaseModel Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class phaseModel
55 :
56  public volScalarField
57 {
58  // Private Data
59 
60  word name_;
61  const volScalarField& p_;
62  const volScalarField& T_;
63  autoPtr<rhoThermo> thermo_;
64  volScalarField Alpha_;
65  volScalarField dgdt_;
66 
67 
68 public:
69 
70  // Constructors
71 
72  //- Construct from components
74  (
75  const word& phaseName,
76  const volScalarField& p,
77  const volScalarField& T
78  );
79 
80  //- Return clone
81  autoPtr<phaseModel> clone() const;
82 
83  //- Return a pointer to a new phaseModel created on freestore
84  // from Istream
85  class iNew
86  {
87  const volScalarField& p_;
88  const volScalarField& T_;
89 
90  public:
91 
93  (
94  const volScalarField& p,
95  const volScalarField& T
96  )
97  :
98  p_(p),
99  T_(T)
100  {}
103  {
104  return autoPtr<phaseModel>(new phaseModel(is, p_, T_));
105  }
106  };
107 
108 
109  // Member Functions
111  const word& name() const
112  {
113  return name_;
114  }
116  const word& keyword() const
117  {
118  return name();
119  }
120 
121  //- Return const-access to phase rhoThermo
122  const rhoThermo& thermo() const
123  {
124  return thermo_();
125  }
126 
127  //- Return access to phase rhoThermo
128  rhoThermo& thermo()
129  {
130  return thermo_();
131  }
132 
133  //- Return const-access to phase mass-fraction
134  const volScalarField& Alpha() const
135  {
136  return Alpha_;
137  }
138 
139  //- Return access to phase mass-fraction
141  {
142  return Alpha_;
143  }
144 
145  //- Return const-access to phase divergence
146  const volScalarField& dgdt() const
147  {
148  return dgdt_;
149  }
150 
151  //- Return access to phase divergence
153  {
154  return dgdt_;
155  }
156 
157  void correct();
158 };
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace Foam
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #endif
168 
169 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
autoPtr< phaseModel > operator()(Istream &is) const
Definition: phaseModel.H:101
autoPtr< phaseModel > clone() const
Return clone.
const volScalarField & Alpha() const
Return const-access to phase mass-fraction.
Definition: phaseModel.H:133
const word & name() const
Definition: phaseModel.H:110
phaseModel(const word &phaseName, const volScalarField &p, const volScalarField &T)
Construct from components.
iNew(const volScalarField &p, const volScalarField &T)
Definition: phaseModel.H:92
A class for handling words, derived from string.
Definition: word.H:59
const rhoThermo & thermo() const
Return const-access to phase rhoThermo.
Definition: phaseModel.H:121
Return a pointer to a new phaseModel created on freestore.
Definition: phaseModel.H:84
const word & keyword() const
Definition: phaseModel.H:115
tmp< GeometricField< scalar, fvPatchField, volMesh > > T() const
Return transpose (only if it is a tensor field)
Base-class for fluid thermodynamic properties based on density.
Definition: rhoThermo.H:52
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
const volScalarField & dgdt() const
Return const-access to phase divergence.
Definition: phaseModel.H:145
volScalarField & p
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:53
Namespace for OpenFOAM.