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

Fixed bug where totalET & netRadiation were incorrectly written to output #487

Merged
merged 2 commits into from
Oct 12, 2021

Conversation

wknoben
Copy link
Collaborator

@wknoben wknoben commented Aug 19, 2021

Affected variables are scalarTotalET and scalarNetRadiation, which were correctly calculated but incorrectly written to output files on timesteps where no vegetation calculations were performed.

Make sure all the relevant boxes are checked (and only check the box if you actually completed the step):

Issue

In niche cases, variables scalarTotalET and scalarNetRadiation get calcualted correctly as part of the opSplittin routine but not copied from the temporary data structure flux_temp (used by systemSolve and underlying processes) into the main data structure flux_data used to write output files and carry data over between timesteps. This is because these variables were originally only identified as iname_nrgCanopy in flxMapping which is used to determine which variables to copy from the temporary structure into the main structure, and iname_nrgCanopy variables are not copied from temp to data in cases where no canopy energy calculations are performed. Identifying both variables also as iname_nrgLayer ensures that they are copied correctly in all cases.

Equations

scalarTotalET:

https://github.com/NCAR/summa/blob/372c3fbeb3825e3b3d635461a8e552f9f0895aec/build/source/engine/vegNrgFlux.f90#L1441

scalarNetRadiation:

https://github.com/NCAR/summa/blob/372c3fbeb3825e3b3d635461a8e552f9f0895aec/build/source/engine/vegNrgFlux.f90#L1442

Tests

Standard test cases

I added scalarTotalET, scalarNetRadiation and their constitutive variables to the standard test case outputs to ensure results remain consistent for these variables. The conditions under which this bug appears are present in 7/34 test cases:

Test   0 - Filename celia1990_testSumma_timestep.nc                                  - changes expected on      0 time steps.
Test   1 - Filename colbeck1976-exp1_testSumma_timestep.nc                           - changes expected on      0 time steps.
Test   2 - Filename colbeck1976-exp2_testSumma_timestep.nc                           - changes expected on      0 time steps.
Test   3 - Filename colbeck1976-exp3_testSumma_timestep.nc                           - changes expected on      0 time steps.
Test   4 - Filename millerClay_testSumma_timestep.nc                                 - changes expected on      0 time steps.
Test   5 - Filename millerLoam_testSumma_timestep.nc                                 - changes expected on      0 time steps.
Test   6 - Filename millerSand_testSumma_timestep.nc                                 - changes expected on      0 time steps.
Test   7 - Filename mizoguchi1990_testSumma_timestep.nc                              - changes expected on      0 time steps.
Test   8 - Filename vanderborght2005_exp1_testSumma_timestep.nc                      - changes expected on      0 time steps.
Test   9 - Filename vanderborght2005_exp2_testSumma_timestep.nc                      - changes expected on      0 time steps.
Test  10 - Filename vanderborght2005_exp3_testSumma_timestep.nc                      - changes expected on      0 time steps.
Test  11 - Filename syntheticHillslope-exp1_testSumma_timestep.nc                    - changes expected on  50350 time steps.
Test  12 - Filename syntheticHillslope-exp2_testSumma_timestep.nc                    - changes expected on  50350 time steps.
Test  13 - Filename vegImpactsRad_riparianAspenBeersLaw_timestep.nc                  - changes expected on      0 time steps.
Test  14 - Filename vegImpactsRad_riparianAspenCLM2stream_timestep.nc                - changes expected on      0 time steps.
Test  15 - Filename vegImpactsRad_riparianAspenNLscatter_timestep.nc                 - changes expected on      0 time steps.
Test  16 - Filename vegImpactsRad_riparianAspenUEB2stream_timestep.nc                - changes expected on      0 time steps.
Test  17 - Filename vegImpactsRad_riparianAspenVegParamPerturb_timestep.nc           - changes expected on      0 time steps.
Test  18 - Filename vegImpactsWind_riparianAspenWindParamPerturb_timestep.nc         - changes expected on      0 time steps.
Test  19 - Filename vegImpactsWind_riparianAspenExpWindProfile_timestep.nc           - changes expected on      0 time steps.
Test  20 - Filename storckSite_hedpom9697_timestep.nc                                - changes expected on      0 time steps.
Test  21 - Filename storckSite_hedpom9798_timestep.nc                                - changes expected on      0 time steps.
Test  22 - Filename storckSite_storck9697_timestep.nc                                - changes expected on      0 time steps.
Test  23 - Filename storckSite_storck9798_timestep.nc                                - changes expected on      0 time steps.
Test  24 - Filename albedoTest_reynoldsConstantDecayRate_timestep.nc                 - changes expected on   1946 time steps.
Test  25 - Filename albedoTest_reynoldsVariableDecayRate_timestep.nc                 - changes expected on   1959 time steps.
Test  26 - Filename albedoTest_senatorConstantDecayRate_timestep.nc                  - changes expected on   3035 time steps.
Test  27 - Filename albedoTest_senatorVariableDecayRate_timestep.nc                  - changes expected on   3105 time steps.
Test  28 - Filename vegImpactsTranspire_ballBerry_timestep.nc                        - changes expected on      0 time steps.
Test  29 - Filename vegImpactsTranspire_jarvis_timestep.nc                           - changes expected on      0 time steps.
Test  30 - Filename vegImpactsTranspire_simpleResistance_timestep.nc                 - changes expected on      0 time steps.
Test  31 - Filename vegImpactsTranspire_perturbRoots_timestep.nc                     - changes expected on      0 time steps.
Test  32 - Filename basinRunoff_1dRichards_timestep.nc                               - changes expected on      0 time steps.
Test  33 - Filename basinRunoff_distributedTopmodel_timestep.nc                      - changes expected on  35792 time steps.
Test  34 - Filename basinRunoff_lumpedTopmodel_timestep.nc                           - changes expected on      0 time steps.

