Skip to content

Commit

Permalink
Multi level hydrofabric (#615)
Browse files Browse the repository at this point in the history
* Add trival multi layer hydrofabric sample.

* Added Multlevel hydrofabric sample file.

* Added level variable to HY_Catchment. Added function to get and set catchment level. Added constant variables to mark predefined catchment level values.

* Add missing config file for a multilevel configuration testing.

* Updated level variables in multilevel hydrofabric test to match documentation.

* Update non mpi code to handle hydro fabric multiple levels. Fix bug where level was not a string.

* Add support for hydrofabric levels.

* Added runtime loop based on levels.

* saving for merge

* Fix for error in rebase.

* Fix missing variable in HY_Features.hpp

* added test file using google test replacing stand alone test.

* fix parsing of layer data from the formulation config file.

* Update test code for multilayer.

* Multilayer test added to CMake.

* Add datastructures for storing layer meta data and add those structures to the formulation manager.

* Inital multi time step muti level time loop

* Simulation_Time methods useful for multilayer

* Change get_properties() of the FeatureBase class to return const or normal references to avoid copies of maps

* add an internal map to the network class to track layer association.

* Add support for filtering a network based on level.

* Create inital skelton of layer class.

* add <string> to simulation_time.hpp to fix VSCode issue

* Add missing changes to Layer.hpp

* moved logic to run catchments into layer class

* remove code that is no longer needed

* Fix typos

* update layer control for better depnd btwn layers

* Add command to advance the current time stored in a layer.

* add current_timestep_epoch_time to layers

* commit changes to simulation time object to allow current time update.

* Fix to missing changes on pervious commit.

* Updates to fix testing on Multilayer

* Add current_time_index to SurfaceLayer to
improve readability

* Added more documentation to main time loop.

* Fix to HY_Features constructor
set of levels is now correctly updated.

* Add defualt layer creation to formulation manager

* fix bad units on defualt layer

* Correct units string for default layer.

* Fix merge error in HH_Features_MPI.hpp

* Required fixes for serial build

* Create HY_Catchments with level metadata in single processor mode.

* Change HY_Features constructor to use the link hydrofabric version that works with levels.

* Apply spelling/grammar/clarity suggestions from code review

Co-authored-by: Phil Miller - NOAA <[email protected]>

* Resolving issues from pr review.

* Fixes after rebase, mainly to remove pdm03 dependency and `using namespace std`.

* Missed precompiled header file from removed code

* Correct typedef to ussing change that was not finished.

* Correct primary time loop time objects was not being advanced.

* More corrections to time object advancment.

* Remove debuging code.

* Change call to get response in layer code to use the built in simulation time object.

Conflicts:
	include/core/Layer.hpp

* Apply typographical suggestions from code review

Co-authored-by: Phil Miller - NOAA <[email protected]>

* Changes to make multilayer tests pass

* Unifying terminology from "level" to "layer"

---------

Co-authored-by: Matt Williamson <matthew.williamson@gov>
Co-authored-by: Matt Williamson <[email protected]>
Co-authored-by: Phil Miller - NOAA <[email protected]>
Co-authored-by: Phil Miller - NOAA <[email protected]>
  • Loading branch information
5 people authored Sep 28, 2023
1 parent 72f121a commit a472cab
Show file tree
Hide file tree
Showing 23 changed files with 1,830 additions and 144 deletions.
68 changes: 68 additions & 0 deletions data/bmi/fortran/noah-owp-modular-init-agg-1.namelist.input
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
&timing ! and output
dt = 1800.0 ! timestep [seconds]
startdate = "199801010630" ! UTC time start of simulation (YYYYMMDDhhmm)
enddate = "199901010630" ! UTC time end of simulation (YYYYMMDDhhmm)
forcing_filename = "data/config/bmi/sugar_creek/noah-mp-modular.dat" ! change filename to match your forcing data
output_filename = "data/config/bmi/sugar_creek/output.nc"
/

&parameters
parameter_dir = "extern/noah-owp-modular/noah-owp-modular/parameters/"
general_table = "GENPARM.TBL" ! general param tables and misc params
soil_table = "SOILPARM.TBL" ! soil param table
noahowp_table = "MPTABLE.TBL" ! noah-mp related param tables
soil_class_name = "STAS" ! soil class data source - "STAS" or "STAS-RUC"
veg_class_name = "MODIFIED_IGBP_MODIS_NOAH" ! vegetation class data source - "MODIFIED_IGBP_MODIS_NOAH" or "USGS"
/

&location ! for point runs, needs to be modified for gridded
lat = 40.01 ! latitude [degrees]
lon = -88.37 ! longitude [degrees]
terrain_slope = 0.0 ! terrain slope [degrees]
azimuth = 0.0 ! terrain azimuth or aspect [degrees clockwise from north]
/

&forcing
ZREF = 10.0 ! measurment height for wind speed
rain_snow_thresh = 1.0 ! rain-snow temperature threshold (degrees Celcius)
/

&model_options
precip_phase_option = 2
snow_albedo_option = 2 ! 1 = BATS, 2 = CLASS
dynamic_veg_option = 1
runoff_option = 8
drainage_option = 8
frozen_soil_option = 1
dynamic_vic_option = 1
radiative_transfer_option = 3
sfc_drag_coeff_option = 1
canopy_stom_resist_option = 1
crop_model_option = 0
snowsoil_temp_time_option = 3
soil_temp_boundary_option = 2
supercooled_water_option = 1
stomatal_resistance_option = 1
evap_srfc_resistance_option = 1
subsurface_option = 1
/

&structure
isltyp = 1 ! soil texture class
nsoil = 4 ! number of soil levels
nsnow = 3 ! number of snow levels
nveg = 20 ! number of vegetation types
vegtyp = 1 ! vegetation type modis
croptype = 0 ! crop type (0 = no crops)
sfctyp = 1 ! land surface type, 1:soil, 2:lake
soilcolor = 4 ! soil color code
/

&initial_values
dzsnso = 0.0, 0.0, 0.0, 0.1, 0.3, 0.6, 1.0 ! level thickness [m]
sice = 0.0, 0.0, 0.0, 0.0 ! initial soil ice profile [vol]
sh2o = 0.3, 0.3, 0.3, 0.3 ! initial soil liquid profile [vol]
zwt = -2.0 ! initial water table depth below surface [m]
/


11 changes: 11 additions & 0 deletions data/catchment_data_multilayer.geojson

Large diffs are not rendered by default.

131 changes: 131 additions & 0 deletions data/example_multilayer_realization_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{
"global": {
"formulations": [
{
"name": "bmi_c++",
"params": {
"model_type_name": "test_bmi_cpp",
"library_file": "./extern/test_bmi_cpp/cmake_build/libtestbmicppmodel.so",
"init_config": "./data/bmi/c/test/test_bmi_c_config.ini",
"main_output_variable": "OUTPUT_VAR_2",
"variables_names_map" : {
"INPUT_VAR_2": "TMP_2maboveground",
"INPUT_VAR_1": "precip_rate"
},
"create_function": "bmi_model_create",
"destroy_function": "bmi_model_destroy",
"uses_forcing_file": false
}
}
],
"forcing": {
"file_pattern": ".*{{id}}.*.csv",
"path": "./data/forcing/"
}
},
"time": {
"start_time": "2015-12-01 00:00:00",
"end_time": "2015-12-30 23:00:00",
"output_interval": 3600
},
"catchments": {
"cat-27": {
"formulations": [
{
"name": "bmi_c++",
"params": {
"model_type_name": "test_bmi_cpp",
"library_file": "./extern/test_bmi_cpp/cmake_build/libtestbmicppmodel.so",
"init_config": "./data/bmi/c/test/test_bmi_c_config.ini",
"main_output_variable": "OUTPUT_VAR_2",
"variables_names_map" : {
"INPUT_VAR_2": "TMP_2maboveground",
"INPUT_VAR_1": "precip_rate"
},
"create_function": "bmi_model_create",
"destroy_function": "bmi_model_destroy",
"uses_forcing_file": false
}
}
],
"forcing": {
"path": "./data/forcing/cat-27_2015-12-01 00_00_00_2015-12-30 23_00_00.csv"
}
},
"cat-52": {
"formulations": [
{
"name": "bmi_c++",
"params": {
"model_type_name": "test_bmi_cpp",
"library_file": "./extern/test_bmi_cpp/cmake_build/libtestbmicppmodel.so",
"init_config": "./data/bmi/c/test/test_bmi_c_config.ini",
"main_output_variable": "OUTPUT_VAR_2",
"variables_names_map" : {
"INPUT_VAR_2": "TMP_2maboveground",
"INPUT_VAR_1": "precip_rate"
},
"create_function": "bmi_model_create",
"destroy_function": "bmi_model_destroy",
"uses_forcing_file": false
}
}
],
"forcing": {
"path": "./data/forcing/cat-52_2015-12-01 00_00_00_2015-12-30 23_00_00.csv"
}
},
"cat-67": {
"formulations": [
{
"name": "bmi_c++",
"params": {
"model_type_name": "test_bmi_cpp",
"library_file": "./extern/test_bmi_cpp/cmake_build/libtestbmicppmodel.so",
"init_config": "./data/bmi/c/test/test_bmi_c_config.ini",
"main_output_variable": "OUTPUT_VAR_2",
"variables_names_map" : {
"INPUT_VAR_2": "TMP_2maboveground",
"INPUT_VAR_1": "precip_rate"
},
"create_function": "bmi_model_create",
"destroy_function": "bmi_model_destroy",
"uses_forcing_file": false
}
}
],
"forcing": {
"path": "./data/forcing/cat-67_2015-12-01 00_00_00_2015-12-30 23_00_00.csv"
}
},
"agg-1": {
"formulations": [
{
"name": "bmi_fortran",
"params": {
"model_type_name": "bmi_fortran_noahowp",
"library_file": "./extern/noah-owp-modular/cmake_build/libsurfacebmi.so",
"forcing_file": "",
"init_config": "./data/bmi/fortran/noah-owp-modular-init-agg-1.namelist.input",
"allow_exceed_end_time": true,
"main_output_variable": "QINSUR",
"variables_names_map": {
"PRCPNONC": "atmosphere_water__liquid_equivalent_precipitation_rate",
"Q2": "atmosphere_air_water~vapor__relative_saturation",
"SFCTMP": "land_surface_air__temperature",
"UU": "land_surface_wind__x_component_of_velocity",
"VV": "land_surface_wind__y_component_of_velocity",
"LWDN": "land_surface_radiation~incoming~longwave__energy_flux",
"SOLDN": "land_surface_radiation~incoming~shortwave__energy_flux",
"SFCPRS": "land_surface_air__pressure"
},
"uses_forcing_file": false
}
}
],
"forcing": {
"path": "./data/forcing/agg-1_2015-12-01 00_00_00_2015-12-30 23_00_00.csv"
}
}
}
}
Loading

0 comments on commit a472cab

Please sign in to comment.