Difference between revisions of "Customization"

From Medusa: Coordinate Free Mehless Method implementation
Jump to: navigation, search
(Custom operators: Hyperviscosity operator)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
Medusa library support users defining custom basis types, weights, operators and more, as long as they conform to the prescribed interfaces, given in the [http://e6.ijs.si/medusa/docs/html/concepts.html Concepts page].
 
Medusa library support users defining custom basis types, weights, operators and more, as long as they conform to the prescribed interfaces, given in the [http://e6.ijs.si/medusa/docs/html/concepts.html Concepts page].
Here we show this on an example of the biharmonic equation.
 
  
== Custom operators: Biharmonic equation ==
+
== Custom stencil selection ==
We solve the problem
+
TODO
  
$
+
== Custom RBF definition ==
\begin{align}
+
TODO
  \nabla^4 u &= f      &&\text{in } \Omega, \\
 
  u &= g_d          &&\text{on } \partial \Omega,\\
 
  \frac{\partial u}{\partial \vec n} &= g_n          &&\text{on } \partial \Omega,
 
\end{align}
 
$
 
where $u = TODO$ and $f$, $g_d$ and $g_n$ are computed from $u$.
 
  
TODO: JureMB
+
== Custom operators: Hyperviscosity operator ==
 +
Medusa library also allows custom linear operators $ \mathcal{L} $ to be used. This functionality is achieved by adding a child struct that inherits the struct Operator. The virtual functions of struct Operator that need to be defined are <code>apply</code> and <code>applyAt0</code>, the functions require one to also specify the basis to which the operator is applied. For example if one was to define the hyperviscosity operator denoted as $\nabla^{2\alpha}$, we would say that the RBF-FD approximation to the operator applied to function $u$ is,
 +
$$
 +
\nabla^{2\alpha} u \approx \sum_{i=0}^n u_i \nabla^{2\alpha} \Psi_i (u),
 +
$$
 +
where $\Psi_i (u)$ are cardinal functions and $\alpha$ is the order of hyperviscosity. The evaluated cardinal functions are called weights. The weights are obtained by using a system of RBF coupled with monomial augmentation. Therefore, our operator must have a definition of the function <code>apply</code> or <code> applyAt0 </code> for monomial and RBF basis. We define the struct, as
 +
 
 +
<syntaxhighlight lang="cpp">
 +
template <int dim, int order>
 +
struct Hyperviscosity : public mm::Operator<Hyperviscosity <dim, order>>
 +
</syntaxhighlight>

Latest revision as of 14:31, 12 July 2024

Medusa library support users defining custom basis types, weights, operators and more, as long as they conform to the prescribed interfaces, given in the Concepts page.

Custom stencil selection

TODO

Custom RBF definition

TODO

Custom operators: Hyperviscosity operator

Medusa library also allows custom linear operators $ \mathcal{L} $ to be used. This functionality is achieved by adding a child struct that inherits the struct Operator. The virtual functions of struct Operator that need to be defined are apply and applyAt0, the functions require one to also specify the basis to which the operator is applied. For example if one was to define the hyperviscosity operator denoted as $\nabla^{2\alpha}$, we would say that the RBF-FD approximation to the operator applied to function $u$ is, $$ \nabla^{2\alpha} u \approx \sum_{i=0}^n u_i \nabla^{2\alpha} \Psi_i (u), $$ where $\Psi_i (u)$ are cardinal functions and $\alpha$ is the order of hyperviscosity. The evaluated cardinal functions are called weights. The weights are obtained by using a system of RBF coupled with monomial augmentation. Therefore, our operator must have a definition of the function apply or applyAt0 for monomial and RBF basis. We define the struct, as

template <int dim, int order>
struct Hyperviscosity : public mm::Operator<Hyperviscosity <dim, order>>