Functions/Subroutines | |
subroutine, public | initiate_state_for_submodel (dir, basemodel, frozenstate, soilstate, aquiferstate, riverstate, lakestate, miscstate) |
subroutine, public | load_saved_state (dir, ns, frozenstate, soilstate, aquiferstate, riverstate, lakestate, miscstate) |
subroutine, public | finalize_outstate (dir, ns, stateoutdate, frozenstate, soilstate, aquiferstate, riverstate, lakestate, miscstate) |
subroutine, public | reset_soil_state (dir, ns, soilstate, miscstate) |
subroutine, public | save_soil_state_file (dir, ns, soilstate, miscstate) |
subroutine | divide_large_array (dim, npiece, array) |
subroutine | write_state_check (ffunitloc) |
subroutine | write_state_check_bin (ffunitloc, next_record) |
subroutine | read_and_perform_state_check (ffunitloc, nsubst, config, status) |
subroutine, public | read_state_check (ffunitloc, nsub, substanceorder, lrice, dim, config, status) |
subroutine | read_and_perform_state_check_bin (ffunitloc, nsubst, config, next_record) |
subroutine, public | read_state_check_bin (ffunitloc, nsub, substanceorder, lrice, dim, config, next_record) |
logical function | check_basic_states (n, lrice, dim, config) |
logical function | check_substance_states (substanceorder, dim, config) |
Load and save model states.
Procedures for loading and saving initial states from file. Also processing them for submodel.
logical function state_datamodule::check_basic_states | ( | integer, intent(in) | n, |
integer, intent(in) | lrice, | ||
type(statedimensiontype), intent(in) | dim, | ||
type(stateconfigurationtype), intent(in) | config | ||
) |
Check if the basic states in the state file are appropriate for this model.
[in] | dim | state file state dimensions |
[in] | config | state file configuration |
Algorithm
Time step
Basic dimensions
Model options
logical function state_datamodule::check_substance_states | ( | integer, dimension(9), intent(in) | substanceorder, |
type(statedimensiontype), intent(in) | dim, | ||
type(stateconfigurationtype), intent(in) | config | ||
) |
Check if substance related states in the state file are appropriate for this model.
[in] | substanceorder | state file substance order |
[in] | dim | state file state dimensions |
[in] | config | state file configuration |
Algorithm
Basic dimensions
Order of substances
Model options
subroutine state_datamodule::divide_large_array | ( | integer, intent(in) | dim, |
integer, intent(out) | npiece, | ||
integer, dimension(:,:), intent(out), allocatable | array | ||
) |
Calculates appropriate size sections of large array.
subroutine, public state_datamodule::finalize_outstate | ( | character(len=*), intent(in) | dir, |
integer, intent(in) | ns, | ||
type(datetype), intent(in) | stateoutdate, | ||
type(snowicestatetype), intent(inout) | frozenstate, | ||
type(soilstatetype), intent(inout) | soilstate, | ||
type(aquiferstatetype), intent(inout) | aquiferstate, | ||
type(riverstatetype), intent(inout) | riverstate, | ||
type(lakestatetype), intent(inout) | lakestate, | ||
type(miscstatetype), intent(inout) | miscstate | ||
) |
Saves state values for later use as starting state.
[in] | dir | file directory |
[in] | ns | number of subbasins |
[in] | stateoutdate | date for writing state |
[in,out] | frozenstate | Snow and ice states |
[in,out] | soilstate | Soil states |
[in,out] | aquiferstate | Aquifer states |
[in,out] | riverstate | River states |
[in,out] | lakestate | Lake states |
[in,out] | miscstate | Misc states |
Algorithm
Set the file name
Open the file and write file checks to it
Write the frozen state variables to file
Write the soil state variables to file
Write the aquifer state variables to file
Write the river state variables to file
Write the lake state variables to file
Write the miscellaneuos state variables to file
Close the file
If asked for: compress the state file
subroutine, public state_datamodule::initiate_state_for_submodel | ( | character(len=*), intent(in) | dir, |
type(basemodeltype), intent(in) | basemodel, | ||
type(snowicestatetype), intent(inout) | frozenstate, | ||
type(soilstatetype), intent(inout) | soilstate, | ||
type(aquiferstatetype), intent(inout) | aquiferstate, | ||
type(riverstatetype), intent(inout) | riverstate, | ||
type(lakestatetype), intent(inout) | lakestate, | ||
type(miscstatetype), intent(inout) | miscstate | ||
) |
Initiate state variables for submodel simulation.
[in] | dir | file directory |
[in] | basemodel | Information on basemodel |
[in,out] | frozenstate | Snow and ice states |
[in,out] | soilstate | Soil states |
[in,out] | aquiferstate | Aquifer states |
[in,out] | riverstate | River states |
[in,out] | lakestate | Lake states |
[in,out] | miscstate | Misc states |
Algoritm
If statefiles exist: read and store states temporary
Reallocate state variables to submodel size
If statefiles exist: Initiate state variables from those and deallocate temporary storage
Else: Initiate state variables with default values
Initiate other model variables and parameters
subroutine, public state_datamodule::load_saved_state | ( | character(len=*), intent(in) | dir, |
integer, intent(in) | ns, | ||
type(snowicestatetype), intent(inout) | frozenstate, | ||
type(soilstatetype), intent(inout) | soilstate, | ||
type(aquiferstatetype), intent(inout) | aquiferstate, | ||
type(riverstatetype), intent(inout) | riverstate, | ||
type(lakestatetype), intent(inout) | lakestate, | ||
type(miscstatetype), intent(inout) | miscstate | ||
) |
Load starting state from file and initiate state variables.
[in] | dir | file directory |
[in] | ns | number of subbasins |
[in,out] | frozenstate | Snow and ice states |
[in,out] | soilstate | Soil states |
[in,out] | aquiferstate | Aquifer states |
[in,out] | riverstate | River states |
[in,out] | lakestate | Lake states |
[in,out] | miscstate | Misc states |
Algorithm
Set the file name
Decompress the state file if it is compressed
Open the file and check it
Get the frozen state variables from file
Get the soil state variables from file
Get the aquifer state variables from file
Get the river state variables from file
Get the lake state variables from file
Get the miscellaneuos state variables from file
Close the file, delete the uncomressed txt-file and end the subroutine
subroutine state_datamodule::read_and_perform_state_check | ( | integer, intent(in) | ffunitloc, |
integer, intent(out) | nsubst, | ||
type(stateconfigurationtype), intent(out) | config, | ||
integer, intent(out) | status | ||
) |
Check if starting state is appropriate.
[in] | ffunitloc | File unit |
[out] | nsubst | number of substances in file |
[out] | config | state file configuration |
[out] | status | error status, or status of deviation between models |
Algorithm
Get model set-up for statefile and current model
Set output variables
Compare model set-up with statefile set-up
Write result of check to log-file
subroutine state_datamodule::read_and_perform_state_check_bin | ( | integer, intent(in) | ffunitloc, |
integer, intent(out) | nsubst, | ||
type(stateconfigurationtype), intent(out) | config, | ||
integer, intent(inout) | next_record | ||
) |
Check if starting state is appropriate, unformatted ascii file.
[in] | ffunitloc | File unit |
[out] | nsubst | number of substances in file |
[out] | config | state file configuration |
Algorithm
Get model set-up for statefile and current model
Set output variables
Compare model set-up with statefile set-up
Write result of check to log-file
subroutine, public state_datamodule::read_state_check | ( | integer, intent(in) | ffunitloc, |
integer, intent(out) | nsub, | ||
integer, dimension(9), intent(out) | substanceorder, | ||
integer | lrice, | ||
type(statedimensiontype), intent(out) | dim, | ||
type(stateconfigurationtype), intent(out) | config, | ||
integer, intent(out) | status | ||
) |
Check if starting state is appropriate.
[in] | ffunitloc | File unit |
[out] | nsub | Number of subbasins in saved state |
[out] | substanceorder | Order of substances in saved state file |
lrice | Modeloption lakeriverice in saved state | |
[out] | status | error status |
[out] | dim | state file state dimensions |
[out] | config | state file configuration |
Algorithm
Read state file information
Set output variables from state file information
subroutine, public state_datamodule::read_state_check_bin | ( | integer, intent(in) | ffunitloc, |
integer, intent(out) | nsub, | ||
integer, dimension(9), intent(out) | substanceorder, | ||
integer | lrice, | ||
type(statedimensiontype), intent(out) | dim, | ||
type(stateconfigurationtype), intent(out) | config, | ||
integer, intent(inout) | next_record | ||
) |
Check if starting state is appropriate, unformatted ascii file.
[in] | ffunitloc | File unit |
[out] | nsub | Number of subbasins in saved state |
[out] | substanceorder | Order of substances in saved state file |
lrice | Modeloption lakeriverice in saved state | |
[out] | dim | state file state dimensions |
[out] | config | state file configuration |
Algorithm
Read state file information
Set output variables from state file information
subroutine, public state_datamodule::reset_soil_state | ( | character(len=*), intent(in) | dir, |
integer, intent(in) | ns, | ||
type(soilstatetype), intent(inout) | soilstate, | ||
type(miscstatetype), intent(inout) | miscstate | ||
) |
Read soil starting state from file and reinitiate some soil state variables.
[in] | dir | file directory |
[in] | ns | number of subbasins (submodel) |
[in,out] | soilstate | Soil states |
[in,out] | miscstate | Misc states |
subroutine, public state_datamodule::save_soil_state_file | ( | character(len=*), intent(in) | dir, |
integer, intent(in) | ns, | ||
type(soilstatetype), intent(in) | soilstate, | ||
type(miscstatetype), intent(in) | miscstate | ||
) |
Saves selected state values for later use to reset states during simulation.
[in] | dir | file directory |
[in] | ns | number of subbasins |
[in] | soilstate | Soil states |
[in] | miscstate | Misc states |
|
private |
Saves values for later use as check if starting state is appropriate.
[in] | ffunitloc | File unit |
subroutine state_datamodule::write_state_check_bin | ( | integer, intent(in) | ffunitloc, |
integer, intent(inout) | next_record | ||
) |
Saves values for later use as check if starting state is appropriate.
[in] | ffunitloc | File unit |