daughterSizeDistributionModel.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) 2017-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 
27 #include "breakupModel.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace populationBalance
34 {
37 }
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * //
42 
45 (
46  const breakupModel& breakup,
47  const dictionary& dict
48 )
49 {
50  const word daughterSizeDistributionModelType =
51  dict.lookup<word>("daughterSizeDistributionModel");
52 
53  Info<< indentOrNl << "Selecting " << typeName << ' '
54  << daughterSizeDistributionModelType << endl;
55 
56  dictionaryConstructorTable::iterator cstrIter =
57  dictionaryConstructorTablePtr_->find(daughterSizeDistributionModelType);
58 
59  if (cstrIter == dictionaryConstructorTablePtr_->end())
60  {
62  << "Unknown daughter size distribution model type "
63  << daughterSizeDistributionModelType << endl << endl
64  << "Valid daughter size distribution model types are : " << endl
65  << dictionaryConstructorTablePtr_->sortedToc()
66  << exit(FatalError);
67  }
68 
69  printDictionary print(dict);
70 
71  return cstrIter()(breakup, dict);
72 }
73 
74 
75 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
76 
77 
80 (
81  const breakupModel& breakup,
82  const dictionary& dict
83 )
84 :
85  breakup_(breakup),
86  nik_()
87 {}
88 
89 
90 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
91 
94 {}
95 
96 
97 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
98 
101 (
102  const label i,
103  const label k
104 ) const
105 {
106  return nik_[k][i];
107 }
108 
109 
111 {
112  if (nik_.size() == 0)
113  {
114  forAll(breakup_.popBal().phases(), k)
115  {
116  nik_.append(new PtrList<dimensionedScalar>());
117 
118  for (label i = 0; i <= k; i++)
119  {
120  nik_[k].append
121  (
123  (
124  this->calcNik(i, k)
125  )
126  );
127  }
128  }
129  }
130 }
131 
132 
133 // ************************************************************************* //
label k
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Base class for breakup models which provide a total breakup rate and a separate daughter size distrib...
Definition: breakupModel.H:56
Base class for daughter size distribution models. Currently only supports field-independent formulati...
void precompute()
Pre-compute field independent expressions.
const dimensionedScalar & nik(const label i, const label k) const
Return contribution to group i due to breakup in group k.
daughterSizeDistributionModel(const breakupModel &breakup, const dictionary &dict)
static autoPtr< daughterSizeDistributionModel > New(const breakupModel &breakup, const dictionary &dict)
Enables the printing of a dictionary and subsequently looked-up defaulted entries.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
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
defineTypeNameAndDebug(breakupModel, 0)
defineRunTimeSelectionTable(breakupModel, dictionary)
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
messageStream Info
Ostream & indentOrNl(Ostream &os)
Indent stream or add newline if indent level == 0.
Definition: Ostream.H:250
error FatalError
dictionary dict