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

Deal with uninitialized variables in MOSART_heat_mod.F90 #5343

Merged
merged 4 commits into from
Dec 14, 2022

Conversation

liho745
Copy link
Contributor

@liho745 liho745 commented Dec 1, 2022

The use of uninitialized variables (i.e., Qsur and Qsub) in the computation of the change of energy
due to heat exchange with the environment and advection is fixed. Currently, it is assumed that those
changes in energy are zero.

Fixes #5332
[BFB]

Copy link
Member

@ambrad ambrad left a comment

Choose a reason for hiding this comment

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

This resolves #5332. I don't have any knowledge of the meaning of the model changes, but my understanding is that these changes do not affect E3SM productions configurations. That is, this is a BFB PR from the perspective of E3SM, right?

@liho745
Copy link
Contributor Author

liho745 commented Dec 1, 2022

This resolves #5332. I don't have any knowledge of the meaning of the model changes, but my understanding is that these changes do not affect E3SM productions configurations. That is, this is a BFB PR from the perspective of E3SM, right?

I'd say yes based on my understanding, but I have not done any BFB test.

@rljacob rljacob removed the request for review from bishtgautam December 1, 2022 17:51
Copy link
Member

@ambrad ambrad left a comment

Choose a reason for hiding this comment

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

I'll approve based on resolution of the issue. I expect this PR to be BFB. @bishtgautam, I suggest you run e3sm_developer on, e.g., Chrysalis to be sure that it is indeed BFB before merging it to next.

Copy link
Contributor

@bishtgautam bishtgautam left a comment

Choose a reason for hiding this comment

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

Minor code clean up changes requested.

components/mosart/src/riverroute/MOSART_heat_mod.F90 Outdated Show resolved Hide resolved
components/mosart/src/riverroute/MOSART_heat_mod.F90 Outdated Show resolved Hide resolved
components/mosart/src/riverroute/MOSART_heat_mod.F90 Outdated Show resolved Hide resolved
@bishtgautam
Copy link
Contributor

@ambrad Typically, the developer is responsible for running the regression test suite and ensuring the test suite's results are as expected.

@rljacob rljacob added this to the v2.1rc milestone Dec 1, 2022
@liho745
Copy link
Contributor Author

liho745 commented Dec 2, 2022

@ambrad Typically, the developer is responsible for running the regression test suite and ensuring the test suite's results are as expected.

I have addressed the comments from @bishtgautam, and performed the E3SM land developer's tests on Compy -- all passed with BFB.

@bishtgautam bishtgautam self-requested a review December 2, 2022 17:32
@bishtgautam
Copy link
Contributor

@liho745 I have edited the first comment of this PR, which will be copied/pasted as the merge commit message. For the record, below is the original first comment

In MOSART_heat_mod.F90, Qsur and Qsub were not initialized before using them in Line 91. Lines 91 and 92 calculate deltaM_t and deltaH_t that are actually not used in the later calculations, i.e., since here a simplified approach is used to calculate the stream temperature instead of the energy balance approach. I commented off Qsur and Qsub and made another couple of minor changes. A global test run was performed with the IELM compset and r05_r05 grids, and heatflag was set to true. The simulated stream temperature seems reasonable in terms of magnitude and spatial patterns.

@bishtgautam
Copy link
Contributor

@liho745 How about also adding a test for this stealth feature?

@liho745
Copy link
Contributor Author

liho745 commented Dec 2, 2022

@liho745 I have edited the first comment of this PR, which will be copied/pasted as the merge commit message. For the record, below is the original first comment

In MOSART_heat_mod.F90, Qsur and Qsub were not initialized before using them in Line 91. Lines 91 and 92 calculate deltaM_t and deltaH_t that are actually not used in the later calculations, i.e., since here a simplified approach is used to calculate the stream temperature instead of the energy balance approach. I commented off Qsur and Qsub and made another couple of minor changes. A global test run was performed with the IELM compset and r05_r05 grids, and heatflag was set to true. The simulated stream temperature seems reasonable in terms of magnitude and spatial patterns.

Sounds good.

@liho745
Copy link
Contributor Author

liho745 commented Dec 2, 2022

@liho745 How about also adding a test for this stealth feature?

I don't quite follow. Can you elaborate?

@bishtgautam
Copy link
Contributor

Add a new test (say ERS.<RES>.<COMPSET>.mosart-heat) in the e3sm_mosart_developer test suite in tests.py#L13 and add a corresponding new heat directory in components/mosart/cime_config/testdefs/testmods_dirs/mosart. Does that make sense?

@hydrotian
Copy link
Contributor

hydrotian commented Dec 2, 2022

@liho745 I wrote a document about adding a new ELM test last year. Hope the information is still up to date.

@liho745
Copy link
Contributor Author

liho745 commented Dec 4, 2022

Many thanks! I have added a new test for MOSART-heat, and passed the baseline tests BFB.

