singleSizeGroupFvPatchScalarField.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) 2024 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 "populationBalanceModel.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 (
34  const fvPatch& p,
36  const dictionary& dict
37 )
38 :
39  fixedValueFvPatchScalarField(p, iF, dict),
40  index_(dict.lookup<label>("index"))
41 {}
42 
43 
45 (
47  const fvPatch& p,
49  const fieldMapper& mapper
50 )
51 :
52  fixedValueFvPatchScalarField(ptf, p, iF, mapper),
53  index_(ptf.index_)
54 {}
55 
56 
58 (
61 )
62 :
63  fixedValueFvPatchScalarField(ptf, iF),
64  index_(ptf.index_)
65 {}
66 
67 
68 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69 
71 {
72  if (updated())
73  {
74  return;
75  }
76 
77  const diameterModels::sizeGroup& fi =
78  refCast<const diameterModels::sizeGroup>(internalField());
79 
80  // Check the index
81  const label firstIndex = fi.group().sizeGroups().first().i();
82  const label lastIndex = fi.group().sizeGroups().last().i();
83  if (index_ < firstIndex || index_ > lastIndex)
84  {
86  << "Size-group index " << index_ << " is out of range of the "
87  << "indices associated with phase " << internalField().group()
88  << " (" << firstIndex << " -> " << lastIndex << ")"
89  << exit(FatalError);
90  }
91 
93 
94  fixedValueFvPatchScalarField::updateCoeffs();
95 }
96 
97 
99 (
100  Ostream& os
101 ) const
102 {
104  writeEntry(os, "index", index_);
105  writeEntry(os, "value", *this);
106 }
107 
108 
109 // * * * * * * * * * * * * * * Build Macro Function * * * * * * * * * * * * //
110 
111 namespace Foam
112 {
114  (
117  );
118 }
119 
120 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Single size class fraction field representing a fixed particle volume as defined by the user through ...
Definition: sizeGroup.H:96
const velocityGroup & group() const
Return const-reference to the velocityGroup.
Definition: sizeGroupI.H:44
label i() const
Return index of the size group within the population balance.
Definition: sizeGroupI.H:30
const PtrList< sizeGroup > & sizeGroups() const
Return sizeGroups belonging to this velocityGroup.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:91
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:237
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Boundary condition for size-group fractions that sets a value of one in a single group,...
singleSizeGroupFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
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
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
error FatalError
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
dictionary dict
volScalarField & p