Skip to content

Example Execution

Steven Hahn edited this page Feb 12, 2023 · 35 revisions

Build ASGarD with -DASGARD_USE_MATLAB=ON or no output will be displayed!

Example PDE using the 1D Diffusion Equation. This example PDE is time dependent (although not all the terms are time dependent). This implies the need for an initial condition.

PDE: $\frac{df}{dt} = \frac{d^2 f}{dx^2}$ Analytic solution: $\cos(\frac{\pi \cdot x}{2}) \exp(-\frac{\pi^2 \cdot t}{2})$

First, run ASGarD selecting the diffusion_1 PDE and 1 time step.

./asgard -p diffusion_1 -n 1

This matches the analytic solution at t=0. $f(0,0) = 1$ and $f(1,0) = 0$.

diffusion_1

Next, run for 1000 time-steps. After each calculation the figure will be updated.

./asgard -p diffusion_1 -n 1000

diffusion_1_1000

The final figure shows $f(0,t)$ decreasing with time, matching the analytic solution.

Lastly, let's increase the precision of this calculation. Increasing the number of legendre basis polynomials (-d) and the starting (-l) and maximum (-m) hierarchical levels (resolution) results in a denser grid.

./asgard -p diffusion_1 -n 1 -d 3 -l 4 -m 4

diffusion_1_d3_l4

./asgard -p diffusion_1 -n 1000 -d 3 -l 4 -m 4

diffusion1_1000

  • 2D Continuity Equation

Consider the continuity equation in two dimensions

$\frac{df}{dt} + v_x \cdot \frac{df}{dx} + v_y \cdot \frac{df}{dy} = 0$

with analytic solution

$f(x,y,t) = \cos(\pi * x) \cdot \cos(2 \pi * y) \cdot \sin(2 \cdot t)$

Use the -p continuity_2 option to select the 2D continuity equation. Let's start with a higher precision calculation. Notice that in 2 dimensions and the starting (-l) and maximum (-m) hierarchical levels (resolution) take a string containing two values.

First, start with -n 1 to get the initial values at t=0.

./asgard -p continuity_2 -n 1 -d 3 -l "4 4" -m "4 4"

continuity_2d_min

We note that the y-axis is multiplied $\pm10^{-3}$ and therefore is in agreement with of analytic solution of 0.

Next, we run for 627 time steps, which should display the greatest amplitude.

./asgard -p continuity_2 -n 627 -d 3 -l "4 4" -m "4 4"

The slices are slightly offset from 0. At $x=0$, we see the amplitude matches $cos(2pi0.125) = 0.707$

continuity_2d_max

Clone this wiki locally