ParticleStressModel.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2013 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_(readScalar(dict.lookup("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  (
77  "ParticleStressModel::New"
78  "("
79  "const dictionary&"
80  ")"
81  ) << "Unknown particle stress model type " << modelType
82  << ", constructor not in hash table" << nl << nl
83  << " Valid particle stress model types are:" << nl
84  << dictionaryConstructorTablePtr_->sortedToc()
85  << abort(FatalError);
86  }
87 
88  return autoPtr<ParticleStressModel>(cstrIter()(dict));
89 }
90 
91 
92 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
93 
95 {}
96 
97 
98 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
99 
101 {
102  return alphaPacked_;
103 }
104 
105 
108 (
109  const FieldField<Field, scalar>& alpha,
110  const FieldField<Field, scalar>& rho,
111  const FieldField<Field, scalar>& uRms
112 ) const
113 {
115  (
116  new FieldField<Field, scalar>(alpha.size())
117  );
118 
119  forAll(alpha, i)
120  {
121  value->set(i, tau(alpha[i], rho[i], uRms[i]));
122  }
123 
124  return value;
125 }
126 
127 
128 // ************************************************************************* //
virtual ~ParticleStressModel()
Destructor.
scalar alphaPacked() const
Member Functions.
label size() const
Return the number of elements in the PtrList.
Generic field type.
Definition: FieldField.H:51
Base class for inter-particle stress models.
A class for handling words, derived from string.
Definition: word.H:59
messageStream Info
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
dictionary dict
static const char nl
Definition: Ostream.H:260
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
#define forAll(list, i)
Definition: UList.H:421
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
Definition: doubleScalar.H:63
errorManip< error > abort(error &err)
Definition: errorManip.H:131
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:452
error FatalError
ParticleStressModel(const dictionary &dict)
Constructors.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
static autoPtr< ParticleStressModel > New(const dictionary &dict)
Selector.
virtual tmp< Field< scalar > > tau(const Field< scalar > &alpha, const Field< scalar > &rho, const Field< scalar > &uRms) const =0
Collision stress.
A class for managing temporary objects.
Definition: PtrList.H:118
scalar alphaPacked_
Close pack volume fraction.
defineTypeNameAndDebug(combustionModel, 0)