Skip to content
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ One of the objectives of the modernization of the CRHM software was to separate

Both versions support the same command line interface which is described here: https://github.com/srlabUsask/crhmcode/wiki/Using-CRHMcode-Command-Line-Interface

### CRHMcode GCC
### CRHMcode CLI

CRHMcode GCC can be compiled on any system that supports the GCC C++ compiler. Instructions for compiling it can be found here: https://github.com/srlabUsask/crhmcode/wiki/Building-CRHMcode-GCC
CRHMcode CLI can be compiled on any system that supports the GCC C++ compiler. Instructions for compiling it can be found here: https://github.com/srlabUsask/crhmcode/wiki/Building-CRHMcode-GCC

It is likely that other C++ compilers can be used to compile and run CRHMcode GCC but only the GCC compiler has been tested.
It is likely that other C++ compilers can be used to compile and run CRHMcode CLI but only the GCC compiler has been tested.

CRHMcode GCC will be available as a source distribution designed to be built with the CMake set of tools.
CRHMcode CLI will be available as a source distribution designed to be built with the CMake set of tools.


### CRHMcode GUI
Expand Down
6 changes: 3 additions & 3 deletions borland_source/CRHMmain.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// 06/28/22 correcting mixed precipitation phase equation in obs
// module in 06/27/22
// 08/02/22 correcting hru_evap estimation in lake_evap module and volumetric_rechr
// equation and fallstat value for pavement in volumetric module in 06/28/22
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#define CurrentVersion "06/28/22"
#define CurrentVersion "08/02/22"

#include <stdexcept>
#include "CRHMmain.h"
Expand Down
28 changes: 14 additions & 14 deletions borland_source/NewModules.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 06/28/22
// 08/02/22
//---------------------------------------------------------------------------

