LESfilter.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::LESfilter
29 
30 Description
31  Abstract class for LES filters
32 
33 SourceFiles
34  LESfilter.C
35  newFilter.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef LESfilter_H
40 #define LESfilter_H
41 
42 #include "volFields.H"
43 #include "typeInfo.H"
44 #include "autoPtr.H"
45 #include "runTimeSelectionTables.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 class fvMesh;
53 
54 /*---------------------------------------------------------------------------*\
55  Class LESfilter Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class LESfilter
59 {
60  // Private data
61 
62  const fvMesh& mesh_;
63 
64 
65  // Private Member Functions
66 
67  //- No copy construct
68  LESfilter(const LESfilter&) = delete;
69 
70  //- No copy assignment
71  void operator=(const LESfilter&) = delete;
72 
73 
74 protected:
75 
76  //- Temporary function to ensure the coupled boundary conditions of the
77  // field are correct for filtering.
78  //
79  // Following the rewrite of the turbulence models to use
80  // GeometricField::InternalField for sources etc. delta() will return a
81  // GeometricField::InternalField and filters will take a
82  // tmp<GeometricField::InternalField> argument and handle the coupled BCs
83  // appropriately
84  template<class GeoFieldType>
85  void correctBoundaryConditions(const tmp<GeoFieldType>& tgf) const
86  {
87  tgf.constCast().correctBoundaryConditions();
88  }
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName("LESfilter");
95 
96 
97  // Declare run-time constructor selection table
98 
100  (
101  autoPtr,
102  LESfilter,
103  dictionary,
104  (
105  const fvMesh& mesh,
106  const dictionary& LESfilterDict
107  ),
108  (mesh, LESfilterDict)
109  );
110 
111 
112  // Constructors
113 
114  //- Construct from components
115  LESfilter(const fvMesh& mesh)
116  :
117  mesh_(mesh)
118  {}
119 
120 
121  // Selectors
122 
123  //- Return a reference to the selected LES filter
124  static autoPtr<LESfilter> New
125  (
126  const fvMesh&,
127  const dictionary&,
128  const word& filterDictName="filter"
129  );
130 
131 
132  //- Destructor
133  virtual ~LESfilter() = default;
134 
135 
136  // Member Functions
137 
138  //- Return mesh reference
139  const fvMesh& mesh() const
140  {
141  return mesh_;
142  }
143 
144  //- Read the LESfilter dictionary
145  virtual void read(const dictionary&) = 0;
146 
147 
148  // Member Operators
149 
150  virtual tmp<volScalarField> operator()
151  (
152  const tmp<volScalarField>&
153  ) const = 0;
154 
155  virtual tmp<volVectorField> operator()
156  (
157  const tmp<volVectorField>&
158  ) const = 0;
159 
160  virtual tmp<volSymmTensorField> operator()
161  (
163  ) const = 0;
164 
165  virtual tmp<volTensorField> operator()
166  (
167  const tmp<volTensorField>&
168  ) const = 0;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
Foam::LESfilter::correctBoundaryConditions
void correctBoundaryConditions(const tmp< GeoFieldType > &tgf) const
Temporary function to ensure the coupled boundary conditions of the.
Definition: LESfilter.H:84
volFields.H
Foam::tmp::constCast
T & constCast() const
Definition: tmpI.H:248
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
typeInfo.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::LESfilter::mesh
const fvMesh & mesh() const
Return mesh reference.
Definition: LESfilter.H:138
Foam::LESfilter::read
virtual void read(const dictionary &)=0
Read the LESfilter dictionary.
Foam::LESfilter::TypeName
TypeName("LESfilter")
Runtime type information.
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::LESfilter
Abstract class for LES filters.
Definition: LESfilter.H:57
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::LESfilter::New
static autoPtr< LESfilter > New(const fvMesh &, const dictionary &, const word &filterDictName="filter")
Return a reference to the selected LES filter.
Definition: LESfilter.C:44
Foam::LESfilter::LESfilter
LESfilter(const fvMesh &mesh)
Construct from components.
Definition: LESfilter.H:114
Foam::LESfilter::~LESfilter
virtual ~LESfilter()=default
Destructor.
Foam::LESfilter::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, LESfilter, dictionary,(const fvMesh &mesh, const dictionary &LESfilterDict),(mesh, LESfilterDict))
autoPtr.H