Loading [MathJax]/extensions/tex2jax.js
Plugins
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
convection_diffusion_sss.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019: G-CSC, Goethe University Frankfurt
3 * Author: Dmitry Logashenko / Michael Lampe
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 * Singular (point and line) sources and sinks in ConvectionDiffusion.
35 */
36#ifndef __H__UG__PLUGINS__CD__SINGULAR_SOURCES_AND_SINKS__
37#define __H__UG__PLUGINS__CD__SINGULAR_SOURCES_AND_SINKS__
38
39#include <vector>
40
41// ug4 headers
44
45#ifdef UG_FOR_LUA
47#endif
48
49namespace ug {
50namespace ConvectionDiffusionPlugin {
51
53template <int dim>
55{
56public:
61protected:
62 //MathVector<1> m_values;
64
66
67public:
68
71
73 number flux () {return m_values ;}
74
77 (
78 const MathVector<dim>& x,
79 number time,
80 int si
81 )
82 {
83 if (m_spData.valid ())
84 (* m_spData) (m_values, x, time, si);
85 }
86
89 {
90 m_values = flux;
92 }
93
95 void set (user_data_type spData)
96 {
97 m_spData = spData;
98 }
99
100#ifdef UG_FOR_LUA
102 void set (LuaFunctionHandle func)
103 { m_spData = make_sp (new LuaUserData<number, dim> (func)); }
104#endif
105
106};
107
113{
115 size_t m_co;
116
117public:
118
120 point_sss_marker () : m_elem (NULL), m_co (0) {};
121
123 void init () {m_elem = NULL; m_co = 0;}
124
126 bool marked_for (GridObject * elem, size_t co)
127 {
128 if (m_elem == NULL)
129 {
130 m_elem = elem; m_co = co;
131 return true;
132 }
133 return m_elem == elem && m_co == co;
134 }
135};
136
143{
144// All the members are used in the fractures only!
145
148 {
150 size_t fract_co;
151
152 t_fract_elem (IVertexGroup * face, size_t co) : fract_face (face), fract_co (co) {};
153 };
154
156 std::vector<t_fract_elem> m_intersections;
157
158public:
159
162
164 void init () {m_intersections.clear ();}
165
167 bool marked_for (IVertexGroup * elem, size_t co)
168 {
169 // is the fracture already processed?
170 for (size_t i = 0; i < m_intersections.size (); i++)
171 {
172 // check if we have already registered this mark
173 t_fract_elem& intersection = m_intersections[i];
174 if (intersection.fract_face == elem)
175 return intersection.fract_co == co;
176
177 // check if a different corner is meant (i.e. this is the same fracture)
178 Vertex * vrt = elem->vertex (co);
179 for (size_t j = 0; j < intersection.fract_face->num_vertices (); j++)
180 if (vrt == intersection.fract_face->vertex (j))
181 return false; // in this fracture, we use a different corner
182 }
183 // no, register this fracture, too
184 m_intersections.push_back (t_fract_elem (elem, co));
185 return true;
186 }
187};
188
189template <int dim> class cd_point_sss_data : public cd_sss_data<dim>, public point_sss_marker {};
190template <int dim> class cd_line_sss_data : public cd_sss_data<dim>, public line_sss_marker {};
191template <int dim>
193 : public FVSingularSourcesAndSinks<dim, cd_point_sss_data<dim>, cd_line_sss_data<dim> >
194{
195public:
197};
198
199} // namespace ConvectionDiffusionPlugin
200} // end namespace ug
201
202#endif // __H__UG__PLUGINS__CD__SINGULAR_SOURCES_AND_SINKS__
203
204/* End of File */
bool valid() const
Definition convection_diffusion_sss.h:194
cd_point_sss_data< dim > user_data_type
Definition convection_diffusion_sss.h:196
Definition convection_diffusion_sss.h:190
Definition convection_diffusion_sss.h:189
class for data for all the CD plugin sources and sinks
Definition convection_diffusion_sss.h:55
void compute(const MathVector< dim > &x, number time, int si)
computes the data from the user data object
Definition convection_diffusion_sss.h:77
number m_values
Definition convection_diffusion_sss.h:63
user_data_type m_spData
an alternative method to specify the data
Definition convection_diffusion_sss.h:65
cd_sss_data()
class construction (there must exist a 'dummy' constructor!)
Definition convection_diffusion_sss.h:70
number flux()
returns the flux
Definition convection_diffusion_sss.h:73
void set(user_data_type spData)
sets the data by an object
Definition convection_diffusion_sss.h:95
SmartPtr< CplUserData< number, dim > > user_data_type
Definition convection_diffusion_sss.h:57
void set(number flux)
sets the data
Definition convection_diffusion_sss.h:88
Definition convection_diffusion_sss.h:143
bool marked_for(IVertexGroup *elem, size_t co)
check and set the element mark (use it only for fractures!)
Definition convection_diffusion_sss.h:167
std::vector< t_fract_elem > m_intersections
array keeping the elements from different(!) fractures
Definition convection_diffusion_sss.h:156
line_sss_marker()
class constructor
Definition convection_diffusion_sss.h:161
void init()
reset the mark
Definition convection_diffusion_sss.h:164
Definition convection_diffusion_sss.h:113
size_t m_co
corner of the element (not to take it into account twice inside of the element)
Definition convection_diffusion_sss.h:115
point_sss_marker()
class constructor
Definition convection_diffusion_sss.h:120
bool marked_for(GridObject *elem, size_t co)
check and set the element mark
Definition convection_diffusion_sss.h:126
GridObject * m_elem
grid element for the source/sink (not to take it into account twice)
Definition convection_diffusion_sss.h:114
void init()
resets the mark
Definition convection_diffusion_sss.h:123
virtual size_t num_vertices() const=0
virtual Vertex * vertex(size_t index) const=0
const NullSmartPtr SPNULL
double number
SmartPtr< T, FreePolicy > make_sp(T *inst)
a special structure to identify the element and its corner in a fracture
Definition convection_diffusion_sss.h:148
t_fract_elem(IVertexGroup *face, size_t co)
Definition convection_diffusion_sss.h:152
size_t fract_co
Definition convection_diffusion_sss.h:150
IVertexGroup * fract_face
Definition convection_diffusion_sss.h:149