# AGRIF handling of class declaration

**URL:** <https://nemo-ocean.discourse.group/t/agrif-handling-of-class-declaration/912>\
**Category:** v4.2.x\
**Tags:** AGRIF\
**Created:** [12 June 2025 09:48 UTC](https://nemo-ocean.discourse.group/t/agrif-handling-of-class-declaration/912 "2025-06-12T09:48:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhilt](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mhilt](https://nemo-ocean.discourse.group/u/mhilt)\
**Post date:** [12 June 2025 09:48 UTC](https://nemo-ocean.discourse.group/t/agrif-handling-of-class-declaration/912/1 "2025-06-12T09:48:13Z")

</div>

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](https://gitlab.opencode.de/bsh/neccton/nemo-ergom/) .

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.

```auto
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](https://github.com/fabm-model/fabm/wiki/Using-FABM-from-a-physical-model)), for exemple in src/TOP/FABM/par\_fabm.F90 , line 20 :

```auto
#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
