Commit a3b08f9a authored by Timo Koch's avatar Timo Koch
Browse files

[example][1ptracer] Update doc after changing the random distribution

parent 82386d67
......@@ -314,9 +314,15 @@ over the computational grid
In this example, we use a randomly generated and element-wise distributed
permeability field. For this, we use the random number generation facilities
provided by the C++ standard library.
Dumux additionally implements some simpler but
standard-library-implementation-independent random distributions
that are accurate enough for our purposes
but allow to generate reproducible and portable random fields (when using a constant seed)
for testing purposes.
```cpp
#include <random>
#include <dumux/common/random.hh>
```
We include the spatial parameters class for single-phase models discretized
......@@ -380,15 +386,19 @@ of 10% here and compute permeabily values for all elements of the computational
// Furthermore, the position of the lens, which is defined by the position of the lower left and the upper right corners, are obtained from the input file.
lensLowerLeft_ = getParam<GlobalPosition>("SpatialParams.LensLowerLeft");
lensUpperRight_ =getParam<GlobalPosition>("SpatialParams.LensUpperRight");
lensUpperRight_ = getParam<GlobalPosition>("SpatialParams.LensUpperRight");
// We generate random fields for the permeability using lognormal distributions,
// with `permeability_` as mean value and 10 % of it as standard deviation.
// A separate distribution is used for the lens using `permeabilityLens_`.
// A permeability value is created for each element of the grid and is stored in the vector `K_`.
// For a "truly" random field (different every time we execute) the seed `0` for the
// Mersenne-Twister pseudo-random-number generator should be replaced
// by `std::random_device{}()`. For unbiased high-quality distributions (usually not needed)
// replace `Dumux::SimpleLogNormalDistribution` by `std::lognormal_distribution`.
std::mt19937 rand(0);
std::lognormal_distribution<Scalar> K(std::log(permeability_), std::log(permeability_)*0.1);
std::lognormal_distribution<Scalar> KLens(std::log(permeabilityLens_), std::log(permeabilityLens_)*0.1);
Dumux::SimpleLogNormalDistribution<Scalar> K(std::log(permeability_), std::log(permeability_)*0.1);
Dumux::SimpleLogNormalDistribution<Scalar> KLens(std::log(permeabilityLens_), std::log(permeabilityLens_)*0.1);
// loop over all elements and compute a permeability value
for (const auto& element : elements(gridGeometry->gridView()))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment