CMAQ-5.3 run error

Hi everyone,
I am using CMAQ-5.3.2 and i added a new module named FBR2 to use BRO vertical profile. When i run the model, this error popped up:
forrtl: severe (408): fort: (2): Subscript #1 of the array CGRID has value 66 which is greater than the upper bound of 65
Image PC Routine Line Source
CCTM_v53.exe 0000000001614DC6 Unknown Unknown Unknown
CCTM_v53.exe 0000000000DF7BD8 fbr2_ 132 fBr2.F
CCTM_v53.exe 0000000000D2EAFB sciproc_ 255 sciproc.F
CCTM_v53.exe 0000000000D1560D cmaq_driver_ 717 driver.F
CCTM_v53.exe 0000000000D0DC2A MAIN__ 97 cmaq_main.F
CCTM_v53.exe 0000000000407662 Unknown Unknown Unknown
libc-2.17.so 00002AAAACCB6555 __libc_start_main Unknow Unknown
CCTM_v53.exe 0000000000407569 Unknown Unknown Unknown

I checked the fBr2.F file and row 132 is: CGRID( C,R,L,167 ) = BR2C( C,R,L )
My domain has 130*120 grids and i checked the GRIDDESC file:
’ ’
‘LAM_40N97W’
2 33.000 45.000 -97.000 -97.000 40.000
’ ’
‘US12NE’
‘LAM_40N97W’ 756000.000 -456000.000 12000.000 12000.000 130 140 1
’ ’

And there is no 65 as showed in the error message. Could you help with this?
Best!
Lin

For more information, go to your BLD directory and *rm *.o .exe and then re-build with the DBG option turned on., That will give you an executable with traceback (and lots of other checking) enabled.

Run that executable, and then the output like that above will be annotated with line numbers. You can use it to find at which line of your code you’ve made a subscript error.

Hi,
Thanks for your help. I already have the DBG option on. The error was in line 132 of the fBr2.F file and i checked the file. The 132th line is: CGRID(C,R,L,167) = BR2C(C,R,L). Is the subscript #1 of the array CGRID C? I checked my GRIDDESC file, i have 130*120 grids. Both 130 and 120 are larger than 65. So i don’t know what to do. Could you help?
Best!
Lin

Yes, C is the first subscript here.

But… are you running MPI-parallel? If so, the arrays are just allocated and dimensioned by the current processor’s tile-size, and you probably have the wrong bounds for the enclosing loop(s).

Thanks for your reply. I don’t know much about MPI, how should i check if i have the wrong bounds for the enclosing loops or not?
Thanks!
Lin

Compare your code against one of the other CMAQ full-grid subroutines, e.g., vdiffproc.F

Got it.
I will try that.
Thanks so much !
Lin

Hi,
I checked and my vdiffproc.F file is exactly the same as the original file.
Best!
Lin

Does your loop-structure match that of vdiffproc.F ?

How about running “serial” simulation to check your code?

You just write “PROC = serial” in run scripts.

Hi Hun,
The serial simulation runs smoothly. But when i change serial back to mpi, the error popped up agiain.
Lin

I think your loop-structure in new module(named FBR2) is not for mpi structure. you should change your loop-structure to running mpi simulation.

I recommend to check your code follow this answer.

Do you mean i need to chnage the loop in my own script to match that in vdiffproc.F?
Lin

1 Like

Hi,
I still can not solve the problem, what do you mean by “loop-structure match”?
Thanks!
Lin

You need to read the documentation about the CMAQ implementation of MPI, and how the science modules use that information.

Got it! Thanks! I will do that.
Lin

Hi,
I have another question, i noticed that if i compile the model with the “standard, optimized compile process” mode, not the “debug” mode, the simulation could run smoothly. Could i run with the debug mode off? Will this output be right if i run with the debug mode off?
Thanks!
Lin

In principle, you should get the same results with debug and error-tracking on or off. In practice, there are enough problems with the code (floating-point underflows, bounds-checking problems, etc.) that it is unclear whether you could get a debug/check-everything executable to run. If you have debug but do not enable the checking, you should probably be OK.