segregated.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 | Copyright (C) 2014-2015 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"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace dragModels
37 {
38  defineTypeNameAndDebug(segregated, 0);
39  addToRunTimeSelectionTable(dragModel, segregated, dictionary);
40 }
41 }
42 
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
47 (
48  const dictionary& dict,
49  const phasePair& pair,
50  const bool registerObject
51 )
52 :
53  dragModel(dict, pair, registerObject),
54  m_("m", dimless, dict),
55  n_("n", dimless, dict)
56 {}
57 
58 
59 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
60 
62 {}
63 
64 
65 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66 
68 {
69  FatalErrorIn("Foam::dragModels::segregated::CdRe() const")
70  << "Not implemented."
71  << "Drag coefficient not defined for the segregated model."
72  << exit(FatalError);
73 
74  return pair_.phase1();
75 }
76 
77 
79 {
80  const fvMesh& mesh(pair_.phase1().mesh());
81 
84 
85  const volScalarField& rho1(pair_.phase1().rho());
86  const volScalarField& rho2(pair_.phase2().rho());
87 
88  tmp<volScalarField> tnu1(pair_.phase1().nu());
89  tmp<volScalarField> tnu2(pair_.phase2().nu());
90 
91  const volScalarField& nu1(tnu1());
92  const volScalarField& nu2(tnu2());
93 
95  (
96  IOobject
97  (
98  "L",
99  mesh.time().timeName(),
100  mesh
101  ),
102  mesh,
103  dimensionedScalar("L", dimLength, 0),
105  );
106  L.internalField() = cbrt(mesh.V());
107  L.correctBoundaryConditions();
108 
110  (
111  alpha1
112  /max
113  (
114  alpha1 + alpha2,
116  )
117  );
118  volScalarField magGradI
119  (
120  max
121  (
122  mag(fvc::grad(I)),
124  )
125  );
126 
127  volScalarField muI
128  (
129  rho1*nu1*rho2*nu2
130  /(rho1*nu1 + rho2*nu2)
131  );
132  volScalarField muAlphaI
133  (
134  alpha1*rho1*nu1*alpha2*rho2*nu2
135  /(alpha1*rho1*nu1 + alpha2*rho2*nu2)
136  );
137 
138  volScalarField ReI
139  (
140  pair_.rho()
141  *pair_.magUr()
142  /(magGradI*muI)
143  );
144 
145  volScalarField lambda(m_*ReI + n_*muAlphaI/muI);
146 
147  return lambda*sqr(magGradI)*muI;
148 }
149 
150 
152 {
153  return fvc::interpolate(K());
154 }
155 
156 
157 // ************************************************************************* //
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &vf, const surfaceScalarField &faceFlux, Istream &schemeData)
static const char *const typeName
Definition: Field.H:94
tmp< volScalarField > rho() const
Average density.
dimensioned< scalar > mag(const dimensioned< Type > &)
const phasePair & pair_
Phase pair.
Definition: dragModel.H:62
const phaseModel & phase1() const
Definition: phasePairI.H:28
static const sphericalTensor I(1)
dimensionedScalar cbrt(const dimensionedScalar &ds)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
InternalField & internalField()
Return internal field.
Surface Interpolation.
const Mesh & mesh() const
Return mesh.
dynamicFvMesh & mesh
const phaseModel & phase2() const
Definition: phasePairI.H:34
tmp< volScalarField > magUr() const
Relative velocity magnitude.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
Namespace for OpenFOAM.
Calculate the gradient of the given field.
virtual tmp< volScalarField > CdRe() const
Drag coefficient.
dictionary dict
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
rho1
Definition: pEqn.H:124
dimensionedScalar lambda(laminarTransport.lookup("lambda"))
Macros for easy insertion into run-time selection tables.
rho2
Definition: pEqn.H:125
volScalarField & alpha1
Definition: createFields.H:15
const dimensionedScalar & residualAlpha() const
Return the residual phase-fraction for given phase.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
alpha2
Definition: alphaEqn.H:112
error FatalError
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:131
const dimensionedScalar & rho() const
Definition: phaseModel.H:165
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:52
virtual ~segregated()
Destructor.
virtual tmp< surfaceScalarField > Kf() const
The drag function Kf used in the face-momentum equations.
virtual tmp< volScalarField > K() const
Return the drag coefficient K.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
segregated(const dictionary &dict, const phasePair &pair, const bool registerObject)
Construct from components.
virtual tmp< volScalarField > K() const
The drag function used in the momentum equation.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A class for managing temporary objects.
Definition: PtrList.H:118
defineTypeNameAndDebug(combustionModel, 0)
const dimensionedScalar & nu() const
Return the laminar viscosity.
Definition: phaseModel.H:150