Commit c2f94e6d authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Readme file written

parent fa2d863e
Pipeline #4129 passed with stage
in 12 minutes and 27 seconds
Preparing the Sources
=========================
Additional to the software mentioned in README you'll need the
following programs installed on your system:
cmake >= 2.8.12
Getting started
---------------
If these preliminaries are met, you should run
dunecontrol all
which will find all installed dune modules as well as all dune modules
(not installed) which sources reside in a subdirectory of the current
directory. Note that if dune is not installed properly you will either
have to add the directory where the dunecontrol script resides (probably
./dune-common/bin) to your path or specify the relative path of the script.
Most probably you'll have to provide additional information to dunecontrol
(e. g. compilers, configure options) and/or make options.
The most convenient way is to use options files in this case. The files
define four variables:
CMAKE_FLAGS flags passed to cmake (during configure)
An example options file might look like this:
#use this options to configure and make if no other options are given
CMAKE_FLAGS=" \
-DCMAKE_CXX_COMPILER=g++-5 \
-DCMAKE_CXX_FLAGS='-Wall -pedantic' \
-DCMAKE_INSTALL_PREFIX=/install/path" #Force g++-5 and set compiler flags
If you save this information into example.opts you can pass the opts file to
dunecontrol via the --opts option, e. g.
dunecontrol --opts=example.opts all
More info
---------
See
dunecontrol --help
for further options.
The full build system is described in the dune-common/doc/buildsystem (Git version) or under share/doc/dune-common/buildsystem if you installed DUNE!
# dune-curvedsurfacegrid
# Dune-CurvedSurfaceGrid - A Dune module for surface parametrization
This Dune module provides a meta-grid for wrapping other grid implementations and providing
a curved geometry on each element, parametrized by a [Dune-CurvedGeometry](https://gitlab.mn.tu-dresden.de/spraetor/dune-curvedgeometry)
class.
A metagrid-module for dune which uses a surface-mesh (triangles in a 3D-world) as host-grid and treats the elements as curved triangles with Lagrange interpolatory vertices of orders 1 to 5.
\ No newline at end of file
For an overview about the CurvedSurfaceGrid and the CurvedGeometry, see also the presentation
[Dune-CurvedSurfaceGrid - A Dune module for surface parametrization](http://www.math.tu-dresden.de/~spraetor/dune-curvedsurfacegrid).
## Initial Example
(See [example1.cc](https://gitlab.mn.tu-dresden.de/iwr/dune-curvedsurfacegrid/-/blob/master/src/example1.cc))
```c++
// 1. Construct a reference grid
auto refGrid = GmshReader< FoamGrid<2,3> >::read("sphere.msh");
// 2. Define the geometry mapping
auto sphere = [](const auto& x) { return x / x.two_norm(); };
auto sphereGF = analyticDiscreteFunction(sphere, *refGrid, order);
// 3. Wrap the reference grid to build a curved grid
CurvedSurfaceGrid grid{*refGrid, sphereGF};
```
At first, we have to create a reference grid that acts as a parametrization domain for the
target curved grid. In the example, we use [Dune-FoamGrid](https://gitlab.dune-project.org/extensions/dune-foamgrid)
and read a piece-wise flat grid from a GMsh file [`sphere.msh`](https://gitlab.mn.tu-dresden.de/iwr/dune-curvedsurfacegrid/-/blob/master/doc/grids/sphere.msh).
In a second step, we describe the parametrization of the curved surface by a closest-point
projection to the sphere with radius 1. This projection is given by a callable `sphere` and
the wrapped into a grid-function by a call to `analyticDiscreteFunction`. This grid-function
wrapper associated the lambda-expression with a grid and a polynomial order for the local
interpolation of the projection into a Lagrange basis. This interpolation allows to obtain
values and derivatives of the geometry mapping.
Finally, the reference grid and the parametrization together build the curved grid. This
meta-grid `CurvedSurfaceGrid` implements the Dune grid interface and can thus be used as
replacement for, e.g., the reference grid.
## Two Different Geometry Mappings
The [Dune-CurvedGeometry](https://gitlab.mn.tu-dresden.de/spraetor/dune-curvedgeometry) module
provides two different geometry implementations that differ in the input and in the
representation of the parametrization.
### Parametrized-Geometry
The first one, `ParametrizedGeometry`, provides a geometry that locally interpolates a given
projection function into a (Lagrange) basis on the reference element. This requires from the
projection mapping just that it allows to map local coordinates in the reference element to
global coordinates on the surface.
The `CurvedSurfaceGrid` constructs on request of the element geometry a LocalFiniteElement
of Lagrange basis functions for the internal parametrization of the geometry. The `ParametrizedGeometry`
is constructed, if the grid gets a polynomial order `k > 0`.
```c++
// Construct a reference grid
auto refGrid = GmshReader< FoamGrid<2,3> >::read("sphere.msh");
// Define the geometry mapping
auto sphere = [](const auto& x) { return x / x.two_norm(); };
template <int order>
using Order_t = std::integral_constant<int,order>;
// Wrap the reference grid to build a curved grid
CurvedSurfaceGrid grid{*refGrid, sphere, Order_t<k>{}};
```
### LocalFunction-Geometry
In case the projection is given as a differentiable mapping `f`, i.e., there exists a
function `derivative(f)` returning a callable that gives the Jacobian of the mapping, the
grid constructs a `LocalFunctionGeometry` on each element. This geometry is exactly parametrized
with the mapping and its derivative, i.e., no additional interpolation is performed.
```c++
auto gv = refGrid->leafGridView();
// Define a discrete grid-function on the reference grid
// with dim(range) = 3 and polynomial order k
auto f = discreteGridViewFunction<3>(gv, k);
// Interpolate the parametrization into the grid-function
Functions::interpolate(f.basis(), f.coefficients(), sphere);
// Wrap the reference grid and the grid-function
CurvedSurfaceGrid grid{*refGrid, f};
```
\ No newline at end of file
Markdown is supported
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