Heat Equation Solver using most recent API

What's new?

Prerequisites

Problem statement

We are investigating the instationary Heat equation $$ \partial_t u - \Delta u = 0 \text{ in } (x,y) \in (-1,1)^2, \ \ \ u = 0 \text{ on } \partial (-1,1)^2 $$ with the initial value $$ u_0(x,y) = \cos(x \pi / 2) \cos(y \pi / 2), $$ and the exact solution $$ u_{\text{ex}}(t,x,y) = ( -\pi^2 / 2 ) u_0(x,y). $$

Solution within the BoSSS framework

First, we initialize the new worksheet; Note:

  1. This tutorial can be found in the source code repository as as HeatEquationSolver.ipynb. One can directly load this into Jupyter to interactively work with the following code examples.
  2. In the following line, the reference to BoSSSpad.dll is required. You must either set #r "BoSSSpad.dll" to something which is appropirate for your computer (e.g. C:\Program Files (x86)\FDY\BoSSS\bin\Release\net6.0\BoSSSpad.dll if you installed the binary distribution), or, if you are working with the source code, you must compile BoSSSpad and put it side-by-side to this worksheet file (from the original location in the repository, you can use the scripts getbossspad.sh, resp. getbossspad.bat).

Creation of Grid and Differential Operator

Here, 1 2D, $16 \times 16$ mesh is used:

Regarding the spatial part of the operator, we re-use the SIP-implementation which is already available in the BoSSS.Solution.NSECommon library. For this implementation, whe have to specify the diffusion coefficient (here to -1.0) as well as the Location of the Dirichlet boundary.

We compose the differential operator from the previously created Laplace implementation. The Laplace is also called an "equation component". Individual equation components can be combined int a differential/spatial operator. This "componentization" allows to later re-use the components in different operators.

Note on historical development and inconsistent naming conventions: Until 2020-API changes, (API-layer 2, aka. BoSSS.Foundation) BoSSS concentrated on spatial operators. Thus, differential operators were called "spatial operators". Time discretization was taken car of in higher levels and/or left to the user. Later, as an attempt to unify the temporal integration, the ITemporalOperator was created, which was added to the spatial operator, rendering its naming inconsistent. At some later point (mid 2023), the spatial operator was renamed to "differential operator", but the oly name might still appear in multiple places, especially in the documentation.

Performing Temporal Integration

Specify the initial value; For the initial field we also specify the DG polynomial degree 4, which also sets the DG polynomial degree for the numerical solution.

Performing a temporal convergence study

Computing the error against the exact solution:

Computing the error against the finest solution:

Computing the error between each solution and the finer one:

Computing the experimental error of the DG discretization with DG polynomial degree $k$ against degree $k-1$.

Plotting different errors

Confirming the order of the time integration:

Note that the lower limit (lower plateau) of the error plots looks different, depending

Fro finer time-steps, the experimental error is reducing further and further, the lower plateau is the floating-point accuracy limit of the double data type. The exact error hits its lower plateau at a much higher level, where the accuracy limit by the DG polynomial degree and the spatial accuracy is reached. I.e., using a finer resolution and/or higher DG degree will bring the lower limit of the red curve further down. The blue and red curve are not affected by the spatial resolution - one would have to use increased floating-point accuracy (not feasible for BoSSS) to get this limit lower.