compressibleInterPhaseTransportModel.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) 2017-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 
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
31 (
32  const volScalarField& rho,
33  const volVectorField& U,
34  const surfaceScalarField& phi,
35  const surfaceScalarField& rhoPhi,
36  const surfaceScalarField& alphaPhi10,
37  const twoPhaseMixtureThermo& mixture
38 )
39 :
40  twoPhaseTransport_(false),
41  mixture_(mixture),
42  phi_(phi),
43  alphaPhi10_(alphaPhi10)
44 {
45  {
46  IOdictionary turbulenceProperties
47  (
48  IOobject
49  (
51  U.time().constant(),
52  U.db(),
55  )
56  );
57 
58  word simulationType
59  (
60  turbulenceProperties.lookup("simulationType")
61  );
62 
63  if (simulationType == "twoPhaseTransport")
64  {
65  twoPhaseTransport_ = true;
66  }
67  }
68 
69  if (twoPhaseTransport_)
70  {
71  const volScalarField& alpha1(mixture_.alpha1());
72  const volScalarField& alpha2(mixture_.alpha2());
73 
74  const volScalarField& rho1 = mixture_.thermo1().rho();
75  const volScalarField& rho2 = mixture_.thermo2().rho();
76 
77  alphaRhoPhi1_ =
78  (
80  (
81  IOobject::groupName("alphaRhoPhi", alpha1.group()),
82  fvc::interpolate(rho1)*alphaPhi10_
83  )
84  );
85 
86  alphaRhoPhi2_ =
87  (
89  (
90  IOobject::groupName("alphaRhoPhi", alpha2.group()),
91  fvc::interpolate(rho2)*(phi_ - alphaPhi10_)
92  )
93  );
94 
95  turbulence1_ =
96  (
97  ThermalDiffusivity<PhaseCompressibleTurbulenceModel<fluidThermo>>
98  ::New
99  (
100  alpha1,
101  rho1,
102  U,
103  alphaRhoPhi1_(),
104  phi,
105  mixture.thermo1()
106  )
107  );
108 
109  turbulence2_ =
110  (
111  ThermalDiffusivity<PhaseCompressibleTurbulenceModel<fluidThermo>>
112  ::New
113  (
114  alpha2,
115  rho2,
116  U,
117  alphaRhoPhi2_(),
118  phi,
119  mixture.thermo2()
120  )
121  );
122  }
123  else
124  {
126  (
127  rho,
128  U,
129  rhoPhi,
130  mixture
131  );
132 
133  turbulence_->validate();
134  }
135 }
136 
137 
138 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
139 
142 {
143  if (twoPhaseTransport_)
144  {
145  return
146  mixture_.alpha1()*mixture_.thermo1().alphaEff
147  (
148  turbulence1_->alphat()
149  )
150  + mixture_.alpha2()*mixture_.thermo2().alphaEff
151  (
152  turbulence2_->alphat()
153  );
154  }
155  else
156  {
157  return mixture_.alphaEff(turbulence_->alphat());
158  }
159 }
160 
161 
164 (
165  volVectorField& U
166 ) const
167 {
168  if (twoPhaseTransport_)
169  {
170  return
171  turbulence1_->divDevRhoReff(U)
172  + turbulence2_->divDevRhoReff(U);
173  }
174  else
175  {
176  return turbulence_->divDevRhoReff(U);
177  }
178 }
179 
180 
182 {
183  if (twoPhaseTransport_)
184  {
185  const volScalarField& rho1 = mixture_.thermo1().rho();
186  const volScalarField& rho2 = mixture_.thermo2().rho();
187 
188  alphaRhoPhi1_.ref() = fvc::interpolate(rho1)*alphaPhi10_;
189  alphaRhoPhi2_.ref() = fvc::interpolate(rho2)*(phi_ - alphaPhi10_);
190  }
191 }
192 
193 
195 {
196  if (twoPhaseTransport_)
197  {
198  turbulence1_->correct();
199  turbulence2_->correct();
200  }
201  else
202  {
203  turbulence_->correct();
204  }
205 }
206 
207 
208 // ************************************************************************* //
static word group(const word &name)
Return group (extension part of name)
Definition: IOobject.C:176
const volScalarField & alpha2() const
Return the phase-fraction of phase 2.
IOobject(const word &name, const fileName &instance, const objectRegistry &registry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true)
Construct from name, instance, registry, io options.
Definition: IOobject.C:209
void correctPhasePhi()
Correct the phase mass-fluxes.
void correct()
Correct the phase or mixture transport models.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
tmp< volScalarField > alphaEff() const
Return the effective temperature transport coefficient.
const volScalarField & alpha1() const
Return the phase-fraction of phase 1.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
static const word propertiesName
Default name of the turbulence properties dictionary.
static word groupName(Name name, const word &group)
tmp< fvVectorMatrix > divDevRhoReff(volVectorField &U) const
Return the effective momentum stress divergence.
static autoPtr< psiThermo > New(const fvMesh &mesh, const word &phaseName=word::null)
Selector.
Definition: psiThermo.C:76
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Internal & ref()
Return a reference to the dimensioned internal field.
compressibleInterPhaseTransportModel(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const surfaceScalarField &rhoPhi, const surfaceScalarField &alphaPhi10, const twoPhaseMixtureThermo &mixture)
Construct from components.
IOdictionary(const IOobject &)
Construct given an IOobject.
Definition: IOdictionary.C:30
static autoPtr< ThermalDiffusivity > New(const alphaField &alpha, const volScalarField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &trasportModel, const word &propertiesName=turbulenceModel::propertiesName)
Return a reference to the selected turbulence model.
A class for managing temporary objects.
Definition: PtrList.H:53
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField