Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
CurvedGeometry
==============
The `CurvedGeometry` is a Geometry parametrized by a local-to-global mapping that
is interpolated into a local basis. In the Traits type the local basis in encoded
by a LocalFiniteElement Cache type, that allows to construct a local FiniteElement
and with this also the local basis.
```c++
// <dune/curvedgeometry/curvedgeometry.hh>
template <class ctype, int mydim, int corddim, class Traits>
class CurvedGeometry;
```
The following type requirements must be fulfilled:
- `ctype`: Type of the coordiante vector components, i.e., representation for R. This type should
be an *Arithmetic* type.
- `mydim`: Dimension of the entity-coordinate system this geometry is bound to.
- `coorddim`: Dimension of the global coordinates this geometry maps into.
There is a specialization of that type for Lagrange basis functions:
```c++
template <class ctype, int mydim, int corddim, int order>
using LagrangeCurvedGeometry = CurvedGeometry<ctype,mydim,corddim,
CurvedGeometryTraits<ctype, LagrangeLocalFiniteElementCache<ctype,ctype,mydim,order>> >;
```
with
- `order`: Polynomial order of the lagrange basis functions. Should be > 0.
Example
-------
```c++
// construct a reference grid
Grid grid(...);
// define the geometry type
const int order = 3;
using Geometry = LagrangeCurvedGeometry<double, Grid::dimension, 3, order>;
using LocalCoordinate = typename Geometry::LocalCoordinate;
using GlobalCoordinate = typename Geometry::GlobalCoordinate;
for (const auto& e : elements(grid.leafGridView()))
{
// sphere projection from local to global coordinates
auto X = [geo=e.geometry()](const LocalCoordinate& local) -> GlobalCoordinate
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{
auto x = geo.global(local);
return x / x.two_norm();
};
// create a curved geometry
Geometry geometry(e.type(), X);
}
```
LocalFunctionGeometry
=====================
The `LocalFunctionGeometry` is a Geometry parametrized by a local-function bound to an element.
The local-function is evaluated in the coordinates provided by a local-geometry mapping that
allows to construct also geometries of intersections.
```c++
// <dune/curvedgeometry/localfunctiongeometry.hh>
template <class LocalFunction, class LocalGeometry, class Traits>
class LocalFunctionGeometry;
```
The following type requirements must be fulfilled:
- `LocalGeometry` represents a geometric mapping from an entity of codim `c` to the element
with codim `0`.
- `LocalFunction` represents a differentiable mapping with from the global coordinates of the
`LocalGeometry` to the global coordinate of the target geometry. It must be bound to an element
and must provide a free function `derivative(LocalFunction)` that creates the jacobian mapping
of the coordinate mapping.
A sepcial form of `LocalFunctionGeometry` could be defined that lives in elements (codim = 0) of
a host grid:
```c++
template <class LocalFunction, class ctype, int mydim>
using ElementLocalFunctionGeometry = LocalFunctionGeometry<LocalFunction,
DefaultLocalGeometry<ctype,mydim,mydim>, LocalFunctionGeometryTraits<ctype> >;
```
Example
-------
```c++
// construct a reference grid
Grid grid(...);
// sphere-mapping grid function
auto sphereGridFct = analyticGridFunction<Grid>([](const auto& x) { return x / x.two_norm(); });
auto sphereLocalFct = localFunction(sphereGridFct);
// define the geometry type
using Geometry = ElementLocalFunctionGeometry<decltype(sphereLocalFct), double, Grid::dimension>;
using LocalCoordinate = typename Geometry::LocalCoordinate;
using GlobalCoordinate = typename Geometry::GlobalCoordinate;
for (const auto& e : elements(grid.leafGridView()))
{
sphereLocalFct.bind(e);
// create a curved geometry
Geometry geometry(e.type(), sphereLocalFct);
sphereLocalFct.unbind();
}
```
Installation Instructions
=========================
`dune-curvedgeometry` requires the DUNE core modules, version 2.7 or later.
Please see the [general instructions for building DUNE modules](https://www.dune-project.org/doc/installation)
for detailed instructions on how to build the module.