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

Add initialisation routine for offline drivers #440

Merged
merged 5 commits into from
Nov 7, 2024

Conversation

SeanBryan51
Copy link
Collaborator

@SeanBryan51 SeanBryan51 commented Oct 29, 2024

Whilst looking into merging the MPI master and worker drivers (#358), @micaeljtoliveira and I have identified that the model initialisation logic is duplicated across all drivers (serial and MPI master/worker). This change adds a preliminary initialisation routine to remove code duplication and improve code clarity across each of the drivers. The remaining initialisation code in the offline drivers will be moved to this routine in later pull requests to clean up the drivers further.

Checklist

  • The new content is accessible and located in the appropriate section.
  • I have checked that links are valid and point to the intended content.
  • I have checked my code/text and corrected any misspellings

📚 Documentation preview 📚: https://cable--440.org.readthedocs.build/en/440/

Copy link
Contributor

@micaeljtoliveira micaeljtoliveira left a comment

Choose a reason for hiding this comment

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

@SeanBryan51 Overall looks good!

Most of my comments are quite general and, at this point, they are all optional.

src/offline/cable_driver_init.F90 Show resolved Hide resolved
src/offline/cable_driver_init.F90 Show resolved Hide resolved
src/offline/cable_driver_init.F90 Show resolved Hide resolved
src/offline/cable_mpicommon.F90 Show resolved Hide resolved
@SeanBryan51 SeanBryan51 marked this pull request as ready for review October 31, 2024 06:11
Copy link
Contributor

@micaeljtoliveira micaeljtoliveira left a comment

Choose a reason for hiding this comment

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

I think the issue with the CMake mentioned above needs to be fixed before merging this.

@SeanBryan51 SeanBryan51 requested a review from ccarouge November 1, 2024 04:42
@SeanBryan51 SeanBryan51 force-pushed the 425-offline-driver-initialisation-refactor branch from 337142c to 0af4a0f Compare November 6, 2024 23:57
@SeanBryan51 SeanBryan51 force-pushed the 425-offline-driver-initialisation-refactor branch from 0af4a0f to f02dc3b Compare November 7, 2024 00:50
@SeanBryan51
Copy link
Collaborator Author

Testing with benchcab fluxsite -v shows this branch bitwise reproduces model outputs from the main branch:

PBS log file:

2024-11-07 12:29:39,954 - INFO - benchcab.benchcab.py:369 - Running comparison tasks...
2024-11-07 12:29:39,977 - INFO - benchcab.benchcab.py:370 - tasks: 168 (models: 2, sites: 42, science configurations: 4)
2024-11-07 12:32:37,432 - INFO - benchcab.benchcab.py:381 - 0 failed, 168 passed

Benchcab version: 4.1.0

config.yaml:

realisations:
  - repo:
      git:
        branch: main
  - repo:
      git:
        branch: 425-offline-driver-initialisation-refactor

modules: [
  intel-compiler/2021.1.1,
  netcdf/4.7.4,
  openmpi/4.1.0
]

@SeanBryan51 SeanBryan51 merged commit f1bc23a into main Nov 7, 2024
7 checks passed
@SeanBryan51 SeanBryan51 deleted the 425-offline-driver-initialisation-refactor branch November 7, 2024 01:48
SeanBryan51 added a commit that referenced this pull request Nov 25, 2024
This change further consolidates the initialisation logic within the
offline drivers to remove code duplication and improve code clarity
across each of the drivers (see #425, #440 and #469).

As part of the refactoring changes, new optional namelist options
(`filename%new_sumbal` and `filename%trunk_sumbal`) are introduced to
replace hard coded filenames and optional namelist option `CASAonly` is
restored for consistency with the documentation.

## Type of change

- [x] Code refactor
- [x] New feature
- [x] New or updated documentation

## Checklist

- [x] The new content is accessible and located in the appropriate
section.
- [x] I have checked that links are valid and point to the intended
content.
- [x] I have checked my code/text and corrected any misspellings

<!-- readthedocs-preview cable start -->
----
📚 Documentation preview 📚:
https://cable--472.org.readthedocs.build/en/472/

<!-- readthedocs-preview cable end -->
SeanBryan51 added a commit that referenced this pull request Nov 29, 2024
…#498)

This change further consolidates the initialisation logic within the
offline drivers (in particular logic related to `cable_user%MetType`) to
remove code duplication and improve code clarity across each of the
drivers (see #425, #440, #469 and #472).

As part of the refactoring changes, the `cable_user%MetType = 'gpgs'`
namelist parameter is deprecated as it is equivalent to setting
`cable_user%MetType = 'gswp'` and `leaps = .TRUE.`.

## Type of change

- [x] Code refactor
- [x] New or updated documentation

## Checklist

- [x] The new content is accessible and located in the appropriate
section.
- [x] I have checked that links are valid and point to the intended
content.
- [x] I have checked my code/text and corrected any misspellings


<!-- readthedocs-preview cable start -->
----
📚 Documentation preview 📚:
https://cable--498.org.readthedocs.build/en/498/

<!-- readthedocs-preview cable end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code clean-up e.g., removal of dead code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants