Skip to content

CHASE — Common

Backend-independent modules shared by all CHASE backends.

The common/ directory contains the base object and all CHASE-specific handler types. Every backend extends chase_common_object and reuses these modules unchanged.

Source layout

Source fileModuleRole
adam_chase_common_object.F90adam_chase_common_objectBase object — ADAM SDK + CHASE handler composition
adam_chase_physics_object.F90adam_chase_physics_objectFluid physics — EOS, variable layout, flux procedures
adam_chase_parameters.F90adam_chase_parametersPhysical constants and eigenvector matrices
adam_chase_bc_object.F90adam_chase_bc_objectBoundary conditions handler
adam_chase_ic_object.F90adam_chase_ic_objectInitial conditions handler
adam_chase_io_object.F90adam_chase_io_objectIO handler — XH5F output, restart, residuals
adam_chase_time_object.F90adam_chase_time_objectTime state and integration parameters
adam_chase_riemann_library.F90adam_chase_riemann_libraryRiemann solvers and Maxwell flux functions
adam_chase_common_library.F90adam_chase_common_libraryBarrel re-export of all common modules

chase_common_object

Non-extending base type that aggregates all ADAM SDK objects and CHASE-specific handlers. Backend objects (e.g. chase_cpu_object) extend this type and provide the numerical methods.

Composition

Data members

MemberTypeDescription
mpihmpih_objectMPI handler
adamadam_objectADAM SDK — grid, tree, field, AMR, IO
fieldfield_object*Field variable storage and ghost-cell maps (pointer into adam)
gridgrid_object*Structured block grid (pointer into adam)
amramr_objectAMR marker handler
ibib_objectImmersed Boundary handler
slicesslices_objectSlice sampling for scheduled output
rkrk_objectRunge-Kutta integrator
wenoweno_objectWENO reconstructor
iochase_io_objectIO configuration and file handles
physicschase_physics_objectEOS and WENO projection basis
icchase_ic_objectInitial conditions
bcchase_bc_objectBoundary conditions
timechase_time_objectTime state and parameters
ngc, ni, nj, nk, nbinteger*Grid dimension pointers
blocks_number, nv, nv_auxinteger*Size pointers
qreal(R8P)(nv, 1-ngc:ni+ngc, …, nb)Conservative variables
q_auxreal(R8P)(nv_aux, 1-ngc:ni+ngc, …, nb)Auxiliary variables
q_namecharacter(2)(nv)Variable names: r ru rv rw rE

initialize_common(field, filename, …)

Initialisation sequence:

mpih%initialize         ! MPI init
io%initialize           ! parse INI file
bc%initialize           ! read BC config
physics%initialize      ! EOS + WENO basis
adam%grid%initialize    ! build structured grid
adam%compute_blocks_number
adam%initialize         ! tree + maps + field
adam%refine_uniform     ! initial uniform refinement
adam%prune              ! tree pruning
amr%initialize
time%initialize
ic%initialize
ib%initialize
slices%initialize
rk%initialize
weno%initialize
allocate_common         ! allocate q_aux
adam%io%initialize      ! register output variables

Output variable names registered with ADAM IO: r_a u_a v_a w_a p_a a_a T_a E_a H_a Rfa g_a.


chase_physics_object

Encapsulates the ideal-gas equation of state and the WENO reconstruction basis selection. Also exports three pure elemental procedures used directly in the compute kernel loop.

Variable layout

ArrayIndexSymbolDescription
q (conservative)1ρDensity
2ρux-momentum
3ρvy-momentum
4ρwz-momentum
5ρETotal energy
q_aux (auxiliary)1ρDensity
2ux-velocity
3vy-velocity
4wz-velocity
5pPressure
6TTemperature
7ETotal specific energy
8HTotal specific enthalpy
9aSpeed of sound
10Rf=cpcvFluid constant
11γ=cp/cvSpecific heats ratio

Named index constants (e.g. VAR_R=1, VAR_RU=2, …, VAR_G=11) are exported as public parameters.

Key data members

MemberDefaultDescription
nv5Conservative variable count
nv_aux11Auxiliary variable count
eoseos_ic_object — ideal-gas: R, cv, g, mu, delta, gm1
weno_rec_var'CONSERVATIVE' or 'CHARACTERISTICS'
erw, elwRight/left eigenvector matrix pointers for WENO projection

WENO reconstruction basis (INI section [physics], key weno_rec_var):

ValueMatrix usedDescription
CONSERVATIVEIERL (identity, 6×6×3)Reconstruct conservative variables directly
CHARACTERISTICSER / EL (6×6×3)Project to characteristics before reconstruction

Module-level procedures

ProcedureDescription
compute_auxiliary(cv, Rf, g, conservative, auxiliary)Single-cell conservative → auxiliary; derives p=RfρT, a=γRfT, H=E+RfT
compute_conservative(auxiliary, conservative)Single-cell auxiliary → conservative: ρE=ρHp
compute_fluxes_conservative(sir, auxiliary, fluxes)Single-cell Euler flux vector in direction sir; F1=ρus^, F5=F1H

adam_chase_parameters

Global physical constants and precomputed eigenvector matrices. All symbols are public module-level entities.

Physical constants

ParameterValueDescription
NV_MAX11Maximum variable count for static array sizing
MU01.256637×10⁻⁶Vacuum magnetic permeability μ0 (H m⁻¹)
EPS08.854187×10⁻¹²Vacuum permittivity ε0 (F m⁻¹)
C01/μ0ε0Vacuum speed of light c0 (m s⁻¹)
PI3.14159…π
E_CHARGE−1.6×10⁻¹⁹Electron charge (C)
E_MASS9.11×10⁻³¹Electron mass (kg)
K_B1.380649×10⁻²³Boltzmann constant (J K⁻¹)

