coneDiskDirectionLagrangianVectorFieldSource.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) 2025-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 "diskInjection.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
35 (
36  const LagrangianFieldSourceBase& field,
37  const dictionary& dict
38 )
39 :
40  field_(field),
41  thetaInner_
42  (
43  Function1<scalar>::New
44  (
45  "thetaInner",
46  field.time().userUnits(),
47  units::degrees,
48  dict
49  )
50  ),
51  thetaOuter_
52  (
53  Function1<scalar>::New
54  (
55  "thetaOuter",
56  field.time().userUnits(),
57  units::degrees,
58  dict
59  )
60  )
61 {}
62 
63 
66 (
68  const LagrangianFieldSourceBase& field
69 )
70 :
71  field_(field),
72  thetaInner_(cddlvfs.thetaInner_, false),
73  thetaOuter_(cddlvfs.thetaOuter_, false)
74 {}
75 
76 
77 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
78 
81 {}
82 
83 
84 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
85 
88 (
89  const LagrangianInjection& injection,
90  const LagrangianSubMesh& subMesh
91 ) const
92 {
93  const Lagrangian::diskInjection& diskInjection =
94  field_.modelCast<Lagrangian::diskInjection>(injection);
95 
96  // Evaluate the cone angle
97  const tmp<LagrangianSubScalarField> tthetaInner =
98  Function1LagrangianFieldSource::value(subMesh, dimless, thetaInner_());
99  const tmp<LagrangianSubScalarField> tthetaOuter =
100  Function1LagrangianFieldSource::value(subMesh, dimless, thetaOuter_());
101  const LagrangianSubScalarField theta
102  (
103  (1 - diskInjection.rFrac())*tthetaInner
104  + diskInjection.rFrac()*tthetaOuter
105  );
106 
107  // Return the direction
108  return cos(theta)*diskInjection.axis() + sin(theta)*diskInjection.radial();
109 }
110 
111 
113 (
114  Ostream& os
115 ) const
116 {
117  writeEntry
118  (
119  os,
120  field_.time().userUnits(),
122  thetaInner_()
123  );
124 
125  writeEntry
126  (
127  os,
128  field_.time().userUnits(),
130  thetaOuter_()
131  );
132 }
133 
134 
135 // ************************************************************************* //
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...
tmp< LagrangianSubField< Type > > value(const LagrangianSubMesh &subMesh, const Function1< Type > &function) const
Return the source value.
Run-time selectable general function of one variable.
Definition: Function1.H:62
Base class for Lagrangian source conditions.
Base class for Lagrangian injections. Minimal wrapper over LagrangianSource. Implements some utility ...
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
Disk injection model. This injects particles continuously over a disk with a given number rate....
const LagrangianSubVectorField & radial() const
Access the cached radial vectors. Only valid during injection.
const LagrangianSubVectorField & axis() const
Access the cached axes. Only valid during injection.
const LagrangianSubScalarField & rFrac() const
Access the cached radius fractions. Only valid during injection.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Mix-in for source conditions that provides a random injection direction on a disk between two cone an...
coneDiskDirectionLagrangianVectorFieldSource(const LagrangianFieldSourceBase &, const dictionary &dict)
Construct from a dictionary.
tmp< LagrangianSubVectorField > direction(const LagrangianInjection &, const LagrangianSubMesh &) const
Return the value for an instantaneous injection.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A class for managing temporary objects.
Definition: tmp.H:55
const dimensionSet time
const unitSet degrees
const dimensionSet & dimless
Definition: dimensions.C:138
dimensionedScalar sin(const dimensionedScalar &ds)
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
dimensionedScalar cos(const dimensionedScalar &ds)
dictionary dict