parcelCloudNew.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) 2020-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 #include "parcelCloud.H"
27 
28 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
29 
31 (
32  const word& name,
33  const volScalarField& rho,
34  const volVectorField& U,
35  const volScalarField& mu,
36  const dimensionedVector& g
37 )
38 {
40  (
41  IOobject
42  (
43  name + "Properties",
44  rho.mesh().time().constant(),
45  rho.mesh(),
46  IOobject::MUST_READ,
47  IOobject::NO_WRITE
48  )
49  );
50 
51  const word type(dict.lookup<word>("type"));
52 
53  Info<< "Selecting " << parcelCloud::typeName << " " << type << endl;
54 
55  viscosityConstructorTable::iterator cstrIter =
56  viscosityConstructorTablePtr_->find(type);
57 
58  if (cstrIter == viscosityConstructorTablePtr_->end())
59  {
61  << "Unknown " << parcelCloud::typeName << " " << type << nl << nl
62  << "Valid cloud types are:" << nl
63  << viscosityConstructorTablePtr_->sortedToc()
64  << exit(FatalError);
65  }
66 
67  return cstrIter()(name, rho, U, mu, g);
68 }
69 
70 
72 (
73  const word& name,
74  const volScalarField& rho,
75  const volVectorField& U,
76  const dimensionedVector& g,
77  const fluidThermo& carrierThermo
78 )
79 {
81  (
82  IOobject
83  (
84  name + "Properties",
85  rho.mesh().time().constant(),
86  rho.mesh(),
87  IOobject::MUST_READ,
88  IOobject::NO_WRITE
89  )
90  );
91 
92  const word type(dict.lookup<word>("type"));
93 
94  Info<< "Selecting " << parcelCloud::typeName << " " << type << endl;
95 
96  thermoConstructorTable::iterator cstrIter =
97  thermoConstructorTablePtr_->find(type);
98 
99  if (cstrIter == thermoConstructorTablePtr_->end())
100  {
102  << "Unknown " << parcelCloud::typeName << " " << type << nl << nl
103  << "Valid cloud types are:" << nl
104  << thermoConstructorTablePtr_->sortedToc()
105  << exit(FatalError);
106  }
107 
108  return cstrIter()(name, rho, U, g, carrierThermo);
109 }
110 
111 
112 // ************************************************************************* //
dictionary dict
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
static autoPtr< parcelCloud > New(const word &name, const volScalarField &rho, const volVectorField &U, const volScalarField &mu, const dimensionedVector &g)
Selectors.
U
Definition: pEqn.H:72
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
A class for handling words, derived from string.
Definition: word.H:59
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:53
static const char nl
Definition: Ostream.H:260
const dimensionedScalar mu
Atomic mass unit.
const Mesh & mesh() const
Return mesh.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
messageStream Info
const dimensionedVector & g
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:98
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:864