kOmegaSSTSato.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) 2014-2026 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 
26 #include "kOmegaSSTSato.H"
27 #include "fvModels.H"
28 #include "fvConstraints.H"
29 #include "phaseSystem.H"
30 
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace RASModels
37 {
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
41 template<class BasicMomentumTransportModel>
43 (
44  const alphaField& alpha,
45  const rhoField& rho,
46  const volVectorField& U,
47  const surfaceScalarField& alphaRhoPhi,
48  const surfaceScalarField& phi,
49  const viscosity& viscosity,
50  const word& type
51 )
52 :
53  kOmegaSST<BasicMomentumTransportModel>
54  (
55  alpha,
56  rho,
57  U,
58  alphaRhoPhi,
59  phi,
60  viscosity,
61  type
62  ),
63 
64  phase_(refCast<const phaseModel>(viscosity)),
65 
66  hasDispersedPhaseNames_(this->typeDict(type).found("dispersedPhases")),
67 
68  dispersedPhaseNames_
69  (
70  this->typeDict(type).lookupOrDefault
71  (
72  "dispersedPhases",
74  )
75  ),
76 
77  Cmub_("Cmub", this->typeDict(type), 0.6)
78 {}
79 
80 
81 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
82 
83 template<class BasicMomentumTransportModel>
85 {
87  {
88  Cmub_.readIfPresent(this->typeDict());
89 
90  return true;
91  }
92  else
93  {
94  return false;
95  }
96 }
97 
98 
99 template<class BasicMomentumTransportModel>
102 {
103  UPtrList<const phaseModel> dispersedPhases;
104 
105  const phaseSystem& fluid = phase_.fluid();
106 
107  if (hasDispersedPhaseNames_)
108  {
109  dispersedPhases.resize(dispersedPhaseNames_.size());
110 
111  forAll(dispersedPhaseNames_, dispersedPhasei)
112  {
113  dispersedPhases.set
114  (
115  dispersedPhasei,
116  &fluid.phases()[dispersedPhaseNames_[dispersedPhasei]]
117  );
118  }
119  }
120  else
121  {
122  dispersedPhases.resize(fluid.movingPhases().size() - 1);
123 
124  label dispersedPhasei = 0;
125 
126  forAll(fluid.movingPhases(), movingPhasei)
127  {
128  const phaseModel& otherPhase = fluid.movingPhases()[movingPhasei];
129 
130  if (&otherPhase != &phase_)
131  {
132  dispersedPhases.set
133  (
134  dispersedPhasei ++,
135  &otherPhase
136  );
137  }
138  }
139  }
140 
141  return dispersedPhases;
142 }
143 
144 
145 template<class BasicMomentumTransportModel>
147 (
148  const volScalarField& S2,
149  const volScalarField& F2
150 )
151 {
153  (
154  pow(this->betaStar_, 0.25)*this->y()*sqrt(this->k_)/this->nu()
155  );
156 
157  this->nut_ =
158  this->a1_*this->k_/max(this->a1_*this->omega_, this->b1_*F2*sqrt(S2));
159 
160  UPtrList<const phaseModel> dispersedPhases(getDispersedPhases());
161  forAllIter(UPtrList<const phaseModel>, dispersedPhases, phaseIter)
162  {
163  this->nut_ +=
164  sqr(1 - exp(-yPlus/16.0))
165  *Cmub_*phaseIter().d()*phaseIter()
166  *(mag(this->U_ - phaseIter().U()));
167  }
168 
169  this->nut_.correctBoundaryConditions();
170  fvConstraints::New(this->mesh_).constrain(this->nut_);
171 }
172 
173 
174 template<class BasicMomentumTransportModel>
176 {
178 }
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 } // End namespace RASModels
184 } // End namespace Foam
185 
186 // ************************************************************************* //
scalar y
#define F2(B, C, D)
Definition: SHA1.C:174
bool found
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:474
static fvConstraints & New(const word &name, const fvMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
Generic GeometricField class.
Implementation of the k-omega-SST turbulence model for dispersed bubbly flows with Sato (1981) bubble...
virtual void correct()
Solve the turbulence equations and correct the turbulence viscosity.
kOmegaSSTSato(const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const viscosity &viscosity, const word &type=typeName)
Construct from components.
Definition: kOmegaSSTSato.C:43
virtual bool read()
Read model coefficients if they have changed.
Definition: kOmegaSSTSato.C:84
Specialisation for RAS of the generic kOmegaSSTBase base class. For more information,...
Definition: kOmegaSST.H:64
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: UPtrList.H:66
bool set(const label) const
Is element set.
Definition: UPtrListI.H:87
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:29
void resize(const label)
Reset size of UPtrList. This can only be used to set the size.
Definition: UPtrListI.H:71
bool constrain(fvMatrix< Type > &eqn) const
Apply constraints to an equation.
A wordList with hashed indices for faster lookup by name.
virtual void correct()
Solve the turbulence equations and correct the turbulence viscosity.
BasicMomentumTransportModel::alphaField alphaField
BasicMomentumTransportModel::rhoField rhoField
Class to represent a system of phases.
Definition: phaseSystem.H:74
const phaseModelPartialList & movingPhases() const
Return the models for phases that are moving.
Definition: phaseSystemI.H:118
const phaseModelList & phases() const
Return the phase models.
Definition: phaseSystemI.H:104
Abstract base class for all fluid physical properties.
Definition: viscosity.H:50
A class for handling words, derived from string.
Definition: word.H:63
const scalar yPlus
U
Definition: pEqn.H:72
rho
Definition: pEqn.H:1
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
dimensionedScalar exp(const dimensionedScalar &ds)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:141
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
tmp< DimensionedField< typename powProduct< Type, r >::type, GeoMesh, Field > > pow(const DimensionedField< Type, GeoMesh, PrimitiveField > &df, typename powProduct< Type, r >::type)
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488