Hi again Simon ! :)
In general, to do this you would need to either:
1. change the code to add print statements at the beginning of each subroutine, to print the input arguments, and at the end to print the results of the computation.
or
2. Use a debugger to run the code, and print whatever you want at any point in the code.
For CICE specifically, there are facilities that can help you with 1). See
3.5. Troubleshooting — CICE documentation. If you use CICE standalone (and thus the Consortium's driver (
cicecore/drivers/standalone/cice/
), several
debug_ice
calls are already added, so if you add
debug_model
to your namelist and adjust
lonpnt
and
latpnt
to the lon/lat of your choice, it will print extended diagnostics each time
debug_ice
is called (and so several times per time step). You can also use
debug_model_i,j,iblk,task
instead of lat/lon to choose a specific grid point by its indices instead.
If these options are not sufficient to help you debug, then you could add additional calls to
debug_ice
, or go with option 2 and use a debugger. Of course this has a learning curve if you've never used a debugger before. Here is some advice:
1. On macOS, there is no Fortran debugger available by default. You can install GDB (for example using Homebrew or conda), but GDB unfortunately does not work reliably on recent macOS versions (which I remember you are using). So it would be easier to find a Linux machine to do your debugging.
2. It will be easier to debug if you run CICE in single process mode, i.e.
./cice.setup -p 1x1
. If not, you need to use some tricks, or use a commercial parallel debugger like Arm DDT or Totalview. You university *might* have licenses for these.