Skip to content

Conversation

@samsrabin
Copy link
Member

@samsrabin samsrabin commented Apr 25, 2025

Corresponding ctsm-docs PR: ESCOMP/ctsm-docs#11

billsacks and others added 30 commits March 17, 2025 18:04
ESMF was being repeatedly initialized in unittestTimeManagerMod.F90,
which is an error. This led to unit tests failing silently. This commit
fixes the issue by checking if ESMF is already initialized before
calling ESMF_Initialize, and not calling ESMF_Finalize at the end of
each unit test.

Currently this skips any calls to ESMF_Finalize, as it is an error to
re-call ESMF_Initialize after calling ESMF_Finalize. A better solution
would be to only call ESMF_Initialize and ESMF_Finalize once per unit
test executable. I am looking into whether that's possible. I'm not sure
if it will cause any problems to not do the ESMF_Finalize.

See ESCOMP#3015 (comment)
for details.

Resolves ESCOMP#3015
Without this change, the unit tests of clm_time_manager were aborting
due to trying to destroy an ESMF clock that hadn't been initialized.
Other pieces of this reset routine don't appear to be causing problems,
but it seems most robust to just skip the whole thing if the time
manager hasn't been initialized.
There is a behavior difference between the real ESMF library and the
ESMF WRF Timemgr we had been using previously, in how prevTime is
defined: the ESMF WRF Timemgr defined prevTime using a -dtime offset
from currTime; the real ESMF library instead defines prevTime by
tracking the previous value of currTime. Therefore, now that we are
using the real ESMF library, if a unit test relies on prevTime (as is
the case, for example, with test_year_position_start_of_timestep in
test_dynTimeInfo.pf), it is now important that any setting of the time
be done in a way such that there is a call to ESMF_ClockAdvance, since
that is the only way that prevTime will get set correctly. Thus, this
commit updates the implementation of for_test_set_curr_date so that it
involves a call to ESMF_ClockAdvance.

Making this change in the implementation of for_test_set_curr_date also
required some other changes in some unit test code:
- I needed to remove the call to unittest_timemgr_set_curr_date at the
  end of unittest_timemgr_setup. This call now leads to an increment of
  the time step count, which was causing failures in some time manager
  tests that check the time step count. And it turns out that (at least
  with the other changes here), the call to
  unittest_timemgr_set_curr_date was unnecessary: it wasn't actually
  leading to any change in time from what was set in the initialization
  of the time manager.
- I needed to change some set_date calls to use a year of 2 instead of
  1. This is needed for calls setting the date to January 1 and the time
  to 0: It is no longer allowed to set the date to yr,mon,day,tod =
  1,1,1,0, because the new method sets the date/time to one time step
  earlier and then advances the clock, and it is illegal to set the
  date/time to one time step before 1,1,1,0.
'stop' calls were leading to pFUnit passes instead of fails. Need to
either have shr_sys_abort (which raises a pFUnit exception) or stop with
a non-zero integer return value (which causes the program to stop with
an error code).
…aramfile in the case directory"

This reverts commit 0e6eed5.
* Require that user specify whether longitude is in [-180, 180] format (i.e., centered around Prime Meridian) or [0, 360] format (i.e., centered around International Date Line).
* Specified as --lon-type, either 180 or 360 (respectively)
* Resolves ESCOMP#2017
* Resolves ESCOMP#3001
@samsrabin samsrabin added the bfb bit-for-bit label Apr 25, 2025
@samsrabin samsrabin self-assigned this Apr 25, 2025
@wwieder wwieder self-requested a review April 25, 2025 14:25
@samsrabin samsrabin moved this from Ready to start (or start again) to In progress - master in CTSM: Upcoming tags Apr 25, 2025
@github-project-automation github-project-automation bot moved this to Ready to start (or start again) in CTSM: Upcoming tags Apr 25, 2025
@samsrabin samsrabin merged commit e0104b9 into ESCOMP:master Apr 25, 2025
4 checks passed
@github-project-automation github-project-automation bot moved this from In progress - master to Done (non release/external) in CTSM: Upcoming tags Apr 25, 2025
slevis-lmwg added a commit to slevis-lmwg/ctsm that referenced this pull request May 9, 2025
Merge b4bdev 20250509

