Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
a007c69
Added new templates to add snow interception routine
acebulsk Nov 12, 2024
eef1dac
Merge branch 'master' of https://github.com/acebulsk/crhmcode
acebulsk Nov 12, 2024
7edf49d
Other changes to incorporate new snow interception param template. Ap…
acebulsk Nov 13, 2024
ebddb2b
Added vector based parameterization for snow interception, changed ma…
acebulsk Nov 13, 2024
af8a27f
Change Cc calculation to limit to 1
acebulsk Nov 14, 2024
e662bee
Modified IP alpha value so that it is a parameter
acebulsk Nov 14, 2024
02d6e37
Changed Clca to a declvar so it can be displayed in the model output
acebulsk Nov 14, 2024
cad88ca
Fixed bug with alpha parameter
acebulsk Nov 15, 2024
f37e759
Change integers to floats so Ht_1_third is computed correctly
acebulsk Nov 15, 2024
403f1d0
fixed bug with Cp_inc function
acebulsk Nov 15, 2024
fb29dc5
finished first try at mass unloading switch and started working on me…
acebulsk Nov 19, 2024
e4fbe81
!!! changed formatting to vscode recommended
acebulsk Nov 19, 2024
54fa983
put hp98/ellis unloading and drip back together within the mass unloa…
acebulsk Nov 19, 2024
b729d15
updated vector based to take Cc as input
acebulsk Nov 20, 2024
d2d772d
ignore vscode settings.json
acebulsk Nov 20, 2024
ee96ef5
adjusted PSPnew module and is now running still need to check outputs…
acebulsk Nov 23, 2024
9d4db76
updates to get PSPnew working
acebulsk Nov 23, 2024
557cc21
fixed floating point precision problem which was causing segfault whe…
acebulsk Nov 23, 2024
07f2652
fixed some bugs in ClassPSPnew it now seems to be producing somewhat …
acebulsk Nov 23, 2024
f3665df
finished some TODOs including pull snobal surface temp and canopy loa…
acebulsk Nov 26, 2024
50a503c
state before changing PSP sublimation to pull from Canopy module
acebulsk Nov 26, 2024
8b7f5c1
did not change sublimation to pull from Canopy module as the equation…
acebulsk Nov 26, 2024
0c4ccd3
added canopy snow phase change algorithm following CLASS
acebulsk Nov 26, 2024
db01203
fixed bugs was using single & instead of && in if statements
acebulsk Nov 27, 2024
0721ffe
changed canopy water heat capacity to include liquid portion, moved s…
acebulsk Nov 27, 2024
753ddde
Updated DblTBar can to initialize at Tbiomass from prev tstep
acebulsk Nov 28, 2024
510f354
Added switch to calculate canopy wind using either cionco or log wind…
acebulsk Nov 28, 2024
9c9e222
updated to add pomeroy 2009 longwave
acebulsk Nov 29, 2024
f42ebbe
output some vars associated with previous commit to make available in…
acebulsk Nov 29, 2024
8078809
ignore vscode files
acebulsk Nov 29, 2024
3ac3261
changed canopy snowmelt to use routine as in snobal
acebulsk Nov 30, 2024
8938c86
changed to initilize ablation routine with observed canopy snow load …
acebulsk Dec 1, 2024
2e0dcb1
updated canopy snowmelt routine to drain directly without evaporating
acebulsk Dec 1, 2024
2180a4c
updated PSP back to Lstar this had zero change to modelled snowmelt
acebulsk Dec 1, 2024
08d5a1b
fixed bug in wind and duration unloading functions that previously we…
acebulsk Dec 1, 2024
4e979a1
fixed bug in wind and duration unloading functions that previously we…
acebulsk Dec 1, 2024
f78ad9e
updated PSP back to Lstar this had zero change to modelled snowmelt
acebulsk Dec 1, 2024
8f8df8e
updated canopy snowmelt routine to drain directly without evaporating
acebulsk Dec 1, 2024
6d1849c
fixed bug in wind scaling equations
acebulsk Dec 2, 2024
b6ac868
Merge branch 'class-trials' into ablation-test-obs-tree
acebulsk Dec 2, 2024
977885c
changed t unload to reset at 0 mm
acebulsk Dec 2, 2024
c785571
Merge branch 'class-trials' into ablation-test-obs-tree
acebulsk Dec 2, 2024
0188f3b
added maximum canopy snowload check
acebulsk Dec 2, 2024
8467813
updated new unloading fn from ODE to analytical solution
acebulsk Dec 2, 2024
23df7fd
Merge branch 'class-trials' into ablation-test-obs-tree
acebulsk Dec 3, 2024
407744d
add sunload
acebulsk Dec 3, 2024
de23182
Merge branch 'class-trials' into ablation-test-obs-tree
acebulsk Dec 3, 2024
f4d16a7
removed uneeded lines
acebulsk Dec 3, 2024
2bd0545
moved melt before unloading
acebulsk Dec 3, 2024
fc8a2d4
deleted duration based unloading in vector based paramaterisation
acebulsk Jan 13, 2025
aa85223
changed exponential melt function to ratio melt mas unloading
acebulsk Jan 14, 2025
9f78239
added unloading to drip ratio as param
acebulsk Jan 15, 2025
852feb6
updt comment
acebulsk Jan 22, 2025
f232d27
updt comment
acebulsk Jan 22, 2025
c09f772
update wind unloading pars to use new ones developed as function of w…
acebulsk Jan 22, 2025
ed7537f
added catch to only calc wind induced unloading if above th wind speed
acebulsk Jan 22, 2025
86f8329
add wind and melt unloading as output vars
acebulsk Jan 23, 2025
8ca76ed
switched lstar to lmax
acebulsk Jan 23, 2025
cfd7668
fixed bug in energy balance check, little sensitivity to change
acebulsk Jan 24, 2025
aedeba0
edit comments
acebulsk Jan 28, 2025
554dbdf
changed 0 to 0.0
acebulsk Jan 28, 2025
a232979
ignore vscode files
acebulsk Jan 28, 2025
0564eaa
changed wind unloading function to include temperature parameter
acebulsk Jan 28, 2025
3916e06
added roesch and andreadis unloading fns
acebulsk Jan 29, 2025
67c0b04
changed meltwater drip to use icebulb temp
acebulsk Jan 29, 2025
9f53a3d
updated comment
acebulsk Jan 29, 2025
4b43724
added min wind th for wind unloading fn as parameter
acebulsk Jan 29, 2025
314c065
removed psp dependency from vector based module
acebulsk Jan 29, 2025
f976217
reverted addition of air temperature in wind speed unloading function…
acebulsk Jan 30, 2025
ff7a9b5
updt q unload wind pars after filtering some of the SCLs
acebulsk Jan 31, 2025
40a8d33
change unload melt from linear to exp
acebulsk Feb 4, 2025
cb7f397
changed unload melt to sigmoid
acebulsk Feb 4, 2025
cf27c3e
added back linear melt unload this commit has all three option
acebulsk Feb 4, 2025
e865387
added in a new unloading parameterization proportional to sublimation
acebulsk Feb 5, 2025
9442757
first try at implementing LW in sublimation calculation to help reduc…
acebulsk Feb 7, 2025
07f04b2
moved satw function into SnobalDefines.h so can be shared with CanSnobal
acebulsk Feb 8, 2025
5cbb8ed
added new modules to handle canopy snow energy and mass balance after…
acebulsk Feb 8, 2025
566acb4
several changes specific to making this canopy specific
acebulsk Feb 11, 2025
a1cbe9c
moved shared snobal functions to SnobalDefines
acebulsk Feb 11, 2025
738950b
add new CanSnobal modules to crhm
acebulsk Feb 11, 2025
16a9274
fixed bug used wrong surface temp
acebulsk Feb 11, 2025
65db8c0
add new output vars for CanSnobal
acebulsk Feb 11, 2025
dc29048
fixed bug incorrectly referenced precip_now var
acebulsk Feb 11, 2025
917decf
new cansnobal module is working but some problems with the energy bal…
acebulsk Feb 13, 2025
d54f5f5
comment out variable not used and zero intercepted_rain avr
acebulsk Feb 13, 2025
bcc0412
changed harder precip partitioning function so does not have infinite…
acebulsk Feb 13, 2025
f24ad23
changed energy bal here to iterate on canopy snow temp/turbulent flux…
acebulsk Mar 5, 2025
244c860
canopy snow energy balance modified to iterate on ice sphere to calcu…
acebulsk Mar 7, 2025
2e4f686
updated canopy energy balance to use Essery 2003 latent heat flux no …
acebulsk Mar 8, 2025
f98cbaa
some organization and process updates prior to and following discussi…
acebulsk Mar 15, 2025
a7f4cd4
added melt unloading, subl unloading, and SW to LW fn as pars
acebulsk Mar 16, 2025
88b82dc
!!! fixed bugs in latent heat fn related to aero resistance calc and …
acebulsk Mar 17, 2025
a4c2f6f
Cansnobal v_1_0
acebulsk Mar 18, 2025
ec641c4
fixed some psp bugs
acebulsk Mar 18, 2025
5b68571
fix aero resistance bug and subl unloading bug
acebulsk Mar 20, 2025
066814a
added some comments
acebulsk Mar 25, 2025
fb33465
changed canopy snow unloading to melt and subl ratios from through th…
acebulsk Apr 1, 2025
8e76c54
removed unused Z_0_cansnow par
acebulsk Apr 9, 2025
ac8defd
deleted canopy snow unloading param as function of sublimation
acebulsk May 1, 2025
3c4495b
changed wind unloading to use shear stress instead
acebulsk May 1, 2025
39f9a51
fixed bug in tau unloading, now is very similar to wind unloading...
acebulsk May 2, 2025
b9e980c
deleted unused variables from VectorBased module
acebulsk May 2, 2025
837fb02
added necessary variables
acebulsk May 2, 2025
44a9ed4
fixed bug where intercepted_snow was not set to 0 if not snowing
acebulsk May 5, 2025
b97060f
fixed bug where liquid water stored in the snowpack was lost when no …
acebulsk May 5, 2025
e9fda22
revised Cp calc to match published function
acebulsk May 7, 2025
fc8ec24
fixed bug on rain interception not reaching ground and made it possib…
acebulsk May 8, 2025
ac3d774
changed wind unload to use cionco function from .h file instead of re…
acebulsk May 8, 2025
3e014e4
minor changes
acebulsk May 13, 2025
6a043f7
adjusted liquid water routine
acebulsk May 14, 2025
0361949
changed liquid evap to use essery2003 needed to make changes to ebal …
acebulsk May 15, 2025
6ac7157
added iff statement to handle differing liq water holding capcitites
acebulsk May 22, 2025
b0cae92
comment breakpoint by time
acebulsk May 22, 2025
b90f45f
fixed some units so not throwing errors in the log
acebulsk May 29, 2025
1f37c71
moved throughfall calc outside of cansnobal so that it is executed f…
acebulsk Jun 6, 2025
14d164b
reorg on wind speed adjustments
acebulsk Jun 26, 2025
ec70945
change some var descriptions and comments
acebulsk Jun 26, 2025
5cdc3af
changed description
acebulsk Jun 26, 2025
0205f04
removed several unused variables
acebulsk Jun 27, 2025
ea4a8f2
edit function descriptions to be more meaningful
acebulsk Jun 27, 2025
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.user
*.userosscache
*.sln.docstates
settings.json

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down Expand Up @@ -269,3 +270,7 @@ __pycache__/

