Line data Source code
1 : /*
2 : * Copyright (c) 2018: G-CSC, Goethe University Frankfurt
3 : * Author: Arne Naegel
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__LIB_DISC__CONVECTION_DIFFUSION__CONVECTION_DIFFUSION_STAB_FE__
34 : #define __H__UG__LIB_DISC__CONVECTION_DIFFUSION__CONVECTION_DIFFUSION_STAB_FE__
35 :
36 : // library intern headers
37 : #include "../convection_diffusion_base.h"
38 : #include "lib_disc/spatial_disc/disc_util/conv_shape_interface.h"
39 :
40 : namespace ug{
41 : namespace ConvectionDiffusionPlugin{
42 :
43 : // \ingroup lib_disc_elem_disc
44 : /// \addtogroup convection_diffusion
45 : /// \{
46 :
47 : /// Discretization for the Convection-Diffusion Equation
48 : /**
49 : * This class implements the IElemDisc interface to provide element local
50 : * assemblings for the convection diffusion equation.
51 : * \tparam TDomain Domain
52 : * \tparam TAlgebra Algebra
53 : */
54 : template< typename TDomain>
55 : class ConvectionDiffusionStabFE : public IElemDisc<TDomain>
56 : {
57 : private:
58 : /// Base class type
59 : typedef IElemDisc<TDomain> base_type;
60 :
61 : /// Own type
62 : typedef ConvectionDiffusionStabFE<TDomain> this_type;
63 :
64 : public:
65 : /// World dimension
66 : static const int dim = base_type::dim;
67 :
68 : public:
69 : /// Constructor
70 : ConvectionDiffusionStabFE(const char* functions, const char* subsets);
71 : ConvectionDiffusionStabFE(const char* functions, const char* subsets, number stabM);
72 : ConvectionDiffusionStabFE(const char* functions, const char* subsets, number stabM, number stabA);
73 :
74 : /// Destructor
75 0 : virtual ~ConvectionDiffusionStabFE() {};
76 :
77 : /// sets the quad order
78 : void set_quad_order(size_t order);
79 :
80 : private:
81 : /// prepares the loop over all elements
82 : /**
83 : * This method prepares the loop over all elements. It resizes the Position
84 : * array for the corner coordinates and schedules the local ip positions
85 : * at the data imports.
86 : */
87 : template <typename TElem, typename TFEGeom>
88 : void prep_elem_loop(const ReferenceObjectID roid, const int si);
89 :
90 : /// prepares the element for assembling
91 : /**
92 : * This methods prepares an element for the assembling. The Positions of
93 : * the Element Corners are read and the Finite Volume Geometry is updated.
94 : * The global ip positions are scheduled at the data imports.
95 : */
96 : template <typename TElem, typename TFEGeom>
97 : void prep_elem(const LocalVector& u, GridObject* elem, const ReferenceObjectID roid, const MathVector<dim> vCornerCoords[]);
98 :
99 : /// finishes the loop over all elements
100 : template <typename TElem, typename TFEGeom>
101 : void fsh_elem_loop();
102 :
103 : template <typename TElem, typename TFEGeom>
104 : void add_jac_X_elem(LocalMatrix& J, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[], double stab);
105 :
106 : /// assembles the local stiffness matrix using a finite volume scheme
107 : template <typename TElem, typename TFEGeom>
108 : void add_jac_A_elem(LocalMatrix& J, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[]);
109 :
110 : /// assembles the stiffness part of the local defect
111 : template <typename TElem, typename TFEGeom>
112 0 : void add_def_A_elem(LocalVector& d, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[]){};
113 :
114 : /// assembles the local mass matrix using a finite volume scheme
115 : template <typename TElem, typename TFEGeom>
116 : void add_jac_M_elem(LocalMatrix& J, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[]);
117 :
118 : /// assembles the mass part of the local defect
119 : template <typename TElem, typename TFEGeom>
120 : void add_def_M_elem(LocalVector& d, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[]);
121 :
122 : /// assembles the local right hand side
123 : template <typename TElem, typename TFEGeom>
124 0 : void add_rhs_elem(LocalVector& d, GridObject* elem, const MathVector<dim> vCornerCoords[]) {}
125 :
126 : /// prepares the loop over all elements of one type for the computation of the error estimator
127 : template <typename TElem, typename TFEGeom>
128 0 : void prep_err_est_elem_loop(const ReferenceObjectID roid, const int si) {}
129 :
130 : /// prepares the element for assembling the error estimator
131 : template <typename TElem, typename TFEGeom>
132 0 : void prep_err_est_elem(const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[]) {}
133 :
134 : /// computes the error estimator contribution for one element
135 : template <typename TElem, typename TFEGeom>
136 0 : void compute_err_est_A_elem(const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[], const number& scale) {}
137 :
138 : /// computes the error estimator contribution for one element
139 : template <typename TElem, typename TFEGeom>
140 0 : void compute_err_est_M_elem(const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[], const number& scale) {}
141 :
142 : /// computes the error estimator contribution for one element
143 : template <typename TElem, typename TFEGeom>
144 0 : void compute_err_est_rhs_elem(GridObject* elem, const MathVector<dim> vCornerCoords[], const number& scale) {}
145 :
146 : /// postprocesses the loop over all elements of one type in the computation of the error estimator
147 : template <typename TElem, typename TFEGeom>
148 0 : void fsh_err_est_elem_loop() {}
149 :
150 : private:
151 : /// abbreviation for the local solution
152 : static const size_t _C_ = 0;
153 :
154 :
155 :
156 : public:
157 : /// type of trial space for each function used
158 : virtual void prepare_setting(const std::vector<LFEID>& vLfeID, bool bNonRegularGrid);
159 :
160 : /// returns if hanging nodes are needed
161 : virtual bool use_hanging() const;
162 :
163 : protected:
164 : /// current integration order
165 : bool m_bQuadOrderUserDef;
166 : int m_quadOrder;
167 :
168 : /// current shape function set
169 : LFEID m_lfeID;
170 :
171 : /// register utils
172 : /// \{
173 : void register_all_funcs(const LFEID& lfeid, const int quadOrder);
174 : template <typename TElem, typename TFEGeom> void register_func();
175 : /// \}
176 :
177 : private:
178 : /// struct holding values of shape functions in IPs
179 : /* struct ShapeValues
180 : {
181 : public:
182 : void resize(std::size_t nEip, std::size_t nSip, std::size_t _nSh)
183 : {
184 : nSh = _nSh;
185 : elemVals.resize(nEip);
186 : sideVals.resize(nSip);
187 : for (std::size_t i = 0; i < nEip; i++) elemVals[i].resize(nSh);
188 : for (std::size_t i = 0; i < nSip; i++) sideVals[i].resize(nSh);
189 : }
190 : number& shapeAtElemIP(std::size_t sh, std::size_t ip) {return elemVals[ip][sh];}
191 : number& shapeAtSideIP(std::size_t sh, std::size_t ip) {return sideVals[ip][sh];}
192 : number* shapesAtElemIP(std::size_t ip) {return &elemVals[ip][0];}
193 : number* shapesAtSideIP(std::size_t ip) {return &sideVals[ip][0];}
194 : std::size_t num_sh() {return nSh;}
195 : private:
196 : std::size_t nSh;
197 : std::vector<std::vector<number> > elemVals;
198 : std::vector<std::vector<number> > sideVals;
199 : } m_shapeValues;*/
200 :
201 : double m_stabParamM;
202 : double m_stabParamA;
203 : };
204 :
205 : // end group convection_diffusion
206 : /// \}
207 :
208 : } // end ConvectionDiffusionPlugin
209 : } // end namespace ug
210 :
211 :
212 : #endif /*__H__UG__LIB_DISC__CONVECTION_DIFFUSION__CONVECTION_DIFFUSION_FE__*/
|