1 / 26

Code structure - HYSS

MAIN PROGRAM. Code structure - HYSS. Handle input and output data. Calibration and criteria calculation. S Y S T E M. H Y S S. M O D E L. A hydrological model. eg. H Y P E. MODVAR and MODELMODULE. State variables Variables for model parameters

Download Presentation

Code structure - HYSS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MAIN PROGRAM Codestructure- HYSS Handle input and output data Calibration and criteriacalculation S Y S T E M H Y S S M O D E L A hydrologicalmodel eg. H Y P E

  2. MODVAR and MODELMODULE • State variables • Variables for model parameters • Variables for input and output • Derived data typedeclarations • Othervariables (time, numberofsubbasinsetc.) • MODEL – calculationsduringonetime step • INITIATE_MODEL – sets initial values for statevariables, initialisationofmodel parameters • INITIATE_MODEL_PARAMETERS – definition ofmodel parameters • INITIATE_OUTPUT_VARIABLES – definition of output variables • MODEL_VERSION_INFORMATION – information for log-file • DEFINE_AND_ALLOCATE_MODELMODULE_STATE – definition ofself-definedstatevariables • GET_MODELMODULE_STATE – get values for self-definedstatevariables from HYSS • SET_MODELMODULE_STATE – save valuesofself-definedstatevariables for HYSS HYSS variables for the model Modelsubroutines for HYSS

  3. MAIN PROGRAM Read INPUT DATA Optimization loop Time loop Write RESULT and CRITERIA Time loop Calculate new parameters MODEL Prepare OUTPUT MODEL

  4. MAIN PROGRAM read info model, simulation and input data optimization model- and output initiation time loop write result and criteria read opt. input data MODEL calc. crit. print out during simulation timestep input opt. loop write opt. result mod. init. set best parameters time loop timestep input MODEL calc. crit. calculate new parameters

  5. FILES and MODULES ofHYSS and HYPE

  6. main.f90 HYSS/HYPE – source codefiles worldvar.f90 S Y S T E M optim.f90 data.f90 • 13 files • 20000 linesofcode • 7 Fortran modules • + three extra in hype • 243 procedures • 66 ofthese in hype H Y S S readwrite.f90 compout.f90 convert.f90 modvar.f90 time.f90 model_hype.f90 H Y P E M O D E L npproc_2.f90 tocproc.f90 hypevar.f90

  7. HYSS/HYPE – source code files • main.f90 main program • data.f90 subroutines for indata and print out • optim.f90 subroutines for optimization • compout.f90 subroutines for calculations in HYSS; for accumulation (for print out) and criteria • readwrite.f90 subroutines for read and writetofile • time.f90, convert.f90 subroutines for time and conversion • worvar.f90 variables in HYSS and subroutines for these • modvar.f90 variables for the model and subroutines for these • model_hype.f90 subroutines for HYPE-modelrequired by HYSS and subroutines for water • hypevar.f90 variables for HYPE • npproc2.f90 subroutines for nitrogen and phosphorus • tocproc.f90 subroutines for organiccarbon

  8. main.f90 Modulehierarchy(short names) data.f90 optim.f90 modelmodule readwrite compout convert timeroutines toc_processes worldvar np_processes modvar hypevar

  9. main.f90 Moduledependence data.f90 optim.f90 modelmodule readwrite compout convert timeroutines toc_processes worldvar np_processes modvar hypevar

  10. Someprinciples • Fortran 90/95, free format • Balance explicit code /calls to subroutines. • ! is used for comments. Comment blocks before or specific lines to the right. • Subroutines: name after END SUBROUTINE, use INTENT on all arguments • Name major DO-loops • IMPLICIT NONE is used • Use x(:) for an array than x or x(1:n) if possible. • Fileunits: Specific fileunits set in WORLDVAR. 6 is used for hyss.log. fileunit_temp for temporary

  11. Someother tips • Your own model variables can be declared in the MODELMODULE or in a separate module. These are used via "USE" or host association. • In HYSS -9999 denotes missing values. • All files are ASCII files. • Maximum 200 output variables and 200 model parameters can be defined. • All output variables and parameter names are to be defined with small letters • The connection between output variables and their value is an index which may be a defined constant in the modelmodule. E.g. m_tt=1, o_snow=3

  12. MODVAR - details Variablesmadeavailable by HYSS to the modelprogrammer

  13. END HERE? • Questions? • A fileyouwanttohave a closer look at?

  14. MODEL subroutine - details Calculationsduringonetime step for HYPE

  15. MODEL() for HYPE For everysubbasin: Regional groundwaterflows (for everysubbasin/class) Class processes Routing (river and lake processes) Prepare for output For local and main river/lake: For land classes: For lake classes: River flow Transformation (NPC) Outflow from lake Updating (QW) Snow Soilrunoff Groundwater table transformations in soil (NPC) Subbasinavarage Atmospheric deposition (NPC) Precipitation Evaporation Exampleofcalculations

  16. Calculation order land class • Atmospheric deposition (NPC) • Precipitation • Plant growth (NPC) • Snow • Evapotranspiration • Runoff(soillayer, tile) • Add regional groundwaterflow • Diffuse source (NP) • Otherflows (surfaceflow, macroporeflow) • Add infiltration • Snowdepth, soiltemp, frostdepth

  17. Calculation order land class (continued) • Percolation • Surface flow, erosion (P) • Addmacroporeflow • Delaypool (P) • Groundwater table • NPC transformations in soil • Subbasinavarage

  18. Calculation order lake class • Atmosphericdeposition (NPC) • Precipitation • Evaporation

  19. Couplingbetweensubbasins local river and lake main river and outlet lake groundwaterpaths surfacewaterpath

  20. Calculationlocal river and lake • Riparian zone C processes • Watertemperature • Inflow from soil • Diffuse source (NP) • Wetland (NP) • River flowdelay • transformation in river (NPC) • Inflowto lake • transformation in lake (NPC) • Outflow from lake • Lake waterstage

  21. Calculationmain river and lake • Inflow from upstreamsubbasins • Point sources (NP) • Wetland (NP) • River flowdelay • transformation in river (NPC) • Inflowto lake • transformation in lake (NPC) • Outflow from lake/subbasin • Lake waterstage • Within lake flows • Updating QW

More Related