Eigenvector matrices

Pre-built for characteristic-based WENO projection on a 6-component system.

SymbolShapeDescription
EV(6)[0,0,c₀,c₀,−c₀,−c₀]Eigenvalues (electromagnetic wave speeds)
ER(6,6,3)6×6×3Right eigenvectors per direction
EL(6,6,3)6×6×3Left eigenvectors per direction
IEV(6)[1,1,1,1,1,1]Identity eigenvalues
IERL(6,6,3)6×6×3Identity eigenvectors (no projection)

chase_bc_object

Reads and stores boundary conditions for all 6 domain faces.

BC types

ConstantValueINI keywordDescription
BC_EXTRAPOLATION1extrapolationZero-order extrapolation into ghost cells
BC_INFLOW2inflowSupersonic inflow — prescribed primitive state
BC_WALL_INVISCID3wall-inviscidSlip wall (normal velocity reflected)

INI configuration

One section per face: [bc_x_min], [bc_x_max], [bc_y_min], [bc_y_max], [bc_z_min], [bc_z_max].

ini
[bc_x_min]
type = extrapolation

[bc_x_max]
type = inflow
r  = 1.0     ; density
u  = 2.0     ; x-velocity
v  = 0.0     ; y-velocity
w  = 0.0     ; z-velocity
p  = 1.0     ; pressure
s  = 0.0     ; perturbation seed

[bc_y_min]
type = wall-inviscid

The inflow state q(:, face) stores (r, u, v, w, p, s) — 6 values per face. s is a perturbation amplitude used by the IC module.

Data members

MemberDescription
bc_type(6)BC type integer per face
q(6, 6)Primitive state (r,u,v,w,p,s) for each face

chase_ic_object

Sets initial conditions at simulation start and after each AMR adaptation pass.

IC types

ConstantINI keywordDescription
IC_TYPE_UNIFORMuniformConstant (ρ,u,v,w,p) with optional random velocity perturbation δu[0,q6]
IC_TYPE_IVORTEXisentropic-vortexAnalytical isentropic vortex; q6 = radius, emin(x,y) = centre coordinates
IC_TYPE_RPriemann-problemPiecewise constant regions; each box defined by [emin, emax] in 3D

INI configuration

ini
[initial_conditions]
amr_iterations = 2
type           = riemann-problem
regions_number = 2

[initial_conditions_region_1]
r      = 1.0
u      = 0.0
v      = 0.0
w      = 0.0
p      = 1.0
s      = 0.0
emin_x = -1.0  ;  emin_y = -1.0  ;  emin_z = -1.0
emax_x =  0.0  ;  emax_y =  1.0  ;  emax_z =  1.0

[initial_conditions_region_2]
r      = 0.125
u      = 0.0
; ...
emin_x =  0.0  ;  ...  ;  emax_x = 1.0  ;  ...

amr_iterations controls how many AMR + IC cycles to run before the final initial condition is applied on the converged grid.


chase_io_object

Manages file I/O scheduling, file handles, and residuals output.

Data members

INI option ([IO])DefaultDescription
it_save100Main XH5F snapshot frequency (every N steps)
output_basenameBasename for XH5F output files
restart.false.Enable restart from checkpoint
restart_basenameBasename for restart files
restart_save100Restart checkpoint frequency (every N steps)
save_memory_status.false.Log memory usage during allocation
residuals_save10Residuals norm output frequency (every N steps)

Methods

ProcedureDescription
open_file_residualsOpens residuals text file at output_basename.res
close_file_residualsCloses the residuals file
save_residuals(it, time, blocks_number, residuals)Appends one line: step, time, per-variable L2 norms

chase_time_object

Tracks simulation time and provides the termination check.

Data members

INI option ([time])DefaultDescription
it_max−1Maximum time steps (−1 = ignore)
time_max1.0Maximum simulation time
CFL0.3CFL stability coefficient
it0Current time step counter
time0.0Current simulation time
dt0.0001Current time step (updated each step)

Termination criteria

is_to_save(it_save) returns .true. when any of:

CriterionCondition
Periodic outputmod(it, it_save) == 0
Step limitit_max > 0 and it >= it_max
Time limitit_max <= 0 and time >= time_max

adam_chase_riemann_library

Riemann solver library for Maxwell's equations and related flux functions.

Public procedures

ProcedureDescription
compute_riemann_maxwell_llf(sir, nv, q1, q4, f [,lmax])LLF (Rusanov) solver; wave speed fixed at c0=1/μ0ε0
compute_riemann_maxwell_hll(sir, nv, q1, q4, f [,lmax, lmin])HLL solver; λmax=+c0, λmin=c0
compute_convective_fluxes_maxwell(sir, q, f)Maxwell flux vector in direction sir
compute_convective_fluxes_maxwell_div_d(sir, q, f)Maxwell flux with D divergence cleaning
compute_convective_fluxes_maxwell_div_d_b(sir, q, f)Maxwell flux with D and B cleaning

Note: This module is not included in adam_chase_common_library and must be used explicitly by any backend that requires it.


adam_chase_common_library

Barrel re-export module. A single use adam_chase_common_library brings all common handler modules into scope:

fortran
use adam_chase_bc_object
use adam_chase_common_object
use adam_chase_ic_object
use adam_chase_io_object
use adam_chase_parameters
use adam_chase_physics_object
use adam_chase_time_object

adam_chase_riemann_library is intentionally excluded — backends use it directly when needed.


Copyrights

CHASE is part of the ADAM framework, released under the GNU Lesser General Public License v3.0 (LGPLv3).

Copyright (C) Andrea Di Mascio, Federico Negro, Giacomo Rossi, Francesco Salvadore, Stefano Zaghi.