Appearance
adam_flume_ic_object
ADAM, FLUME initial conditions class definition.
Accepted [initial_conditions].(type):
uniform: the state of region 1 everywhere, density and pressure perturbed by the signed relative amplitudes,rho (1 + s h1),p (1 + s h2), withh1, h2in [-1, 1) hashed from the block Morton code and the cell indexes: the same on every rank decomposition and on every backend (no random generator state);isentropic-vortex: the free stream of region 1 plus an isentropic vortex of axis z centred at(x0, y0), of radiusradiusand velocity strengthstrength(Shu 1998, ICASE 97-65, section 5.1, written for any free stream):du = -strength/(2 pi) (y-y0)/radius exp((1-r^2)/2),dv = strength/(2 pi) (x-x0)/radius exp((1-r^2)/2),d(p/rho) = -(gamma-1)/gamma strength^2/(8 pi^2) exp(1-r^2), isentropic,r = |x-x0| / radius; an exact steady solution convected by the free stream;riemann-problem: piecewise-constant axis-aligned regions, a cell belongs to a region iffemin < center <= emaxon every axis. A cell covered by no region is fatal: leaving it at zero density would divide by zero downstream;glm-pulse(MHD only, the GLM d'Alembert test, issue #41, MV-3): the state of region 1 plus a Gaussian pulse in the magnetic field alongpulse_axis(x, y or z),B_axis += pulse_amplitude exp(-((s - pulse_center) / pulse_width)^2),sthe cell coordinate along the axis; pressure and velocity unchanged (psizero);divb-peak(MHD only, the Dedner et al. 2002 peak inB_x, issue #41, MV-10): the state of region 1 plusB_x += peak_amplitude (1 - (s / peak_radius)^2)^2fors < peak_radius,sthe distance in the x-y plane from(peak_x0, peak_y0)(Dedner:peak_amplitude = 1 / sqrt(4 pi),peak_radius = 1/8); a non-zero initial div(B);mhd-linear-wave(MHD only, issue #41, MV-5; Stone et al. 2008, section 8.2): the stateq0of region 1 (global frame) pluswave_amplitude R sin(2 pi (x cos a + y sin a) / wavelength),a = wave_angle(degrees, in the x-y plane),Rthe right eigenvector of the right-goingwave(fast,alfven,sloworentropy) of the conservative system atq0in the frame of the wave normal (the library Roe-Balsara core,mhd_eigenvectors), rotated back to x, y, z; after one periodwavelength / |u_n + c|the exact solution is the initial state;mhd-cpaw(MHD only, issue #41, MV-6; Toth 2000, J. Comput. Phys. 161): the circularly polarised Alfven wave, an exact nonlinear solution of any amplitude. Density and pressure of region 1 (whose velocity and field must be zero), the fieldb_par n + wave_amplitude (sin(phi) t1 + h cos(phi) t2)and the velocity-sign(b_par) B_perp / sqrt(rho),phi = 2 pi (x cos a + y sin a) / wavelength,a = wave_angle(degrees),n = (cos a, sin a, 0),t1 = (-sin a, cos a, 0),t2 = z,h = +1(polarisation = right) or-1(left, the mirror image underz -> -z);|B_perp|is uniform, so the total pressure is too, and the wave travels along+nunchanged at|b_par| / sqrt(rho): after one periodwavelength sqrt(rho) / |b_par|the exact solution is the initial state.
The primitive keys of a region follow the physical model: r, u, v, w, p (Euler), plus bx, by, bz (MHD; psi is zero). isentropic-vortex is Euler only (issue #41, section 3.7).
Source: src/app/flume/common/adam_flume_ic_object.F90
Dependencies
Contents
- flume_ic_object
- initialize
- load_from_file
- set_initial_conditions
- hash_cell
- linear_wave_eigenvector
- isentropic_vortex
- description
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
INI_SECTION_NAME | character(len=18) | parameter | INI section name. |
IC_UNIFORM_STR | character(len=7) | parameter | Uniform state. |
IC_ISENTROPIC_VORTEX_STR | character(len=17) | parameter | Isentropic vortex in a free stream. |
IC_RIEMANN_PROBLEM_STR | character(len=15) | parameter | Piecewise-constant regions. |
IC_GLM_PULSE_STR | character(len=9) | parameter | Gaussian pulse in B along an axis (MHD). |
PULSE_KEY | character(len=15) | parameter | GLM pulse keys. |
IC_DIVB_PEAK_STR | character(len=9) | parameter | Dedner peak in B_x (MHD). |
PEAK_KEY | character(len=14) | parameter | div(B) peak keys. |
IC_MHD_LINEAR_WAVE_STR | character(len=15) | parameter | MHD linear wave (MHD). |
WAVE_KEY | character(len=14) | parameter | Linear wave and CPAW keys. |
IC_MHD_CPAW_STR | character(len=8) | parameter | Circularly polarised Alfven wave (MHD). |
VORTEX_KEY | character(len=8) | parameter | Vortex keys. |
PI | real(kind=R8P) | parameter | Pi greek. |
PRIM_KEY | character(len=2) | parameter | Region primitive state keys (MHD: all 8). |
EXTENT_KEY | character(len=6) | parameter | Region extents keys. |
Derived Types
flume_ic_object
FLUME initial conditions class definition.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
amr_iterations | integer(kind=I4P) | AMR iterations performed while imposing the initial conditions. | |
ic_type | character(len=:) | allocatable | Initial conditions type. |
regions_number | integer(kind=I4P) | Regions number. | |
model | integer(kind=I4P) | Physical model id. | |
nprim | integer(kind=I4P) | Primitive keys number of a region: 5 (Euler) or 8 (MHD). | |
q_region | real(kind=R8P) | allocatable | Conservative state of each region [nv, regions_number]. |
emin | real(kind=R8P) | allocatable | Minimum corner of each region [3, regions_number]. |
emax | real(kind=R8P) | allocatable | Maximum corner of each region [3, regions_number]. |
gamma | real(kind=R8P) | Specific heats ratio. | |
prim_1 | real(kind=R8P) | Primitive state of region 1, the free stream (first nprim used). | |
s | real(kind=R8P) | Uniform: relative amplitude of the seeded perturbation. | |
vortex | real(kind=R8P) | Isentropic vortex: x0, y0, radius, strength. | |
pulse_axis | integer(kind=I4P) | GLM pulse: axis, 1=x, 2=y, 3=z. | |
pulse | real(kind=R8P) | GLM pulse: center, width, amplitude. | |
peak | real(kind=R8P) | div(B) peak: x0, y0, radius, amplitude. | |
wave | character(len=:) | allocatable | Linear wave family: fast, alfven, slow, entropy. |
wave_par | real(kind=R8P) | Linear wave, CPAW: angle (degrees), amplitude, wavelength. | |
wave_r | real(kind=R8P) | Linear wave: right eigenvector, global frame. | |
b_par | real(kind=R8P) | CPAW: field along the wave normal. | |
polarisation | real(kind=R8P) | CPAW: +1 right, -1 left. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
description | pass(self) | Return pretty-printed object description. |
initialize | pass(self) | Initialize initial conditions. |
load_from_file | pass(self) | Load config from file. |
set_initial_conditions | pass(self) | Set initial conditions on the blocks interior. |
Subroutines
initialize
Initialize initial conditions.
fortran
subroutine initialize(self, file_parameters, physics)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_ic_object) | inout | Initial conditions. | |
file_parameters | type(file_ini) | in | Simulation parameters ini file handler. | |
physics | type(flume_physics_object) | in | Physics (for the regions state conversion). |
Call graph
load_from_file
Load config from file; every key used by the selected type is required and an unknown type is fatal.
fortran
subroutine load_from_file(self, file_parameters, physics)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_ic_object) | inout | Initial conditions. | |
file_parameters | type(file_ini) | in | Simulation parameters ini file handler. | |
physics | type(flume_physics_object) | in | Physics (for the regions state conversion). |
Call graph
set_initial_conditions
Set initial conditions on the blocks interior; ghost cells are filled by the following ghost update.
fortran
subroutine set_initial_conditions(self, field, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_ic_object) | in | Initial conditions. | |
field | type(field_object) | in | Field (realm component, threaded in). | |
q | real(kind=R8P) | inout | Conservative variables. |
Call graph
hash_cell
Return two pseudo-random numbers in [-1, 1) that depend only on the block Morton code and the cell indexes.
Integer mixing with no integer overflow, so the same bits on every compiler; the cell key never depends on the rank that owns the block. The key is chained (mix the code, then fold in i, j, k one at a time and mix again), so keys whose bits overlap, such as small codes and small indexes, do not collide. Xorshift alone is linear over GF(2), which would make the numbers an affine function of the key bits (exactly equidistributed, spatially structured): each mix also multiplies by an odd constant modulo 2^52 (xorshift* idea, Vigna 2016), in 26-bit limbs to stay in range.
Attributes: pure
fortran
subroutine hash_cell(code, i, j, k, h)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
code | integer(kind=I8P) | in | Block Morton code. | |
i | integer(kind=I4P) | in | Cell indexes. | |
j | integer(kind=I4P) | in | Cell indexes. | |
k | integer(kind=I4P) | in | Cell indexes. | |
h | real(kind=R8P) | out | Pseudo-random numbers in [-1, 1). |
Call graph
linear_wave_eigenvector
Return the right eigenvector of the right-going wave of the conservative MHD system at the primitive state prim (global frame), for the wave normal at angle degrees in the x-y plane: the state is rotated into the frame of the normal, R is the column of mhd_eigenvectors (x direction of that frame; waves ordered u_n - c_f, u_n - c_a, u_n - c_s, u_n, u_n + c_s, u_n + c_a, u_n + c_f, B_n), and its momentum and field are rotated back to x, y, z.
Attributes: pure
fortran
subroutine linear_wave_eigenvector(gamma, R, prim, wave, angle, r_global)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Specific heats ratio. | |
R | real(kind=R8P) | in | Gas constant. | |
prim | real(kind=R8P) | in | Primitive state, global frame (r, u, v, w, p, bx, by, bz). | |
wave | character(len=*) | in | Wave family: fast, alfven, slow, entropy. | |
angle | real(kind=R8P) | in | Wave normal angle in the x-y plane (degrees). | |
r_global | real(kind=R8P) | out | Right eigenvector, global frame. |
Call graph
isentropic_vortex
Return the conservative state of the isentropic vortex at (x, y) (formulas in the module documentation).
Attributes: pure
fortran
subroutine isentropic_vortex(gamma, prim, vortex, x, y, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Specific heats ratio. | |
prim | real(kind=R8P) | in | Free stream primitive state (r, u, v, w, p). | |
vortex | real(kind=R8P) | in | Vortex x0, y0, radius, strength. | |
x | real(kind=R8P) | in | Point coordinates. | |
y | real(kind=R8P) | in | Point coordinates. | |
q | real(kind=R8P) | out | Conservative variables. |
Call graph
Functions
description
Return a pretty-formatted object description.
Returns: character(len=:)
fortran
function description(self) result(desc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_ic_object) | in | Initial conditions. |
Call graph