singleGroupFractionFvPatchScalarField.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-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 "populationBalanceModel.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
34 (
35  const fvPatch& p,
37  const dictionary& dict
38 )
39 :
40  fixedValueFvPatchScalarField(p, iF, dict),
42  index_(dict.lookup<label>("index"))
43 {}
44 
45 
48 (
50  const fvPatch& p,
52  const fieldMapper& mapper
53 )
54 :
55  fixedValueFvPatchScalarField(ptf, p, iF, mapper),
57  index_(ptf.index_)
58 {}
59 
60 
63 (
66 )
67 :
68  fixedValueFvPatchScalarField(ptf, iF),
70  index_(ptf.index_)
71 {}
72 
73 
74 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
75 
77 {
78  if (updated())
79  {
80  return;
81  }
82 
83  const populationBalanceModel& popBal = this->popBal();
84  const label i = this->i();
85  const label phaseiFirst = popBal.diameters()[i].iFirst();
86  const label phaseiLast = popBal.diameters()[i].iLast();
87 
88  // Check the index
89  if (index_ < phaseiFirst || index_ > phaseiLast)
90  {
92  << "Group index " << index_ << " is out of range of the group "
93  << "indices associated with phase " << internalField().group()
94  << " (" << phaseiFirst << " -> " << phaseiLast << ")"
95  << exit(FatalError);
96  }
97 
99 
100  fixedValueFvPatchScalarField::updateCoeffs();
101 }
102 
103 
105 (
106  Ostream& os
107 ) const
108 {
110  writeEntry(os, "index", index_);
111  writeEntry(os, "value", *this);
112 }
113 
114 
115 // * * * * * * * * * * * * * * Build Macro Function * * * * * * * * * * * * //
116 
117 namespace Foam
118 {
120  (
123  );
124 }
125 
126 // ************************************************************************* //
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
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:90
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:235
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:58
Base class for source conditions of properties of the groups in a population balance model.
Model for tracking the evolution of a dispersed phase size distribution due to coalescence (synonymou...
const UPtrList< const diameterModels::populationBalance > & diameters() const
Access the list of diameter models associated with each group.
Boundary condition for group fractions of a population balance model that sets a value of one in a si...
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
singleGroupFractionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, fvMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
Definition: units.C:346
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 > &)
makePatchTypeField(fvPatchScalarField, atmosphericBoundaryLayerTurbulentEpsilonFvPatchScalarField)
error FatalError
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
dictionary dict
volScalarField & p