HYPE
All Classes Namespaces Files Functions Variables Pages
Functions/Subroutines
state_datamodule Module Reference

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)
 

Detailed Description

Load and save model states.

Procedures for loading and saving initial states from file. Also processing them for submodel.

Function/Subroutine Documentation

◆ check_basic_states()

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.

Parameters
[in]dimstate file state dimensions
[in]configstate file configuration

Algorithm

Time step

Basic dimensions

Model options

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_substance_states()

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.

Parameters
[in]substanceorderstate file substance order
[in]dimstate file state dimensions
[in]configstate file configuration

Algorithm

Basic dimensions

Order of substances

Model options

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ divide_large_array()

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.

+ Here is the caller graph for this function:

◆ finalize_outstate()

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.

Parameters
[in]dirfile directory
[in]nsnumber of subbasins
[in]stateoutdatedate for writing state
[in,out]frozenstateSnow and ice states
[in,out]soilstateSoil states
[in,out]aquiferstateAquifer states
[in,out]riverstateRiver states
[in,out]lakestateLake states
[in,out]miscstateMisc 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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initiate_state_for_submodel()

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.

Parameters
[in]dirfile directory
[in]basemodelInformation on basemodel
[in,out]frozenstateSnow and ice states
[in,out]soilstateSoil states
[in,out]aquiferstateAquifer states
[in,out]riverstateRiver states
[in,out]lakestateLake states
[in,out]miscstateMisc 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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_saved_state()

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.

Parameters
[in]dirfile directory
[in]nsnumber of subbasins
[in,out]frozenstateSnow and ice states
[in,out]soilstateSoil states
[in,out]aquiferstateAquifer states
[in,out]riverstateRiver states
[in,out]lakestateLake states
[in,out]miscstateMisc 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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_and_perform_state_check()

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.

Parameters
[in]ffunitlocFile unit
[out]nsubstnumber of substances in file
[out]configstate file configuration
[out]statuserror 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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_and_perform_state_check_bin()

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.

Parameters
[in]ffunitlocFile unit
[out]nsubstnumber of substances in file
[out]configstate 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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_state_check()

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.

Parameters
[in]ffunitlocFile unit
[out]nsubNumber of subbasins in saved state
[out]substanceorderOrder of substances in saved state file
lriceModeloption lakeriverice in saved state
[out]statuserror status
[out]dimstate file state dimensions
[out]configstate file configuration

Algorithm

Read state file information

Set output variables from state file information

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_state_check_bin()

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.

Parameters
[in]ffunitlocFile unit
[out]nsubNumber of subbasins in saved state
[out]substanceorderOrder of substances in saved state file
lriceModeloption lakeriverice in saved state
[out]dimstate file state dimensions
[out]configstate file configuration

Algorithm
Read state file information

Set output variables from state file information

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset_soil_state()

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.

Parameters
[in]dirfile directory
[in]nsnumber of subbasins (submodel)
[in,out]soilstateSoil states
[in,out]miscstateMisc states
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save_soil_state_file()

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.

Parameters
[in]dirfile directory
[in]nsnumber of subbasins
[in]soilstateSoil states
[in]miscstateMisc states
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_state_check()

subroutine state_datamodule::write_state_check ( integer, intent(in)  ffunitloc)
private

Saves values for later use as check if starting state is appropriate.

Parameters
[in]ffunitlocFile unit
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_state_check_bin()

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.

Parameters
[in]ffunitlocFile unit
+ Here is the call graph for this function:
+ Here is the caller graph for this function: