Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
lognormal_random_field.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014-2015: G-CSC, Goethe University Frankfurt
3 * Authors: Ivo Muha, Martin Rupp
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 * example usage (on unit square)
35 * elemDisc = ConvectionDiffusion("c", "Inner", disc)
36 * elemDisc:set_diffusion(LognormalRandomField(100, 0, 1, 0.01))
37 */
38
39#ifndef __H__UG__LIB_DISC__SPATIAL_DISC__LOGNORMAL_RANDOM_FIELD__
40#define __H__UG__LIB_DISC__SPATIAL_DISC__LOGNORMAL_RANDOM_FIELD__
41
42// extern headers
43#include <vector>
45
46namespace ug{
47
48template <typename TData, int dim, typename TRet = void>
50 : public StdGlobPosData<LognormalRandomField<TData, dim, TRet>, TData, dim, TRet>
51{
52
53public:
54
56 {
57 m_bNoExp=false;
58 set_config(100, 0, 1, 0.1);
59 };
60
61 LognormalRandomField(size_t N, double mean_f, double sigma_f, double sigma)
62 {
63 m_bNoExp=false;
64 set_config(N, mean_f, sigma_f, sigma);
65 };
66
67
69 {
70 }
71 inline TRet evaluate(TData& D, const MathVector<dim>& x, number time, int si) const;
72
73 void set_no_exp() { m_bNoExp = true; }
74 void set_config(size_t N, double mean_f, double sigma_f, double sigma);
75
76 std::string config_string() const;
77
78private:
79 double gasdev();
80 double undev();
81 double eval_K(const MathVector<dim> &x) const;
82
84
85 double m_dMean_f;
86 double m_dSigma_f;
87 double m_N;
89 double m_dSigma;
90
91 std::vector<MathVector<dim> > m_vRandomQvec;
92 std::vector<double> m_vRandomAlpha;
93
94};
95
96} // end ug
97
99
100#endif /* __H__UG__LIB_DISC__SPATIAL_DISC__LOGNORMAL_FIELD__ */
number time() const
get the current evaluation time
Definition user_data.h:285
Definition lognormal_random_field.h:51
double gasdev()
Definition lognormal_random_field_impl.h:72
std::string config_string() const
Definition lognormal_random_field_impl.h:157
std::vector< double > m_vRandomAlpha
Definition lognormal_random_field.h:92
double m_N
Definition lognormal_random_field.h:87
TRet evaluate(TData &D, const MathVector< dim > &x, number time, int si) const
Definition lognormal_random_field_impl.h:56
double m_dMean_f
Definition lognormal_random_field.h:85
double m_dSigma
Definition lognormal_random_field.h:89
double undev()
Definition lognormal_random_field_impl.h:104
bool m_bNoExp
Definition lognormal_random_field.h:88
MathVector< dim > m_sigma
Definition lognormal_random_field.h:83
void set_config(size_t N, double mean_f, double sigma_f, double sigma)
Definition lognormal_random_field_impl.h:127
LognormalRandomField()
Definition lognormal_random_field.h:55
double m_dSigma_f
Definition lognormal_random_field.h:86
std::vector< MathVector< dim > > m_vRandomQvec
Definition lognormal_random_field.h:91
void set_no_exp()
Definition lognormal_random_field.h:73
LognormalRandomField(size_t N, double mean_f, double sigma_f, double sigma)
Definition lognormal_random_field.h:61
virtual ~LognormalRandomField()
Definition lognormal_random_field.h:68
double eval_K(const MathVector< dim > &x) const
Definition lognormal_random_field_impl.h:110
a mathematical Vector with N entries.
Definition math_vector.h:97
Definition std_glob_pos_data.h:55
double number
Definition types.h:124
the ug namespace