@@ -13,13 +13,21 @@
"e3sm_mosart_developer" : {
"share" : True,
"time" : "0:45:00",
"inherit" : ("e3sm_mosart_heat"),
Copy link
Contributor

@bishtgautam bishtgautam Dec 5, 2022

Choose a reason for hiding this comment

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

@liho745 Thanks for adding a new test. Instead of creating a new test suite (i.e. e3sm_mosart_heat), please directly add the new test in the e3sm_mosart_developer test suite at https://github.com/E3SM-Project/E3SM/pull/5343/files#diff-e2fbf220fd98012c3bdf61d7f341a1815f43823af2ffd3bf926d5aafc4363d8bR20. Does it make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually not quite -- I followed the example of the sediment test added by Donghui Xu, where he created a mosart-sediment separately and then inherited it in the e3sm_mosart_developer suite. Are there any considerations to treating sediment and heat differently in the testing?

Copy link
Contributor

Choose a reason for hiding this comment

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

I will have to revisit the approach taken for the sediment test when I re-merge that PR into next. To avoid creating many new test suites, directly add ERS.r05_r05.RMOSGPCC.mosart-heat in the e3sm_mosart_developer test suite.

Copy link
Contributor Author

@liho745 liho745 Dec 7, 2022

Choose a reason for hiding this comment

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

It has to be created as a sub-suite and then called from the main e3sm_mosart_developer suite, since in this mosart-heat test we are turning on heatflag which is set to .false. by default in the other test cases. I have discussed this with Donghui about the reason he created a mosart-sediment test as a sub-suite, and I quote from him "mosart-sediment cannot run with other test cases with the same build". Similarly, in my case, if I create a mosart-heat case directly within e3sm_mosart_developer suite, the tests will just fail for mosart-heat.

It seems at least more discussion is needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I quote from him "mosart-sediment cannot run with other test cases with the same build".

Okay, I now recall this issue with mosart sediment. Does your mosart heat test need different build flags (not namelist flags) than those tests in the e3sm_mosart_developer test suite?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I have to turn on heatflag via user_nl_mosart.

Copy link
Contributor

Choose a reason for hiding this comment

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

That is a namelist flag and not a build flag (e.g. -DUSE_PETSC_LIB), which is used when compiling various *.F90. Thus, you should be able to directly add the new test in the e3sm_mosart_developer test suite.

Copy link
Contributor Author

@liho745 liho745 Dec 8, 2022

Choose a reason for hiding this comment

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

That is a namelist flag and not a build flag (e.g. -DUSE_PETSC_LIB), which is used when compiling various *.F90. Thus, you should be able to directly add the new test in the e3sm_mosart_developer test suite.

I tried what you said, and the test results are below, i.e., the baseline test failed.

ERS.r05_r05.RMOSGPCC.compy_intel.mosart-heat (Overall: DIFF) details:
PASS ERS.r05_r05.RMOSGPCC.compy_intel.mosart-heat CREATE_NEWCASE
PASS ERS.r05_r05.RMOSGPCC.compy_intel.mosart-heat XML
PASS ERS.r05_r05.RMOSGPCC.compy_intel.mosart-heat SETUP
PASS ERS.r05_r05.RMOSGPCC.compy_intel.mosart-heat SHAREDLIB_BUILD time=277
FAIL ERS.r05_r05.RMOSGPCC.compy_intel.mosart-heat NLCOMP
PASS ERS.r05_r05.RMOSGPCC.compy_intel.mosart-heat MODEL_BUILD time=212
PASS ERS.r05_r05.RMOSGPCC.compy_intel.mosart-heat SUBMIT
PASS ERS.r05_r05.RMOSGPCC.compy_intel.mosart-heat RUN time=51
PASS ERS.r05_r05.RMOSGPCC.compy_intel.mosart-heat COMPARE_base_rest
FAIL ERS.r05_r05.RMOSGPCC.compy_intel.mosart-heat BASELINE 21ffb4d: ERROR BFAIL baseline directory '/compyfs/liho623/e3sm_scratch/e3sm_baseline/21ffb4d/ERS.r05_r05.RMOSGPCC.compy_intel.mosart-heat' does not exist
PASS ERS.r05_r05.RMOSGPCC.compy_intel.mosart-heat MEMLEAK
PASS ERS.r05_r05.RMOSGPCC.compy_intel.mosart-heat SHORT_TERM_ARCHIVER

Copy link
Contributor

Choose a reason for hiding this comment

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

The above failure is okay because the baseline for this new test doesn't exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. Added the mosart-heat test directly into the e3sm_mosart_developer suite.

bishtgautam added a commit that referenced this pull request Dec 13, 2022
The use of uninitialized variables (i.e., `Qsur` and `Qsub`) in the computation of the change of energy
due to heat exchange with the environment and advection is fixed. Currently, it is assumed that those
changes in energy are zero.

Fixes #5332
[BFB]
@bishtgautam
Copy link
Contributor

Merged to next

@bishtgautam bishtgautam merged commit 0273cfa into master Dec 14, 2022
@bishtgautam bishtgautam deleted the hongyili/mosart/mosart_heat_v3 branch December 14, 2022 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MOSART: Use of uninitialized variable
5 participants