Plugins
Loading...
Searching...
No Matches
fv1_conv.h
Go to the documentation of this file.
1/*
2 * Author: Dmitry Logashenko
3 *
4 * This file is part of UG4.
5 *
6 * UG4 is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU Lesser General Public License version 3 (as published by the
8 * Free Software Foundation) with the following additional attribution
9 * requirements (according to LGPL/GPL v3 §7):
10 *
11 * (1) The following notice must be displayed in the Appropriate Legal Notices
12 * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
13 *
14 * (2) The following notice must be displayed at a prominent place in the
15 * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
16 *
17 * (3) The following bibliography is recommended for citation and must be
18 * preserved in all covered files:
19 * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
20 * parallel geometric multigrid solver on hierarchically distributed grids.
21 * Computing and visualization in science 16, 4 (2013), 151-164"
22 * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
23 * flexible software system for simulating pde based models on high performance
24 * computers. Computing and visualization in science 16, 4 (2013), 165-179"
25 *
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU Lesser General Public License for more details.
30 */
31
32/*
33 * FV-discretization of a convection equation (in a non-divergent form).
34 */
35
36#ifndef __H__UG__PLUGINS__LEVEL_SET__FV1_CONV_H__
37#define __H__UG__PLUGINS__LEVEL_SET__FV1_CONV_H__
38
39// basic ug4 headers
40#include "common/common.h"
41
42// library-specific headers
43#include "lib_grid/lg_base.h"
48#ifdef UG_FOR_LUA
50#endif
51
52namespace ug{
53namespace LevelSet{
54
71template <typename TDomain>
73 : public IElemDisc<TDomain>
74{
75private:
77 static const size_t _U_ = 0;
78
81
84
87
90
92 static const int dim = base_type::dim;
93
96
97public:
98
99//---- Constructor ----
100
103 (
105 const char * functions,
106 const char * subsets
107 );
108
109//---- Settings: ----
110
113 {
114 m_spUpwind = upwind;
115 }
116
119 {
120 m_imVelocity.set_data (vel);
121 }
122
123#ifdef UG_FOR_LUA
124
126 void set_velocity(const char* fctName)
127 {
129 }
130
133 {
135 }
136
137#endif
138
141 {
142 m_source = r;
143 }
144
147 {
148 m_diffusion = d;
149 }
150
152 {
153 m_alpha = d;
154 }
155
159
161 template <typename TElem>
162 void ex_grad(MathVector<dim> vValue[],
163 const MathVector<dim> vGlobIP[],
164 number time, int si,
165 const LocalVector& u,
166 GridObject* elem,
167 const MathVector<dim> vCornerCoords[],
168 const MathVector<dim> vLocIP[],
169 const size_t nip,
170 bool bDeriv,
171 std::vector<std::vector<MathVector<dim> > > vvvDeriv[]);
172
173//---- Local discretization interface: ----
174private:
175
177 virtual void prepare_setting
178 (
179 const std::vector<LFEID> & vLfeID,
180 bool bNonRegular
181 );
182
183//---- Assembling functions: ----
184
185 template <typename TElem>
186 void prepare_element_loop(ReferenceObjectID roid, int si);
187
188 template <typename TElem>
189 void prepare_element(const LocalVector& u, GridObject* elem, ReferenceObjectID roid, const position_type vCornerCoords[]);
190
191 template <typename TElem>
192 void finish_element_loop();
193
194 template <typename TElem>
195 void ass_JA_elem(LocalMatrix& J, const LocalVector& u, GridObject* elem, const position_type vCornerCoords[]);
196
197 template <typename TElem>
198 void ass_dA_elem(LocalVector& d, const LocalVector& u, GridObject* elem, const position_type vCornerCoords[]);
199
200 template <typename TElem>
201 void ass_JM_elem(LocalMatrix& J, const LocalVector& u, GridObject* elem, const position_type vCornerCoords[]);
202
203 template <typename TElem>
204 void ass_dM_elem(LocalVector& d, const LocalVector& u, GridObject* elem, const position_type vCornerCoords[]);
205
206 template <typename TElem>
207 void ass_rhs_elem(LocalVector& d, GridObject* elem, const position_type vCornerCoords[]);
208
209//---- Registration of the template functions: ----
210private:
211
213
215 {
218 template< typename TElem > void operator() (TElem &)
219 {m_pThis->register_loc_discr_func<TElem> ();}
220 };
221
222 template <typename TElem>
224
225private:
226
228
230
232
234
236
239}; // end class
240
241} // end namespace LevelSet
242} // end namespace ug
243
244#include "fv1_conv_impl.h"
245
246#endif // __H__UG__PLUGINS__LEVEL_SET__FV1_CONV_H__
247
248/* End of File */
number time() const
TDomain::position_type position_type
static const int dim
Definition fv1_conv.h:74
number m_source
the source term
Definition fv1_conv.h:231
virtual void prepare_setting(const std::vector< LFEID > &vLfeID, bool bNonRegular)
check type of the grid and the trial space
Definition fv1_conv_impl.h:80
IConvectionShapes< dim > conv_shape_type
upwind method type
Definition fv1_conv.h:95
base_type::position_type position_type
position type
Definition fv1_conv.h:89
void ex_grad(MathVector< dim > vValue[], const MathVector< dim > vGlobIP[], number time, int si, const LocalVector &u, GridObject *elem, const MathVector< dim > vCornerCoords[], const MathVector< dim > vLocIP[], const size_t nip, bool bDeriv, std::vector< std::vector< MathVector< dim > > > vvvDeriv[])
computes the gradient of the concentration
Definition fv1_conv_impl.h:435
void set_velocity(SmartPtr< CplUserData< MathVector< dim >, dim > > vel)
sets the convection velocity
Definition fv1_conv.h:118
SmartPtr< DataExport< MathVector< dim >, dim > > m_exGrad
Export for the gradient of concentration.
Definition fv1_conv.h:238
static const int dim
world dimension
Definition fv1_conv.h:92
number m_alpha
the diffusion coefficient
Definition fv1_conv.h:235
void finish_element_loop()
finalizes the loop over the elements: clear the source
Definition fv1_conv_impl.h:134
void ass_dM_elem(LocalVector &d, const LocalVector &u, GridObject *elem, const position_type vCornerCoords[])
computes the mass part of the defect of a time-dependent problem
Definition fv1_conv_impl.h:339
SmartPtr< conv_shape_type > m_spUpwind
upwind method
Definition fv1_conv.h:227
void register_loc_discr_func()
registers the local assembler functions for a given element
Definition fv1_conv_impl.h:410
number m_diffusion
the diffusion coefficient
Definition fv1_conv.h:233
IElemDisc< TDomain > base_type
base class type
Definition fv1_conv.h:80
FV1_Convection< TDomain > this_type
own type
Definition fv1_conv.h:83
void prepare_element(const LocalVector &u, GridObject *elem, ReferenceObjectID roid, const position_type vCornerCoords[])
prepares a given element for assembling: computes the discretization of the rot-rot operator
Definition fv1_conv_impl.h:142
CplUserData< MathVector< dim >, dim > TGradientExport
returns the export of the gradient of associated unknown function
Definition fv1_conv.h:157
void ass_rhs_elem(LocalVector &d, GridObject *elem, const position_type vCornerCoords[])
assembles the right-hand side
Definition fv1_conv_impl.h:368
void set_source(number r)
sets the value of the source
Definition fv1_conv.h:140
void ass_JM_elem(LocalMatrix &J, const LocalVector &u, GridObject *elem, const position_type vCornerCoords[])
computes the mass matrix of a time-dependent problem
Definition fv1_conv_impl.h:310
void prepare_element_loop(ReferenceObjectID roid, int si)
prepares the loop over the elements: checks whether the parameters are set, ...
Definition fv1_conv_impl.h:107
DataImport< MathVector< dim >, dim > m_imVelocity
data import for the velocity field (if used)
Definition fv1_conv.h:229
void ass_dA_elem(LocalVector &d, const LocalVector &u, GridObject *elem, const position_type vCornerCoords[])
assembles the local defect
Definition fv1_conv_impl.h:235
void register_all_loc_discr_funcs()
registers the local assembler functions for all the elements and dimensions
Definition fv1_conv_impl.h:398
void ass_JA_elem(LocalMatrix &J, const LocalVector &u, GridObject *elem, const position_type vCornerCoords[])
assembles the local stiffness matrix
Definition fv1_conv_impl.h:168
SmartPtr< TGradientExport > gradient()
Definition fv1_conv.h:158
void set_upwind(SmartPtr< IConvectionShapes< dim > > upwind)
sets the upwind for the transport equation
Definition fv1_conv.h:112
void set_alpha(number d)
Definition fv1_conv.h:151
void set_diffusion(number d)
sets the diffusion coefficient
Definition fv1_conv.h:146
base_type::domain_type domain_type
domain type
Definition fv1_conv.h:86
static const size_t _U_
abbreviation for the local solution
Definition fv1_conv.h:77
double number
ReferenceObjectID
SmartPtr< T, FreePolicy > make_sp(T *inst)
RegisterLocalDiscr(this_type *pThis)
Definition fv1_conv.h:216
void operator()(TElem &)
Definition fv1_conv.h:218
this_type * m_pThis
Definition fv1_conv.h:217