LESfilter.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) 2011-2020 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::LESfilter
26 
27 Description
28  Abstract class for LES filters
29 
30 SourceFiles
31  LESfilter.C
32  newFilter.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef LESfilter_H
37 #define LESfilter_H
38 
39 #include "volFields.H"
40 #include "typeInfo.H"
41 #include "autoPtr.H"
42 #include "runTimeSelectionTables.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 class fvMesh;
50 
51 /*---------------------------------------------------------------------------*\
52  Class LESfilter Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class LESfilter
56 {
57  // Private Data
58 
59  const fvMesh& mesh_;
60 
61 
62 protected:
63 
64  //- Temporary function to ensure the coupled boundary conditions of the
65  // field are correct for filtering.
66  //
67  // Following the rewrite of the turbulence models to use
68  // GeometricField::InternalField for sources etc. delta() will return a
69  // GeometricField::InternalField and filters will take a
70  // tmp<GeometricField::InternalField> argument and handle the coupled BCs
71  // appropriately
72  template<class GeoFieldType>
73  void correctBoundaryConditions(const tmp<GeoFieldType>& tgf) const
74  {
75  const_cast<GeoFieldType&>(tgf()).correctBoundaryConditions();
76  }
77 
78 
79 public:
80 
81  //- Runtime type information
82  TypeName("LESfilter");
83 
84 
85  // Declare run-time constructor selection table
86 
88  (
89  autoPtr,
90  LESfilter,
91  dictionary,
92  (
93  const fvMesh& mesh,
94  const dictionary& LESfilterDict
95  ),
96  (mesh, LESfilterDict)
97  );
98 
99 
100  // Constructors
101 
102  //- Construct from components
103  LESfilter(const fvMesh& mesh)
104  :
105  mesh_(mesh)
106  {}
107 
108  //- Disallow default bitwise copy construction
109  LESfilter(const LESfilter&) = delete;
110 
111 
112  // Selectors
113 
114  //- Return a reference to the selected LES filter
115  static autoPtr<LESfilter> New
116  (
117  const fvMesh&,
118  const dictionary&,
119  const word& filterDictName="filter"
120  );
121 
122 
123  //- Destructor
124  virtual ~LESfilter()
125  {}
126 
127 
128  // Member Functions
129 
130  //- Return mesh reference
131  const fvMesh& mesh() const
132  {
133  return mesh_;
134  }
135 
136  //- Read the LESfilter dictionary
137  virtual void read(const dictionary&) = 0;
138 
139 
140  // Member Operators
141 
142  void operator=(const LESfilter&) = delete;
143 
144  virtual tmp<volScalarField> operator()
145  (
146  const tmp<volScalarField>&
147  ) const = 0;
148 
149  virtual tmp<volVectorField> operator()
150  (
151  const tmp<volVectorField>&
152  ) const = 0;
153 
154  virtual tmp<volSymmTensorField> operator()
155  (
157  ) const = 0;
158 
159  virtual tmp<volTensorField> operator()
160  (
161  const tmp<volTensorField>&
162  ) const = 0;
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
Abstract class for LES filters.
Definition: LESfilter.H:55
LESfilter(const fvMesh &mesh)
Construct from components.
Definition: LESfilter.H:102
TypeName("LESfilter")
Runtime type information.
virtual void read(const dictionary &)=0
Read the LESfilter dictionary.
void correctBoundaryConditions(const tmp< GeoFieldType > &tgf) const
Temporary function to ensure the coupled boundary conditions of the.
Definition: LESfilter.H:72
const fvMesh & mesh() const
Return mesh reference.
Definition: LESfilter.H:130
virtual ~LESfilter()
Destructor.
Definition: LESfilter.H:123
void operator=(const LESfilter &)=delete
static autoPtr< LESfilter > New(const fvMesh &, const dictionary &, const word &filterDictName="filter")
Return a reference to the selected LES filter.
Definition: LESfilter.C:40
declareRunTimeSelectionTable(autoPtr, LESfilter, dictionary,(const fvMesh &mesh, const dictionary &LESfilterDict),(mesh, LESfilterDict))
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
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.
Macros to ease declaration of run-time selection tables.
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...