Ask Your Question

Issue with time varying river BGC tracer reading

asked 2022-10-17 11:18:21 +0200


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:> 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.

edit retag flag offensive close merge delete

5 answers

Sort by ยป oldest newest most voted

answered 2023-06-15 11:40:39 +0200

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 '' 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/ 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 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,, namelist_pisces_ref, and any other files you needed to edit to make it work.

Thank you so much. Konstantinos

edit flag offensive delete link more

answered 2023-06-14 09:58:24 +0200

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 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

edit flag offensive delete link more


This error is referring to the psource block in your 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

jmcgovern gravatar imagejmcgovern ( 2023-06-14 18:29:12 +0200 )edit

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

Konstantinos_K gravatar imageKonstantinos_K ( 2023-06-19 11:19:41 +0200 )edit

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

jmcgovern gravatar imagejmcgovern ( 2023-06-19 11:27:41 +0200 )edit

Got it thanks! So you need to specify all PISCES tracers in the 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!

Konstantinos_K gravatar imageKonstantinos_K ( 2023-06-19 11:50:23 +0200 )edit

answered 2023-06-13 14:46:11 +0200

GildasC gravatar image

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 [] , 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.


edit flag offensive delete link more


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

jmcgovern gravatar imagejmcgovern ( 2023-06-13 14:51:44 +0200 )edit

answered 2023-06-13 13:30:05 +0200

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:

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

edit flag offensive delete link more


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.

jmcgovern gravatar imagejmcgovern ( 2023-06-13 13:44:40 +0200 )edit

answered 2022-10-17 17:50:57 +0200

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)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2022-10-17 11:18:21 +0200

Seen: 211 times

Last updated: Jun 15