Skip to content

Conversation

jimmielin
Copy link
Member

Tag name (required for release branches):
Originator(s): @jimmielin

Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number):

This PR fixes a set of miscellaneous bugs that were preventing a standalone case to run with the SE dycore - namely, the FADIAB compset.

  • Fixes input field read error (on dynamics INI grid) for all 3-D variables
    Previously the model would crash when reading any 3-D field in ncdata with the SE dycore
INFLD_REAL8_3D: field = U, grid = INI
INFLD_REAL8_3D: field(1:16,0:-1,1:3), file(488,30,1)
 INFLD_REAL8_3D: Mismatch between array bounds and field size for U, dimension 2

the vertical dimension was not being handled correctly in infld_real8_3d. Additionally, a dimensions name check was missing the right index offset.

  • Removes pointer attribute from cam_in and cam_out throughout cam_comp.F90 as this structure no longer has chunks in SIMA.
  • Updates NUOPC atm component to use cam_in and cam_out directly as allocated in physics_types.F90 via the CAM registry. Otherwise there would be
forrtl: severe (408): fort: (7): Attempt to use pointer CAM_OUT when it is not associated with a target
  • Adds FADIAB test on SE dycore. The CAM test uses analytic IC, but I decided to make it read a default ncdata here to have test coverage for this functionality as it was fixed by this PR.

Describe any changes made to build system: N/A

Describe any changes made to the namelist: N/A

List any changes to the defaults for the input datasets (e.g. boundary datasets): N/A

List all files eliminated and why: N/A

List all files added and what they do: N/A

List all existing files that have been modified, and describe the changes:
(Helpful git command: git diff --name-status development...<your_branch_name>)

M       src/control/cam_comp.F90
  - remove pointer from dechunkized cam_in/cam_out

M       src/cpl/nuopc/atm_comp_nuopc.F90
  - use cam_in/cam_out from physics_types, not inline

M       src/utils/cam_field_read.F90
  - fixes to infld_real8_3d

M       cime_config/testdefs/testlist_cam.xml
  - add FADIAB test with read initial condition (for coverage of dycore-enabled ncdata read)

If there are new failures (compared to the test/existing-test-failures.txt file),
have them OK'd by the gatekeeper, note them here, and add them to the file.
If there are baseline differences, include the test and the reason for the
diff. What is the nature of the change? Roundoff?

B4B except new tests

derecho/intel/aux_sima:
SMS_Ln9.ne3pg3_ne3pg3_mg37.FADIAB.derecho_intel.cam-outfrq_se_cslam (Overall: DIFF): new baseline

derecho/gnu/aux_sima:
SMS_Ln9.ne3pg3_ne3pg3_mg37.FADIAB.derecho_gnu.cam-outfrq_se_cslam (Overall: DIFF): new baseline

If this changes climate describe any run(s) done to evaluate the new
climate in enough detail that it(they) could be reproduced:

CAM-SIMA date used for the baseline comparison tests if different than latest:

…om physics data. Add FADIAB test

Update comment
@jimmielin jimmielin self-assigned this Sep 11, 2025
@jimmielin jimmielin added the bug-fix This PR was created to fix a specific bug. label Sep 11, 2025
@nusbaume nusbaume self-requested a review September 12, 2025 15:56
Copy link
Collaborator

@nusbaume nusbaume left a comment

Choose a reason for hiding this comment

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

Thanks for the bug fixes @jimmielin! I have some questions and cleanup requests, but otherwise it looks good!

Comment on lines 148 to 149
type(cam_out_t) :: cam_out ! Output from CAM to surface
type(cam_in_t) :: cam_in ! Merged input state to CAM
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should these be declared here, or should they be coming from physics_types? Maybe a better question is are these variables needed here at all? It looks like they are only used in a commented-out subroutine call, and my guess is that subroutine could just use cam_in and cam_out directly from physics_types itself if it wanted to.

Copy link
Member Author

Choose a reason for hiding this comment

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

It looks confusing here I think these should be inout arguments since they're passed in from the nuopc coupler. I'll update that part.

I don't know whether they're really needed - there's commented out code as you mentioned and I am not sure how CAM-SIMA will handle restarts (or does it already handle restarts?) -- this and the subsequent various phases have cam_in and cam_out passed as inout but I'm not sure what kind of role they play in CAM-SIMA, it just seems to exactly replicate the subroutine signatures for CAM.

Copy link
Member Author

Choose a reason for hiding this comment

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

All arguments removed or switched to use from physics_types!

Comment on lines 399 to 400
type(cam_out_t), intent(inout) :: cam_out ! Output from CAM to surface
type(cam_in_t), intent(inout) :: cam_in ! Input from surface to CAM
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these arguments actually needed anymore? It doesn't look like they are being used anywhere.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looking at the ESCOMP/CAM version, it appears that there may be uses for these during future development of code which hasn't been ported yet. Your call on whether we keep them or not

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I've removed all of the arguments. There is one that is passed down to the dycore, and I've changed that to a use statement that works.

Comment on lines 567 to 568
type(cam_out_t) :: cam_out ! Output from CAM to surface
type(cam_in_t) :: cam_in ! Input from merged surface to CAM
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these arguments actually needed? They don't appear to be used anywhere in the subroutine.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In ESCOMP/CAM, these variable are used in cam_write_restart. Do we have writing restart implemented in CAM-SIMA yet? If not, and we think this is where restart will happen, then I propose we leave them in

Copy link
Member Author

Choose a reason for hiding this comment

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

A use statement from physics_types will work, so I've removed all the arguments.

use cam_instance , only : cam_instance_init, inst_suffix, inst_index
use cam_comp , only : cam_init, cam_run1, cam_run2, cam_run3, cam_run4, cam_final
use cam_comp , only : cam_timestep_init, cam_timestep_final
use physics_types , only : cam_out_t, cam_in_t
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to bring in cam_out_t and cam_in_t if we are no longer declaring the variables in this module?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, removed!

!
!-----------------------------------------------------------------------
use stepon, only: stepon_run3
use physics_types, only: cam_out ! Output from CAM to surface
Copy link
Member Author

Choose a reason for hiding this comment

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

This is an example that will work instead of passing in through the subroutine. In the end they're all the same object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix This PR was created to fix a specific bug.
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants