AGRIF handling of class declaration

Hi everyone,
I’m doing some runs that use the FABM library for BGC model coupling in Nemo v4.2 (the BGC model in question being ERGOM). FABM-ERGOM is built independantly from nemo and linked to at compilation. In Nemo , this introduces a new cpp key key_fabm, and new nemo routines in src/TOP/FABM , you can find the modifications made to nemo4.2 here : BSH / NECCTON / nemo-ergom · GitLab .

For a project, I want to try both 2-way nesting with agrif and BGC coupling with FABM in the same configuration. I have both a working nested configuration and a working non-nested BGC-coupled configuration. However when trying to activate both, the code stops compiling during the ‘conv’ step of agrif pre-processing.

touch /home/mah/NEMO-SRC-LOC/nemo4.2.1/cfgs/NORDICAGRIF_FABM_loc_v0/NEMOFILES/flags/FFLAGS__nemo__par_fabm.flags
fcm_internal compile:F nemo /home/mah/NEMO-SRC-LOC/nemo4.2.1/cfgs/NORDICAGRIF_FABM_loc_v0/NEMOFILES/ppsrc/nemo/par_fabm.f90 par_fabm.f90
/home/mah/NEMO-SRC-LOC/nemo4.2.1/mk/agrifpp.sh /home/mah/NEMO-SRC-LOC/nemo4.2.1/cfgs/NORDICAGRIF_FABM_loc_v0  par_fabm.f90 /home/mah/NEMO-SRC-LOC/nemo4.2.1/cfgs/NORDICAGRIF_FABM_loc_v0/NEMOFILES/inc  /home/mah/NEMO-SRC-LOC/nemo4.2.1/cfgs/NORDICAGRIF_FABM_loc_v0/NEMOFILES/ppsrc/nemo/par_fabm.f90
fcm_internal compile failed (256)
make: *** [/home/mah/NEMO-SRC-LOC/nemo4.2.1/cfgs/NORDICAGRIF_FABM_loc_v0/NEMOFILES/Makefile:2467: par_fabm.f90] Error 1
make -f /home/mah/NEMO-SRC-LOC/nemo4.2.1/cfgs/NORDICAGRIF_FABM_loc_v0/NEMOFILES/Makefile -j 1 all failed (2) at /home/mah/NEMO-SRC-LOC/nemo4.2.1/ext/FCM/bin/../lib/Fcm/Build.pm line 597.

I figure this is because we introduce class declarations in nemo when using key_fabm (as per this page of the FABM wiki), for exemple in src/TOP/FABM/par_fabm.F90 , line 20 :

#if defined key_fabm
   CLASS (type_fabm_model), POINTER :: model !FABM model instance

Peeping at the files in ext/AGRIF/LEX for exemple fortan.lex the ‘class’ case doesn’t seem to be implemented. However I’m not really confident in doing modifications there myself, so I would be grateful if anyone can help me.

Thanks,
Margaux