ParticleStressModel.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) 2013-2019 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 "ParticleStressModel.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32  defineTypeNameAndDebug(ParticleStressModel, 0);
33  defineRunTimeSelectionTable(ParticleStressModel, dictionary);
34 }
35 
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
40 (
41  const dictionary& dict
42 )
43 :
44  alphaPacked_(dict.template lookup<scalar>("alphaPacked"))
45 {
46 }
47 
48 
50 (
51  const ParticleStressModel& cm
52 )
53 :
54  alphaPacked_(cm.alphaPacked_)
55 {
56 }
57 
58 
59 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
60 
62 (
63  const dictionary& dict
64 )
65 {
66  word modelType(dict.lookup("type"));
67 
68  Info<< "Selecting particle stress model " << modelType << endl;
69 
70  dictionaryConstructorTable::iterator cstrIter =
71  dictionaryConstructorTablePtr_->find(modelType);
72 
73  if (cstrIter == dictionaryConstructorTablePtr_->end())
74  {
76  << "Unknown particle stress model type " << modelType
77  << ", constructor not in hash table" << nl << nl
78  << " Valid particle stress model types are:" << nl
79  << dictionaryConstructorTablePtr_->sortedToc()
80  << abort(FatalError);
81  }
82 
83  return autoPtr<ParticleStressModel>(cstrIter()(dict));
84 }
85 
86 
87 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
88 
90 {}
91 
92 
93 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
94 
96 {
97  return alphaPacked_;
98 }
99 
100 
103 (
104  const FieldField<Field, scalar>& alpha,
105  const FieldField<Field, scalar>& rho,
106  const FieldField<Field, scalar>& uRms
107 ) const
108 {
110  (
111  new FieldField<Field, scalar>(alpha.size())
112  );
113 
114  forAll(alpha, i)
115  {
116  value->set(i, tau(alpha[i], rho[i], uRms[i]));
117  }
118 
119  return value;
120 }
121 
122 
123 // ************************************************************************* //
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
scalar alphaPacked_
Close pack volume fraction.
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
virtual ~ParticleStressModel()
Destructor.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
ParticleStressModel(const dictionary &dict)
Constructors.
static autoPtr< ParticleStressModel > New(const dictionary &dict)
Selector.
Generic field type.
Definition: FieldField.H:51
scalar alphaPacked() const
Member Functions.
A class for handling words, derived from string.
Definition: word.H:59
errorManip< error > abort(error &err)
Definition: errorManip.H:131
static const char nl
Definition: Ostream.H:260
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:29
messageStream Info
A class for managing temporary objects.
Definition: PtrList.H:53
Base class for inter-particle stress models.
Namespace for OpenFOAM.
virtual tmp< Field< scalar > > tau(const Field< scalar > &alpha, const Field< scalar > &rho, const Field< scalar > &uRms) const =0
Collision stress.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:812