build/
/crhmcode/src/libs/boost_1_75_0
.vscode/tasks.json
.vscode/launch.json
crhmcode/.vscode/tasks.json
crhmcode/.vscode/launch.json
4 changes: 2 additions & 2 deletions crhmcode/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ ClassalbedoBaker.o Classalbedoobs.o Classalbedoobs2.o Classalbedoparam.o \
ClassalbedoRichard.o ClassalbedoWinstral.o ClassAnnan.o ClassAyers.o \
ClassBasin.o Classbrushintcp.o Classcalcsun.o Classcontribution.o \
Classcrack.o ClassCRHMCanopy.o ClassCRHMCanopyClearing.o \
ClassCRHMCanopyClearingGap.o Classebsm.o Classevap.o Classevap_Resist.o \
ClassevapD.o ClassevapD_Resist.o ClassevapX.o ClassFlowInSnow.o \
ClassCRHMCanopyClearingGap.o ClassCRHMCanopyVectorBased.o Classebsm.o Classevap.o \
Classevap_Resist.o ClassevapD.o ClassevapD_Resist.o ClassevapX.o ClassFlowInSnow.o \
Classfrostdepth.o Classfrozen.o ClassfrozenAyers.o Classglacier.o \
Classglacier_debris.o ClassGlobal.o ClassGreenAmpt.o ClassGreencrack.o \
ClassGrow_Crop.o ClassHMSA.o ClassHtobs.o ClassIceBulb.o ClassICEflow.o \
Expand Down
2 changes: 1 addition & 1 deletion crhmcode/prj/badlake.prj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Macros:
######
Observations:
######
C:\Users\jhs507\repos\crhmcode\crhmcode\obs\Badlake73_76.obs
/home/alex/Documents/code/crhmcode/crhmcode/obs/Badlake73_76.obs
######
Dates:
######
Expand Down
8 changes: 7 additions & 1 deletion crhmcode/src/core/CRHM_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace CRHM_constants {
const double Cp = 1005; // (J/kg/K) volumetric heat capacity of dry air
const double Rgas = 287.0; // Gas constant for dry air (J/kg/K)
const double Tm = 273.15; // Melting point (K)
const double Tf = 273.16; // Freezing point of water (K) as in CLASS and SNOBAL

const double Ls = 2.845e6; // Latent heat of sublimation (J/kg)
const double Lv = 2.50e6; // Latent heat of vaporization (J/kg)
Expand All @@ -36,9 +37,14 @@ namespace CRHM_constants {
const double sbc = 5.67E-8; // Stephan-Boltzmann constant W/m^2/k4
const double SB = 4.899e-09; // Stephan-Boltzmann constant MJ/m^2-d

const double emiss = 0.985; // emissivity of the atmosphere and snowpack
const double emiss = 0.99; // emissivity the snowpack changed from 0.985 on 2025-02-06
const double emiss_c = 0.96; // emissivity of the canopy
const double em = 0.622; //
const double ci = 2.102e3; // specific heat capacity of ice (J/kg/K)
const double cw = 4.186e3; // specific heat capacity of h2o (J/kg/K) from CLASS
const double cv = 2.70e3; // specific heat capacity of vegetation (J/kg/K) from CLASS


}

#endif // !CRHM_CONSTANTS
12 changes: 9 additions & 3 deletions crhmcode/src/core/CRHMmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2308,7 +2308,7 @@ MMSData * CRHMmain::RunClick2Start()
}
}


