compressibleInterPhaseTransportModel.C
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) 2017-2018 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 Foam::compressibleInterPhaseTransportModel::compressibleInterPhaseTransportModel
34 (
35  const volScalarField& rho,
36  const volVectorField& U,
37  const surfaceScalarField& phi,
40  const twoPhaseMixtureThermo& mixture
41 )
42 :
43  twoPhaseTransport_(false),
44  mixture_(mixture),
45  phi_(phi),
46  alphaPhi10_(alphaPhi10)
47 {
48  {
49  IOdictionary turbulenceProperties
50  (
51  IOobject
52  (
54  U.time().constant(),
55  U.db(),
58  )
59  );
60 
61  const word simulationType
62  (
63  turbulenceProperties.get<word>("simulationType")
64  );
65 
66  if (simulationType == "twoPhaseTransport")
67  {
68  twoPhaseTransport_ = true;
69  }
70  }
71 
72  if (twoPhaseTransport_)
73  {
74  const volScalarField& alpha1(mixture_.alpha1());
75  const volScalarField& alpha2(mixture_.alpha2());
76 
77  const volScalarField& rho1 = mixture_.thermo1().rho();
78  const volScalarField& rho2 = mixture_.thermo2().rho();
79 
80  alphaRhoPhi1_ =
81  (
83  (
84  IOobject::groupName("alphaRhoPhi", alpha1.group()),
85  fvc::interpolate(rho1)*alphaPhi10_
86  )
87  );
88 
89  alphaRhoPhi2_ =
90  (
92  (
93  IOobject::groupName("alphaRhoPhi", alpha2.group()),
94  fvc::interpolate(rho2)*(phi_ - alphaPhi10_)
95  )
96  );
97 
98  turbulence1_ =
99  (
100  ThermalDiffusivity<PhaseCompressibleTurbulenceModel<fluidThermo>>
101  ::New
102  (
103  alpha1,
104  rho1,
105  U,
106  alphaRhoPhi1_(),
107  phi,
108  mixture.thermo1()
109  )
110  );
111 
112  turbulence2_ =
113  (
114  ThermalDiffusivity<PhaseCompressibleTurbulenceModel<fluidThermo>>
115  ::New
116  (
117  alpha2,
118  rho2,
119  U,
120  alphaRhoPhi2_(),
121  phi,
122  mixture.thermo2()
123  )
124  );
125  }
126  else
127  {
129  (
130  rho,
131  U,
132  rhoPhi,
133  mixture
134  );
135 
136  turbulence_->validate();
137  }
138 }
139 
140 
141 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
142 
145 {
146  if (twoPhaseTransport_)
147  {
148  return
149  mixture_.alpha1()*mixture_.thermo1().alphaEff
150  (
151  turbulence1_->alphat()
152  )
153  + mixture_.alpha2()*mixture_.thermo2().alphaEff
154  (
155  turbulence2_->alphat()
156  );
157  }
158  else
159  {
160  return mixture_.alphaEff(turbulence_->alphat());
161  }
162 }
163 
164 
167 (
169 ) const
170 {
171  if (twoPhaseTransport_)
172  {
173  return
174  turbulence1_->divDevRhoReff(U)
175  + turbulence2_->divDevRhoReff(U);
176  }
177  else
178  {
179  return turbulence_->divDevRhoReff(U);
180  }
181 }
182 
183 
185 {
186  if (twoPhaseTransport_)
187  {
188  const volScalarField& rho1 = mixture_.thermo1().rho();
189  const volScalarField& rho2 = mixture_.thermo2().rho();
190 
191  alphaRhoPhi1_.ref() = fvc::interpolate(rho1)*alphaPhi10_;
192  alphaRhoPhi2_.ref() = fvc::interpolate(rho2)*(phi_ - alphaPhi10_);
193  }
194 }
195 
196 
198 {
199  if (twoPhaseTransport_)
200  {
201  turbulence1_->correct();
202  turbulence2_->correct();
203  }
204  else
205  {
206  turbulence_->correct();
207  }
208 }
209 
210 
211 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
rhoPhi
rhoPhi
Definition: rhoEqn.H:10
alphaPhi10
alphaPhi10
Definition: alphaEqn.H:7
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::IOdictionary::IOdictionary
IOdictionary(const IOobject &)
Construct given an IOobject.
Definition: IOdictionary.C:35
Foam::turbulenceModel::propertiesName
static const word propertiesName
Default name of the turbulence properties dictionary.
Definition: turbulenceModel.H:100
Foam::IOobject::IOobject
IOobject(const IOobject &)=default
Copy construct.
rho
rho
Definition: readInitialConditions.H:88
Foam::twoPhaseMixture::alpha2
const volScalarField & alpha2() const
Return the phase-fraction of phase 2.
Definition: twoPhaseMixture.H:105
Foam::psiThermo::rho
virtual tmp< volScalarField > rho() const
Density [kg/m^3] - uses current value of pressure.
Definition: psiThermo.C:146
compressibleInterPhaseTransportModel.H
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
rho2
volScalarField & rho2
Definition: setRegionFluidFields.H:30
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
rho1
volScalarField & rho1
Definition: setRegionFluidFields.H:27
Foam::twoPhaseMixture::alpha1
const volScalarField & alpha1() const
Return the phase-fraction of phase 1.
Definition: twoPhaseMixture.H:93
Foam::fvc::interpolate
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.
Foam::ThermalDiffusivity::New
static autoPtr< ThermalDiffusivity > New(const alphaField &alpha, const volScalarField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &transportModel, const word &propertiesName=turbulenceModel::propertiesName)
Return a reference to the selected turbulence model.
Definition: ThermalDiffusivity.C:64
Foam::compressibleInterPhaseTransportModel::divDevRhoReff
tmp< fvVectorMatrix > divDevRhoReff(volVectorField &U) const
Return the effective momentum stress divergence.
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:62
U
U
Definition: pEqn.H:72
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:54
Foam::GeometricField::ref
Internal & ref(const bool updateAccessTime=true)
Return a reference to the dimensioned internal field.
Definition: GeometricField.C:749
Foam::compressibleInterPhaseTransportModel::correctPhasePhi
void correctPhasePhi()
Correct the phase mass-fluxes.
Foam::compressibleInterPhaseTransportModel::correct
void correct()
Correct the phase or mixture transport models.
Foam::compressibleInterPhaseTransportModel::alphaEff
tmp< volScalarField > alphaEff() const
Return the effective temperature transport coefficient.
Foam::IOobject::groupName
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
Foam::psiThermo::New
static autoPtr< psiThermo > New(const fvMesh &mesh, const word &phaseName=word::null)
Selector.
Definition: psiThermo.C:118
mixture
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n"<< endl;autoPtr< temperaturePhaseChangeTwoPhaseMixture > mixture
Definition: createFields.H:39
Foam::IOobject::MUST_READ
Definition: IOobject.H:120