Skip to content

Commit

Permalink
comply with setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ceyron committed Feb 27, 2024
1 parent 95695ad commit 444a145
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/test_validation.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import jax
import jax.numpy as jnp
import pytest

import exponax as ex

### Linear steppers
# Linear steppers

# linear steppers do not make spatial and temporal truncation errors, hence we
# can directly compare them with the analytical solution without performing a
Expand Down Expand Up @@ -46,7 +46,7 @@ def test_diffusion_1d():
diffusivity = 0.1

analytical_solution = lambda t, x: jnp.exp(
-(4 * 2 * jnp.pi / domain_extent) ** 2 * diffusivity * t
-((4 * 2 * jnp.pi / domain_extent) ** 2) * diffusivity * t
) * jnp.sin(4 * 2 * jnp.pi * x / domain_extent)

grid = ex.get_grid(num_spatial_dims, domain_extent, num_points)
Expand All @@ -64,3 +64,13 @@ def test_diffusion_1d():
u_1_pred = stepper(u_0)

assert u_1_pred == pytest.approx(u_1, rel=1e-4)


# Nonlinear steppers

# Burgers can be test by comparing it with the solution obtained by Cole-Hopf
# transformation.


# The Korteveg-de Vries equation has an analytical solution, given the initial
# condition is a soliton.

0 comments on commit 444a145

Please sign in to comment.