Plugins
Loading...
Searching...
No Matches
d3f_sss.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 Gesellschaft fuer Anlagen- und Reaktorsicherheit gGmbH
3 * SPDX-License-Identifier: EUPL-1.2
4 * SPDX-FileContributor: Dmitry Logashenko
5 * SPDX-FileContributor: Goethe Universität Frankfurt
6 * SPDX-FileType: SOURCE
7 *
8 * This file is part of d3f++.
9 * d3f++ is an extension for UG4. Licensing information and citation requirements of UG4 are provided in LICENSES/UG4-LGPL_2.1
10 */
11
12/*
13 * Singular (point and line) sources and sinks in d3f.
14 */
15#ifndef __H__UG__PLUGINS__D3F__SINGULAR_SOURCES_AND_SINKS__
16#define __H__UG__PLUGINS__D3F__SINGULAR_SOURCES_AND_SINKS__
17
18#include <vector>
19
20// ug4 headers
24
25namespace ug {
26namespace d3f {
27
29template <int dim>
31{
37
39
40public:
41
43 dd_sss_data () {m_values [0] = 0; m_values [1] = 0;}
44
46 number intensity () {return m_values [0];}
47
49 number concentration () {return m_values [1];}
50
53 (
54 const MathVector<dim>& x,
55 number time,
56 int si
57 )
58 {
59 if (m_spData.valid ())
60 (* m_spData) (m_values, x, time, si);
61 }
62
64 void set (number intens, number c)
65 {
66 m_values[0] = intens;
67 m_values[1] = c;
69 }
70
72 void set (SmartPtr<UserData<MathVector<2>, dim> > spData)
73 {
74 m_spData = spData;
75 }
76
79 {
80 m_spData = make_sp (new LuaUserData<MathVector<2>, dim> (func));
81 }
82};
83
85template <int dim>
87{
94
96
97public:
98
100 th_sss_data () {m_values [0] = 0; m_values [1] = 0; m_values [2] = 0;}
101
103 number intensity () {return m_values [0];}
104
107
109 number temperature () {return m_values [2];}
110
113 (
114 const MathVector<dim>& x,
115 number time,
116 int si
117 )
118 {
119 if (m_spData.valid ())
120 (* m_spData) (m_values, x, time, si);
121 }
122
124 void set (number intens, number c, number T)
125 {
126 m_values[0] = intens;
127 m_values[1] = c;
128 m_values[2] = T;
130 }
131
133 void set (SmartPtr<UserData<MathVector<3>, dim> > spData)
134 {
135 m_spData = spData;
136 }
137
140 {
141 m_spData = make_sp (new LuaUserData<MathVector<3>, dim> (func));
142 }
143};
144
146 template <int dim>
148 {
161 public:
162
165 m_values[0] = 0;
166 m_values[1] = 0;
167 m_values[2] = 0;
168 }
169
171 number intensity () {return m_values [0];}
172
175
178
180 number width() const {return m_width;}
181
184
187
190 (
191 const MathVector<dim>& x,
192 number time,
193 int si
194 )
195 {
196 if (m_spData.valid ())
197 (* m_spData) (m_values, x, time, si);
198 }
199
201 void set (number intens, number c, number perm, number width = 1.0, number thickness = 1.0)
202 {
203 m_values[0] = intens;
204 m_values[1] = c;
205 m_values[2] = perm;
206 m_width = width;
207 m_bottom_thickness = thickness;
209 }
210
211 void set_edge(Edge* edge) {m_edge = edge;}
212 Edge* get_edge() const {return m_edge;}
215
217 void set (SmartPtr<UserData<MathVector<3>, dim> > spData)
218 {
219 m_spData = spData;
220 }
221
224 {
225 m_spData = make_sp (new LuaUserData<MathVector<3>, dim> (func));
226 }
227 };
228
229
230
236{
238 size_t m_co;
239
240public:
241
243 point_sss_marker () : m_elem (NULL), m_co (0) {};
244
246 void init () {m_elem = NULL; m_co = 0;}
247
249 bool marked_for (GridObject * elem, size_t co)
250 {
251 if (m_elem == NULL)
252 {
253 m_elem = elem; m_co = co;
254 return true;
255 }
256 return m_elem == elem && m_co == co;
257 }
258};
259
266{
267// All the members are used in the fractures only!
268
271 {
273 size_t fract_co;
274
275 t_fract_elem (IVertexGroup * face, size_t co) : fract_face (face), fract_co (co) {};
276 };
277
279 std::vector<t_fract_elem> m_intersections;
280
281public:
282
285
287 void init () {m_intersections.clear ();}
288
290 bool marked_for (IVertexGroup * elem, size_t co)
291 {
292 // is the fracture already processed?
293 for (size_t i = 0; i < m_intersections.size (); i++)
294 {
295 // check if we have already registered this mark
296 t_fract_elem& intersection = m_intersections[i];
297 if (intersection.fract_face == elem)
298 return intersection.fract_co == co;
299
300 // check if a different corner is meant (i.e. this is the same fracture)
301 Vertex * vrt = elem->vertex (co);
302 for (size_t j = 0; j < intersection.fract_face->num_vertices (); j++)
303 if (vrt == intersection.fract_face->vertex (j))
304 return false; // in this fracture, we use a different corner
305 }
306 // no, register this fracture, too
307 m_intersections.push_back (t_fract_elem (elem, co));
308 return true;
309 }
310};
311
312template <int dim> class dd_point_sss_data : public dd_sss_data<dim>, public point_sss_marker {};
313template <int dim> class dd_line_sss_data : public dd_sss_data<dim>, public line_sss_marker {};
314template <int dim>
316 : public FVSingularSourcesAndSinks<dim, dd_point_sss_data<dim>, dd_line_sss_data<dim> >
317{};
318
319template <int dim> class th_point_sss_data : public th_sss_data<dim>, public point_sss_marker {};
320template <int dim> class th_line_sss_data : public th_sss_data<dim>, public line_sss_marker {};
321template <int dim>
323 : public FVSingularSourcesAndSinks<dim, th_point_sss_data<dim>, th_line_sss_data<dim> >
324{};
325
326
327template <int dim> class river_point_sss_data : public river_sss_data<dim>, public point_sss_marker {};
328template <int dim> class river_line_sss_data : public river_sss_data<dim>, public line_sss_marker {};
329
330
331} // namespace d3f
332} // end namespace ug
333
334#endif // __H__UG__PLUGINS__D3F__SINGULAR_SOURCES_AND_SINKS__
335
336/* End of File */
virtual size_t num_vertices() const=0
virtual Vertex * vertex(size_t index) const=0
Definition d3f_sss.h:317
Definition d3f_sss.h:324
Definition d3f_sss.h:313
Definition d3f_sss.h:312
class for data for all the density-driven flow sources and sinks
Definition d3f_sss.h:31
number concentration()
returns the concentration
Definition d3f_sss.h:49
void set(number intens, number c)
sets the data
Definition d3f_sss.h:64
number intensity()
returns the intensity
Definition d3f_sss.h:46
dd_sss_data()
class construction (there must exist a 'dummy' constructor!)
Definition d3f_sss.h:43
void set(LuaFunctionHandle func)
set as a LUA function
Definition d3f_sss.h:78
SmartPtr< UserData< MathVector< 2 >, dim > > m_spData
an alternative method to specify the data
Definition d3f_sss.h:38
MathVector< 2 > m_values
Definition d3f_sss.h:36
void compute(const MathVector< dim > &x, number time, int si)
computes the data from the user data object
Definition d3f_sss.h:53
void set(SmartPtr< UserData< MathVector< 2 >, dim > > spData)
sets the data by an object
Definition d3f_sss.h:72
Definition d3f_sss.h:266
line_sss_marker()
class constructor
Definition d3f_sss.h:284
void init()
reset the mark
Definition d3f_sss.h:287
bool marked_for(IVertexGroup *elem, size_t co)
check and set the element mark (use it only for fractures!)
Definition d3f_sss.h:290
std::vector< t_fract_elem > m_intersections
array keeping the elements from different(!) fractures
Definition d3f_sss.h:279
Definition d3f_sss.h:236
point_sss_marker()
class constructor
Definition d3f_sss.h:243
GridObject * m_elem
grid element for the source/sink (not to take it into account twice)
Definition d3f_sss.h:237
size_t m_co
corner of the element (not to take it into account twice inside of the element)
Definition d3f_sss.h:238
void init()
resets the mark
Definition d3f_sss.h:246
bool marked_for(GridObject *elem, size_t co)
check and set the element mark
Definition d3f_sss.h:249
Definition d3f_sss.h:328
Definition d3f_sss.h:327
class for data for all the river sources and sinks
Definition d3f_sss.h:148
void set(SmartPtr< UserData< MathVector< 3 >, dim > > spData)
sets the data by an object
Definition d3f_sss.h:217
number m_matrix_permeability
Definition d3f_sss.h:155
MathVector< 3 > m_values
Definition d3f_sss.h:154
number m_bottom_thickness
Definition d3f_sss.h:158
number relative_bottom_permeability()
returns the relative bottom permeability
Definition d3f_sss.h:177
number intensity()
returns the intensity
Definition d3f_sss.h:171
river_sss_data()
class construction (there must exist a 'dummy' constructor!)
Definition d3f_sss.h:164
number matrix_permeability() const
Definition d3f_sss.h:214
number m_width
Definition d3f_sss.h:157
void compute(const MathVector< dim > &x, number time, int si)
computes the data from the user data object
Definition d3f_sss.h:190
number m_exchange_flux
Definition d3f_sss.h:156
void set_edge(Edge *edge)
Definition d3f_sss.h:211
Edge * m_edge
Definition d3f_sss.h:160
void set(LuaFunctionHandle func)
set as a LUA function
Definition d3f_sss.h:223
SmartPtr< UserData< MathVector< 3 >, dim > > m_spData
an alternative method to specify the data
Definition d3f_sss.h:159
number concentration()
returns the concentration
Definition d3f_sss.h:174
number & exchange_flux()
reference to exchange flux
Definition d3f_sss.h:186
void set_matrix_permeability(number k)
Definition d3f_sss.h:213
number width() const
returns width
Definition d3f_sss.h:180
number bottom_thickness() const
returns bottom thickness
Definition d3f_sss.h:183
void set(number intens, number c, number perm, number width=1.0, number thickness=1.0)
sets the data
Definition d3f_sss.h:201
Edge * get_edge() const
Definition d3f_sss.h:212
Definition d3f_sss.h:320
Definition d3f_sss.h:319
class for data for all the thermohaline flow sources and sinks
Definition d3f_sss.h:87
number concentration()
returns the concentration
Definition d3f_sss.h:106
void compute(const MathVector< dim > &x, number time, int si)
computes the data from the user data object
Definition d3f_sss.h:113
void set(SmartPtr< UserData< MathVector< 3 >, dim > > spData)
sets the data by an object
Definition d3f_sss.h:133
number temperature()
returns the temperature
Definition d3f_sss.h:109
number intensity()
returns the intensity
Definition d3f_sss.h:103
void set(LuaFunctionHandle func)
set as a LUA function
Definition d3f_sss.h:139
SmartPtr< UserData< MathVector< 3 >, dim > > m_spData
an alternative method to specify the data
Definition d3f_sss.h:95
th_sss_data()
class construction (there must exist a 'dummy' constructor!)
Definition d3f_sss.h:100
MathVector< 3 > m_values
Definition d3f_sss.h:93
void set(number intens, number c, number T)
sets the data
Definition d3f_sss.h:124
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 d3f_sss.h:271
IVertexGroup * fract_face
Definition d3f_sss.h:272
size_t fract_co
Definition d3f_sss.h:273
t_fract_elem(IVertexGroup *face, size_t co)
Definition d3f_sss.h:275