Test cases complete bit-4-bit identical where expected and deviate in only scalarTotalET and/or scalarNetRadiation where expected:

Test   0 - Filename: celia1990_testSumma_timestep.nc                                  - Total difference: 0.0
Test   1 - Filename: colbeck1976-exp1_testSumma_timestep.nc                           - Total difference: 0.0
Test   2 - Filename: colbeck1976-exp2_testSumma_timestep.nc                           - Total difference: 0.0
Test   3 - Filename: colbeck1976-exp3_testSumma_timestep.nc                           - Total difference: 0.0
Test   4 - Filename: millerClay_testSumma_timestep.nc                                 - Total difference: 0.0
Test   5 - Filename: millerLoam_testSumma_timestep.nc                                 - Total difference: 0.0
Test   6 - Filename: millerSand_testSumma_timestep.nc                                 - Total difference: 0.0
Test   7 - Filename: mizoguchi1990_testSumma_timestep.nc                              - Total difference: 0.0
Test   8 - Filename: vanderborght2005_exp1_testSumma_timestep.nc                      - Total difference: 0.0
Test   9 - Filename: vanderborght2005_exp2_testSumma_timestep.nc                      - Total difference: 0.0
Test  10 - Filename: vanderborght2005_exp3_testSumma_timestep.nc                      - Total difference: 0.0

Test  11 - Variable: scalarNetRadiation                                               -       difference: 1657622.1487927483
Test  11 - Variable: scalarTotalET                                                    -       difference: 0.15835834201014903
Test  11 - Filename: syntheticHillslope-exp1_testSumma_timestep.nc                    - Total difference: 1657622.3071510904

Test  12 - Variable: scalarNetRadiation                                               -       difference: 1682531.8951496314
Test  12 - Variable: scalarTotalET                                                    -       difference: 0.23157308335481688
Test  12 - Filename: syntheticHillslope-exp2_testSumma_timestep.nc                    - Total difference: 1682532.1267227149

