phaseModel.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) 2013-2021 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 "phaseModel.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
31 (
32  const word& phaseName,
33  const volScalarField& p,
34  const volScalarField& T
35 )
36 :
38  (
39  IOobject
40  (
41  IOobject::groupName("alpha", phaseName),
42  p.mesh().time().timeName(),
43  p.mesh(),
44  IOobject::MUST_READ,
45  IOobject::AUTO_WRITE
46  ),
47  p.mesh()
48  ),
49  name_(phaseName),
50  p_(p),
51  T_(T),
52  thermo_(nullptr),
53  Alpha_
54  (
55  IOobject
56  (
57  IOobject::groupName("Alpha", phaseName),
58  p.mesh().time().timeName(),
59  p.mesh()
60  ),
61  p.mesh(),
63  ),
64  dgdt_
65  (
66  IOobject
67  (
68  IOobject::groupName("dgdt", phaseName),
69  p.mesh().time().timeName(),
70  p.mesh(),
71  IOobject::READ_IF_PRESENT,
72  IOobject::AUTO_WRITE
73  ),
74  p.mesh(),
76  )
77 {
78  {
79  volScalarField Tp(IOobject::groupName("T", phaseName), T);
80  Tp.write();
81  }
82 
83  thermo_ = rhoThermo::New(p.mesh(), phaseName);
84  thermo_->validate(phaseName, "e");
85 
86  correct();
87 }
88 
89 
90 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
91 
93 {
95  return autoPtr<phaseModel>(nullptr);
96 }
97 
98 
100 {
101  thermo_->he() = thermo_->he(p_, T_);
102  thermo_->correct();
103 }
104 
105 
106 // ************************************************************************* //
autoPtr< phaseModel > clone() const
Return clone.
static autoPtr< rhoThermo > New(const fvMesh &, const word &phaseName=word::null)
Standard selection based on fvMesh.
Definition: rhoThermo.C:92
const dimensionSet dimless
phaseModel(const word &phaseName, const volScalarField &p, const volScalarField &T)
Construct from components.
fvMesh & mesh
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:58
const dimensionSet dimTime
static word groupName(Name name, const word &group)
word timeName
Definition: getTimeIndex.H:3
virtual void correct()
Update properties.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:353