ug4
Loading...
Searching...
No Matches
lagrange_dirac_source.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019-2020: 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/*
34 * Finite Volume Element Discretization for an inner BndCond that depends on the unknowns (on the bnd)
35 *
36 * This class implements the IElemDisc interface to provide element local
37 * assemblings for the unknown-dependent Neumann-flux over an inner boundary.
38 * The equation of this flux and its derivative should be given
39 * in a concretization of this class.
40 *
41 * \tparam TDomain Domain
42 * \tparam TAlgebra Algebra
43 */
44
45#ifndef __H__UG__LIB_DISC__SPACIAL_DISCRETIZATION__ELEM_DISC__DIRAC_SOURCE__LAGRANGE_DIRAC_SOURCE_H__
46#define __H__UG__LIB_DISC__SPACIAL_DISCRETIZATION__ELEM_DISC__DIRAC_SOURCE__LAGRANGE_DIRAC_SOURCE_H__
47
48#include <vector>
49#include <string>
50#include <utility> // std::pair
51
52// other ug4 modules
53#include "common/common.h"
54
55// library intern headers
60
61
62
63
64namespace ug
65{
66
67
68
69template<typename TDomain>
71: public IElemDisc<TDomain>
72{
73
74 public:
77
79 typedef typename base_type::domain_type domain_type;
80
82 static const int dim = base_type::dim;
83
84 static const int _C_ = 0;
85
87 typedef typename base_type::position_type position_type;
88
89 private:
92
93
94 public:
95
97 DiracSourceDisc(const char* functions = "", const char* subsets = "")
98 : IElemDisc<TDomain>(functions, subsets), m_bNonRegularGrid(false) /*, m_bCurrElemIsHSlave(false)*/
99 {
101 }
102
104 DiracSourceDisc(const std::vector<std::string>& functions, const std::vector<std::string>& subsets)
105 : IElemDisc<TDomain>(functions, subsets), m_bNonRegularGrid(false) /*, m_bCurrElemIsHSlave(false)*/
106 {
108 }
109
111 virtual ~DiracSourceDisc() {};
112
113
114
116 void add_source(number scale, MathVector<dim> &srcCoord);
117 void add_source(SmartPtr<UserData<number, dim> > srcData, MathVector<dim> &srcCoord);
118#ifdef UG_FOR_LUA
119 void add_source(const char* luaScaleFctName, MathVector<dim> &srcCoord);
120#endif
121
124 void add_transport_sink(number snk);
125
126#ifdef UG_FOR_LUA
127 void add_transport_sink(const char* luaScaleFctName);
128#endif
129
130 public: // inherited from IElemDisc
132 virtual void prepare_setting(const std::vector<LFEID>& vLfeID, bool bNonRegularGrid);
133
135 virtual bool use_hanging() const;
136
137 protected:
138
139
141
146 template<typename TElem, typename TFVGeom>
147 void prep_elem_loop(const ReferenceObjectID roid, const int si)
148 {}
149
151
156 template<typename TElem, typename TFVGeom>
157 void prep_elem(const LocalVector& u, GridObject* elem, const ReferenceObjectID roid, const MathVector<dim> vCornerCoords[])
158 {}
159
161 template<typename TElem, typename TFVGeom>
163 {}
164
166 template<typename TElem, typename TFVGeom>
167 void add_jac_A_elem(LocalMatrix& J, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[]);
168
170 template<typename TElem, typename TFVGeom>
171 void add_jac_M_elem(LocalMatrix& J, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[])
172 {}
173
175 template<typename TElem, typename TFVGeom>
176 void add_def_A_elem(LocalVector& d, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[]);
177
179 template<typename TElem, typename TFVGeom>
180 void add_def_M_elem(LocalVector& d, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[])
181 {}
182
184 template<typename TElem, typename TFVGeom>
185 void add_rhs_elem(LocalVector& rhs, GridObject* elem, const MathVector<dim> vCornerCoords[]);
186
187
188
190 template <typename TElem, typename TFVGeom>
191 void prep_err_est_elem_loop(const ReferenceObjectID roid, const int si)
192 { UG_THROW("Not Implemented!"); }
193
195 template <typename TElem, typename TFVGeom>
196 void prep_err_est_elem(const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[])
197 { UG_THROW("Not Implemented!"); }
198
200 template <typename TElem, typename TFVGeom>
201 void compute_err_est_A_elem(const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[], const number& scale)
202 { UG_THROW("Not Implemented!"); }
203
205 template <typename TElem, typename TFVGeom>
207 { UG_THROW("Not Implemented!"); }
208
209 private:
210 SmartPtr<UserData<number, dim> > m_srcData; // source/sink: adding 'source' to rhs
211 SmartPtr<UserData<number, dim> > m_snkTransportData; // transport sink: subtracting u*sink
213
214 private:
215 void register_all_funcs();
216
217 template <typename TElem, typename TFVGeom>
218 void register_func();
219 public:
221
222 protected:
225
226 private:
228 // bool m_bCurrElemIsHSlave;
229};
230
231} // namespace ug
232
234
235
236#endif /*__H__UG__LIB_DISC__SPACIAL_DISCRETIZATION__ELEM_DISC__DIRAC_SOURCE__LAGRANGE_DIRAC_SOURCE__*/
Definition smart_pointer.h:107
Definition lagrange_dirac_source.h:72
void compute_err_est_A_elem(const LocalVector &u, GridObject *elem, const MathVector< dim > vCornerCoords[], const number &scale)
computes the error estimator contribution for one element
Definition lagrange_dirac_source.h:201
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 lagrange_dirac_source.h:171
SmartPtr< UserData< number, dim > > m_snkTransportData
Definition lagrange_dirac_source.h:211
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 lagrange_dirac_source.h:180
void prep_elem(const LocalVector &u, GridObject *elem, const ReferenceObjectID roid, const MathVector< dim > vCornerCoords[])
prepares the element for assembling
Definition lagrange_dirac_source.h:157
virtual ~DiracSourceDisc()
Destructor.
Definition lagrange_dirac_source.h:111
void prep_err_est_elem_loop(const ReferenceObjectID roid, const int si)
prepares the loop over all elements of one type for the computation of the error estimator
Definition lagrange_dirac_source.h:191
void prep_elem_loop(const ReferenceObjectID roid, const int si)
prepares the loop over all elements
Definition lagrange_dirac_source.h:147
virtual void prepare_setting(const std::vector< LFEID > &vLfeID, bool bNonRegularGrid)
type of trial space for each function used
Definition lagrange_dirac_source_impl.h:94
static const int dim
World dimension.
Definition lagrange_dirac_source.h:82
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 lagrange_dirac_source_impl.h:117
static const int _C_
Definition lagrange_dirac_source.h:84
void add_source(number scale, MathVector< dim > &srcCoord)
Setting a scaling factor for the flux.
Definition lagrange_dirac_source_impl.h:47
MathVector< dim > m_srcCoord
Definition lagrange_dirac_source.h:212
virtual bool use_hanging() const
returns if hanging nodes are used
Definition lagrange_dirac_source_impl.h:108
SmartPtr< UserData< number, dim > > m_srcData
Definition lagrange_dirac_source.h:210
void register_func()
Definition lagrange_dirac_source_impl.h:187
base_type::domain_type domain_type
Domain type.
Definition lagrange_dirac_source.h:79
DiracSourceDisc< TDomain > this_type
own type
Definition lagrange_dirac_source.h:91
IElemDisc< TDomain > base_type
Base class type.
Definition lagrange_dirac_source.h:76
void fsh_err_est_elem_loop()
postprocesses the loop over all elements of one type in the computation of the error estimator
Definition lagrange_dirac_source.h:206
DiracSourceDisc(const char *functions="", const char *subsets="")
Constructor with c-strings.
Definition lagrange_dirac_source.h:97
void add_transport_sink(SmartPtr< UserData< number, dim > > snkData)
Setting a scaling factor for the flux.
Definition lagrange_dirac_source_impl.h:74
SmartPtr< DataExport< number, dim > > m_exRate
Export for the concentration.
Definition lagrange_dirac_source.h:224
SmartPtr< CplUserData< number, dim > > NumberExport
Definition lagrange_dirac_source.h:220
void prep_err_est_elem(const LocalVector &u, GridObject *elem, const MathVector< dim > vCornerCoords[])
prepares the element for assembling the error estimator
Definition lagrange_dirac_source.h:196
void register_all_funcs()
Definition lagrange_dirac_source_impl.h:175
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 lagrange_dirac_source_impl.h:133
DiracSourceDisc(const std::vector< std::string > &functions, const std::vector< std::string > &subsets)
Constructor with functions.
Definition lagrange_dirac_source.h:104
base_type::position_type position_type
Position type.
Definition lagrange_dirac_source.h:87
void fsh_elem_loop()
finishes the loop over all elements
Definition lagrange_dirac_source.h:162
void add_rhs_elem(LocalVector &rhs, GridObject *elem, const MathVector< dim > vCornerCoords[])
assembles the local right hand side
Definition lagrange_dirac_source_impl.h:147
bool m_bNonRegularGrid
Definition lagrange_dirac_source.h:227
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition grid_base_objects.h:157
Definition elem_disc_interface.h:800
Definition local_algebra.h:422
Definition local_algebra.h:198
a mathematical Vector with N entries.
Definition math_vector.h:97
Type based UserData.
Definition user_data.h:144
#define UG_THROW(msg)
Definition error.h:57
double number
Definition types.h:124
the ug namespace
ReferenceObjectID
these ids are used to identify the shape of a geometric object.
Definition grid_base_objects.h:74