MetOffice / MetOffice/lfric_apps
Fix coupling component to work when there is no Oasis
- Dominant language
- Fortran
- Stars
- 31
- Forks
- 118
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 8
Description
### Are there any linked Issues or Pull Requests?
_No response_
### Brief description
It should be possible to call into the LFRic Core coupling component even if the Oasis library is not present - by unsetting the ``MCT`` preprocessor directive. Currently this does not work.
### Further details of the issue.
The ``MCT`` preprocessor directive is supposed to "switch off" all calls into the Oasis3-MCT library, so the coupling code can still be called, even if the Oasis library is not available. There are two issues with this:
1. Data that should be returned from the Oasis library should be replaced by neutral answers if ``MCT`` is unset. This is not currently the case. For example: in ``coupler_exchange_2d_mod.F90``, the routine ``is_coupling_time()`` returns the variable ``is_coupling`` - but if ``MCT`` is unset, ``is_coupling`` is never set to any value by the code - which leads to a compiler error. There may be other routines with bugs like this.
2. Originally, two preprocessor directives were introduced: ``MCT`` was supposed to be used to eliminate any calls to the Oasis3-MCT library and ``COUPLED`` was supposed to be used to eliminate any calls into the LFRic coupling code. These directives have been (ab)used, so in most cases, they are now interchangeable. This needs sorting. In retrospect, it would have been better to keep it simple and only have one directive. We should remove ``COUPLED`` and replace it with simple run-time Fortran if-then blocks.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in coupler_exchange_2d_mod.F90, especially is_coupling_time(), and build the coupling component with MCT unset to identify uninitialised or otherwise invalid return values. Audit the other MCT and COUPLED uses, then verify that the component compiles and works without Oasis while preserving the intended run-time coupling behaviour.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fortran
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100