All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
segregated.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-2020 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 "segregated.H"
27 #include "phasePair.H"
28 #include "fvcGrad.H"
29 #include "surfaceInterpolate.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace dragModels
38 {
39  defineTypeNameAndDebug(segregated, 0);
40  addToRunTimeSelectionTable(dragModel, segregated, dictionary);
41 }
42 }
43 
44 
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 
48 (
49  const dictionary& dict,
50  const phasePair& pair,
51  const bool registerObject
52 )
53 :
54  dragModel(dict, pair, registerObject),
55  m_("m", dimless, dict),
56  n_("n", dimless, dict)
57 {}
58 
59 
60 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
61 
63 {}
64 
65 
66 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
67 
69 {
71  << "Not implemented."
72  << "Drag coefficient not defined for the segregated model."
73  << exit(FatalError);
74 
75  return pair_.phase1();
76 }
77 
78 
80 {
81  const fvMesh& mesh(pair_.phase1().mesh());
82 
85 
86  const volScalarField& rho1(pair_.phase1().rho());
87  const volScalarField& rho2(pair_.phase2().rho());
88 
89  tmp<volScalarField> tnu1(pair_.phase1().thermo().nu());
90  tmp<volScalarField> tnu2(pair_.phase2().thermo().nu());
91 
92  const volScalarField& nu1(tnu1());
93  const volScalarField& nu2(tnu2());
94 
96  (
97  IOobject
98  (
99  "L",
100  mesh.time().timeName(),
101  mesh
102  ),
103  mesh,
106  );
107  L.primitiveFieldRef() = cbrt(mesh.V());
108  L.correctBoundaryConditions();
109 
110  const dimensionedScalar residualAlpha
111  (
113  );
114 
115  const volScalarField I(alpha1/max(alpha1 + alpha2, residualAlpha));
116  const volScalarField magGradI(max(mag(fvc::grad(I)), 0.5*residualAlpha/L));
117  const volScalarField muI(rho1*nu1*rho2*nu2/(rho1*nu1 + rho2*nu2));
118 
119  const volScalarField limitedAlpha1
120  (
122  );
123 
124  const volScalarField limitedAlpha2
125  (
127  );
128 
129  const volScalarField muAlphaI
130  (
131  limitedAlpha1*rho1*nu1*limitedAlpha2*rho2*nu2
132  /(limitedAlpha1*rho1*nu1 + limitedAlpha2*rho2*nu2)
133  );
134 
135  const volScalarField ReI
136  (
137  pair_.rho()*pair_.magUr()
138  /(magGradI*limitedAlpha1*limitedAlpha2*muI)
139  );
140 
141  const volScalarField lambda(m_*ReI + n_*muAlphaI/muI);
142 
143  return lambda*sqr(magGradI)*muI;
144 }
145 
146 
148 {
149  return fvc::interpolate(K());
150 }
151 
152 
153 // ************************************************************************* //
const volScalarField & rho1
virtual tmp< volScalarField > K() const
The drag function used in the momentum equation.
dictionary dict
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:52
const phaseModel & phase2() const
Return phase 2.
Definition: phasePairI.H:34
dimensionedScalar lambda(laminarTransport.lookup("lambda"))
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:323
static const char *const typeName
Definition: Field.H:105
const phaseModel & phase1() const
Return phase 1.
Definition: phasePairI.H:28
dimensionedSymmTensor sqr(const dimensionedVector &dv)
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:167
virtual tmp< volScalarField > rho() const =0
Return the density field.
volScalarField & alpha1(mixture.alpha1())
tmp< volScalarField > magUr() const
Relative velocity magnitude.
const dimensionSet dimless
virtual ~segregated()
Destructor.
virtual tmp< volScalarField > CdRe() const
Drag coefficient.
Macros for easy insertion into run-time selection tables.
const dimensionSet dimLength
alpha2
Definition: alphaEqn.H:115
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
virtual tmp< volScalarField > K() const
Return the drag coefficient K.
dynamicFvMesh & mesh
static const Identity< scalar > I
Definition: Identity.H:93
Calculate the gradient of the given field.
const rhoThermo & thermo() const
Return const-access to phase rhoThermo.
Definition: phaseModel.H:121
dimensionedScalar cbrt(const dimensionedScalar &ds)
const dimensionedScalar & residualAlpha() const
Return the residual phase-fraction for given phase.
const phasePair & pair_
Phase pair.
Definition: dragModel.H:62
Internal::FieldType & primitiveFieldRef()
Return a reference to the internal field.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
const Mesh & mesh() const
Return mesh.
defineTypeNameAndDebug(combustionModel, 0)
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.
segregated(const dictionary &dict, const phasePair &pair, const bool registerObject)
Construct from components.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const volScalarField & rho2
virtual tmp< volScalarField > nu() const
Kinematic viscosity of mixture [m^2/s].
Definition: fluidThermo.C:84
dimensioned< scalar > mag(const dimensioned< Type > &)
A class for managing temporary objects.
Definition: PtrList.H:53
virtual tmp< surfaceScalarField > Kf() const
The drag function Kf used in the face-momentum equations.
Namespace for OpenFOAM.
tmp< volScalarField > rho() const
Average density.