Skip to content

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 amplitude s, rho (1 + s h1), p (1 + s h2), with h1, h2 in [-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 radius radius and velocity strength strength (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 iff emin < center <= emax on 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 along pulse_axis (x, y or z), B_axis += pulse_amplitude exp(-((s - pulse_center) / pulse_width)^2), s the cell coordinate along the axis; pressure and velocity unchanged (psi zero);
  • divb-peak (MHD only, the Dedner et al. 2002 peak in B_x, issue #41, MV-10): the state of region 1 plus B_x += peak_amplitude (1 - (s / peak_radius)^2)^2 for s < peak_radius, s the 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 state q0 of region 1 (global frame) plus wave_amplitude R sin(2 pi (x cos a + y sin a) / wavelength), a = wave_angle (degrees, in the x-y plane), R the right eigenvector of the right-going wave (fast, alfven, slow or entropy) of the conservative system at q0 in the frame of the wave normal (the library Roe-Balsara core, mhd_eigenvectors), rotated back to x, y, z; after one period wavelength / |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 field b_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 under z -> -z); |B_perp| is uniform, so the total pressure is too, and the wave travels along +n unchanged at |b_par| / sqrt(rho): after one period wavelength 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 ​

Variables ​

NameTypeAttributesDescription
INI_SECTION_NAMEcharacter(len=18)parameterINI section name.
IC_UNIFORM_STRcharacter(len=7)parameterUniform state.
IC_ISENTROPIC_VORTEX_STRcharacter(len=17)parameterIsentropic vortex in a free stream.
IC_RIEMANN_PROBLEM_STRcharacter(len=15)parameterPiecewise-constant regions.
IC_GLM_PULSE_STRcharacter(len=9)parameterGaussian pulse in B along an axis (MHD).
PULSE_KEYcharacter(len=15)parameterGLM pulse keys.
IC_DIVB_PEAK_STRcharacter(len=9)parameterDedner peak in B_x (MHD).
PEAK_KEYcharacter(len=14)parameterdiv(B) peak keys.
IC_MHD_LINEAR_WAVE_STRcharacter(len=15)parameterMHD linear wave (MHD).
WAVE_KEYcharacter(len=14)parameterLinear wave and CPAW keys.
IC_MHD_CPAW_STRcharacter(len=8)parameterCircularly polarised Alfven wave (MHD).
VORTEX_KEYcharacter(len=8)parameterVortex keys.
PIreal(kind=R8P)parameterPi greek.
PRIM_KEYcharacter(len=2)parameterRegion primitive state keys (MHD: all 8).
EXTENT_KEYcharacter(len=6)parameterRegion extents keys.

Derived Types ​

flume_ic_object ​

FLUME initial conditions class definition.

Components ​

NameTypeAttributesDescription
amr_iterationsinteger(kind=I4P)AMR iterations performed while imposing the initial conditions.
ic_typecharacter(len=:)allocatableInitial conditions type.
regions_numberinteger(kind=I4P)Regions number.
modelinteger(kind=I4P)Physical model id.
npriminteger(kind=I4P)Primitive keys number of a region: 5 (Euler) or 8 (MHD).
q_regionreal(kind=R8P)allocatableConservative state of each region [nv, regions_number].
eminreal(kind=R8P)allocatableMinimum corner of each region [3, regions_number].
emaxreal(kind=R8P)allocatableMaximum corner of each region [3, regions_number].
gammareal(kind=R8P)Specific heats ratio.
prim_1real(kind=R8P)Primitive state of region 1, the free stream (first nprim used).
sreal(kind=R8P)Uniform: relative amplitude of the seeded perturbation.
vortexreal(kind=R8P)Isentropic vortex: x0, y0, radius, strength.
pulse_axisinteger(kind=I4P)GLM pulse: axis, 1=x, 2=y, 3=z.
pulsereal(kind=R8P)GLM pulse: center, width, amplitude.
peakreal(kind=R8P)div(B) peak: x0, y0, radius, amplitude.
wavecharacter(len=:)allocatableLinear wave family: fast, alfven, slow, entropy.
wave_parreal(kind=R8P)Linear wave, CPAW: angle (degrees), amplitude, wavelength.
wave_rreal(kind=R8P)Linear wave: right eigenvector, global frame.
b_parreal(kind=R8P)CPAW: field along the wave normal.
polarisationreal(kind=R8P)CPAW: +1 right, -1 left.

Type-Bound Procedures ​

NameAttributesDescription
descriptionpass(self)Return pretty-printed object description.
initializepass(self)Initialize initial conditions.
load_from_filepass(self)Load config from file.
set_initial_conditionspass(self)Set initial conditions on the blocks interior.

Subroutines ​

initialize ​

Initialize initial conditions.

fortran
subroutine initialize(self, file_parameters, physics)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_ic_object)inoutInitial conditions.
file_parameterstype(file_ini)inSimulation parameters ini file handler.
physicstype(flume_physics_object)inPhysics (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

NameTypeIntentAttributesDescription
selfclass(flume_ic_object)inoutInitial conditions.
file_parameterstype(file_ini)inSimulation parameters ini file handler.
physicstype(flume_physics_object)inPhysics (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

NameTypeIntentAttributesDescription
selfclass(flume_ic_object)inInitial conditions.
fieldtype(field_object)inField (realm component, threaded in).
qreal(kind=R8P)inoutConservative 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

NameTypeIntentAttributesDescription
codeinteger(kind=I8P)inBlock Morton code.
iinteger(kind=I4P)inCell indexes.
jinteger(kind=I4P)inCell indexes.
kinteger(kind=I4P)inCell indexes.
hreal(kind=R8P)outPseudo-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

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
Rreal(kind=R8P)inGas constant.
primreal(kind=R8P)inPrimitive state, global frame (r, u, v, w, p, bx, by, bz).
wavecharacter(len=*)inWave family: fast, alfven, slow, entropy.
anglereal(kind=R8P)inWave normal angle in the x-y plane (degrees).
r_globalreal(kind=R8P)outRight 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

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
primreal(kind=R8P)inFree stream primitive state (r, u, v, w, p).
vortexreal(kind=R8P)inVortex x0, y0, radius, strength.
xreal(kind=R8P)inPoint coordinates.
yreal(kind=R8P)inPoint coordinates.
qreal(kind=R8P)outConservative variables.

Call graph

Functions ​

description ​

Return a pretty-formatted object description.

Returns: character(len=:)

fortran
function description(self) result(desc)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_ic_object)inInitial conditions.

Call graph