Introduction

Note:

Create a control object:

1 From Formulas

If the Formula is simple enough to be represented by C# code, it can be embedded in the control file.

However, the code bust be put into a string, since it is not possible to serialize classes/objects from the notebook into a control object:

Use the BoSSSpad-intrinsic GetFormulaObject to set tie inital value:

2 Advanced functions

Some more advanced mathematical functions, e.g. Jacobian elliptic functions $\text{sn}(u|m)$, $\text{cn}(u|m)$ and $\text{dn}(u|m)$ are available throug the GNU Scientific Library, for which BoSSS provides bindings, see e.g. BoSSS.Platform.GSL.gsl_sf_elljac_e

2.1 From MATLAB code

Asssume e.g. the following MATLAB code; obviously, this could
also be implemented in C#, we yust use something smple for demonstration:

We can evaluate this code in BoSSS using the MATLAB connector; We encapsulate it in a ScalarFunction which allows vectorized evaluation (multiple evaluatiuons in one function call) e of some function.

This is much more efficient, since there will be significant overhead for calling MATLAB (starting MATLAB, checking the license, transfering data, etc.).

We test our implementation:

We recive the following velocity values for our input coordinates:

Projecting the MATLAB function to a DG field

As for a standard calculation, we create a mesh, save it to some database and set the mesh in the control object.

We create a DG field for the $x$-velocity on our grid:

Finally, we are able to project the MATLAB function onto the DG field:

One might want to check the data visually, so it can be exported in the usual fashion

Storing the initial value in the database and linking it in the control object

The DG field with the initial value can be stored in the database. this will create a dummy session.