Skip to content

adam_flume_reference_object ​

ADAM, FLUME reference layer ([reference]): dimensional input converted to code units on the host (issue #49, N2).

Why the conversion is all there is. Ideal Euler and MHD as FLUME writes them (B = B_SI/sqrt(mu0)) carry no dimensionless number: with three references, density rho0, length L0 and velocity u0, and the derived time L0/u0, pressure rho0 u0^2 and field u0 sqrt(rho0), every term of the equations picks up the same factor. A dimensional input therefore runs unchanged once each value is divided by the reference of its dimension, and the kernels never see the references (issue #49, ND-1, ND-2).

Where. Once, right after the input file is loaded: every dimensional option of the loaded INI object is replaced by its value in code units (17 significant digits, which read back to the same double), before any parser reads it. FLUME's objects and the library's (grid, AMR markers, solids, slices) then parse code units without knowing about the layer. Without a [reference] section nothing is touched (ND-6: byte-identical runs).

Completeness. With the layer active, every section and every option of the file must be classified here: an unknown section or option is fatal, so no dimensional value can pass unconverted (risk R-5 of #49). Options whose dimension depends on the context are resolved from it: the AMR gradient tolerance takes the dimension of the marked variable per length, the linear-wave amplitude that of the eigenvector it multiplies.

Gas. cp, cv are replaced by gamma = cp / cv (the same double the physics object computes), so that R* = 1 and the temperature unit is u0^2 / R; with [physics] gamma there is nothing to convert.

Restart. Restart files stay in code units; <restart_basename>.reference records the references they were written with (1 without the layer), and a restart under different references is refused (NV-8). Restart files without the record (written before issue #49 N2b) are code units: they restart only with references 1.

Output. [reference] output_units = code (default) writes code units; dimensional multiplies, at write time only, the fields, the grid, the time, the slices and the histories by the reference of their dimension (ND-7: normalisation and output units are separate settings). The temperature is written as p / (rho R) with the gas constant of the input (cp - cv when the layer replaced them by gamma). <output_basename>.units records the output units, the references and the factor of every written variable.

Source: src/app/flume/common/adam_flume_reference_object.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
INI_SECTION_NAMEcharacter(len=9)parameterINI (config) file section name of the references.
DIM_NONEinteger(kind=I4P)parameterDimensionless.
DIM_LENGTHinteger(kind=I4P)parameterLength.
DIM_INV_LENGTHinteger(kind=I4P)parameterInverse length.
DIM_TIMEinteger(kind=I4P)parameterTime.
DIM_VELOCITYinteger(kind=I4P)parameterVelocity.
DIM_VELOCITY2integer(kind=I4P)parameterVelocity squared (specific enthalpy).
DIM_DENSITYinteger(kind=I4P)parameterDensity.
DIM_MOMENTUMinteger(kind=I4P)parameterMomentum density.
DIM_PRESSUREinteger(kind=I4P)parameterPressure, energy density.
DIM_FIELDinteger(kind=I4P)parameterMagnetic field, B_SI/sqrt(mu0).
DIM_PSI_GLMinteger(kind=I4P)parameterGLM psi: field times velocity.
DIM_FIELD_PER_LENGTHinteger(kind=I4P)parameterdiv(B).
DIM_VISCOSITYinteger(kind=I4P)parameterDynamic viscosity, rho0 u0 L0.
DIM_DIFFUSIVITYinteger(kind=I4P)parameterDiffusivity, u0 L0 (resistivity).
DIM_ACCELERATIONinteger(kind=I4P)parameterAcceleration, u0^2 / L0 (gravity).
DIM_GRAV_CONSTinteger(kind=I4P)parameterGravitational constant, u0^2/(rho0 L0^2).
KIND_NONEinteger(kind=I4P)parameterNot converted.
KIND_SCALEDinteger(kind=I4P)parameterDivided by the reference of its dimension.
KIND_GASinteger(kind=I4P)parametercp, cv: replaced by gamma, R* = 1.
KIND_UNKNOWNinteger(kind=I4P)parameterNot classified: fatal.
KIND_TEMPERATUREinteger(kind=I4P)parameterA temperature: divided by u0^2 / R (issue #65).
KIND_CONDUCTIVITYinteger(kind=I4P)parameterA thermal conductivity: divided by rho0 u0 L0 R (issue #65).

Derived Types ​

flume_reference_object ​

FLUME reference layer class definition.

Components ​

NameTypeAttributesDescription
is_activelogicalTrue if the input has a [reference] section.
densityreal(kind=R8P)Reference density, rho0.
lengthreal(kind=R8P)Reference length, L0.
velocityreal(kind=R8P)Reference velocity, u0.
velocity_presetcharacter(len=:)allocatablevalue, acoustic or alfvenic.
ref_pressurereal(kind=R8P)Reference pressure of the acoustic preset.
ref_fieldreal(kind=R8P)Reference field of the alfvenic preset.
dimensional_outputlogicaloutput_units = dimensional.
gas_constantreal(kind=R8P)Gas constant of the input, cp - cv (1 with gamma).
convertedinteger(kind=I4P)Options converted.
physical_modelcharacter(len=:)allocatable[physics] physical_model.
divergence_controlcharacter(len=:)allocatable[mhd] divergence_control (none if absent).
ic_typecharacter(len=:)allocatable[initial_conditions] type.
ic_wavecharacter(len=:)allocatable[initial_conditions] wave (empty if absent).
ic_wave_modecharacter(len=:)allocatable[initial_conditions] wave_mode (empty if absent).

Type-Bound Procedures ​

NameAttributesDescription
descriptionpass(self)Return pretty-printed object description.
check_restartpass(self)Refuse restart files written under other references.
initializepass(self)Initialize the layer and convert the input.
length_outputpass(self)Return the output factor of the lengths.
save_restartpass(self)Record the references of the restart files.
save_unitspass(self)Record the output units and the factor of every written variable.
scalepass(self)Return the reference of a dimension.
time_outputpass(self)Return the output factor of the time.
variable_outputpass(self)Return the output factor of a written variable.
classifypass(self)Return the kind and dimension of an option.
classify_markerpass(self)Return the dimension of a marker threshold.
convert_gaspass(self)Replace cp, cv by gamma (R* = 1).
convert_optionspass(self)Convert every dimensional option of the input.
load_contextpass(self)Load the context of the context-dependent options.
load_from_filepass(self)Load [reference].

Subroutines ​

check_restart ​

Refuse restart files written under other references: the record must equal the current references exactly; without a record (restart files written before issue #49 N2b, in code units) the current references must all be 1.

fortran
subroutine check_restart(self, basename)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inReference layer.
basenamecharacter(len=*)inRestart files basename.

Call graph

initialize ​

Initialize the layer: without [reference] do nothing; with it, load the references and convert every dimensional option of the loaded input to code units.

fortran
subroutine initialize(self, file_parameters)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inoutReference layer.
file_parameterstype(file_ini)inoutSimulation parameters ini file handler.

Call graph

save_restart ​

Record the references of the restart files (rank 0), 17 significant digits: read back, the same doubles.

fortran
subroutine save_restart(self, basename)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inReference layer.
basenamecharacter(len=*)inRestart files basename.

Call graph

save_units ​

Record (rank 0) the output units in <basename>.units: the references, the derived ones, the gas constant and the factor by which every written variable is multiplied; the history columns follow from them (listed as comments).

fortran
subroutine save_units(self, basename, names)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inReference layer.
basenamecharacter(len=*)inOutput files basename.
namestype(string)inNames of the written variables.

Call graph

classify ​

Return the kind and the dimension of an option. Every option FLUME reads is listed (issue #49, N2 inventory); anything else is KIND_UNKNOWN, fatal for the caller.

fortran
subroutine classify(self, file_parameters, section_name, option_name, kind, dim)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inReference layer.
file_parameterstype(file_ini)inSimulation parameters ini file handler.
section_namecharacter(len=*)inSection name.
option_namecharacter(len=*)inOption name.
kindinteger(kind=I4P)outOption kind.
diminteger(kind=I4P)outOption dimension (if scaled).

Call graph

classify_marker ​

Return the dimension of a threshold of an AMR marker: the gradient tolerance tol (mode 2) takes that of the marked variable per length, the Loehner absolute filter floor (mode 4, issue #74) that of the marked variable.

fortran
subroutine classify_marker(self, file_parameters, section_name, option_name, kind, dim)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inReference layer.
file_parameterstype(file_ini)inSimulation parameters ini file handler.
section_namecharacter(len=*)inMarker section name.
option_namecharacter(len=*)intol or floor.
kindinteger(kind=I4P)outOption kind.
diminteger(kind=I4P)outOption dimension.

Call graph

convert_gas ​

Replace cp, cv by gamma = cp / cv: the gas constant becomes 1 ([physics] gamma alone means R = 1) and the temperature unit u0^2 / R. gamma is computed as the physics object computes it, so it is the same double and the conservative solution is unchanged bit for bit; only the temperature, p / (rho R), changes unit.

fortran
subroutine convert_gas(self, file_parameters)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inoutReference layer.
file_parameterstype(file_ini)inoutSimulation parameters ini file handler.

Call graph

convert_options ​

Convert every dimensional option of the input to code units; an unclassified section or option is fatal.

fortran
subroutine convert_options(self, file_parameters)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inoutReference layer.
file_parameterstype(file_ini)inoutSimulation parameters ini file handler.

Call graph

load_context ​

Load, raw, the options on which the dimension of other options depends.

fortran
subroutine load_context(self, file_parameters)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inoutReference layer.
file_parameterstype(file_ini)inSimulation parameters ini file handler.

Call graph

load_from_file ​

Load [reference]: density, length (default 1, > 0) and velocity (default 1): a value > 0, or acoustic (sqrt(gamma pressure / density), needs pressure) or alfvenic (field / sqrt(density), needs field, MHD only); output_units, code (default) or dimensional. Every other option is fatal.

fortran
subroutine load_from_file(self, file_parameters)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inoutReference layer.
file_parameterstype(file_ini)inoutSimulation parameters ini file handler.

Call graph

Functions ​

description ​

Return a pretty-formatted object description.

Returns: character(len=:)

fortran
function description(self) result(desc)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inReference layer.

Call graph

length_output ​

Return the output factor of the lengths: L0 with dimensional output units, 1 otherwise.

Attributes: pure

Returns: real(kind=R8P)

fortran
function length_output(self) result(s)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inReference layer.

Call graph

scale ​

Return the reference of a dimension, L0^a u0^b sqrt(rho0)^c: exact when the references are powers of two (and rho0 a power of four).

Attributes: pure

Returns: real(kind=R8P)

fortran
function scale(self, dim) result(s)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inReference layer.
diminteger(kind=I4P)inExponents of length, velocity, square root of density.

time_output ​

Return the output factor of the time: L0 / u0 with dimensional output units, 1 otherwise.

Attributes: pure

Returns: real(kind=R8P)

fortran
function time_output(self) result(s)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inReference layer.

Call graph

variable_output ​

Return the output factor of a written variable: the reference of its dimension with dimensional output units, 1 otherwise. dq_<name> is the time derivative of <name>. An unknown name is fatal: no variable may be written in code units among dimensional ones.

Returns: real(kind=R8P)

fortran
function variable_output(self, name) result(s)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_reference_object)inReference layer.
namecharacter(len=*)inVariable name.

Call graph

format_value ​

Return a value with 17 significant digits: read back, it is the same double.

Attributes: pure

Returns: character(len=32)

fortran
function format_value(val) result(str_val)

Arguments

NameTypeIntentAttributesDescription
valreal(kind=R8P)inValue.

Call graph