cable_output_impl_smod Submodule

Implementation of the public interface procedures in cable_output_mod.



Variables

Type Visibility Attributes Name Initial
logical, private, parameter :: normalised_averaging = .true.

This flag forces time averaging to computed by summing the diagnostics at each accumulation step and then dividing by the number of samples at write time, rather than computing the average incrementally. This is required to demonstrate bitwise reproducibility with the previous output module.

type(cable_output_stream_t), private, allocatable :: output_streams(:)

The output files being written, one element per file. The configuration decides how many there are.

type(cable_output_variable_definition_t), private, allocatable :: registered_definitions(:)

Registered output variable definitions.


Functions

pure function directory_of(path) result(directory)

The directory part of path, including the final /, or nothing if there is none.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: path

Return Value character(len=:), allocatable

function variable_from_use(variable_use, definitions) result(output_variable)

The output variable for one use of a definition in the configuration.

Arguments

Type IntentOptional Attributes Name
type(cable_output_variable_config_t), intent(in) :: variable_use
type(cable_output_variable_definition_t), intent(in) :: definitions(:)

Return Value type(cable_output_variable_t)

function stream_from_config(stream, grid_type, stream_variables, file_name) result(output_stream)

An output file with the settings of a configured stream.

Arguments

Type IntentOptional Attributes Name
type(cable_output_stream_config_t), intent(in) :: stream
character(len=*), intent(in) :: grid_type
type(cable_output_variable_t), intent(in) :: stream_variables(:)
character(len=*), intent(in) :: file_name

Return Value type(cable_output_stream_t)


Subroutines

subroutine start_stream(output_stream)

Creates an output file, defines its contents, and writes its coordinates.

Arguments

Type IntentOptional Attributes Name
type(cable_output_stream_t), intent(inout) :: output_stream

Module Functions

module function cable_output_impl_build_streams(config, definitions, grid_type) result(streams)

Works out which files the configuration produces and which variables go into each, without creating any files.

Arguments

Type IntentOptional Attributes Name
type(cable_output_config_t), intent(in) :: config
type(cable_output_variable_definition_t), intent(in) :: definitions(:)
character(len=*), intent(in) :: grid_type

Return Value type(cable_output_stream_t), allocatable, (:)


Module Subroutines

module subroutine cable_output_impl_init()

Module initialisation procedure for cable_output_mod.

Read more…

Arguments

None

module subroutine cable_output_impl_end()

Module finalization procedure for cable_output_mod.

Read more…

Arguments

None

module subroutine cable_output_impl_update(time_index, dels, met)

Updates the time aggregation accumulation for any output variables that are active in an output stream with an accumulation frequency that matches the current time step.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: time_index

The current time step index in the simulation.

real, intent(in) :: dels

The current time step size in seconds.

type(met_type), intent(in) :: met

Met variables at the current time step to provide informative error messages for CABLE range checks.

module subroutine cable_output_impl_write(time_index, dels, met, patch, landpt)

Writes output variables to disk for any output streams with a sampling frequency that matches the current time step.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: time_index

The current time step index in the simulation.

real, intent(in) :: dels

The current time step size in seconds.

type(met_type), intent(in) :: met

Met variables at the current time step to provide informative error messages for CABLE range checks.

type(patch_type), intent(in) :: patch(:)

The patch type instance for performing grid reductions over the patch dimension if required.

type(land_type), intent(in) :: landpt(:)

The land type instance for performing grid reductions over the patch dimension if required.

module subroutine cable_output_impl_write_parameters(time_index, patch, landpt)

Writes non-time varying parameter output variables to disk. This is done on the first time step of the simulation after the output streams have been initialised.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: time_index

The current time step index in the simulation.

type(patch_type), intent(in) :: patch(:)

The patch type instance for performing grid reductions over the patch dimension if required.

type(land_type), intent(in) :: landpt(:)

The land type instance for performing grid reductions over the patch dimension if required.

module subroutine cable_output_impl_write_restart(current_time)

Writes variables to the CABLE restart file. This is done at the end of the simulation.

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: current_time

Current simulation time

module subroutine cable_output_impl_register_definitions(definitions)

Registers output variable definitions with the output module.

Arguments

Type IntentOptional Attributes Name
type(cable_output_variable_definition_t), intent(in), dimension(:) :: definitions

The output variable definitions to register.

module subroutine cable_output_impl_init_streams_from_config(config, grid_type, dels)

Creates the output files described by the configuration, defines their contents and writes their coordinate variables.

Arguments

Type IntentOptional Attributes Name
type(cable_output_config_t), intent(in) :: config
character(len=*), intent(in) :: grid_type
real, intent(in) :: dels

The current time step size in seconds.