-
Notifications
You must be signed in to change notification settings - Fork 21
Feat:Added Minimal energy balance check LE<SW #243
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
base: master
Are you sure you want to change the base?
Conversation
|
The errors in question. LE (455146.497810) > SW (38.862583)
[ERROR] Energy Balance Violation: Year 2004 Day 200 Time 5.00
LE (710213.310786) > SW (68.069040)
[ERROR] Energy Balance Violation: Year 2004 Day 201 Time 5.00
LE (984058.604548) > SW (53.147185)
[ERROR] Energy Balance Violation: Year 2004 Day 202 Time 5.00
LE (787543.295803) > SW (47.431788)
[ERROR] Energy Balance Violation: Year 2004 Day 203 Time 5.00
LE (1220415.852822) > SW (70.941722)
[ERROR] Energy Balance Violation: Year 2004 Day 204 Time 5.00
LE (773667.066133) > SW (31.608062)
[ERROR] Energy Balance Violation: Year 2004 Day 205 Time 5.00
LE (761964.178523) > SW (15.920069)
[ERROR] Energy Balance Violation: Year 2004 Day 206 Time 5.00
LE (519620.480262) > SW (38.342882)
[ERROR] Energy Balance Violation: Year 2004 Day 207 Time 5.00
LE (833680.342935) > SW (89.154889)
[ERROR] Energy Balance Violation: Year 2004 Day 208 Time 5.00
LE (1409106.990897) > SW (62.550772)
[ERROR] Energy Balance Violation: Year 2004 Day 209 Time 5.00
LE (1019626.567380) > SW (70.607376)
[ERROR] Energy Balance Violation: Year 2004 Day 210 Time 5.00
LE (555280.535697) > SW (44.168954)
[ERROR] Energy Balance Violation: Year 2004 Day 211 Time 5.00
LE (1522024.479271) > SW (85.579245)
[ERROR] Energy Balance Violation: Year 2004 Day 212 Time 5.00
LE (1305678.282831) > SW (79.910120)
[ERROR] Energy Balance Violation: Year 2004 Day 213 Time 5.00
LE (1707740.534573) > SW (80.440652)
[ERROR] Energy Balance Violation: Year 2004 Day 214 Time 5.00
LE (1625715.069598) > SW (72.939623)
[ERROR] Energy Balance Violation: Year 2004 Day 215 Time 5.00
LE (1028762.237255) > SW (45.772899)
[ERROR] Energy Balance Violation: Year 2004 Day 216 Time 5.00
LE (1187132.793504) > SW (85.569468)
[ERROR] Energy Balance Violation: Year 2004 Day 217 Time 5.00
LE (970046.928046) > SW (80.814065)
[ERROR] Energy Balance Violation: Year 2004 Day 218 Time 5.00
LE (922001.038964) > SW (52.716467)
[ERROR] Energy Balance Violation: Year 2004 Day 219 Time 5.00
LE (1171778.352125) > SW (91.127273) |
|
@dlebauer I think what is going is since the error seems to be primarily occurring in the early hours of the day.And since the numbers are comically large there seems to be some kind of divide by zero or a number close to 0 edge case where one of the fluxes has used to perform some kind of divison.It feels related to the time aswell.I have not looked into it but that is what it seems to be. |
|
I think this may be related to units. Model reads PAR in units of Einsteins * m^-2 ground area, summed over entire time step. I am not 100% certain what internal units are off hand, but I think this is the conversion PAR * 2.35e5 / 0.486 But please check the math. this is what the conversion looks like in R; can use the comments to explain. I don't think it is necessary to write a function in sipnet for a single assertion. #' Convert PAR (Einsteins m^-2 s^-1) to shortwave radiation
#'
#' TODO take input units as arg
#' Converts photosynthetically active radiation (PAR) expressed as
#' photon flux (Einsteins m^-2 s^-1) to total shortwave radiation
#' (W m^-2). Assumes PAR is 0.486 of total shortwave radiation
#' (Campbell & Norman, 1998).
#'
#' @param par_einstein PAR in Einsteins m^-2 s^-1 (i.e., mol photons m^-2 s^-1).
#' @param par_fraction Fraction of total shortwave in PAR band. Default 0.486.
#' @return Shortwave radiation in W m^-2.
#' @export
#' @examples
#' # 0.001 Einsteins m^-2 s^-1 (1 mmol) -> ~484 W m^-2
#' par2sw(0.001)
par2sw <- function(par_einstein, par_fraction = 0.486) {
# 1 mol photons (Einstein) in PAR ~ 2.35e5 J
par_w_m2 <- par_einstein * 2.35e5
sw_w_m2 <- par_w_m2 / par_fraction
return(sw_w_m2)
}
|
|
Appreciate the reply.I definitely messed up the units.I have applied a fix for it now. |
Summary
0<LE<SW or error,0<LE<alphaSW or warn logic where alpha represents absorbed sw, (1-albedo) and 0.8 is very conservative and can be hard coded,LE=ETlambda where lambda is latent heat of evaporation as laid out in Minimal energy balance check LE<SW #231.
Result:
There is something really weird going on with the latent energy being greater than the shortwave radiation by a huge difference,there seems to be some kind of divide-by-zero or small number instability.It only occurs at early mornings.Even if the check for error is too strict latent energy shouldn't posses such a huge difference.
How to test
Steps to reproduce and verify the change locally:
Step 1:
make clean && makeStep 2:
cd tests/smoke/niwot ../../../sipnet -i sipnet.inRelated issues
Checklist
docs/CHANGELOG.mdupdated with noteworthy changesclang-format(rungit clang-formatif needed)For model structure changes:
\frakturfont formatting fromdocs/model-structure.mdfor implemented featuresNote: See CONTRIBUTING.md for additional guidance. This repository uses automated formatting checks; if the pre-commit hook blocks your commit, run
git clang-formatto format staged changes.