virtualMassModel.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) 2014-2015 OpenFOAM Foundation
9  Copyright (C) 2020-2021 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 
29 #include "virtualMassModel.H"
30 #include "phasePair.H"
31 #include "surfaceInterpolate.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37  defineTypeNameAndDebug(virtualMassModel, 0);
38  defineRunTimeSelectionTable(virtualMassModel, dictionary);
39 }
40 
42 
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
47 (
48  const dictionary& dict,
49  const phasePair& pair,
50  const bool registerObject
51 )
52 :
53  regIOobject
54  (
55  IOobject
56  (
57  IOobject::groupName(typeName, pair.name()),
58  pair.phase1().mesh().time().timeName(),
59  pair.phase1().mesh(),
60  IOobject::NO_READ,
61  IOobject::NO_WRITE,
62  registerObject
63  )
64  ),
65  pair_(pair)
66 {}
67 
68 
69 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
70 
73 (
74  const dictionary& dict,
75  const phasePair& pair
76 )
77 {
78  const word modelType(dict.get<word>("type"));
79 
80  Info<< "Selecting virtualMassModel for "
81  << pair << ": " << modelType << endl;
82 
83  auto* ctorPtr = dictionaryConstructorTable(modelType);
84 
85  if (!ctorPtr)
86  {
88  (
89  dict,
90  "virtualMassModel",
91  modelType,
92  *dictionaryConstructorTablePtr_
93  ) << exit(FatalIOError);
94  }
95 
96  return ctorPtr(dict, pair, true);
97 }
98 
99 
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 
103 {
104  return Cvm()*pair_.continuous().rho();
105 }
106 
107 
109 {
110  return pair_.dispersed()*Ki();
111 }
112 
113 
115 {
116  return
117  fvc::interpolate(pair_.dispersed())*fvc::interpolate(Ki());
118 }
119 
120 
121 bool Foam::virtualMassModel::writeData(Ostream& os) const
122 {
123  return os.good();
124 }
125 
126 
127 // ************************************************************************* //
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:57
Foam::dimDensity
const dimensionSet dimDensity
Foam::virtualMassModel::virtualMassModel
virtualMassModel(const dictionary &dict, const phasePair &pair, const bool registerObject)
Definition: virtualMassModel.C:42
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Foam::virtualMassModel::writeData
bool writeData(Ostream &os) const
Definition: virtualMassModel.C:116
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Definition: Ostream.H:381
Foam::dictionary::get
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:100
Foam::dimensionSet
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:104
Foam::IOstream::good
bool good() const noexcept
Definition: IOstream.H:229
Foam::virtualMassModel::K
virtual tmp< volScalarField > K() const
Definition: virtualMassModel.C:103
Foam::virtualMassModel::Ki
virtual tmp< volScalarField > Ki() const
Definition: virtualMassModel.C:97
Foam::virtualMassModel::New
static autoPtr< virtualMassModel > New(const dictionary &dict, const phasePair &pair)
Definition: virtualMassModel.C:68
virtualMassModel.H
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Definition: error.H:502
Foam::Info
messageStream Info
timeName
word timeName
Definition: getTimeIndex.H:3
dict
dictionary dict
Definition: searchingEngine.H:14
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Definition: atmBoundaryLayer.C:26
Foam::fvc::interpolate
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
Foam::virtualMassModel::Kf
virtual tmp< surfaceScalarField > Kf() const
Definition: virtualMassModel.C:109
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:49
Foam::name
word name(const expressions::valueTypeCode typeCode)
Definition: exprTraits.C:52
phase1
phaseModel & phase1
Definition: setRegionFluidFields.H:5
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::virtualMassModel::dimK
static const dimensionSet dimK
Definition: virtualMassModel.H:88