Plugins
upwind.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2015: G-CSC, Goethe University Frankfurt
3  * Author: Andreas Vogel
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__UG__NAVIER_STOKES__UPWIND__
34 #define __H__UG__NAVIER_STOKES__UPWIND__
35 
36 //#define UG_NSUPWIND_ASSERT(cond, exp)
37 // include define below to assert arrays used in stabilization
38 #define UG_NSUPWIND_ASSERT(cond, exp) UG_ASSERT((cond), exp)
39 
40 #include <vector>
41 #include <string>
42 
43 #include "upwind_interface.h"
47 
48 namespace ug{
49 namespace NavierStokes{
50 
52 // No Upwind
54 
55 template <int dim>
57 : public INavierStokesUpwind<dim>,
58  public NavierStokesUpwindRegister<FV1Geometry, dim, NavierStokesNoUpwind<dim> >,
59  public NavierStokesUpwindRegister<CRFVGeometry, dim, NavierStokesNoUpwind<dim> >,
60  public NavierStokesUpwindRegister<HCRFVGeometry, dim, NavierStokesNoUpwind<dim> >
61 {
62  public:
64  static const size_t maxNumSCVF = base_type::maxNumSCVF;
65  static const size_t maxNumSH = base_type::maxNumSH;
66 
67  public:
70 
72  template <typename TElem>
73  static void compute(const FV1Geometry<TElem, dim>* geo,
74  const MathVector<dim> vIPVel[maxNumSCVF],
75  number vUpShapeSh[maxNumSCVF][maxNumSH],
76  number vUpShapeIp[maxNumSCVF][maxNumSCVF],
77  number vConvLength[maxNumSCVF]);
78 
80  template <typename TElem>
81  static void compute(const CRFVGeometry<TElem, dim>* geo,
82  const MathVector<dim> vIPVel[maxNumSCVF],
83  number vUpShapeSh[maxNumSCVF][maxNumSH],
84  number vUpShapeIp[maxNumSCVF][maxNumSCVF],
85  number vConvLength[maxNumSCVF]);
86 
88  template <typename TElem>
89  static void compute(const HCRFVGeometry<TElem, dim>* geo,
90  const MathVector<dim> vIPVel[maxNumSCVF],
91  number vUpShapeSh[maxNumSCVF][maxNumSH],
92  number vUpShapeIp[maxNumSCVF][maxNumSCVF],
93  number vConvLength[maxNumSCVF]);
94 };
95 
97 // Full Upwind
99 
100 template <int dim>
102 : public INavierStokesUpwind<dim>,
103  public NavierStokesUpwindRegister<FV1Geometry, dim, NavierStokesFullUpwind<dim> >,
104  public NavierStokesUpwindRegister<CRFVGeometry, dim, NavierStokesFullUpwind<dim> >,
105  public NavierStokesUpwindRegister<HCRFVGeometry, dim, NavierStokesFullUpwind<dim> >
106 {
107  public:
109  static const size_t maxNumSCVF = base_type::maxNumSCVF;
110  static const size_t maxNumSH = base_type::maxNumSH;
111 
112  public:
115 
117  template <typename TElem>
118  static void compute(const FV1Geometry<TElem, dim>* geo,
119  const MathVector<dim> vIPVel[maxNumSCVF],
120  number vUpShapeSh[maxNumSCVF][maxNumSH],
121  number vUpShapeIp[maxNumSCVF][maxNumSCVF],
122  number vConvLength[maxNumSCVF]);
123 
125  template <typename TElem>
126  static void compute(const CRFVGeometry<TElem, dim>* geo,
127  const MathVector<dim> vIPVel[maxNumSCVF],
128  number vUpShapeSh[maxNumSCVF][maxNumSH],
129  number vUpShapeIp[maxNumSCVF][maxNumSCVF],
130  number vConvLength[maxNumSCVF]);
131 
133  template <typename TElem>
134  static void compute(const HCRFVGeometry<TElem, dim>* geo,
135  const MathVector<dim> vIPVel[maxNumSCVF],
136  number vUpShapeSh[maxNumSCVF][maxNumSH],
137  number vUpShapeIp[maxNumSCVF][maxNumSCVF],
138  number vConvLength[maxNumSCVF]);
139 };
140 
141 
143 // Weighted Upwind
144 // upwinding between full and no upwind
145 // shapes computed as m_weight*no_upwind_shape + (1-m_weight)*full_upwind_shape
147 /*
148 template <int dim>
149 class NavierStokesWeightedUpwind
150 : public INavierStokesUpwind<dim>,
151  public NavierStokesUpwindRegister<CRFVGeometry, dim, NavierStokesWeightedUpwind<dim> >
152 {
153  public:
154  typedef INavierStokesUpwind<dim> base_type;
155  static const size_t maxNumSCVF = base_type::maxNumSCVF;
156  static const size_t maxNumSH = base_type::maxNumSH;
157 
158  public:
160  NavierStokesWeightedUpwind(number weight = 0.5) : m_weight(weight)
161  {
162  this->set_shape_ip_flag(false);
163  }
164 
165  void set_weight(number weight) {m_weight = weight;}
166 
168  template <typename TElem>
169  static void compute(const CRFVGeometry<TElem, dim>* geo,
170  const MathVector<dim> vIPVel[maxNumSCVF],
171  number vUpShapeSh[maxNumSCVF][maxNumSH],
172  number vUpShapeIp[maxNumSCVF][maxNumSCVF],
173  number vConvLength[maxNumSCVF]);
174 
175  protected:
176  number m_weight;
177 };
178 */
180 // Skewed Upwind
182 
183 template <int dim>
185 : public INavierStokesUpwind<dim>,
186  public NavierStokesUpwindRegister<FV1Geometry, dim, NavierStokesSkewedUpwind<dim> >,
187  public NavierStokesUpwindRegister<CRFVGeometry, dim, NavierStokesSkewedUpwind<dim> >
188 {
189  public:
191  static const size_t maxNumSCVF = base_type::maxNumSCVF;
192  static const size_t maxNumSH = base_type::maxNumSH;
193 
194  public:
197 
199  template <typename TElem>
200  static void compute(const FV1Geometry<TElem, dim>* geo,
201  const MathVector<dim> vIPVel[maxNumSCVF],
202  number vUpShapeSh[maxNumSCVF][maxNumSH],
203  number vUpShapeIp[maxNumSCVF][maxNumSCVF],
204  number vConvLength[maxNumSCVF]);
205 
207  template <typename TElem>
208  static void compute(const CRFVGeometry<TElem, dim>* geo,
209  const MathVector<dim> vIPVel[maxNumSCVF],
210  number vUpShapeSh[maxNumSCVF][maxNumSH],
211  number vUpShapeIp[maxNumSCVF][maxNumSCVF],
212  number vConvLength[maxNumSCVF]);
213 };
214 
216 // Linear Profile Skewed Upwind
218 
219 template <int dim>
221 : public INavierStokesUpwind<dim>,
222  public NavierStokesUpwindRegister<FV1Geometry, dim, NavierStokesLinearProfileSkewedUpwind<dim> >,
223  public NavierStokesUpwindRegister<CRFVGeometry, dim, NavierStokesLinearProfileSkewedUpwind<dim> >
224 {
225  public:
227  static const size_t maxNumSCVF = base_type::maxNumSCVF;
228  static const size_t maxNumSH = base_type::maxNumSH;
229 
230  public:
233 
235  template <typename TElem>
236  static void compute(const FV1Geometry<TElem, dim>* geo,
237  const MathVector<dim> vIPVel[maxNumSCVF],
238  number vUpShapeSh[maxNumSCVF][maxNumSH],
239  number vUpShapeIp[maxNumSCVF][maxNumSCVF],
240  number vConvLength[maxNumSCVF]);
241 
243  template <typename TElem>
244  static void compute(const CRFVGeometry<TElem, dim>* geo,
245  const MathVector<dim> vIPVel[maxNumSCVF],
246  number vUpShapeSh[maxNumSCVF][maxNumSH],
247  number vUpShapeIp[maxNumSCVF][maxNumSCVF],
248  number vConvLength[maxNumSCVF]);
249 };
250 
251 
253 // Positive Upwind
255 
256 template <int dim>
258 : public INavierStokesUpwind<dim>,
259  public NavierStokesUpwindRegister<FV1Geometry,dim, NavierStokesPositiveUpwind<dim> >
260 {
261  public:
263  static const size_t maxNumSCVF = base_type::maxNumSCVF;
264  static const size_t maxNumSH = base_type::maxNumSH;
265 
266  public:
269 
271  template <typename TElem>
272  static void compute(const FV1Geometry<TElem, dim>* geo,
273  const MathVector<dim> vIPVel[maxNumSCVF],
274  number vUpShapeSh[maxNumSCVF][maxNumSH],
275  number vUpShapeIp[maxNumSCVF][maxNumSCVF],
276  number vConvLength[maxNumSCVF]);
277 };
278 
280 // Regular Upwind
282 
283 template <int dim>
285 : public INavierStokesUpwind<dim>,
286  public NavierStokesUpwindRegister<FV1Geometry, dim, NavierStokesRegularUpwind<dim> >
287 {
288  public:
290  static const size_t maxNumSCVF = base_type::maxNumSCVF;
291  static const size_t maxNumSH = base_type::maxNumSH;
292 
293  public:
296 
298  template <typename TElem>
299  static void compute(const FV1Geometry<TElem, dim>* geo,
300  const MathVector<dim> vIPVel[maxNumSCVF],
301  number vUpShapeSh[maxNumSCVF][maxNumSH],
302  number vUpShapeIp[maxNumSCVF][maxNumSCVF],
303  number vConvLength[maxNumSCVF]);
304 };
305 
306 
307 } // namespace NavierStokes
308 } // end namespace ug
309 
310 #endif /* __H__UG__NAVIER_STOKES__UPWIND__ */
function NavierStokes(fcts, subsets, discType)
Definition: upwind_interface.h:57
void set_shape_ip_flag(bool flag)
sets the shape ip flag
Definition: upwind_interface.h:173
static const size_t maxNumSH
max number of shape functions
Definition: upwind_interface.h:67
static const size_t maxNumSCVF
max number of SubControlVolumeFaces
Definition: upwind_interface.h:64
NavierStokesFullUpwind()
constructor
Definition: upwind.h:114
static const size_t maxNumSH
Definition: upwind.h:110
static const size_t maxNumSCVF
Definition: upwind.h:109
static void compute(const FV1Geometry< TElem, dim > *geo, const MathVector< dim > vIPVel[maxNumSCVF], number vUpShapeSh[maxNumSCVF][maxNumSH], number vUpShapeIp[maxNumSCVF][maxNumSCVF], number vConvLength[maxNumSCVF])
update of values for FV1Geometry
Definition: upwind.cpp:137
INavierStokesUpwind< dim > base_type
Definition: upwind.h:108
static const size_t maxNumSCVF
Definition: upwind.h:227
NavierStokesLinearProfileSkewedUpwind()
constructor
Definition: upwind.h:232
static void compute(const FV1Geometry< TElem, dim > *geo, const MathVector< dim > vIPVel[maxNumSCVF], number vUpShapeSh[maxNumSCVF][maxNumSH], number vUpShapeIp[maxNumSCVF][maxNumSCVF], number vConvLength[maxNumSCVF])
update of values for FV1Geometry
Definition: upwind.cpp:509
static const size_t maxNumSH
Definition: upwind.h:228
INavierStokesUpwind< dim > base_type
Definition: upwind.h:226
INavierStokesUpwind< dim > base_type
Definition: upwind.h:63
NavierStokesNoUpwind()
constructor
Definition: upwind.h:69
static void compute(const FV1Geometry< TElem, dim > *geo, const MathVector< dim > vIPVel[maxNumSCVF], number vUpShapeSh[maxNumSCVF][maxNumSH], number vUpShapeIp[maxNumSCVF][maxNumSCVF], number vConvLength[maxNumSCVF])
update of values for FV1Geometry
Definition: upwind.cpp:56
static const size_t maxNumSCVF
Definition: upwind.h:64
static const size_t maxNumSH
Definition: upwind.h:65
static void compute(const FV1Geometry< TElem, dim > *geo, const MathVector< dim > vIPVel[maxNumSCVF], number vUpShapeSh[maxNumSCVF][maxNumSH], number vUpShapeIp[maxNumSCVF][maxNumSCVF], number vConvLength[maxNumSCVF])
update of values for FV1Geometry
Definition: upwind.cpp:647
static const size_t maxNumSH
Definition: upwind.h:264
INavierStokesUpwind< dim > base_type
Definition: upwind.h:262
NavierStokesPositiveUpwind()
constructor
Definition: upwind.h:268
static const size_t maxNumSCVF
Definition: upwind.h:263
static const size_t maxNumSCVF
Definition: upwind.h:290
NavierStokesRegularUpwind()
constructor
Definition: upwind.h:295
static const size_t maxNumSH
Definition: upwind.h:291
INavierStokesUpwind< dim > base_type
Definition: upwind.h:289
static void compute(const FV1Geometry< TElem, dim > *geo, const MathVector< dim > vIPVel[maxNumSCVF], number vUpShapeSh[maxNumSCVF][maxNumSH], number vUpShapeIp[maxNumSCVF][maxNumSCVF], number vConvLength[maxNumSCVF])
update of values for FV1Geometry
Definition: upwind.cpp:796
INavierStokesUpwind< dim > base_type
Definition: upwind.h:190
static const size_t maxNumSH
Definition: upwind.h:192
static const size_t maxNumSCVF
Definition: upwind.h:191
NavierStokesSkewedUpwind()
constructor
Definition: upwind.h:196
static void compute(const FV1Geometry< TElem, dim > *geo, const MathVector< dim > vIPVel[maxNumSCVF], number vUpShapeSh[maxNumSCVF][maxNumSH], number vUpShapeIp[maxNumSCVF][maxNumSCVF], number vConvLength[maxNumSCVF])
update of values for FV1Geometry
Definition: upwind.cpp:385
Definition: upwind_interface.h:362
double number