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-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 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  autoPtr<viscosityModel> nuModel_;
61  dimensionedScalar rho_;
62 
63 
64 public:
65 
66  // Constructors
67 
68  //- Construct from components
69  phase
70  (
71  const word& name,
72  const volVectorField& U,
73  const surfaceScalarField& phi
74  );
75 
76  //- Return clone
77  autoPtr<phase> clone() const;
78 
79  //- Return a pointer to a new phase created on freestore
80  // from Istream
81  class iNew
82  {
83  const volVectorField& U_;
84  const surfaceScalarField& phi_;
85 
86  public:
87 
89  (
90  const volVectorField& U,
91  const surfaceScalarField& phi
92  )
93  :
94  U_(U),
95  phi_(phi)
96  {}
97 
99  {
100  const word name(is);
101  return autoPtr<phase>(new phase(name, U_, phi_));
102  }
103  };
104 
105 
106  // Member Functions
108  const word& name() const
109  {
110  return name_;
111  }
113  const word& keyword() const
114  {
115  return name();
116  }
117 
118  //- Return const-access to phase1 viscosityModel
119  const viscosityModel& nuModel() const
120  {
121  return nuModel_();
122  }
123 
124  //- Return the kinematic laminar viscosity
125  tmp<volScalarField> nu() const
126  {
127  return nuModel_->nu();
128  }
129 
130  //- Return the laminar viscosity for patch
131  tmp<scalarField> nu(const label patchi) const
132  {
133  return nuModel_->nu(patchi);
134  }
135 
136  //- Return const-access to phase1 density
137  const dimensionedScalar& rho() const
138  {
139  return rho_;
140  }
141 
142  //- Correct the phase properties
143  void correct();
144 
145  //-Inherit read from volScalarField
146  using volScalarField::read;
147 
148  //- Read base phaseProperties dictionary
149  bool read(const dictionary& phaseDict);
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
const dimensionedScalar & rho() const
Return const-access to phase1 density.
Definition: phase.H:136
Return a pointer to a new phase created on freestore.
Definition: phase.H:80
U
Definition: pEqn.H:72
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
phase(const word &name, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
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.
const word & keyword() const
Definition: phase.H:112
An abstract base class for Newtonian viscosity models.
iNew(const volVectorField &U, const surfaceScalarField &phi)
Definition: phase.H:88
A class for handling words, derived from string.
Definition: word.H:59
autoPtr< phase > clone() const
Return clone.
phi
Definition: correctPhi.H:3
const viscosityModel & nuModel() const
Return const-access to phase1 viscosityModel.
Definition: phase.H:118
autoPtr< phase > operator()(Istream &is) const
Definition: phase.H:97
label patchi
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:124
A class for managing temporary objects.
Definition: PtrList.H:53
const word & name() const
Definition: phase.H:107
Namespace for OpenFOAM.