phase.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::phase
28 
29 Description
30  Single incompressible phase derived from the phase-fraction.
31  Used as part of the multiPhaseMixture for interface-capturing multi-phase
32  simulations.
33 
34 SourceFiles
35  phase.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef phase_H
40 #define phase_H
41 
42 #include "volFields.H"
43 #include "dictionaryEntry.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class phase Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class phase
56 :
57  public volScalarField
58 {
59  // Private data
60 
61  word name_;
62  dictionary phaseDict_;
63  autoPtr<viscosityModel> nuModel_;
64  dimensionedScalar rho_;
65 
66 
67 public:
68 
69  // Constructors
70 
71  //- Construct from components
72  phase
73  (
74  const word& name,
75  const dictionary& phaseDict,
76  const volVectorField& U,
77  const surfaceScalarField& phi
78  );
79 
80  //- Return clone
81  autoPtr<phase> clone() const;
82 
83  //- Return a pointer to a new phase created on freestore
84  // from Istream
85  class iNew
86  {
87  const volVectorField& U_;
88  const surfaceScalarField& phi_;
89 
90  public:
91 
93  (
94  const volVectorField& U,
95  const surfaceScalarField& phi
96  )
97  :
98  U_(U),
99  phi_(phi)
100  {}
101 
103  {
105  return autoPtr<phase>(new phase(ent.keyword(), ent, U_, phi_));
106  }
107  };
108 
109 
110  // Member Functions
111 
112  const word& name() const
113  {
114  return name_;
115  }
116 
117  const word& keyword() const
118  {
119  return name();
120  }
121 
122  //- Return const-access to phase1 viscosityModel
123  const viscosityModel& nuModel() const
124  {
125  return *nuModel_;
126  }
127 
128  //- Return the kinematic laminar viscosity
129  tmp<volScalarField> nu() const
130  {
131  return nuModel_->nu();
132  }
133 
134  //- Return the laminar viscosity for patch
135  tmp<scalarField> nu(const label patchi) const
136  {
137  return nuModel_->nu(patchi);
138  }
139 
140  //- Return const-access to phase1 density
141  const dimensionedScalar& rho() const
142  {
143  return rho_;
144  }
145 
146  //- Correct the phase properties
147  void correct();
148 
149  //-Inherit read from volScalarField
150  using volScalarField::read;
151 
152  //- Read base transportProperties dictionary
153  bool read(const dictionary& phaseDict);
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #endif
164 
165 // ************************************************************************* //
volFields.H
Foam::dictionaryEntry
A keyword and a list of tokens is a 'dictionaryEntry'.
Definition: dictionaryEntry.H:65
Foam::phase::read
bool read(const dictionary &phaseDict)
Read base transportProperties dictionary.
Foam::viscosityModel
An abstract base class for incompressible viscosityModels.
Definition: viscosityModel.H:67
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::phase
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phase.H:54
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::entry::keyword
const keyType & keyword() const noexcept
Return keyword.
Definition: entry.H:195
Foam::phase::nu
tmp< scalarField > nu(const label patchi) const
Return the laminar viscosity for patch.
Definition: phase.H:134
Foam::dictionary::null
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition: dictionary.H:392
Foam::blockMeshTools::read
void read(Istream &, label &val, const dictionary &)
In-place read with dictionary lookup.
Definition: blockMeshTools.C:57
Foam::phase::correct
void correct()
Correct the phase properties.
Foam::phase::keyword
const word & keyword() const
Definition: phase.H:116
Foam::phase::clone
autoPtr< phase > clone() const
Return clone.
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::phase::nuModel
const viscosityModel & nuModel() const
Return const-access to phase1 viscosityModel.
Definition: phase.H:122
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::dimensioned< scalar >
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::phase::phase
phase(const word &name, const dictionary &phaseDict, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
dictionaryEntry.H
Foam::phase::name
const word & name() const
Definition: phase.H:111
viscosityModel.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
U
U
Definition: pEqn.H:72
Foam::phase::nu
tmp< volScalarField > nu() const
Return the kinematic laminar viscosity.
Definition: phase.H:128
Foam::phase::iNew::operator()
autoPtr< phase > operator()(Istream &is) const
Definition: phase.H:101
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::phase::iNew
Return a pointer to a new phase created on freestore.
Definition: phase.H:84
Foam::phase::rho
const dimensionedScalar & rho() const
Return const-access to phase1 density.
Definition: phase.H:140
Foam::phase::iNew::iNew
iNew(const volVectorField &U, const surfaceScalarField &phi)
Definition: phase.H:92