#include <vcl.h>
Expand Down Expand Up @@ -108,7 +108,7 @@ void MoveModulesToGlobal(String DLLName){
DLLModules.AddModule(new ClassXGAyers("XGAyers", "05/19/17", CRHM::PROTO));

DLLModules.AddModule(new ClassSetSoil("SetSoil", "10/21/09", CRHM::ADVANCE));
DLLModules.AddModule(new ClassVolumetric("Volumetric", "04/05/22", CRHM::ADVANCE));
DLLModules.AddModule(new ClassVolumetric("Volumetric", "08/02/22", CRHM::ADVANCE));
DLLModules.AddModule(new Classtsurface("tsurface", "04/05/22", CRHM::PROTO));

DLLModules.AddModule(new Classalbedoparam("albedo_param", "11/22/05", CRHM::SUPPORT));
Expand All @@ -132,7 +132,7 @@ void MoveModulesToGlobal(String DLLName){

DLLModules.AddModule(new ClassSnobalX("Snobal", "02/03/16", CRHM::OBSOL));
DLLModules.AddModule(new Classinterception("interception", "04/05/22", CRHM::OBSOL));
DLLModules.AddModule(new Classlake("lake_evap", "04/05/22", CRHM::ADVANCE));
DLLModules.AddModule(new Classlake("lake_evap", "08/02/22", CRHM::ADVANCE));

if(!RELEASE){
DLLModules.AddModule(new ClassHMSA("HMSA", "01/16/13", CRHM::PROTO));
Expand Down Expand Up @@ -12608,7 +12608,7 @@ void ClassVolumetric::run(void) {
Volumetric[hh] = 0.0;

if(soil_rechr_max[hh] > 0.0) // 03/15/2021: conditional statement to restrict divided by zero error
Volumetric_rechr[hh] = (soil_rechr[hh]/soil_rechr_max[hh]*SetSoilproperties[soil_type[hh]][3] + SetSoilproperties[soil_type[hh]][1])/1000.0; // 04/14/2020
Volumetric_rechr[hh] = (soil_rechr[hh]/soil_rechr_max[hh]*(SetSoilproperties[soil_type[hh]][3] - SetSoilproperties[soil_type[hh]][1]) + SetSoilproperties[soil_type[hh]][1])/1000.0; // 04/14/2020, Aug 2, 2022 correction with term (SetSoilproperties[soil_type[hh]][3] - SetSoilproperties[soil_type[hh]][1])
else
Volumetric_rechr[hh] = 0.0;

Expand Down Expand Up @@ -12642,7 +12642,7 @@ void ClassVolumetric::run(void) {
fallstat[hh] = fallstat[hh]*fallstat_correction[hh]; // 08/11/2021
} // 08/11/2021
else
fallstat [hh] = 1.0;
fallstat [hh] = 100.0; // Aug 2, 2022 correction

fallstat_V[hh] = fallstat[hh];
}
Expand Down Expand Up @@ -17492,9 +17492,9 @@ void Classlake::decl(void) {

declstatdiag("hru_cum_evap", NHRU, "cumulative interval evaporation", "(mm)", &hru_cum_evap);

declvar("hru_actet", NHRU, "actual evapotranspiration over HRU, limited by the amount of soil moisture available", "(mm/int)", &hru_actet);
//declvar("hru_actet", NHRU, "actual evapotranspiration over HRU, limited by the amount of soil moisture available", "(mm/int)", &hru_actet); // modified Aug 2, 2022, hru_actet not calculated in lake_evap

declstatdiag("hru_cum_actet", NHRU, "cumulative actual evapotranspiration over HRU", "(mm)", &hru_cum_actet);
//declstatdiag("hru_cum_actet", NHRU, "cumulative actual evapotranspiration over HRU", "(mm)", &hru_cum_actet); // modified Aug 2, 2022, hru_actet not calculated in lake_evap

decldiag("Va", NHRU, "water vapour pressure, Vw*rh (Meyer)", "(mm)", &Va);

Expand Down Expand Up @@ -17545,8 +17545,8 @@ void Classlake::init(void) {
lake_evap_month[hh] = 0.0;
hru_evap[hh] = 0.0;
hru_cum_evap[hh] = 0.0;
hru_actet[hh] = 0.0;
hru_cum_actet[hh] = 0.0;
//hru_actet[hh] = 0.0; // modified Aug 2, 2022, hru_actet not calculated in lake_evap
//hru_cum_actet[hh] = 0.0; // modified Aug 2, 2022, hru_actet not calculated in lake_evap
hru_rh_acc[hh] = 0.0;
hru_t_acc[hh] = 0.0;
hru_t_Mmean[hh] = 0.0;
Expand Down Expand Up @@ -17598,7 +17598,7 @@ void Classlake::run(void) {
Va[hh] = 0.0;
Vw[hh] = 0.0;

hru_actet[hh] = 0.0;
//hru_actet[hh] = 0.0; // modified Aug 2, 2022, hru_actet not calculated in lake_evap
hru_evap[hh] = 0.0;
} // for

Expand All @@ -17618,7 +17618,7 @@ void Classlake::run(void) {
} // beginning of month

if(DoMean){
if(--DaysMonth == 0 || last_timestep()){
if(DaysMonth > 0 || last_timestep()){ // modified Aug 2, 2022
add();
process();
--Global::CRHMControlSaveCnt; // restore state to backtrack
Expand All @@ -17631,11 +17631,11 @@ void Classlake::run(void) {
else if(N_intervals){ // normal entry after monthly lake evaporation
Ahead = false;
for(hh = 0; chkStruct(); ++hh) {
hru_actet[hh] = 0.0;
//hru_actet[hh] = 0.0; // modified Aug 2, 2022, hru_actet not calculated in lake_evap
hru_evap[hh] = 0.0;

if((double) Global::DTnow + 0.01 >= start_open_day[hh] && (double) Global::DTnow - 0.01 <= end_open_day[hh]){
hru_evap[hh] = lake_evap_month[hh]/N_intervals;
hru_evap[hh] = lake_evap_month[hh]/(DaysMonth * Global::Freq); // correction Aug 2, 2022 for interval evaporation based on monthly evap
hru_cum_evap[hh] += hru_evap[hh];
} // if
} // for
Expand All @@ -17648,7 +17648,7 @@ void Classlake::finish(bool good) {

LogMessageA(hh, string("'" + Name + " (lake_evap)' hru_cum_evap (mm) (mm*hru) (mm*hru/basin): ").c_str(), hru_cum_evap[hh], hru_area[hh], basin_area[0]);

LogMessageA(hh, string("'" + Name + " (lake_evap)' hru_cum_actet (mm) (mm*hru) (mm*hru/basin): ").c_str(), hru_cum_actet[hh], hru_area[hh], basin_area[0]);
//LogMessageA(hh, string("'" + Name + " (lake_evap)' hru_cum_actet (mm) (mm*hru) (mm*hru/basin): ").c_str(), hru_cum_actet[hh], hru_area[hh], basin_area[0]);
LogDebug(" ");

}
Expand Down
6 changes: 3 additions & 3 deletions borland_source/NewModules.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 04/22/22 with changes to 08/11/21
// 08/02/22 with changes to 04/22/22
//---------------------------------------------------------------------------

#ifndef OurModulesH
Expand Down Expand Up @@ -3713,8 +3713,8 @@ Classlake(string Name, String Version = "undefined", CRHM::LMODULE Lvl = CRHM::P
// declared variables
float *hru_evap;
float *hru_cum_evap;
float *hru_actet;
float *hru_cum_actet;
//float *hru_actet; // modified Aug 2, 2022, hru_actet not calculated in lake_evap
//float *hru_cum_actet; // modified Aug 2, 2022, hru_actet not calculated in lake_evap
float *lake_evap_month;
float *hru_t_Mmean;
float *hru_rh_Mmean;
Expand Down
11 changes: 11 additions & 0 deletions borland_source/Notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -633,3 +633,14 @@ CRHM 06/28/22
Corrections in hru_rain equation in the mixed precipitation phase in module obs:

hru_rain[hh] = hru_p[hh]*(Use - tmax_allsnow[hh])/(tmax_allrain[hh] - tmax_allsnow[hh]);

CRHM 08/02/22

Changes in hru_evap estimation based on Meyer's monthly evaporation in module lake_evap.

Corrections in volumetric_rechr equation and fallstat value for pavement case in module Volumetric:

Volumetric_rechr[hh] = (soil_rechr[hh]/soil_rechr_max[hh]*(SetSoilproperties[soil_type[hh]][3] - SetSoilproperties[soil_type[hh]][1])+ SetSoilproperties[soil_type[hh]][1])/1000.0;

fallstat [hh] = 100.0; // i.e. for pavement

4 changes: 2 additions & 2 deletions crhmcode/src/modules/ClassVolumetric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void ClassVolumetric::run(void) {
Volumetric[hh] = 0.0;

if (soil_rechr_max[hh] > 0.0) // 03/15/2021: conditional statement to restrict divided by zero error
Volumetric_rechr[hh] = (soil_rechr[hh] / soil_rechr_max[hh] * SetSoilproperties[soil_type[hh]][3] + SetSoilproperties[soil_type[hh]][1]) / 1000.0; // 04/14/2020
Volumetric_rechr[hh] = (soil_rechr[hh] / soil_rechr_max[hh] * (SetSoilproperties[soil_type[hh]][3] - SetSoilproperties[soil_type[hh]][1]) + SetSoilproperties[soil_type[hh]][1]) / 1000.0; // 04/14/2020, Aug 2, 2022 correction with term (SetSoilproperties[soil_type[hh]][3] - SetSoilproperties[soil_type[hh]][1])
else
Volumetric_rechr[hh] = 0.0;

Expand Down Expand Up @@ -131,7 +131,7 @@ void ClassVolumetric::run(void) {
}
else
{
fallstat[hh] = 1.0;
fallstat[hh] = 100.0; // Aug 2, 2022 correction
}

fallstat_V[hh] = fallstat[hh];
Expand Down
18 changes: 9 additions & 9 deletions crhmcode/src/modules/Classlake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ void Classlake::decl(void) {

declstatdiag("hru_cum_evap", TDim::NHRU, "cumulative interval evaporation", "(mm)", &hru_cum_evap);

declvar("hru_actet", TDim::NHRU, "actual evapotranspiration over HRU, limited by the amount of soil moisture available", "(mm/int)", &hru_actet);
// declvar("hru_actet", TDim::NHRU, "actual evapotranspiration over HRU, limited by the amount of soil moisture available", "(mm/int)", &hru_actet); // modified Aug 2, 2022, hru_actet not calculated in lake_evap

declstatdiag("hru_cum_actet", TDim::NHRU, "cumulative actual evapotranspiration over HRU", "(mm)", &hru_cum_actet);
// declstatdiag("hru_cum_actet", TDim::NHRU, "cumulative actual evapotranspiration over HRU", "(mm)", &hru_cum_actet); // modified Aug 2, 2022, hru_actet not calculated in lake_evap

decldiag("Va", TDim::NHRU, "water vapour pressure, Vw*rh (Meyer)", "(mm)", &Va);

Expand Down Expand Up @@ -80,8 +80,8 @@ void Classlake::init(void) {
lake_evap_month[hh] = 0.0;
hru_evap[hh] = 0.0;
hru_cum_evap[hh] = 0.0;
hru_actet[hh] = 0.0;
hru_cum_actet[hh] = 0.0;
// hru_actet[hh] = 0.0; // modified Aug 2, 2022, hru_actet not calculated in lake_evap
// hru_cum_actet[hh] = 0.0; // modified Aug 2, 2022, hru_actet not calculated in lake_evap
hru_rh_acc[hh] = 0.0;
hru_t_acc[hh] = 0.0;
hru_t_Mmean[hh] = 0.0;
Expand Down Expand Up @@ -136,7 +136,7 @@ void Classlake::run(void) {
Va[hh] = 0.0;
Vw[hh] = 0.0;

hru_actet[hh] = 0.0;
// hru_actet[hh] = 0.0; // modified Aug 2, 2022, hru_actet not calculated in lake_evap
hru_evap[hh] = 0.0;
} // for

Expand All @@ -156,7 +156,7 @@ void Classlake::run(void) {
} // beginning of month

if(DoMean){
if(--DaysMonth == 0 || last_timestep()){
if(DaysMonth > 0 || last_timestep()){ // modified Aug 2, 2022
add();
process();
--Global::CRHMControlSaveCnt; // restore state to backtrack
Expand All @@ -169,11 +169,11 @@ void Classlake::run(void) {
else if(N_intervals){ // normal entry after monthly lake evaporation
Ahead = false;
for(hh = 0; chkStruct(); ++hh) {
hru_actet[hh] = 0.0;
// hru_actet[hh] = 0.0; // modified Aug 2, 2022, hru_actet not calculated in lake_evap
hru_evap[hh] = 0.0;

if((double) Global::DTnow + 0.01 >= start_open_day[hh] && (double) Global::DTnow - 0.01 <= end_open_day[hh]){
hru_evap[hh] = lake_evap_month[hh]/N_intervals;
hru_evap[hh] = lake_evap_month[hh]/(DaysMonth * Global::Freq); // correction Aug 2, 2022 for interval evaporation based on monthly evap
hru_cum_evap[hh] += hru_evap[hh];
} // if
} // for
Expand All @@ -186,7 +186,7 @@ void Classlake::finish(bool good) {

LogMessageA(hh, string("'" + Name + " (lake_evap)' hru_cum_evap (mm) (mm*hru) (mm*hru/basin): ").c_str(), hru_cum_evap[hh], hru_area[hh], basin_area[0]);

LogMessageA(hh, string("'" + Name + " (lake_evap)' hru_cum_actet (mm) (mm*hru) (mm*hru/basin): ").c_str(), hru_cum_actet[hh], hru_area[hh], basin_area[0]);
// LogMessageA(hh, string("'" + Name + " (lake_evap)' hru_cum_actet (mm) (mm*hru) (mm*hru/basin): ").c_str(), hru_cum_actet[hh], hru_area[hh], basin_area[0]);
LogDebug(" ");

}
Expand Down
4 changes: 2 additions & 2 deletions crhmcode/src/modules/Classlake.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Classlake(string Name, string Version = "undefined", LMODULE Lvl = LMODULE::PROT
// declared variables
double *hru_evap{ NULL };
double *hru_cum_evap{ NULL };
double *hru_actet{ NULL };
double *hru_cum_actet{ NULL };
// double *hru_actet{ NULL }; // modified Aug 2, 2022, hru_actet not calculated in lake_evap
// double *hru_cum_actet{ NULL }; // modified Aug 2, 2022, hru_actet not calculated in lake_evap
double *lake_evap_month{ NULL };
double *hru_t_Mmean{ NULL };
double *hru_rh_Mmean{ NULL };
Expand Down
4 changes: 2 additions & 2 deletions crhmcode/src/modules/newmodules/NewModules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void MoveModulesToGlobal(string DLLName)
DLLModules.AddModule(new ClassXG("XG", "04/05/22", LMODULE::ADVANCE));
DLLModules.AddModule(new ClassXGAyers("XGAyers", "05/19/17", LMODULE::PROTO));
DLLModules.AddModule(new ClassSetSoil("SetSoil", "10/21/09", LMODULE::ADVANCE));
DLLModules.AddModule(new ClassVolumetric("Volumetric", "04/05/22", LMODULE::ADVANCE));
DLLModules.AddModule(new ClassVolumetric("Volumetric", "08/02/22", LMODULE::ADVANCE));
DLLModules.AddModule(new Classtsurface("tsurface", "04/05/22", LMODULE::PROTO));
DLLModules.AddModule(new Classalbedoparam("albedo_param", "11/22/05", LMODULE::SUPPORT));
DLLModules.AddModule(new Classalbedoobs("albedo_obs", "11/22/05", LMODULE::SUPPORT));
Expand All @@ -217,7 +217,7 @@ void MoveModulesToGlobal(string DLLName)
DLLModules.AddModule(new ClassK_Estimate("K_Estimate", "04/06/22", LMODULE::ADVANCE)); // fixed 'put' descriptions
DLLModules.AddModule(new ClassSnobalX("Snobal", "02/03/16", LMODULE::OBSOL));
DLLModules.AddModule(new Classinterception("interception", "04/05/22", LMODULE::OBSOL));
DLLModules.AddModule(new Classlake("lake_evap", "04/05/22", LMODULE::ADVANCE));
DLLModules.AddModule(new Classlake("lake_evap", "08/02/22", LMODULE::ADVANCE));

if(!RELEASE)
{
Expand Down