Test  13 - Filename: vegImpactsRad_riparianAspenBeersLaw_timestep.nc                  - Total difference: 0.0
Test  14 - Filename: vegImpactsRad_riparianAspenCLM2stream_timestep.nc                - Total difference: 0.0
Test  15 - Filename: vegImpactsRad_riparianAspenNLscatter_timestep.nc                 - Total difference: 0.0
Test  16 - Filename: vegImpactsRad_riparianAspenUEB2stream_timestep.nc                - Total difference: 0.0
Test  17 - Filename: vegImpactsRad_riparianAspenVegParamPerturb_timestep.nc           - Total difference: 0.0
Test  18 - Filename: vegImpactsWind_riparianAspenWindParamPerturb_timestep.nc         - Total difference: 0.0
Test  19 - Filename: vegImpactsWind_riparianAspenExpWindProfile_timestep.nc           - Total difference: 0.0
Test  20 - Filename: storckSite_hedpom9697_timestep.nc                                - Total difference: 0.0
Test  21 - Filename: storckSite_hedpom9798_timestep.nc                                - Total difference: 0.0
Test  22 - Filename: storckSite_storck9697_timestep.nc                                - Total difference: 0.0
Test  23 - Filename: storckSite_storck9798_timestep.nc                                - Total difference: 0.0

Test  24 - Variable: scalarNetRadiation                                               -       difference: 205263.99951329286
Test  24 - Filename: albedoTest_reynoldsConstantDecayRate_timestep.nc                 - Total difference: 205263.99951329286

Test  25 - Variable: scalarNetRadiation                                               -       difference: 202325.35318500453
Test  25 - Filename: albedoTest_reynoldsVariableDecayRate_timestep.nc                 - Total difference: 202325.35318500453

Test  26 - Variable: scalarNetRadiation                                               -       difference: 349072.86124327383
Test  26 - Filename: albedoTest_senatorConstantDecayRate_timestep.nc                  - Total difference: 349072.86124327383

Test  27 - Variable: scalarNetRadiation                                               -       difference: 358963.3451640433
Test  27 - Filename: albedoTest_senatorVariableDecayRate_timestep.nc                  - Total difference: 358963.3451640433

Test  28 - Filename: vegImpactsTranspire_ballBerry_timestep.nc                        - Total difference: 0.0
Test  29 - Filename: vegImpactsTranspire_jarvis_timestep.nc                           - Total difference: 0.0
Test  30 - Filename: vegImpactsTranspire_simpleResistance_timestep.nc                 - Total difference: 0.0
Test  31 - Filename: vegImpactsTranspire_perturbRoots_timestep.nc                     - Total difference: 0.0
Test  32 - Filename: basinRunoff_1dRichards_timestep.nc                               - Total difference: 0.0

Test  33 - Variable: scalarNetRadiation                                               -       difference: 3713424.848170898
Test  33 - Filename: basinRunoff_distributedTopmodel_timestep.nc                      - Total difference: 3713424.848170898

Test  34 - Filename: basinRunoff_lumpedTopmodel_timestep.nc                           - Total difference: 0.0

Additional tests

Using a test case with known periods of zero SAI & LAI, and thus no canopy energy calculations, shows that these fixes lead to correct reporting of scalarTotalET and scalarNetRadiation in output files.

bugfix_scalarTotalET

bugfix_scalarNetRadiation

…ic cases

Affected variables are scalarTotalET and scalarNetRadiation, which were correctly calculated but incorrectly written to output files on timesteps where no vegetation calculations were performed
Copy link
Collaborator

@andywood andywood left a comment

Choose a reason for hiding this comment

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

this looks fine, has been tested, affect diagnostic output rather than prognostics. ok to merge.

@martynpclark martynpclark merged commit 329d66a into CH-Earth:develop Oct 12, 2021
@wknoben wknoben mentioned this pull request Feb 22, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

scalarTotalET sometimes not being calculated correctly
3 participants