Issue with time varying river BGC tracer reading

Hi,

I’m experiencing an issue at present with CROCO-PISCES coupled. Running CROCO alone doesn’t cause an issue with river data reading (time varying T/S are read fine and model runs fine). However, when I turn on PISCES, it seems the code trips on an issue reading BGC tracers for the river.

I have NO3_trc, DIC_trc, PO4_trc and Si_trc in my runoff file. I didn’t have this issue when my river file previously only had T, S and NO3, but I don’t want to revert to that option as it is less realistic.
I have narrowed down the source of the error to /OCEAN/init_scalars.F and /OCEAN/get_psource_ts.F
Specifically, in get_psource_ts.F, in this block of code:
if (got_tsrc(itrc)) then
lvar=lenstr(vname(1,indxTsrc+itrc-1))
ierr=nf_inq_varid (ncidqbar,vname(1,indxTsrc+itrc-1)
& (1:lvar),tsrc_id(itrc))
if (ierr .eq. nf_noerr) then
ierr=nf_inq_varndims (ncidqbar,tsrc_id(itrc), i)
endif
if (ierr .ne. nf_noerr) then
write(stdout,3) vname(1,indxTsrc+itrc-1)(1:lvar),
& qbarname(1:lstr)

I get an error because the way vname for the river tracers is dynamically derived from the main PISCES vars (DIC, TALK,…) in init_scalars.F introduces a repeated “null character” which is printed to screen as ^@
See the error below:

GET_PSOURCE_TS - unable to find forcing variable: NO3_src ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^$
in runoff NetCDF file: croco_runoff.nc–> analytical value (in analytical.F)

The issue only occurs with the 25th of 26 tracers (NO3) but it seems that the code doesn’t even try to look for NH4 either.

I’m tempted to hard code the vname params for the rivers in init_scalars to get past this issue, but I can’t understand why I’m having this issue as other people must have run their rivers for PISCES similarly to me, before now.

Would it help if I had all 26 tracers (T, S and PISCES vars (24)) from the rivers? Could it be an error introduced by ifort?

All suggestions would be greatly appreciated.

I tried many things with this today, and found the solution, which is to increase the size of vname in ncscrum.h from vname(20,500) to vname(20,510)

Hi Jmcgovern,

I am trying to configure something very similar to your setup but I am struggling. I made a forum request if anyone has an example and/or instructions here: https://forum.croco-ocean.org/question/1003/realistic-coastal-pisces-scenario-configuration-documentation/

But since you have done this already, could you please share, if possible, your CONFIG folder for this scenario with bgc tracers from a river?

Thank you for your help
Konstantinos

Can you outline your case study? Location, resolution etc.? Share your struggles on here and I’ll be glad to answer as best I can.

Hi,
Indeed this problem has been identified and fixed increasing the size of vname with vname(20,800).
I assume you are using the official v1.3, as a tarball or the tag v1.3 from release branch.

If you have acces to our gitlab [ https://gitlab.inria.fr/croco-ocean/] , it can be useful to have a look in the evolving branch bugfix_vx.x, [ with x.x the tag number], to see recent bug fix.

Regards,

Hi Gildas,

Thanks for the update. I have been using v1.3 since its release. I’m trying to find out what is Konstantinos’ issue with CROCO for us to assist.

Regards

Hi Joe,

Thank you for your reply. Basically I am trying to learn CROCO-PISCES and I am using the “standard” BENGUELA configuration (low resolution). I have created a croco_runoff.nc file with several nutrients (see attached figure). When I run CROCO by itself, with PSOURCE_NCFILE_TS option, it runs fine. Also when I run CROCO-PISCES without the river PSOURCE it also runs fine. But when I define BIOLOGY and PSOURCE it gives me an error: "1 Number of point sources

READ_INP ERROR while reading block with keyword ‘psource’.
"
Unfortunately, there is no more info given in the croco.out file… CROCO-PISCES would give me the same error even if I run a constant flow PSOURCE river with only temp and salt and no nutrients. Basically doesn’t like any river input.

Thank you for any help.
Konstantinos
image description

This error is referring to the psource block in your croco.in file. I think what you need is to have the correct number of columns of tracer values in the block at the end of the file.

I will see if I can dig out an example for you

Thank you for the suggestion. This is the procedure I am following in case you can spot any errors:

  1. Set ‘makepisces = 1’ in crocotools_param file.
  2. After I have created all the croco required files, (bry, ini, grid etc) I run ‘make_runoff.m’, with option ‘psource_ncfile_ts = 1’ and since ‘makepisces’ is selected, the script automatically create the ‘croco_runoff.nc’ with NO3_src data included in the netcdf.
    The runoff script suggests the following entry:
    psource_ncfile: Nsrc Isrc Jsrc Dsrc qbardir Lsrc Tsrc runoff file name
    CROCO_FILES/croco_runoff.nc
    1
    25 35 0 -1 T T 15.9 25.0202

I also tried with:
25 35 0 -1 T T T 15.9 25.0202 2.9
since the croco_runoff.nc includes the NO3_src with initial value 2.9 but still I get the same error.

I have also changed the setting in the ‘namelist_pisces_ref’ file:
ln_river = .true. ! boolean for river input of nutrients

And I run the ‘make_biol’ script to create the initial and forcing files for pisces.

Yes, it would be great if you could send me an example file, and if you can include the other configuration text files like: cppdefs.h, param.h, croco.in, namelist_pisces_ref, and any other files you needed to edit to make it work.

Thank you so much.
Konstantinos

Hi Joe, any luck with the example file? Please have a look at the latest comment I added (June 15th).
Best regards
Konstantinos

if you can post your email address I will send to you directly

konstantinos.kotzakoulakis@gmail.com

Got it thanks! So you need to specify all PISCES tracers in the croco.in file, even if some of them are not in the river flow (by setting the tracers to F). I think I understand better now. Thanks!