Refactor wet model drivers and controllers - #55
Refactor wet model drivers and controllers#55Pierre Siddall (Pierre-siddall) wants to merge 64 commits into
Conversation
Co-authored-by: harry-shepherd <17930806+harry-shepherd@users.noreply.github.com>
Co-authored-by: harry-shepherd <17930806+harry-shepherd@users.noreply.github.com>
Co-authored-by: harry-shepherd <17930806+harry-shepherd@users.noreply.github.com>
Co-authored-by: harry-shepherd <17930806+harry-shepherd@users.noreply.github.com>
Co-authored-by: harry-shepherd <17930806+harry-shepherd@users.noreply.github.com>
Erica Neininger (ericaneininger)
left a comment
There was a problem hiding this comment.
- I believe some of the functionality added since the original SRS branch was committed has been lost - particularly anything that was removed from
nemo_driver.pyinto new files. The branch was cut a r4173. There are (at least) two diffs which should be considered:
- https://code.metoffice.gov.uk/trac/moci/changeset?reponame=&new=5833%40main%2Ftrunk%2FCoupled_Drivers&old=4161%40main%2Ftrunk%2FCoupled_Drivers
- https://github.com/MetOffice/moci/commits/main/Coupled_Drivers/nemo_driver.py
I may not have picked up on all the specifics here - this may be an iterative review process!
-
Since this affects all UM jobs using the drivers, Can you please run the UM rose-stem "coupled" group with this branch added to the dependencies.yaml file?
-
Copyright notice - Please replace all headers in modified files with the updated Momentum Copyright notice. New files obviously get the new one as well please.
| We look for files conforming to the naming convention: | ||
| <arbitrary suite name>_yyyymmdd_restart_<PE rank>.nc where | ||
| <arbitrary suite name> may itself contain underscores, hence we | ||
| do not parse details based on counting the number of underscores. | ||
| ''' | ||
| nemo_restart_files = [f for f in os.listdir(nemo_rst) if | ||
| re.findall(r'.+_\d{8}_restart(_\d+)?\.nc', f)] |
There was a problem hiding this comment.
Please include modifications made under SRS tickets #605 & 667, to nemo_driver.py between lines 333-339 (original) and lines 343-351 (updated)
https://code.metoffice.gov.uk/trac/moci/changeset?reponame=&new=5562%40main%2Ftrunk%2FCoupled_Drivers%2Fnemo_driver.py&old=4876%40main%2Ftrunk%2FCoupled_Drivers%2Fnemo_driver.py
| ' from a state of zero icebergs\n' | ||
| _ = ocn_lib.setup_nrun(nemo_envar['NEMO_ICEBERGS_START'], | ||
| nemo_envar['RST_LINK_DIR'], | ||
| 'restart_icebergs', nemo_init_dir, |
There was a problem hiding this comment.
I think that restart_icebergs here is now variable - it may alternatively be restart_icb?? depending on NEMO version.
Please see changes made under SRS tickets #605 & #667 in nemo_driver.py beginning around line 410 in the modified file.
https://code.metoffice.gov.uk/trac/moci/changeset?reponame=&new=5562%40main%2Ftrunk%2FCoupled_Drivers%2Fnemo_driver.py&old=4876%40main%2Ftrunk%2FCoupled_Drivers%2Fnemo_driver.py
| self._variables \ | ||
| = {'nemo_first_step': NamelistVal(r'nn_it000=(.+),', None), | ||
| 'nemo_last_step': NamelistVal(r'nn_itend=(.+),', None), | ||
| 'nemo_step_int': NamelistVal(r'rn_rdt=(\d*)', None), |
There was a problem hiding this comment.
I think that, depending on NEMO version, the namelist variable may alternatively be rn_dt.
Please see changes made under SRS tickets #605 & #667, in nemo_driver.py beginning around line 410.
https://code.metoffice.gov.uk/trac/moci/changeset?reponame=&new=5562%40main%2Ftrunk%2FCoupled_Drivers%2Fnemo_driver.py&old=4876%40main%2Ftrunk%2FCoupled_Drivers%2Fnemo_driver.py
| restart_types = [ | ||
| Restarts('NEMO', '%so_%s_restart', 'restart'), | ||
| Restarts('SI3', '%so_%s_restart_ice', 'restart_ice'), | ||
| Restarts('Icebergs', '%so_icebergs_%s_restart', 'restart_icebergs'), |
There was a problem hiding this comment.
Restarts('Icebergs', '%so_icebergs_%s_restart', 'restart_icebergs'),
The NEMO restart file for icebergs changed at NEMO4 to better match all the others -
So depending on version, I think this call to Restarts might alternatively need to be (I think!)
Restarts('Icebergs', '%so_$s_restart_icb', 'restart_icb'),
Please see changes made in SRS tickets #605 & #667 in nemo_driver.py around line 537.
https://code.metoffice.gov.uk/trac/moci/changeset?reponame=&new=5562%40main%2Ftrunk%2FCoupled_Drivers%2Fnemo_driver.py&old=4876%40main%2Ftrunk%2FCoupled_Drivers%2Fnemo_driver.py
Erica Neininger (ericaneininger)
left a comment
There was a problem hiding this comment.
- I believe some of the functionality added since the original SRS branch was committed has been lost - particularly anything that was removed from
nemo_driver.pyinto new files. The branch was cut a r4173. There are (at least) two diffs which should be considered:
- https://code.metoffice.gov.uk/trac/moci/changeset?reponame=&new=5833%40main%2Ftrunk%2FCoupled_Drivers&old=4161%40main%2Ftrunk%2FCoupled_Drivers
- https://github.com/MetOffice/moci/commits/main/Coupled_Drivers/nemo_driver.py
I may not have picked up on all the specifics here - this may be an iterative review process!
-
Since this affects all UM jobs using the drivers, Can you please run the UM rose-stem "coupled" group with this branch added to the dependencies.yaml file?
-
Copyright notice - Please replace all headers in modified files with the updated Momentum Copyright notice. New files obviously get the new one as well please.
Co-authored-by: Erica Neininger <107684099+ericaneininger@users.noreply.github.com>
Co-authored-by: Erica Neininger <107684099+ericaneininger@users.noreply.github.com>
Co-authored-by: Erica Neininger <107684099+ericaneininger@users.noreply.github.com>
Co-authored-by: Erica Neininger <107684099+ericaneininger@users.noreply.github.com>
Co-authored-by: Erica Neininger <107684099+ericaneininger@users.noreply.github.com>
Co-authored-by: Erica Neininger <107684099+ericaneininger@users.noreply.github.com>
Co-authored-by: Erica Neininger <107684099+ericaneininger@users.noreply.github.com>
Co-authored-by: Erica Neininger <107684099+ericaneininger@users.noreply.github.com>
Co-authored-by: Erica Neininger <107684099+ericaneininger@users.noreply.github.com>
Co-authored-by: Erica Neininger <107684099+ericaneininger@users.noreply.github.com>
Co-authored-by: Erica Neininger <107684099+ericaneininger@users.noreply.github.com>
Co-authored-by: Erica Neininger <107684099+ericaneininger@users.noreply.github.com>
PR Summary
Code Reviewer: Erica Neininger (@ericaneininger)
This PR migrates over the ticket number 523 from subversion which was authored by Harry Shepherd (@harry-shepherd) and contained the following description:
As part of the first priority items for the drivers refactor, there is extensive work to do on the wet model drivers and controllers. For this context I take these to be:
As all of these have similar functionality, and areas of code that work in the same way. The original design brief for the drivers was to ensure orthogonality between components, and this will still be followed to allow the SI^3^ controller to easily be reconfigured into a driver if that is desired. However code reuse will be made use of as much as possible (which was not the case in the original implementation of the controllers).
As CICE is not part of GC5, refactoring of that driver is a 2nd tier priority item.
Work in this ticket includes (but is not limited to):
NEMO
SI^3 and Top
The controllers will be removed
Code Quality Checklist
(Some checks are automatically carried out via the CI pipeline)
readability of the code
Testing
acceptable (eg. kgo changes)
tests, unit tests, etc.)
Test Suite Results - moci - test-refactor-wet-model/run2
Suite Information
Task Information
✅ succeeded tasks - 120
Security Considerations
Performance Impact
performance measurements have been conducted
AI Assistance and Attribution
of Generative AI tool name (e.g., Met Office Github Copilot Enterprise,
Github Copilot Personal, ChatGPT GPT-4, etc) and I have followed the
Simulation Systems AI policy
(including attribution labels)
Documentation
confirmed that it builds correctly
Code Review