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-2018 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  dgdt_
54  (
55  IOobject
56  (
57  IOobject::groupName("dgdt", phaseName),
58  p.mesh().time().timeName(),
59  p.mesh(),
60  IOobject::READ_IF_PRESENT,
61  IOobject::AUTO_WRITE
62  ),
63  p.mesh(),
65  )
66 {
67  {
68  volScalarField Tp(IOobject::groupName("T", phaseName), T);
69  Tp.write();
70  }
71 
72  thermo_ = rhoThermo::New(p.mesh(), phaseName);
73  thermo_->validate(phaseName, "e");
74 
75  correct();
76 }
77 
78 
79 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80 
82 {
84  return autoPtr<phaseModel>(nullptr);
85 }
86 
87 
89 {
90  thermo_->he() = thermo_->he(p_, T_);
91  thermo_->correct();
92 }
93 
94 
95 // ************************************************************************* //
autoPtr< phaseModel > clone() const
Return clone.
volScalarField T_
Temperature [K].
Definition: basicThermo.H:68
static autoPtr< rhoThermo > New(const fvMesh &, const word &phaseName=word::null)
Selector.
Definition: rhoThermo.C:141
phaseModel(const word &phaseName, const volScalarField &p, const volScalarField &T)
Construct from components.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
dynamicFvMesh & mesh
volScalarField & p_
Pressure [Pa].
Definition: fluidThermo.H:58
static word groupName(Name name, const word &group)
word timeName
Definition: getTimeIndex.H:3
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
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:366
virtual void correct()
Update properties.