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-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 "ParticleStressModel.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
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 
69  << "Selecting particle stress model " << modelType << endl;
70 
71  dictionaryConstructorTable::iterator cstrIter =
72  dictionaryConstructorTablePtr_->find(modelType);
73 
74  if (cstrIter == dictionaryConstructorTablePtr_->end())
75  {
77  << "Unknown particle stress model type " << modelType
78  << ", constructor not in hash table" << nl << nl
79  << " Valid particle stress model types are:" << nl
80  << dictionaryConstructorTablePtr_->sortedToc()
81  << abort(FatalError);
82  }
83 
84  return autoPtr<ParticleStressModel>(cstrIter()(dict));
85 }
86 
87 
88 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
89 
91 {}
92 
93 
94 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
95 
97 {
98  return alphaPacked_;
99 }
100 
101 
104 (
107  const FieldField<Field, scalar>& uRms
108 ) const
109 {
111  (
112  new FieldField<Field, scalar>(alpha.size())
113  );
114 
115  forAll(alpha, i)
116  {
117  value->set(i, tau(alpha[i], rho[i], uRms[i]));
118  }
119 
120  return value;
121 }
122 
123 
124 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
Generic field type.
Definition: FieldField.H:77
Base class for inter-particle stress models.
ParticleStressModel(const dictionary &dict)
Constructors.
virtual tmp< Field< scalar > > tau(const Field< scalar > &alpha, const Field< scalar > &rho, const Field< scalar > &uRms) const =0
Collision stress.
static autoPtr< ParticleStressModel > New(const dictionary &dict)
Selector.
virtual ~ParticleStressModel()
Destructor.
scalar alphaPacked() const
Member Functions.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:669
A class for managing temporary objects.
Definition: tmp.H:55
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
const vector tau
rho
Definition: pEqn.H:1
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
Definition: units.C:346
Namespace for OpenFOAM.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
errorManip< error > abort(error &err)
Definition: errorManip.H:131
messageStream Info
defineRunTimeSelectionTable(fvConstraint, dictionary)
Ostream & indentOrNl(Ostream &os)
Indent stream or add newline if indent level == 0.
Definition: Ostream.H:250
error FatalError
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
static const char nl
Definition: Ostream.H:297
dictionary dict