HugoMVale / HR-WENO

A Fortran implementation of high-resolution WENO schemes for hyperbolic conservation equations

Home Page:https://hugomvale.github.io/HR-WENO/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HR-WENO (High-Resolution Weighted Essentially Non-Oscillatory)

CI codecov Language

Solution of Burger's equation with 5th order WENO

Description

This package is a modern-Fortran implementation of selected high-resolution weighted essentially non-oscillatory (WENO) schemes and total variation diminishing (TVD) integration methods for solving hyperbolic conservation equations.

In particular, the package includes:

  • WENO schemes up to 5th order;
  • explicit Runge-Kutta TVD methods up to 3rd order;
  • explicit 3rd order multi-step TVD method.

All numerical methods are described in detail by Shu (1997).

Documentation

Getting started

Build

The easiest way to build/test the code and run the examples is by means of fpm. To run a given example, just do:

fpm run --example "example-filename"

and the numerical results will be stored in the output subfolder. You can then use the provided Python script to read the data and plot the results.

Usage

The ODE solvers (rktvd and mstvd) are called like most other solvers (e.g., LSODE):

use tvdode, only: rktvd
...
type(rktvd) :: ode
...
! Initialize solver object
ode = rktvd(rhs, neq=size(u), order=3)

! Integrate
time_start = 0._rk
time_end = 12._rk
dt = 1e-2_rk
time = time_start
num_time_points = 100
do i = 0, num_time_points
  time_out = time_end*i/num_time_points
  call ode%integrate(u, time, time_out, dt)
  call save_intermediate_results(u, time, ...)
end do
 ...

The WENO reconstruction is even simpler to call:

use hrweno, only: weno
...
type(weno) :: myweno
...
! Initialize weno object
myweno = weno(ncells=100, k=3, eps=1e-6_rk)
  
! Get reconstructed values at cell boundaries
call myweno%reconstruct(v, vl, vr)
...

Examples

Burgers' inviscid equation (1D)

This example (example1_burgers_1d_fv.f90) illustrates the application of procedures weno and rktvd for solving Burger's inviscid equation using a finite volume (FV) formulation. The results are depicted in the figure at the top of the page and demonstrate the excellent resolution of the shock wave.

Population balance equation (2D)

This example (example2_pbe_2d_fv.f90) illustrates the application of procedures weno and mstvd for solving a population balance equation with 2 internal coordinates using a finite volume (FV) formulation. The results are depicted in the figure below and demonstrate the excellent resolution of the pulse.

Solution of 2D PBE with 5th order WENO

About

A Fortran implementation of high-resolution WENO schemes for hyperbolic conservation equations

https://hugomvale.github.io/HR-WENO/

License:MIT License


Languages

Language:Fortran 94.1%Language:Python 5.9%