MetOffice / MetOffice/lfric_apps
Use of unallocated arrays in ukca_volcanic_so2
- Dominant language
- Fortran
- Stars
- 31
- Forks
- 118
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 8
Description
### Version
main
### Are there any linked Issues or Pull Requests?
ticket:695
### What happened?
In the LFRic copy of ukca_volcanic_so2 (_interfaces/physics_scheme_interface/source/legacy/ukca_interface/ukca_volcanic_so2_) the variables `true_latitude and true_longitude` are being used without being allocated (and set).
Under ticket:695, dependency on the UM module `trigonometric_mod` was removed, however, no alternate source was provided for the above values.
A closer look at the compiler warning messages reveals that array `weight_volc_vertdist` is also being used without being allocated.
The routine is not currently called in standard lfric_atm configurations as the controlling logical ''l_ukca_so2ems_expvolc'' is not set, but this is still leading to lfric_atm CCE builds on ARCHER2 to fail and warnings from other compilers.
### Relevant log output
On ARCHER2 with CCE compiler _at vn3.0_
~mdalvi/cylc-run/vn3.0_git_trunk/run1 = Vanilla run
--group=lfric_atm_nwp_gal9_noukca_1T-C48_MG_ex_cce_fast-debug-64bit
```
ftn-7212 ftn: ERROR UKCA_VOLCANIC_SO2, File = legacy/ukca_interface/ukca_volcanic_so2.F90, Line = 250
Variable is used before it is defined
....
ftn-7212 ftn: ERROR UKCA_VOLCANIC_SO2, File = legacy/ukca_interface/ukca_volcanic_so2.F90, Line = 338
Variable is used before it is defined
```
After the fix
~mdalvi/cylc-run/vn3.0_git_trunk/run2 = With UKCA fix in cloned copy
```
22:37:51 *Compiled* legacy/ukca_interface/ukca_volcanic_so2.F90
```
_(Note : the CCE build still fails due to an internal compiler error for a Socrates routine, but all UKCA routines are compiled_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with legacy/ukca_interface/ukca_volcanic_so2.F90 and review ticket:695 for the removed trigonometric_mod dependency. Trace how true_latitude, true_longitude, and weight_volc_vertdist are used, then verify the routine no longer uses unallocated or unset arrays. Rebuild the lfric_atm configuration with the CCE compiler and confirm the UKCA routines compile without those errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fortran
- Domain
- build-system, hpc
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100