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-2023 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(),
48  )
49  );
50 
51  const word type(dict.lookup<word>("type"));
52 
53  Info<< "Selecting " << parcelCloud::typeName << " " << type << endl;
54 
55  libs.open(dict, "libs");
56 
57  viscosityConstructorTable::iterator cstrIter =
58  viscosityConstructorTablePtr_->find(type);
59 
60  if (cstrIter == viscosityConstructorTablePtr_->end())
61  {
63  << "Unknown " << parcelCloud::typeName << " " << type << nl << nl
64  << "Valid cloud types are:" << nl
65  << viscosityConstructorTablePtr_->sortedToc()
66  << exit(FatalError);
67  }
68 
69  return cstrIter()(name, rho, U, mu, g);
70 }
71 
72 
74 (
75  const word& name,
76  const volScalarField& rho,
77  const volVectorField& U,
78  const dimensionedVector& g,
79  const fluidThermo& carrierThermo
80 )
81 {
83  (
84  IOobject
85  (
86  name + "Properties",
87  rho.mesh().time().constant(),
88  rho.mesh(),
91  )
92  );
93 
94  const word type(dict.lookup<word>("type"));
95 
96  Info<< "Selecting " << parcelCloud::typeName << " " << type << endl;
97 
98  libs.open(dict, "libs");
99 
100  thermoConstructorTable::iterator cstrIter =
101  thermoConstructorTablePtr_->find(type);
102 
103  if (cstrIter == thermoConstructorTablePtr_->end())
104  {
106  << "Unknown " << parcelCloud::typeName << " " << type << nl << nl
107  << "Valid cloud types are:" << nl
108  << thermoConstructorTablePtr_->sortedToc()
109  << exit(FatalError);
110  }
111 
112  return cstrIter()(name, rho, U, g, carrierThermo);
113 }
114 
115 
116 // ************************************************************************* //
Generic GeometricField class.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:860
bool open(const fileName &libName, const bool verbose=true)
Open the named library, optionally with warnings if problems occur.
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:57
static autoPtr< parcelCloud > New(const word &name, const volScalarField &rho, const volVectorField &U, const volScalarField &mu, const dimensionedVector &g)
Selectors.
A class for handling words, derived from string.
Definition: word.H:62
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
U
Definition: pEqn.H:72
const dimensionedScalar mu
Atomic mass unit.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
dlLibraryTable libs
Table of loaded dynamic libraries.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
messageStream Info
error FatalError
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
static const char nl
Definition: Ostream.H:260
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
dictionary dict