sizeGroup.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-2018 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 "sizeGroup.H"
27 #include "populationBalanceModel.H"
28 #include "mixedFvPatchField.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 (
34  const word& name,
35  const dictionary& dict,
36  const phaseModel& phase,
37  const velocityGroup& velocityGroup,
38  const fvMesh& mesh
39 )
40 :
42  (
43  IOobject
44  (
45  IOobject::groupName
46  (
47  name,
48  IOobject::groupName
49  (
50  velocityGroup.phase().name(),
51  velocityGroup.popBalName()
52  )
53  ),
54  mesh.time().timeName(),
55  mesh,
56  IOobject::READ_IF_PRESENT,
57  IOobject::AUTO_WRITE
58  ),
59  mesh,
60  dimensionedScalar(name, dimless, readScalar(dict.lookup("value"))),
61  velocityGroup.f().boundaryField().types()
62  ),
63  phase_(phase),
64  velocityGroup_(velocityGroup),
65  d_("d", dimLength, dict),
66  x_("x", velocityGroup.formFactor()*pow3(d_)),
67  value_(readScalar(dict.lookup("value")))
68 {
69  // Adjust refValue at mixedFvPatchField boundaries
70  forAll(this->boundaryField(), patchi)
71  {
72  typedef mixedFvPatchField<scalar> mixedFvPatchScalarField;
73 
74  if
75  (
76  isA<mixedFvPatchScalarField>(this->boundaryFieldRef()[patchi])
77  )
78  {
79  mixedFvPatchScalarField& f =
80  refCast<mixedFvPatchScalarField>
81  (
82  this->boundaryFieldRef()[patchi]
83  );
84 
85  f.refValue() = value_;
86  }
87  }
88 }
89 
90 
91 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
92 
94 {}
95 
96 
97 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
98 
101 {
102  notImplemented("sizeGroup::clone() const");
103  return autoPtr<sizeGroup>(nullptr);
104 }
105 
106 
107 // ************************************************************************* //
#define readScalar
Definition: doubleScalar.C:38
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
sizeGroup(const word &name, const dictionary &dict, const phaseModel &phase, const velocityGroup &velocityGroup, const fvMesh &mesh)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
virtual ~sizeGroup()
Destructor.
autoPtr< sizeGroup > clone() const
Return clone.
stressControl lookup("compactNormalStress") >> compactNormalStress
word timeName
Definition: getTimeIndex.H:3
labelList f(nPoints)
dimensionedScalar pow3(const dimensionedScalar &ds)
#define notImplemented(functionName)
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:356
label patchi
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52