Updates to the b4b-dev branch since its last merge to master (PRs ESCOMP#3091 ESCOMP#3092), as shown by git log:

- Merge pull request Update docs infrastructure ESCOMP#2809 from samsrabin/update-docs-builder-2
  Update docs infrastructure
- Merge pull request Update externals to cesm3_0_alpha06c ESCOMP#3106 from ekluzek/update_to_alpha06c
  Update externals to cesm3_0_alpha06c
- Merge pull request User control over snow thermal conductivity scheme over glaciers ESCOMP#3072 from wwieder/JordanGlacier
  User control over snow thermal conductivity scheme over glaciers
ekluzek added a commit to ekluzek/CTSM that referenced this pull request May 9, 2025
Merge b4bdev 20250509

Updates to the b4b-dev branch since its last merge to master (PRs ESCOMP#3091 ESCOMP#3092), as shown by git log:

- Merge pull request Update docs infrastructure ESCOMP#2809 from samsrabin/update-docs-builder-2
  Update docs infrastructure
- Merge pull request Update externals to cesm3_0_alpha06c ESCOMP#3106 from ekluzek/update_to_alpha06c
  Update externals to cesm3_0_alpha06c
- Merge pull request User control over snow thermal conductivity scheme over glaciers ESCOMP#3072 from wwieder/JordanGlacier
  User control over snow thermal conductivity scheme over glaciers

 Conflicts:
	src/biogeochem/CNFireNoFireMod.F90
slevis-lmwg added a commit to slevis-lmwg/ctsm that referenced this pull request May 10, 2025
Merge b4bdev 20250509

Updates to the b4b-dev branch since its last merge to master (PRs ESCOMP#3091 ESCOMP#3092), as shown by git log:

- Merge pull request Update docs infrastructure ESCOMP#2809 from samsrabin/update-docs-builder-2
  Update docs infrastructure
- Merge pull request Update externals to cesm3_0_alpha06c ESCOMP#3106 from ekluzek/update_to_alpha06c
  Update externals to cesm3_0_alpha06c
- Merge pull request User control over snow thermal conductivity scheme over glaciers ESCOMP#3072 from wwieder/JordanGlacier
  User control over snow thermal conductivity scheme over glaciers
samsrabin added a commit to samsrabin/CTSM that referenced this pull request May 12, 2025
Merge b4bdev 20250509

Updates to the b4b-dev branch since its last merge to master (PRs ESCOMP#3091 ESCOMP#3092), as shown by git log:

- Merge pull request Update docs infrastructure ESCOMP#2809 from samsrabin/update-docs-builder-2
  Update docs infrastructure
- Merge pull request Update externals to cesm3_0_alpha06c ESCOMP#3106 from ekluzek/update_to_alpha06c
  Update externals to cesm3_0_alpha06c
- Merge pull request User control over snow thermal conductivity scheme over glaciers ESCOMP#3072 from wwieder/JordanGlacier
  User control over snow thermal conductivity scheme over glaciers
glemieux added a commit to glemieux/ctsm that referenced this pull request May 12, 2025
Merge b4bdev 20250509

Updates to the b4b-dev branch since its last merge to master (PRs ESCOMP#3091 ESCOMP#3092), as shown by git log:

- Merge pull request Update docs infrastructure ESCOMP#2809 from samsrabin/update-docs-builder-2
  Update docs infrastructure
- Merge pull request Update externals to cesm3_0_alpha06c ESCOMP#3106 from ekluzek/update_to_alpha06c
  Update externals to cesm3_0_alpha06c
- Merge pull request User control over snow thermal conductivity scheme over glaciers ESCOMP#3072 from wwieder/JordanGlacier
  User control over snow thermal conductivity scheme over glaciers
samsrabin added a commit to samsrabin/CTSM that referenced this pull request May 14, 2025
Merge b4bdev 20250509

Updates to the b4b-dev branch since its last merge to master (PRs ESCOMP#3091 ESCOMP#3092), as shown by git log:

- Merge pull request Update docs infrastructure ESCOMP#2809 from samsrabin/update-docs-builder-2
  Update docs infrastructure
- Merge pull request Update externals to cesm3_0_alpha06c ESCOMP#3106 from ekluzek/update_to_alpha06c
  Update externals to cesm3_0_alpha06c
- Merge pull request User control over snow thermal conductivity scheme over glaciers ESCOMP#3072 from wwieder/JordanGlacier
  User control over snow thermal conductivity scheme over glaciers
slevis-lmwg added a commit to slevis-lmwg/ctsm that referenced this pull request May 14, 2025
Merge b4bdev 20250509

Updates to the b4b-dev branch since its last merge to master (PRs ESCOMP#3091 ESCOMP#3092), as shown by git log:

- Merge pull request Update docs infrastructure ESCOMP#2809 from samsrabin/update-docs-builder-2
  Update docs infrastructure
- Merge pull request Update externals to cesm3_0_alpha06c ESCOMP#3106 from ekluzek/update_to_alpha06c
  Update externals to cesm3_0_alpha06c
- Merge pull request User control over snow thermal conductivity scheme over glaciers ESCOMP#3072 from wwieder/JordanGlacier
  User control over snow thermal conductivity scheme over glaciers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bfb bit-for-bit

Projects

Status: Done (non release/external)

Development

Successfully merging this pull request may close these issues.

5 participants