FreeFOAM The Cross-Platform CFD Toolkit
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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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 <finiteVolume/volFields.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 
90  iNew
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
109 
110  const word& name() const
111  {
112  return name_;
113  }
114 
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
128  {
129  return nuModel_->nu();
130  }
131 
132  //- Return const-access to phase1 density
133  const dimensionedScalar& rho() const
134  {
135  return rho_;
136  }
137 
138  //- Correct the phase properties
139  void correct();
140 
141  //- Read base transportProperties dictionary
142  bool read(const dictionary& phaseDict);
143 };
144 
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 } // End namespace Foam
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #endif
153 
154 // ************************ vim: set sw=4 sts=4 et: ************************ //