This repository contains the code base for following publication: " Learning closure relations using differentiable programming: an example in radiation transport "
Uses JAX, diffrax and optax libraries.
- Aidan Crilly
E-mail: ac116@ic.ac.uk
The 'Examples/' directory provides a number scripts that can be used to reproduce solutions to the original and modified Su & Olson problem, as well as the training process:
- RunSuOlson.py
This contains the default settings used to run solutions to the original Su & Olson problem for the various models. By default, it reads the closure parameters from the SimData/opt_closure_params.json file which contains optimal parameters found by the author using TrainSuOlson.py
- TrainSuOlson.py
This contains the default settings used to train the closure relations to the original Su & Olson problem with the various models. N.B. the higher order flux limited diffusion (HFLD) model requires an accurate g-closure from the third order moment model to run. Therefore, if training from scratch, the third order model must be trained before HFLD. Optimal parameters are saved to a json file in 'SimData/'
- RunModifiedSuOlson.py
This contains the default settings used to run solutions to the modified Su & Olson problem for the various models. By default, it reads the closure parameters from the SimData/opt_closure_params.json file.
The training data for the closures comes from the Su & Olson test problem. In this problem, the coupled system of equations to be solved are the following:
where:
Here
The analytic solutions given are performed for a source term of the following form:
where
Su and Olson provide analytic solutions at various
We solve radiation transport for the Su & Olson type problems using various reduced models:
- Pure diffusion
- Flux-limited diffusion
- Variable Eddington factor
- Third order moment
- Higher order flux-limited diffusion
Examples of running and training the models are given in the 'Examples' directory
All models are solved using finite volume methods fully explicitly. Reflective boundary conditions are applied. Time stepping was performed using Huen's method, which solves:
by
where
The flux-limited diffusion equations:
were solved using the forward-time-centred-space method - making the fluxes face-centred. Therefore, the flux limiter is also needed at the face. A donor cell approach was used to do this:
if
The Variable Eddington factor equations:
with closure
were solved using a Roe scheme, following Brunner and Holloway, with the RHS treated as source terms.
where
where the correction matrix,
The Third Order Moment equations:
with closure
were solved using face-centred fluxes and first order finite differencing. The donor cell Eddington factor (
if
The higher order flux-limited diffusion model:
used a similar donor cell method to obtain face-centred values, as in flux-limited diffusion and third order moment models. This scheme has a stability which is poorer than the advective CFL condition due to the diffusive terms.
Discrete ordinates numerically solve the full radiation transport equation using a Gauss-Legendre quadrature set for the angular coordinate,
for
where
The
A number of tests of the numerical schemes are given in the 'Tests/' directory.
- Clone git repository and pip install local copy
git clone https://github.com/aidancrilly/RTClosureJAX.git
cd RTClosureJAX
pip install -e .