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-2026 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 
54  << "Selecting " << parcelCloud::typeName << " " << type << endl;
55 
56  libs.open(dict, "libs");
57 
58  viscosityConstructorTable::iterator cstrIter =
59  viscosityConstructorTablePtr_->find(type);
60 
61  if (cstrIter == viscosityConstructorTablePtr_->end())
62  {
64  << "Unknown " << parcelCloud::typeName << " " << type << nl << nl
65  << "Valid cloud types are:" << nl
66  << viscosityConstructorTablePtr_->sortedToc()
67  << exit(FatalError);
68  }
69 
70  return cstrIter()(name, rho, U, mu, g);
71 }
72 
73 
75 (
76  const word& name,
77  const volScalarField& rho,
78  const volVectorField& U,
79  const dimensionedVector& g,
80  const fluidThermo& carrierThermo
81 )
82 {
84  (
85  IOobject
86  (
87  name + "Properties",
88  rho.mesh().time().constant(),
89  rho.mesh(),
92  )
93  );
94 
95  const word type(dict.lookup<word>("type"));
96 
98  << "Selecting " << parcelCloud::typeName << " " << type << endl;
99 
100  libs.open(dict, "libs");
101 
102  thermoConstructorTable::iterator cstrIter =
103  thermoConstructorTablePtr_->find(type);
104 
105  if (cstrIter == thermoConstructorTablePtr_->end())
106  {
108  << "Unknown " << parcelCloud::typeName << " " << type << nl << nl
109  << "Valid cloud types are:" << nl
110  << thermoConstructorTablePtr_->sortedToc()
111  << exit(FatalError);
112  }
113 
114  return cstrIter()(name, rho, U, g, carrierThermo);
115 }
116 
117 
118 // ************************************************************************* //
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:669
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:56
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:63
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
U
Definition: pEqn.H:72
rho
Definition: pEqn.H:1
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:288
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
messageStream Info
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
Ostream & indentOrNl(Ostream &os)
Indent stream or add newline if indent level == 0.
Definition: Ostream.H:250
error FatalError
static const char nl
Definition: Ostream.H:297
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