TreeMig Code
Loading...
Searching...
No Matches
WriteState.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine writestate (year, latstart, latend, lonstart, lonend, nspc)
 WriteState.
 
subroutine writestatefile (statefile, year, latstart, latend, lonstart, lonend, nspc)
 WriteStateFile.
 
subroutine writestateloops (year, latstart, latend, lonstart, lonend, nspc, unit)
 WriteStateLoops.
 

Function/Subroutine Documentation

◆ writestate()

subroutine writestate ( integer, intent(in) year,
integer, intent(in) latstart,
integer, intent(in) latend,
integer, intent(in) lonstart,
integer, intent(in) lonend,
integer, intent(in) nspc )

WriteState.


Writes out the state at the current year to the statefile This can be either in regular intervals for backup, to be able to start a new simulation from this state in case the simulation crashes or at predefined time points or not, e.g. to start new simulation from a state after spinup or for coupling to another model

  • USE: All_par, LoggerModule, FileListModule,FileHandlingModule
  • IN:
    • Parameters
      nspc: number of species
      year: year (relative years)
      latStart,latEnd,lonStart,lonEnd: start and end of total simulated area
    • FROM All_par
      • numyrs : INTEGER : number of years to be simulated
      • simustartyear : INTEGER : start year of simulation in real years
      • stateOutputDist : INTEGER : interval of statefile outputs for backup
      • stateOutputYears : INTEGER, dimension (10): vector of years, when state should be written out
    • FROM LoggerModule:
      • LogMessage : character(len=1024) : string for a message to be output
    • FROM FileListModule :
      • StateBackupOut_File, StateBackupOut_File_1, StateBackupOut_File_0, StateOut_File : TYPE(FILE) : files for state output
    • FROM FileHandlingModule:
      • relativePathLetter : character(2) : character to start a relativ path, depending on OS. ".\" on Windows, "./" on Mac
  • CALLS:
  • CALLS support routines:
  • CALLED FROM:

Definition at line 32 of file WriteState.f90.

◆ writestatefile()

subroutine writestatefile ( type(file), intent(in) statefile,
integer, intent(in) year,
integer, intent(in) latstart,
integer, intent(in) latend,
integer, intent(in) lonstart,
integer, intent(in) lonend,
integer, intent(in) nspc )

WriteStateFile.


Opens, writes and closes the statefile

  • USE LoggerModule, FileHandlingModule
  • IN:
    • Parameters
      nspc: number of species
      year: year (relative years)
      latStart,latEnd,lonStart,lonEnd: start and end of total simulated area
      TYPE(FILE): stateFile : the statefile to be written
    • FROM FileHandlingModule:
      • TYPE(FILE) : general type for files, including unit number and path and name
  • CALLS:
  • CALLS support routines:
  • CALLED FROM:

Definition at line 109 of file WriteState.f90.

◆ writestateloops()

subroutine writestateloops ( integer, intent(in) year,
integer, intent(in) latstart,
integer, intent(in) latend,
integer, intent(in) lonstart,
integer, intent(in) lonend,
integer, intent(in) nspc,
integer, intent(in) unit )

WriteStateLoops.


Loops over the states of the species in the gridcells and writes them out, one line per species

  • USE: All_par
  • IN:
    • Parameters
      nspc: number of species
      year: year (relative years)
      latStart,latEnd,lonStart,lonEnd: start and end of total simulated area
      unit: unit number of the statefile to be written to
    • FROM All_par
      • spec(maxspc) : TYPE(SpecProperties) : species properties; here a.o. all species parameters are put to spec
      • simustartyear : INTEGER : start year of simulation in real years
      • stateGrid : TYPE(CurrStateInCell), dimension(:, :), allocatable : current state in each cell (the entire grid)
      • stockability : REAL, dimension(:,:), allocatable : stockability, i.e. whether forests are prevented from growing by land use
  • CALLED FROM:

output only the stockable cells

one line per species

convert the species specific max. number of height classes to character

Definition at line 146 of file WriteState.f90.