momentumTransportModelTemplates.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) 2021 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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
27 
28 #include "surfaceMesh.H"
29 
30 template<class MomentumTransportModel>
32 (
33  const typename MomentumTransportModel::alphaField& alpha,
34  const typename MomentumTransportModel::rhoField& rho,
35  const volVectorField& U,
36  const surfaceScalarField& alphaRhoPhi,
37  const surfaceScalarField& phi,
38  const viscosity& viscosity
39 )
40 {
41  const word modelType
42  (
44  (
46  (
47  U.db(),
49  )
50  ).lookup("simulationType")
51  );
52 
53  Info<< "Selecting turbulence model type " << modelType << endl;
54 
55  typename MomentumTransportModel::dictionaryConstructorTable::iterator
56  cstrIter =
57  MomentumTransportModel::dictionaryConstructorTablePtr_->find(modelType);
58 
59  if
60  (
61  cstrIter
62  == MomentumTransportModel::dictionaryConstructorTablePtr_->end()
63  )
64  {
66  << "Unknown " << MomentumTransportModel::typeName << " type "
67  << modelType << nl << nl
68  << "Valid " << MomentumTransportModel::typeName << " types:" << endl
69  << MomentumTransportModel::dictionaryConstructorTablePtr_
70  ->sortedToc()
71  << exit(FatalError);
72  }
73 
75  (
76  cstrIter()(alpha, rho, U, alphaRhoPhi, phi, viscosity)
77  );
78 }
79 
80 
81 // ************************************************************************* //
Generic GeometricField class.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:312
static word group(const word &name)
Return group (extension part of name)
Definition: IOobject.C:134
const iterator & end()
Definition: UILList.H:223
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:710
const volVectorField & U() const
Access function to velocity field.
static typeIOobject< IOdictionary > readModelDict(const objectRegistry &obr, const word &group, bool registerObject=false)
static autoPtr< MomentumTransportModel > New(const typename MomentumTransportModel::alphaField &alpha, const typename MomentumTransportModel::rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const viscosity &viscosity)
virtual tmp< surfaceScalarField > phi() const
Return the volumetric flux field.
const surfaceScalarField & alphaRhoPhi() const
Access function to phase flux field.
Abstract base class for all fluid physical properties.
Definition: viscosity.H:50
A class for handling words, derived from string.
Definition: word.H:62
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
U
Definition: pEqn.H:72
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
messageStream Info
error FatalError
static const char nl
Definition: Ostream.H:266