CarrierCoeff.H
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 Class
25  Foam::CarrierCoeff
26 
27 Description
28  Class to store a coefficient of a carrier equation
29 
30 SourceFiles
31  CarrierCoeff.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef CarrierCoeff_H
36 #define CarrierCoeff_H
37 
38 #include "CarrierEqnBase.H"
39 #include "DimensionedField.H"
40 #include "fvMesh.H"
41 #include "LagrangianCoeff.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class CarrierCoeff Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class Type, bool Implicit>
53 class CarrierCoeff
54 {
55  // Private Data
56 
57  //- Reference to the equation
58  const CarrierEqnBase& eqn_;
59 
60  //- Coefficient
62 
63 
64  // Private Member Functions
65 
66  //- Construct the coefficient field for a given Lagrangian field
67  void initialise(const LagrangianSubField<Type>& lField);
68 
69 
70 public:
71 
72  // Constructors
73 
74  //- Construct from a reference to the equation
75  CarrierCoeff(const CarrierEqnBase& eqn);
76 
77  //- Construct as copy
79 
80  //- Construct as copy or reuse as specified
81  CarrierCoeff(CarrierCoeff<Type, Implicit>& coeff, const bool reuse);
82 
83  //- Move construct
85 
86 
87  // Member Functions
88 
89  //- Determine whether this coefficient has values or not
90  bool valid() const;
91 
92  //- Clear the coefficient values
93  void clear();
94 
95  //- Access the field
96  const DimensionedField<Type, fvMesh>& S() const;
97 
98  //- In-place negation
99  void negate();
100 
101 
102  // Member Operators
103 
104  //- Addition assignment
105  void operator+=(const LagrangianCoeff<Type, Implicit>& lCoeff);
106 
107  //- Subtraction assignment
108  void operator-=(const LagrangianCoeff<Type, Implicit>& lCoeff);
109 
110  //- Multiply assignment
111  void operator*=(const dimensionedScalar& s);
112 
113  //- Division assignment
114  void operator/=(const dimensionedScalar& s);
115 };
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 } // End namespace Foam
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 #ifdef NoRepository
124  #include "CarrierCoeff.C"
125 #endif
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #endif
130 
131 // ************************************************************************* //
Class to store a coefficient of a carrier equation.
Definition: CarrierCoeff.H:53
void operator*=(const dimensionedScalar &s)
Multiply assignment.
Definition: CarrierCoeff.C:166
void operator+=(const LagrangianCoeff< Type, Implicit > &lCoeff)
Addition assignment.
Definition: CarrierCoeff.C:138
bool valid() const
Determine whether this coefficient has values or not.
Definition: CarrierCoeff.C:106
void operator/=(const dimensionedScalar &s)
Division assignment.
Definition: CarrierCoeff.C:176
CarrierCoeff(const CarrierEqnBase &eqn)
Construct from a reference to the equation.
Definition: CarrierCoeff.C:63
const DimensionedField< Type, fvMesh > & S() const
Access the field.
Definition: CarrierCoeff.C:121
void negate()
In-place negation.
Definition: CarrierCoeff.C:128
void clear()
Clear the coefficient values.
Definition: CarrierCoeff.C:113
void operator-=(const LagrangianCoeff< Type, Implicit > &lCoeff)
Subtraction assignment.
Definition: CarrierCoeff.C:152
Non-templated base class for carrier equations.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Class to store a coefficient of a Lagrangian equation.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Namespace for OpenFOAM.