Skip to content

cg_drag module fails when running on multiple cores #293

@malcolmmaas

Description

@malcolmmaas

Description

I ran the MiMA test case (MiMA_test_case.py) with the cg_drag included ('do_cg_drag': True), and got this error:
At line 686 of file /home/mdm63/3d/work/codebase/_home_mdm63_3d_isca/code/src/atmos_param/cg_drag/cg_drag.f90 2026-02-02 17:36:19,765 - isca - DEBUG - Fortran runtime error: Index '49' of dimension 2 of array 'source_level' above upper bound of 16.
The cause was the line:
iz0 = source_level(i +is-1,j+js-1).
Changing this to:
iz0 = source_level(i,j)
resolves the error. There is another place later where the same fix is necessary:

iz0 = source_level(i+is-1,j+js-1)
ampl= source_amp(i+is-1,j+js-1)

to

iz0 = source_level(i,j) 
ampl= source_amp(i,j)

.
Upon rerunning there is a similar error at

gwd_u(is:ie,js:je,:) = gwfcng_x(:,:,:)
gwd_v(is:ie,js:je,:) = gwfcng_y(:,:,:)

which I changed to

gwd_u(:,:,:) = gwfcng_x(:,:,:)
gwd_v(:,:,:) = gwfcng_y(:,:,:)

and now things seem to work.

It seems like there is some disagreement in the way the parallelization is expected to be set up in different parts of the module. I raised this issue because I was not sure if what I did is the best fix.


Isca version

a290bc3

System Information:

uname_result(system='Linux', node='echo.damtp.cam.ac.uk', release='5.15.0-168-generic', version='#178-Ubuntu SMP Fri Jan 9 19:05:03 UTC 2026', machine='x86_64')

Minimal reproducible example

Run MiMA_test_case.py with 'do_cg_drag': True and NCORES=4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions