phase.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) 2011-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::phase
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  phase.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef phase_H
38 #define phase_H
39 
40 #include "volFields.H"
41 #include "dictionaryEntry.H"
42 #include "viscosityModel.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class phase Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class phase
54 :
55  public volScalarField
56 {
57  // Private Data
58 
59  word name_;
60  dictionary phaseDict_;
61  autoPtr<viscosityModel> nuModel_;
62  dimensionedScalar rho_;
63 
64 
65 public:
66 
67  // Constructors
68 
69  //- Construct from components
70  phase
71  (
72  const word& name,
73  const dictionary& phaseDict,
74  const volVectorField& U,
75  const surfaceScalarField& phi
76  );
77 
78  //- Return clone
79  autoPtr<phase> clone() const;
80 
81  //- Return a pointer to a new phase created on freestore
82  // from Istream
83  class iNew
84  {
85  const volVectorField& U_;
86  const surfaceScalarField& phi_;
87 
88  public:
89 
91  (
92  const volVectorField& U,
93  const surfaceScalarField& phi
94  )
95  :
96  U_(U),
97  phi_(phi)
98  {}
99 
101  {
103  return autoPtr<phase>(new phase(ent.keyword(), ent, U_, phi_));
104  }
105  };
106 
107 
108  // Member Functions
110  const word& name() const
111  {
112  return name_;
113  }
115  const word& keyword() const
116  {
117  return name();
118  }
119 
120  //- Return const-access to phase1 viscosityModel
121  const viscosityModel& nuModel() const
122  {
123  return nuModel_();
124  }
125 
126  //- Return the kinematic laminar viscosity
127  tmp<volScalarField> nu() const
128  {
129  return nuModel_->nu();
130  }
131 
132  //- Return the laminar viscosity for patch
133  tmp<scalarField> nu(const label patchi) const
134  {
135  return nuModel_->nu(patchi);
136  }
137 
138  //- Return const-access to phase1 density
139  const dimensionedScalar& rho() const
140  {
141  return rho_;
142  }
143 
144  //- Correct the phase properties
145  void correct();
146 
147  //-Inherit read from volScalarField
148  using volScalarField::read;
149 
150  //- Read base transportProperties dictionary
151  bool read(const dictionary& phaseDict);
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #endif
162 
163 // ************************************************************************* //
const dimensionedScalar & rho() const
Return const-access to phase1 density.
Definition: phase.H:138
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
Return a pointer to a new phase created on freestore.
Definition: phase.H:82
const keyType & keyword() const
Return keyword.
Definition: entry.H:123
virtual bool read()
Read object.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void correct()
Correct the phase properties.
A keyword and a list of tokens is a &#39;dictionaryEntry&#39;.
const word & keyword() const
Definition: phase.H:114
An abstract base class for incompressible viscosityModels.
iNew(const volVectorField &U, const surfaceScalarField &phi)
Definition: phase.H:90
A class for handling words, derived from string.
Definition: word.H:59
autoPtr< phase > clone() const
Return clone.
phase(const word &name, const dictionary &phaseDict, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
static const dictionary null
Null dictionary.
Definition: dictionary.H:242
phi
Definition: correctPhi.H:3
const viscosityModel & nuModel() const
Return const-access to phase1 viscosityModel.
Definition: phase.H:120
autoPtr< phase > operator()(Istream &is) const
Definition: phase.H:99
label patchi
U
Definition: pEqn.H:72
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phase.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
tmp< volScalarField > nu() const
Return the kinematic laminar viscosity.
Definition: phase.H:126
A class for managing temporary objects.
Definition: PtrList.H:53
const word & name() const
Definition: phase.H:109
Namespace for OpenFOAM.