Global::DTmin = (int)((DTstartR - Global::DTstart)* Global::Freq);
Global::DTindx = Global::DTmin;
Global::DTnow = Global::DTstart + Global::Interval*((long long)Global::DTindx + 1ll);
Expand Down Expand Up @@ -2351,13 +2351,19 @@ MMSData * CRHMmain::RunClick2Start()
GoodRun = false;
}


ClassData * FileData = NULL;
if (ObsFilesList->size() > 0)
{
FileData = ObsFilesList->begin()->second;
const double tolerance = 1e-9; // to handle floating point precision when DTstartR and FileData->Dt1 are effectively equal but have slightly different precision and then entered the first if statement below.

if (fabs(DTstartR - FileData->Dt1) < tolerance) { // check if effectively equal

LogMessageX("DTstartR and FileData->Dt1 are effectively equal but there still may be a small difference due to floating point precision");

} else if (DTstartR < FileData->Dt1 - tolerance) {

if (DTstartR < FileData->Dt1) {
LogMessageX("Start Time before first Observation");
GoodRun = false;
}
Expand Down
3 changes: 3 additions & 0 deletions crhmcode/src/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ add_library(modules OBJECT
ClassBasin.cpp
Classbrushintcp.cpp
Classcalcsun.cpp
ClassCanSnobalBase.cpp
ClassCanSnobalCRHM.cpp
Classcontribution.cpp
Classcrack.cpp
ClassCRHMCanopy.cpp
ClassCRHMCanopyClearing.cpp
ClassCRHMCanopyClearingGap.cpp
ClassCRHMCanopyVectorBased.cpp
Classebsm.cpp
Classevap_Resist.cpp
Classevap.cpp
Expand Down
20 changes: 20 additions & 0 deletions crhmcode/src/modules/ClassCRHMCanopyClearingGap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ void ClassCRHMCanopyClearingGap::decl(void) {

declobs("Qlosn", TDim::NHRU, "reflected long-wave at surface", "(W/m^2)", &Qlosn);

// declreadobs("obs_snow_load", TDim::NHRU, "Weighed tree canopy snow load", "(kg/m^2)", &obs_snow_load, HRU_OBS_misc);

// declared variables

decldiag("k", TDim::NHRU, "extinction coefficient", "()", &k);
Expand Down Expand Up @@ -247,6 +249,16 @@ void ClassCRHMCanopyClearingGap::run(void){

for (hh = 0; chkStruct(); ++hh){

// uncomment below to hop to specific time in debug

// string test = StandardConverterUtility::GetDateTimeInString(Global::DTnow);

// if (test == "3/14/2023 11:0") {
// // if (test == "3/26/2023 15:0") { // TOP OF THE HOUR IS ONE ZERO
// // if (test == "10/1/2021 0:15") {
// std::cout << "Breakpoint here: Date matched" << std::endl;
// }

switch (variation){
case VARIATION_ORG:
Qsi_ = Qsi[hh];
Expand Down Expand Up @@ -661,6 +673,14 @@ void ClassCRHMCanopyClearingGap::run(void){
net_p[hh] = net_rain[hh] + net_snow[hh];
cum_net_rain[hh] += net_rain[hh];
cum_net_snow[hh] += net_snow[hh];

// // set assimilate observed snow load for begining of select events
// if(obs_snow_load[hh] < 9999){
// Snow_load[hh] = obs_snow_load[hh];
// SUnload[hh] = 0.0;
// SUnload_H2O[hh] = 0.0;
// Subl_Cpy[hh] = 0.0;
// }
} // end for
}

Expand Down
2 changes: 2 additions & 0 deletions crhmcode/src/modules/ClassCRHMCanopyClearingGap.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ double *Qnsn { NULL };
double *Qsisn { NULL };
double *Qlisn { NULL };
double *Qlosn { NULL };
const double *obs_snow_load { NULL };


// put variables

Expand Down
Loading