examples.convection.advection package

Submodules

examples.convection.advection.explicitUpwind module

This example shows the failure of advecting a square pulse with a first order explicit upwind scheme.

examples.convection.advection.implicitUpwind module

This example shows the failure of advecting a square pulse with a first order implicit upwind scheme.

examples.convection.advection.vanLeerUpwind module

This example demonstrates the use of the VanLeerConvectionTerm as defined by http://www.gre.ac.uk/~physica/phy2.12/theory/node173.htm

In this example a square wave is advected. The Van Leer discretization should in theory do a good job of preserving the shape of the wave. This may or may not be happening in this case. This example needs further testing.

The test case is mainly to check that the periodic mesh is working correctly. We advect the wave on different meshes one periodic and one non-periodic but twice as long. The results are then compared. The periodic wave wraps around the mesh.

>>> from builtins import range
>>> for step in range(steps):
...     eq1.solve(var=var1, dt=dt, solver=DefaultAsymmetricSolver(tolerance=1e-11, iterations=10000))
...     eq2.solve(var=var2, dt=dt, solver=DefaultAsymmetricSolver(tolerance=1e-11, iterations=10000))
>>> print(numerix.allclose(var1.globalValue[nx // 2:3 * nx // 4],
...                        var2.globalValue[:nx // 4], atol=1e-6))
1

Currently after 20 steps the wave has lost 23% of its height. Van Leer should do better than this.

>>> print(var1.max() > 0.77)
1
Last updated on Jun 27, 2023. Created using Sphinx 6.2.1.