Appearance
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
- flume_reference_object
- check_restart
- initialize
- save_restart
- save_units
- classify
- classify_marker
- convert_gas
- convert_options
- load_context
- load_from_file
- description
- length_output
- scale
- time_output
- variable_output
- format_value
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
INI_SECTION_NAME | character(len=9) | parameter | INI (config) file section name of the references. |
DIM_NONE | integer(kind=I4P) | parameter | Dimensionless. |
DIM_LENGTH | integer(kind=I4P) | parameter | Length. |
DIM_INV_LENGTH | integer(kind=I4P) | parameter | Inverse length. |
DIM_TIME | integer(kind=I4P) | parameter | Time. |
DIM_VELOCITY | integer(kind=I4P) | parameter | Velocity. |
DIM_VELOCITY2 | integer(kind=I4P) | parameter | Velocity squared (specific enthalpy). |
DIM_DENSITY | integer(kind=I4P) | parameter | Density. |
DIM_MOMENTUM | integer(kind=I4P) | parameter | Momentum density. |
DIM_PRESSURE | integer(kind=I4P) | parameter | Pressure, energy density. |
DIM_FIELD | integer(kind=I4P) | parameter | Magnetic field, B_SI/sqrt(mu0). |
DIM_PSI_GLM | integer(kind=I4P) | parameter | GLM psi: field times velocity. |
DIM_FIELD_PER_LENGTH | integer(kind=I4P) | parameter | div(B). |
DIM_VISCOSITY | integer(kind=I4P) | parameter | Dynamic viscosity, rho0 u0 L0. |
DIM_DIFFUSIVITY | integer(kind=I4P) | parameter | Diffusivity, u0 L0 (resistivity). |
DIM_ACCELERATION | integer(kind=I4P) | parameter | Acceleration, u0^2 / L0 (gravity). |
DIM_GRAV_CONST | integer(kind=I4P) | parameter | Gravitational constant, u0^2/(rho0 L0^2). |
KIND_NONE | integer(kind=I4P) | parameter | Not converted. |
KIND_SCALED | integer(kind=I4P) | parameter | Divided by the reference of its dimension. |
KIND_GAS | integer(kind=I4P) | parameter | cp, cv: replaced by gamma, R* = 1. |
KIND_UNKNOWN | integer(kind=I4P) | parameter | Not classified: fatal. |
KIND_TEMPERATURE | integer(kind=I4P) | parameter | A temperature: divided by u0^2 / R (issue #65). |
KIND_CONDUCTIVITY | integer(kind=I4P) | parameter | A thermal conductivity: divided by rho0 u0 L0 R (issue #65). |
Derived Types
flume_reference_object
FLUME reference layer class definition.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
is_active | logical | True if the input has a [reference] section. | |
density | real(kind=R8P) | Reference density, rho0. | |
length | real(kind=R8P) | Reference length, L0. | |
velocity | real(kind=R8P) | Reference velocity, u0. | |
velocity_preset | character(len=:) | allocatable | value, acoustic or alfvenic. |
ref_pressure | real(kind=R8P) | Reference pressure of the acoustic preset. | |
ref_field | real(kind=R8P) | Reference field of the alfvenic preset. | |
dimensional_output | logical | output_units = dimensional. | |
gas_constant | real(kind=R8P) | Gas constant of the input, cp - cv (1 with gamma). | |
converted | integer(kind=I4P) | Options converted. | |
physical_model | character(len=:) | allocatable | [physics] physical_model. |
divergence_control | character(len=:) | allocatable | [mhd] divergence_control (none if absent). |
ic_type | character(len=:) | allocatable | [initial_conditions] type. |
ic_wave | character(len=:) | allocatable | [initial_conditions] wave (empty if absent). |
ic_wave_mode | character(len=:) | allocatable | [initial_conditions] wave_mode (empty if absent). |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
description | pass(self) | Return pretty-printed object description. |
check_restart | pass(self) | Refuse restart files written under other references. |
initialize | pass(self) | Initialize the layer and convert the input. |
length_output | pass(self) | Return the output factor of the lengths. |
save_restart | pass(self) | Record the references of the restart files. |
save_units | pass(self) | Record the output units and the factor of every written variable. |
scale | pass(self) | Return the reference of a dimension. |
time_output | pass(self) | Return the output factor of the time. |
variable_output | pass(self) | Return the output factor of a written variable. |
classify | pass(self) | Return the kind and dimension of an option. |
classify_marker | pass(self) | Return the dimension of a marker threshold. |
convert_gas | pass(self) | Replace cp, cv by gamma (R* = 1). |
convert_options | pass(self) | Convert every dimensional option of the input. |
load_context | pass(self) | Load the context of the context-dependent options. |
load_from_file | pass(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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_reference_object) | in | Reference layer. | |
basename | character(len=*) | in | Restart 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_reference_object) | inout | Reference layer. | |
file_parameters | type(file_ini) | inout | Simulation 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_reference_object) | in | Reference layer. | |
basename | character(len=*) | in | Restart 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_reference_object) | in | Reference layer. | |
basename | character(len=*) | in | Output files basename. | |
names | type(string) | in | Names 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_reference_object) | in | Reference layer. | |
file_parameters | type(file_ini) | in | Simulation parameters ini file handler. | |
section_name | character(len=*) | in | Section name. | |
option_name | character(len=*) | in | Option name. | |
kind | integer(kind=I4P) | out | Option kind. | |
dim | integer(kind=I4P) | out | Option 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_reference_object) | in | Reference layer. | |
file_parameters | type(file_ini) | in | Simulation parameters ini file handler. | |
section_name | character(len=*) | in | Marker section name. | |
option_name | character(len=*) | in | tol or floor. | |
kind | integer(kind=I4P) | out | Option kind. | |
dim | integer(kind=I4P) | out | Option 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_reference_object) | inout | Reference layer. | |
file_parameters | type(file_ini) | inout | Simulation 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_reference_object) | inout | Reference layer. | |
file_parameters | type(file_ini) | inout | Simulation 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_reference_object) | inout | Reference layer. | |
file_parameters | type(file_ini) | in | Simulation 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_reference_object) | inout | Reference layer. | |
file_parameters | type(file_ini) | inout | Simulation parameters ini file handler. |
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_reference_object) | in | Reference 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_reference_object) | in | Reference 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_reference_object) | in | Reference layer. | |
dim | integer(kind=I4P) | in | Exponents 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_reference_object) | in | Reference 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_reference_object) | in | Reference layer. | |
name | character(len=*) | in | Variable 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
val | real(kind=R8P) | in | Value. |
Call graph