Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ajk/cfe modifications #448

Merged
merged 4 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/module_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ jobs:
mod-dir: "extern/evapotranspiration/evapotranspiration"
targets: "petbmi"

- name: Build SLoTH
id: submod_build_6
uses: ./.github/actions/ngen-submod-build
with:
mod-dir: "extern/sloth/"
targets: "slothmodel"

- name: Build Ngen
uses: ./.github/actions/ngen-build
with:
Expand Down
21 changes: 20 additions & 1 deletion data/example_bmi_multi_realization_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
"allow_exceed_end_time": true,
"main_output_variable": "Q_OUT",
"modules": [
{
"name": "bmi_c++",
"params": {
"model_type_name": "bmi_c++_sloth",
"library_file": "./extern/sloth/cmake_build/libslothmodel.so",
"init_config": "/dev/null",
"allow_exceed_end_time": true,
"main_output_variable": "z",
"uses_forcing_file": false,
"model_params": {
"sloth_ice_fraction_schaake(1,double,m,node)": 0.0,
"sloth_ice_fraction_xinan(1,double,1,node)": 0.0,
"sloth_smp(1,double,1,node)": 0.0
}
}
},
{
"name": "bmi_fortran",
"params": {
Expand Down Expand Up @@ -50,7 +66,10 @@
"land_surface_wind__y_component_of_velocity": "VGRD_10maboveground",
"land_surface_radiation~incoming~longwave__energy_flux": "DLWRF_surface",
"land_surface_radiation~incoming~shortwave__energy_flux": "DSWRF_surface",
"land_surface_air__pressure": "PRES_surface"
"land_surface_air__pressure": "PRES_surface",
"ice_fraction_schaake" : "sloth_ice_fraction_schaake",
"ice_fraction_xinan" : "sloth_ice_fraction_xinan",
"soil_moisture_profile" : "sloth_smp"
},
"uses_forcing_file": false
}
Expand Down
21 changes: 20 additions & 1 deletion data/example_bmi_multi_realization_config_w_netcdf.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
"allow_exceed_end_time": true,
"main_output_variable": "Q_OUT",
"modules": [
{
"name": "bmi_c++",
"params": {
"model_type_name": "bmi_c++_sloth",
"library_file": "./extern/sloth/cmake_build/libslothmodel.so",
"init_config": "/dev/null",
"allow_exceed_end_time": true,
"main_output_variable": "z",
"uses_forcing_file": false,
"model_params": {
"sloth_ice_fraction_schaake(1,double,m,node)": 0.0,
"sloth_ice_fraction_xinan(1,double,1,node)": 0.0,
"sloth_smp(1,double,1,node)": 0.0
}
}
},
{
"name": "bmi_fortran",
"params": {
Expand Down Expand Up @@ -50,7 +66,10 @@
"land_surface_wind__y_component_of_velocity": "VGRD_10maboveground",
"land_surface_radiation~incoming~longwave__energy_flux": "DLWRF_surface",
"land_surface_radiation~incoming~shortwave__energy_flux": "DSWRF_surface",
"land_surface_air__pressure": "PRES_surface"
"land_surface_air__pressure": "PRES_surface",
"ice_fraction_schaake" : "sloth_ice_fraction_schaake",
"ice_fraction_xinan" : "sloth_ice_fraction_xinan",
"soil_moisture_profile" : "sloth_smp"
},
"uses_forcing_file": false
}
Expand Down
23 changes: 21 additions & 2 deletions data/example_bmi_multi_realization_config_w_noah_pet_cfe.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
"allow_exceed_end_time": true,
"main_output_variable": "Q_OUT",
"modules": [
{
"name": "bmi_c++",
"params": {
"model_type_name": "bmi_c++_sloth",
"library_file": "./extern/sloth/cmake_build/libslothmodel.so",
"init_config": "/dev/null",
"allow_exceed_end_time": true,
"main_output_variable": "z",
"uses_forcing_file": false,
"model_params": {
"sloth_ice_fraction_schaake(1,double,m,node)": 0.0,
"sloth_ice_fraction_xinan(1,double,1,node)": 0.0,
"sloth_smp(1,double,1,node)": 0.0
}
}
},
{
"name": "bmi_fortran",
"params": {
Expand All @@ -36,7 +52,7 @@
"name": "bmi_c",
"params": {
"model_type_name": "bmi_c_pet",
"library_file": "./extern/evapotranspiration/evapotranspiration/cmake_build/libpetbmi",
"library_file": "./extern/evapotranspiration/cmake_build/libpetbmi",
mattw-nws marked this conversation as resolved.
Show resolved Hide resolved
"forcing_file": "",
"init_config": "./data/bmi/c/pet/{{id}}_bmi_config.ini",
"allow_exceed_end_time": true,
Expand Down Expand Up @@ -66,7 +82,10 @@
"land_surface_wind__y_component_of_velocity": "VGRD_10maboveground",
"land_surface_radiation~incoming~longwave__energy_flux": "DLWRF_surface",
"land_surface_radiation~incoming~shortwave__energy_flux": "DSWRF_surface",
"land_surface_air__pressure": "PRES_surface"
"land_surface_air__pressure": "PRES_surface",
"ice_fraction_schaake" : "sloth_ice_fraction_schaake",
"ice_fraction_xinan" : "sloth_ice_fraction_xinan",
"soil_moisture_profile" : "sloth_smp"
},
"uses_forcing_file": false
}
Expand Down
80 changes: 57 additions & 23 deletions data/example_realization_config_w_bmi_c__linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,61 @@
"cat-27": {
"formulations": [
{
"name": "bmi_c",
"name": "bmi_multi",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh, tricky... this file exists I think to give an example of a bmi_c formulation... but essentially CFE can't now run by itself with existing forcings.... so it has to exist in _multi ... can we make an example using exclusively libpetbmi instead? @hellkite500 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean, yes we can't run cfe by itself (as a standalone bmi_c) within the framework anymore and we will need an example of bmi_c formulation, could be PET or noah-owp-mod

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked to the group this morning and we will probably just file a TODO to move these examples to the test modules, e.g. extern/test_bmi_c.

"params": {
"model_type_name": "bmi_c_cfe",
"library_file": "./extern/cfe/cmake_build/libcfebmi.so",
"init_config": "./data/bmi/c/cfe/cat-27_bmi_config.ini",
"main_output_variable": "Q_OUT",
"registration_function": "register_bmi_cfe",
"variables_names_map" : {
"water_potential_evaporation_flux" : "potential_evapotranspiration",
"atmosphere_water__liquid_equivalent_precipitation_rate" : "precip_rate",
"atmosphere_air_water~vapor__relative_saturation" : "SPFH_2maboveground",
"land_surface_air__temperature" : "TMP_2maboveground",
"land_surface_wind__x_component_of_velocity" : "UGRD_10maboveground",
"land_surface_wind__y_component_of_velocity" : "VGRD_10maboveground",
"land_surface_radiation~incoming~longwave__energy_flux" : "DLWRF_surface",
"land_surface_radiation~incoming~shortwave__energy_flux" : "DSWRF_surface",
"land_surface_air__pressure" : "PRES_surface"
},
"uses_forcing_file": false
"model_type_name": "bmi_multi_pet_cfe",
"forcing_file": "",
"init_config": "",
"allow_exceed_end_time": true,
"main_output_variable": "Q_OUT",
"modules": [
{
"name": "bmi_c++",
"params": {
"model_type_name": "bmi_c++_sloth",
"library_file": "./extern/sloth/cmake_build/libslothmodel.so",
"init_config": "/dev/null",
"allow_exceed_end_time": true,
"main_output_variable": "z",
"uses_forcing_file": false,
"model_params": {
"sloth_ice_fraction_schaake(1,double,m,node)": 0.0,
"sloth_ice_fraction_xinan(1,double,1,node)": 0.0,
"sloth_smp(1,double,1,node)": 0.0
}
}
},
{

"name": "bmi_c",
"params": {
"model_type_name": "bmi_c_cfe",
"library_file": "./extern/cfe/cmake_build/libcfebmi.so",
"init_config": "./data/bmi/c/cfe/cat-27_bmi_config.ini",
"main_output_variable": "Q_OUT",
"registration_function": "register_bmi_cfe",
"allow_exceed_end_time": true,
"variables_names_map" : {
"water_potential_evaporation_flux" : "potential_evapotranspiration",
"atmosphere_water__liquid_equivalent_precipitation_rate" : "precip_rate",
"atmosphere_air_water~vapor__relative_saturation" : "SPFH_2maboveground",
"land_surface_air__temperature" : "TMP_2maboveground",
"land_surface_wind__x_component_of_velocity" : "UGRD_10maboveground",
"land_surface_wind__y_component_of_velocity" : "VGRD_10maboveground",
"land_surface_radiation~incoming~longwave__energy_flux" : "DLWRF_surface",
"land_surface_radiation~incoming~shortwave__energy_flux" : "DSWRF_surface",
"land_surface_air__pressure" : "PRES_surface",
"ice_fraction_schaake" : "sloth_ice_fraction_schaake",
"ice_fraction_xinan" : "sloth_ice_fraction_xinan",
"soil_moisture_profile" : "sloth_smp"
},
"uses_forcing_file": false
}
}
],
"uses_forcing_file": false
}
}
}
],
"forcing": {
"path": "./data/forcing/cat-27_2015-12-01 00_00_00_2015-12-30 23_00_00.csv"
Expand Down Expand Up @@ -148,10 +182,10 @@
1.0
],
"storage": 1.0,
"gw_storage": 1.0,
"gw_max_storage": 1000.0,
"nash_max_storage": 1000.0,
"smax": 1000.0,
"gw_storage": 1.0,
"gw_max_storage": 1000.0,
"nash_max_storage": 1000.0,
"smax": 1000.0,
"a": 1.0,
"b": 10.0,
"Ks": 0.1,
Expand Down
72 changes: 53 additions & 19 deletions data/example_realization_config_w_bmi_c__macos.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,61 @@
"cat-27": {
"formulations": [
{
"name": "bmi_c",
"name": "bmi_multi",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.... one way or another though, this file can actually be removed since #430.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the above comment, we should have the same TODO clean up this file and make the other one OS-agnostic.

"params": {
"model_type_name": "bmi_c_cfe",
"library_file": "./extern/cfe/cmake_build/libcfebmi.dylib",
"init_config": "./data/bmi/c/cfe/cat-27_bmi_config.ini",
"main_output_variable": "Q_OUT",
"registration_function": "register_bmi_cfe",
"variables_names_map" : {
"water_potential_evaporation_flux" : "potential_evapotranspiration",
"atmosphere_water__liquid_equivalent_precipitation_rate" : "precip_rate",
"atmosphere_air_water~vapor__relative_saturation" : "SPFH_2maboveground",
"land_surface_air__temperature" : "TMP_2maboveground",
"land_surface_wind__x_component_of_velocity" : "UGRD_10maboveground",
"land_surface_wind__y_component_of_velocity" : "VGRD_10maboveground",
"land_surface_radiation~incoming~longwave__energy_flux" : "DLWRF_surface",
"land_surface_radiation~incoming~shortwave__energy_flux" : "DSWRF_surface",
"land_surface_air__pressure" : "PRES_surface"
},
"uses_forcing_file": false
"model_type_name": "bmi_multi_pet_cfe",
"forcing_file": "",
"init_config": "",
"allow_exceed_end_time": true,
"main_output_variable": "Q_OUT",
"modules": [
{
"name": "bmi_c++",
"params": {
"model_type_name": "bmi_c++_sloth",
"library_file": "./extern/sloth/cmake_build/libslothmodel.so",
"init_config": "/dev/null",
"allow_exceed_end_time": true,
"main_output_variable": "z",
"uses_forcing_file": false,
"model_params": {
"sloth_ice_fraction_schaake(1,double,m,node)": 0.0,
"sloth_ice_fraction_xinan(1,double,1,node)": 0.0,
"sloth_smp(1,double,1,node)": 0.0
}
}
},
{

"name": "bmi_c",
"params": {
"model_type_name": "bmi_c_cfe",
"library_file": "./extern/cfe/cmake_build/libcfebmi.dylib",
"init_config": "./data/bmi/c/cfe/cat-27_bmi_config.ini",
"main_output_variable": "Q_OUT",
"registration_function": "register_bmi_cfe",
"allow_exceed_end_time": true,
"variables_names_map" : {
"water_potential_evaporation_flux" : "potential_evapotranspiration",
"atmosphere_water__liquid_equivalent_precipitation_rate" : "precip_rate",
"atmosphere_air_water~vapor__relative_saturation" : "SPFH_2maboveground",
"land_surface_air__temperature" : "TMP_2maboveground",
"land_surface_wind__x_component_of_velocity" : "UGRD_10maboveground",
"land_surface_wind__y_component_of_velocity" : "VGRD_10maboveground",
"land_surface_radiation~incoming~longwave__energy_flux" : "DLWRF_surface",
"land_surface_radiation~incoming~shortwave__energy_flux" : "DSWRF_surface",
"land_surface_air__pressure" : "PRES_surface",
"ice_fraction_schaake" : "sloth_ice_fraction_schaake",
"ice_fraction_xinan" : "sloth_ice_fraction_xinan",
"soil_moisture_profile" : "sloth_smp"
},
"uses_forcing_file": false
}
}
],
"uses_forcing_file": false
}
}
}
],
"forcing": {
"path": "./data/forcing/cat-27_2015-12-01 00_00_00_2015-12-30 23_00_00.csv"
Expand Down
4 changes: 2 additions & 2 deletions extern/cfe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ set(CFE_LIB_DESC_CMAKE "OWP CFE BMI Module Shared Library")
add_compile_definitions(BMI_ACTIVE)

if(WIN32)
add_library(cfebmi cfe/src/bmi_cfe.c cfe/src/cfe.c)
add_library(cfebmi cfe/src/bmi_cfe.c cfe/src/cfe.c cfe/src/giuh.c)
else()
add_library(cfebmi SHARED cfe/src/bmi_cfe.c cfe/src/cfe.c)
add_library(cfebmi SHARED cfe/src/bmi_cfe.c cfe/src/cfe.c cfe/src/giuh.c)
endif()

target_include_directories(cfebmi PRIVATE cfe/include)
Expand Down
2 changes: 1 addition & 1 deletion extern/cfe/cfe
Submodule cfe updated 47 files
+70 −0 CMakeLists.txt
+129 −45 README.md
+148 −0 bmi/bmi.h
+84 −0 bmi/bmi.hxx
+19 −17 configs/cat_58_bmi_config_cfe.txt
+17 −16 configs/cat_58_bmi_config_cfe_pass.txt
+23 −17 configs/cat_87_bmi_config_cfe.txt
+23 −17 configs/cat_87_bmi_config_cfe_pass.txt
+1 −1 configs/cat_89_bmi_config_aorc.txt
+18 −17 configs/cat_89_bmi_config_cfe.txt
+17 −16 configs/cat_89_bmi_config_cfe_pass.txt
+17 −16 configs/cat_89_bmi_config_cfe_unit_test.txt
+19 −0 configs/laramie_bmi_config_aorc.txt
+28 −0 configs/laramie_bmi_config_cfe_pass.txt
+31 −0 configs/laramie_bmi_config_cfe_pass_aet_rz.txt
+9 −0 configs/laramie_bmi_config_coupler.txt
+19 −0 configs/laramie_bmi_config_ftm.txt
+21 −0 configs/laramie_bmi_config_pet_pass.txt
+6 −0 configs/laramie_bmi_config_smc_coupler.txt
+0 −3 env_cheyenne.sh
+3 −1 forcing_code/src/pet.c
+24,863 −0 forcings/Laramie_14Jun09_to_15Apr12.csv
+720 −720 forcings/cat89_01Dec2015.csv
+8 −5 include/bmi_cfe.h
+31 −6 include/cfe.h
+9 −0 include/giuh.h
+0 −3 make_and_run_bmi.sh
+0 −3 make_and_run_bmi_pass_forcings.sh
+0 −3 make_and_run_bmi_pass_forcings_pet.sh
+0 −2 py_cfe/.gitignore
+0 −49 py_cfe/README.md
+0 −777 py_cfe/bmi_cfe.py
+0 −721 py_cfe/cat58_01Dec2015.csv
+0 −28 py_cfe/cat_58_config_cfe.json
+0 −378 py_cfe/cfe.py
+0 −15 py_cfe/environment.yml
+0 −416 py_cfe/run_bmi_unit_test.py
+0 −417 py_cfe/run_cfe.ipynb
+0 −10 py_cfe/run_cfe_unit_test_mass_balance.py
+0 −721 py_cfe/test_compare.csv
+38 −0 run_cfe.sh
+842 −297 src/bmi_cfe.c
+199 −189 src/cfe.c
+41 −0 src/giuh.c
+294 −0 src/main_cfe_aorc_pet_rz_aet.cxx
+20 −0 test/main_unit_test_bmi.c
+2 −2 test/make_and_run_bmi_unit_test.sh