Plugins
navier_stokes_fv.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2017: 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__PLUGINS__NAVIER_STOKES__INCOMPRESSIBLE__FV__NAVIER_STOKES_FV__
34 #define __H__UG__PLUGINS__NAVIER_STOKES__INCOMPRESSIBLE__FV__NAVIER_STOKES_FV__
35 
36 // other ug4 modules
37 #include "common/common.h"
38 #include "lib_grid/lg_base.h"
39 
40 // library intern headers
44 
45 #include "../incompressible_navier_stokes_base.h"
46 
47 namespace ug{
48 namespace NavierStokes{
49 
52 
53 template< typename TDomain>
55  : public IncompressibleNavierStokesBase<TDomain>
56 {
57  private:
60 
63 
64  public:
66  static const int dim = base_type::dim;
67 
68  public:
71  NavierStokesFV(const char* functions, const char* subsets);
72  NavierStokesFV(const std::vector<std::string>& vFct, const std::vector<std::string>& vSubset);
74 
77 
80 
83 
86 
89 
90  public:
92  void prepare_setting(const std::vector<LFEID>& vLfeID, bool bNonRegularGrid);
93 
95  virtual std::string disc_type() const {return "fv";};
96 
98  void set_quad_order(size_t order);
99 
101  virtual bool requests_local_time_series() {return false;}
102 
103  protected:
107 
111 
112  void init();
113 
114  private:
117 
120 
125 
127  static const size_t _P_ = dim;
128 
131  using base_type::m_bStokes;
132  using base_type::m_bLaplace;
133 
134  public:
135  template<typename TElem, typename VGeom, typename PGeom>
136  void prep_elem_loop(const ReferenceObjectID roid, const int si);
137 
138  template<typename TElem, typename VGeom, typename PGeom>
139  void prep_elem(const LocalVector& u, GridObject* elem, const ReferenceObjectID roid, const MathVector<dim> vCornerCoords[]);
140 
142  template<typename TElem, typename VGeom, typename PGeom>
143  void fsh_elem_loop();
144 
146  template<typename TElem, typename VGeom, typename PGeom>
147  void add_jac_A_elem(LocalMatrix& J, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[]);
148 
150  template<typename TElem, typename VGeom, typename PGeom>
151  void add_jac_M_elem(LocalMatrix& J, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[]);
152 
154  template<typename TElem, typename VGeom, typename PGeom>
155  void add_def_A_elem(LocalVector& d, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[]);
156 
158  template<typename TElem, typename VGeom, typename PGeom>
159  void add_def_M_elem(LocalVector& d, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[]);
160 
162  template<typename TElem, typename VGeom, typename PGeom>
163  void add_rhs_elem(LocalVector& d, GridObject* elem, const MathVector<dim> vCornerCoords[]);
164 
165  protected:
167  void register_all_funcs(const LFEID& vLfeID, const LFEID& pLfeID);
168  template<typename TElem, typename VGeom, typename PGeom>
169  void register_func();
170 
171  std::vector<std::vector<number> > m_vvPShape;
172  std::vector<std::vector<number> > m_vvVShape;
173 };
174 
176 
177 } // namespace NavierStokes
178 } // end namespace ug
179 
180 #endif /*__H__UG__PLUGINS__NAVIER_STOKES__INCOMPRESSIBLE__FV__NAVIER_STOKES_FV__*/
function NavierStokes(fcts, subsets, discType)
SmartPtr< CplUserData< number, dim > > user_data()
Finite Volume Element Discretization for the incompressible Navier-Stokes Equation.
Definition: incompressible_navier_stokes_base.h:146
number m_bFullNewtonFactor
factor for exact jacobian, (1 for exact jacobian, 0 for fix point)
Definition: navier_stokes_base.h:207
bool m_bLaplace
flag if using only laplace term
Definition: incompressible_navier_stokes_base.h:256
bool m_bStokes
flag if solving the Stokes equation
Definition: incompressible_navier_stokes_base.h:253
bool m_bPecletBlend
flag if using Peclet Blending
Definition: incompressible_navier_stokes_base.h:244
static const int dim
World dimension.
Definition: incompressible_navier_stokes_base.h:156
Definition: navier_stokes_fv.h:56
void set_density(SmartPtr< CplUserData< number, dim > > user)
sets the density
Definition: navier_stokes_fv.cpp:130
bool m_bQuadOrderUserDef
quadrature order
Definition: navier_stokes_fv.h:109
void set_kinematic_viscosity(SmartPtr< CplUserData< number, dim > > user)
sets the kinematic viscosity
Definition: navier_stokes_fv.cpp:123
void add_def_M_elem(LocalVector &d, const LocalVector &u, GridObject *elem, const MathVector< dim > vCornerCoords[])
assembles the mass part of the local defect
Definition: navier_stokes_fv.cpp:563
LFEID m_pLFEID
Definition: navier_stokes_fv.h:106
void set_source(SmartPtr< CplUserData< MathVector< dim >, dim > > user)
sets the source function
Definition: navier_stokes_fv.cpp:139
void prep_elem(const LocalVector &u, GridObject *elem, const ReferenceObjectID roid, const MathVector< dim > vCornerCoords[])
Definition: navier_stokes_fv.cpp:226
void init()
Definition: navier_stokes_fv.cpp:64
void add_rhs_elem(LocalVector &d, GridObject *elem, const MathVector< dim > vCornerCoords[])
assembles the local right hand side
Definition: navier_stokes_fv.cpp:597
void register_all_funcs(const LFEID &vLfeID, const LFEID &pLfeID)
register util
NavierStokesFV(const char *functions, const char *subsets)
Definition: navier_stokes_fv.cpp:47
void add_jac_M_elem(LocalMatrix &J, const LocalVector &u, GridObject *elem, const MathVector< dim > vCornerCoords[])
assembles the local mass matrix using a finite volume scheme
Definition: navier_stokes_fv.cpp:519
void add_jac_A_elem(LocalMatrix &J, const LocalVector &u, GridObject *elem, const MathVector< dim > vCornerCoords[])
assembles the local stiffness matrix using a finite volume scheme
Definition: navier_stokes_fv.cpp:252
int m_quadOrder
Definition: navier_stokes_fv.h:110
DataImport< number, dim > m_imDensitySCVF
Data import for density.
Definition: navier_stokes_fv.h:122
virtual std::string disc_type() const
returns string identifying disc type
Definition: navier_stokes_fv.h:95
void set_quad_order(size_t order)
sets the quad order
Definition: navier_stokes_fv.cpp:90
IncompressibleNavierStokesBase< TDomain > base_type
Base class type.
Definition: navier_stokes_fv.h:59
std::vector< std::vector< number > > m_vvPShape
Definition: navier_stokes_fv.h:171
DataImport< MathVector< dim >, dim > m_imSource
Data import for source.
Definition: navier_stokes_fv.h:116
void prep_elem_loop(const ReferenceObjectID roid, const int si)
Definition: navier_stokes_fv.cpp:151
std::vector< std::vector< number > > m_vvVShape
Definition: navier_stokes_fv.h:172
static const int dim
World dimension.
Definition: navier_stokes_fv.h:66
DataImport< number, dim > m_imDensitySCVFp
Definition: navier_stokes_fv.h:123
void prepare_setting(const std::vector< LFEID > &vLfeID, bool bNonRegularGrid)
type of trial space for each function used
Definition: navier_stokes_fv.cpp:98
void fsh_elem_loop()
finishes the loop over all elements
Definition: navier_stokes_fv.cpp:219
static const size_t _P_
abbreviation for pressure
Definition: navier_stokes_fv.h:127
void add_def_A_elem(LocalVector &d, const LocalVector &u, GridObject *elem, const MathVector< dim > vCornerCoords[])
assembles the stiffness part of the local defect
Definition: navier_stokes_fv.cpp:389
void register_func()
Definition: navier_stokes_fv.cpp:655
DataImport< number, dim > m_imKinViscosity
Data import for kinematic viscosity.
Definition: navier_stokes_fv.h:119
SmartPtr< CplUserData< number, dim > > kinematic_viscosity()
returns kinematic viscosity
Definition: navier_stokes_fv.h:79
virtual bool requests_local_time_series()
returns if local time series is needed
Definition: navier_stokes_fv.h:101
LFEID m_vLFEID
current shape function set
Definition: navier_stokes_fv.h:105
DataImport< number, dim > m_imDensitySCV
Definition: navier_stokes_fv.h:124
SmartPtr< CplUserData< number, dim > > density()
returns density
Definition: navier_stokes_fv.h:85
NavierStokesFV< TDomain > this_type
own type
Definition: navier_stokes_fv.h:62
ReferenceObjectID