SecondaryPropertyModel.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) 2019-2025 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 "SecondaryPropertyModel.H"
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 template<class ModelType>
33 (
34  const sizeGroup& fi
35 ) const
36 {
37  const ModelType& model = ModelType::model(fi);
38 
39  if (!isA<SecondaryPropertyModel<ModelType>>(model))
40  {
42  << "Phase " << this->group().phase().name() << " of population "
43  << "balance " << this->group().group().popBal().name() << " has a "
44  << type() << " " << ModelType::typeName << " but phase "
45  << fi.phase().name() << " does not. The " << type() << " "
46  << ModelType::typeName << " requires all phases of the population "
47  << "balance to " << " have the " << type() << " "
48  << ModelType::typeName << "." << exit(FatalError);
49  }
50 
51  return refCast<const SecondaryPropertyModel<ModelType>>(model);
52 }
53 
54 
55 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
56 
57 template<class ModelType>
59 (
60  const sizeGroup& group
61 )
62 :
63  ModelType(group)
64 {}
65 
66 
67 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
68 
69 template<class ModelType>
72 {}
73 
74 
75 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
76 
77 template<class ModelType>
80 (
81  const sizeGroup& fi
82 )
83 {
84  const ModelType& model = ModelType::model(fi);
85 
87  {
89  << "Phase " << fi.phase().name() << " does not have a "
90  << ModelType::typeName << " with a secondary property"
91  << exit(FatalError);
92  }
93 
94  return refCast<const SecondaryPropertyModel<ModelType>>(model);
95 }
96 
97 
98 template<class ModelType>
100 (
102  const sizeGroup& fj,
103  const sizeGroup& fk
104 )
105 {
106  const volScalarField::Internal& propj = correspondingModel(fj).fld();
107  const volScalarField::Internal& propk = correspondingModel(fk).fld();
108 
109  src() += (propj*fj.x() + propk*fk.x())/(fj.x() + fk.x())*Su;
110 }
111 
112 
113 template<class ModelType>
115 (
117  const sizeGroup& fj
118 )
119 {
120  const volScalarField::Internal& propj = correspondingModel(fj).fld();
121 
122  src() += propj*Su;
123 }
124 
125 
126 template<class ModelType>
128 {
129  src() = Zero;
130 }
131 
132 
133 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Base class for modelling evolution of secondary representative properties of a size class....
static const SecondaryPropertyModel< ModelType > & model(const sizeGroup &fi)
Return the secondary property model of a given size group.
virtual void addCoalescence(const volScalarField::Internal &Su, const sizeGroup &fj, const sizeGroup &fk)
Add coalescence contribution to secondary property source.
SecondaryPropertyModel(const sizeGroup &group)
Construct from sizeGroup.
virtual void reset()
Reset secondary property source.
virtual void addBreakup(const volScalarField::Internal &Su, const sizeGroup &fj)
Add breakup contribution to secondary property source.
Single size class fraction field representing a fixed particle volume as defined by the user through ...
Definition: sizeGroup.H:96
const dimensionedScalar & x() const
Return representative volume of the sizeGroup.
Definition: sizeGroupI.H:58
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
const char *const group
Group name for atomic constants.
tmp< VolField< Type > > Su(const VolField< Type > &su, const VolField< Type > &vf)
Definition: fvcSup.C:44
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
static const zero Zero
Definition: zero.H:97
bool isA(const Type &t)
Check if a dynamic_cast to typeid is possible.
Definition: typeInfo.H:171
error FatalError
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488