forcing.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) 2017-2023 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::fv::forcing
26 
27 Description
28  Base fvModel for forcing functions.
29 
30 See also
31  Foam::fv::isotropicDamping
32  Foam::fv::verticalDamping
33 
34 SourceFiles
35  forcing.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef forcing_H
40 #define forcing_H
41 
42 #include "fvModel.H"
43 #include "Function1.H"
44 #include "volFields.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 namespace fv
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class forcing Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class forcing
58 :
59  public fvModel
60 {
61 protected:
62 
63  // Protected Data
64 
65  //- Optionally write the forcing fields
66  bool writeForceFields_;
67 
68  //- Forcing coefficient [1/s]
69  mutable dimensionedScalar lambda_;
70 
71  //- Optional boundary forcing coefficient [1/s]
73 
74  //- The scaling function
76 
77  //- Origins of the scaling coordinate
79 
80  //- Directions of increasing scaling coordinate
82 
83 
84  // Protected Member Functions
85 
86  //- Non-virtual read
87  void readCoeffs();
88 
89  //- Read the forcing coefficients
90  void readLambda();
91 
92  //- Calculate and return the volume average forcing region length
94 
95  //- Return the scale distribution
96  virtual tmp<volScalarField::Internal> scale() const;
97 
98  //- Return the force coefficient
100 
101  //- Optionally write the forcing fields:
102  // forcing:scale, forcing:forceCoeff
103  void writeForceFields() const;
104 
105 
106 public:
107 
108  //- Runtime type information
109  TypeName("forcing");
110 
111 
112  // Constructors
113 
114  //- Construct from components
115  forcing
116  (
117  const word& name,
118  const word& modelType,
119  const fvMesh& mesh,
120  const dictionary& dict
121  );
122 
123 
124  //- Destructor
125  virtual ~forcing()
126  {}
127 
128 
129  // Member Functions
130 
131  //- Read dictionary
132  virtual bool read(const dictionary& dict);
133 };
134 
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 } // End namespace fv
139 } // End namespace Foam
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #endif
144 
145 // ************************************************************************* //
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
Finite volume model abstract base class.
Definition: fvModel.H:59
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:53
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:47
Base fvModel for forcing functions.
Definition: forcing.H:59
void readCoeffs()
Non-virtual read.
Definition: forcing.C:65
vectorField directions_
Directions of increasing scaling coordinate.
Definition: forcing.H:80
bool writeForceFields_
Optionally write the forcing fields.
Definition: forcing.H:65
TypeName("forcing")
Runtime type information.
void readLambda()
Read the forcing coefficients.
Definition: forcing.C:45
void writeForceFields() const
Optionally write the forcing fields:
Definition: forcing.C:214
virtual ~forcing()
Destructor.
Definition: forcing.H:124
dimensionedScalar lambda_
Forcing coefficient [1/s].
Definition: forcing.H:68
vectorField origins_
Origins of the scaling coordinate.
Definition: forcing.H:77
dimensionedScalar lambdaBoundary_
Optional boundary forcing coefficient [1/s].
Definition: forcing.H:71
forcing(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
Definition: forcing.C:230
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: forcing.C:251
virtual tmp< volScalarField::Internal > forceCoeff() const
Return the force coefficient.
Definition: forcing.C:184
dimensionedScalar regionLength() const
Calculate and return the volume average forcing region length.
Definition: forcing.C:135
virtual tmp< volScalarField::Internal > scale() const
Return the scale distribution.
Definition: forcing.C:159
autoPtr< Function1< scalar > > scale_
The scaling function.
Definition: forcing.H:74
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
labelList fv(nPoints)
dictionary dict