https://github.com/hugomvale/hr-weno
A Fortran implementation of high-resolution WENO schemes for hyperbolic conservation equations
https://github.com/hugomvale/hr-weno
fortran fpm high-resolution hyperbolic-equations partial-differential-equations pde reconstruction weno-schemes
Last synced: 16 days ago
JSON representation
A Fortran implementation of high-resolution WENO schemes for hyperbolic conservation equations
- Host: GitHub
- URL: https://github.com/hugomvale/hr-weno
- Owner: HugoMVale
- License: mit
- Created: 2019-11-08T23:17:24.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2025-08-02T11:06:58.000Z (3 months ago)
- Last Synced: 2025-08-02T11:40:30.253Z (3 months ago)
- Topics: fortran, fpm, high-resolution, hyperbolic-equations, partial-differential-equations, pde, reconstruction, weno-schemes
- Language: Fortran
- Homepage: https://hugomvale.github.io/HR-WENO/
- Size: 30.2 MB
- Stars: 17
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# HR-WENO (High-Resolution Weighted Essentially Non-Oscillatory)
[](https://github.com/HugoMVale/HR-WENO/actions)
[](https://codecov.io/gh/HugoMVale/HR-WENO)
[](https://github.com/topics/fortran)
[](https://deepwiki.com/HugoMVale/HR-WENO)
## Description
This package is a modern-Fortran implementation of selected high-resolution [weighted essentially non-oscillatory (WENO)](https://en.wikipedia.org/wiki/WENO_methods) schemes and [total variation diminishing (TVD)](https://en.wikipedia.org/wiki/Total_variation_diminishing) integration methods for solving [hyperbolic conservation equations](https://en.wikipedia.org/wiki/Hyperbolic_partial_differential_equation).
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)](doc/Shu-WENO-notes.pdf).
## Documentation
* This readme (start with that).
* [API Reference](https://hugomvale.github.io/HR-WENO/).
## Getting started
### Build
The easiest way to build/test the code and run the examples is by means of [`fpm`](https://fpm.fortran-lang.org/en/index.html). To run a given example, just do:
```sh
fpm run --example "example-filename" --profile release
```
and the numerical results will be stored in the [`output`](/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):
```fortran
use tvdode, only: rktvd
...
type(rktvd) :: ode
...
! Initialize solver object
ode = rktvd(rhs, neq=size(u), order=3)
! Integrate
time_start = 0.0_rk
time_end = 12.0_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:
```fortran
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`](/example/example1_burgers_1d_fv.f90)) illustrates the application of procedures `weno` and `rktvd` for solving [Burger's inviscid equation](https://en.wikipedia.org/wiki/Burgers%27_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`](/example/example2_pbe_2d_fv.f90)) illustrates the application of procedures `weno` and `mstvd` for solving a [population balance equation](https://en.wikipedia.org/wiki/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.