# Compilation error with DIAGNOSTICS\_TS\_MLD\_DENS in CROCO v2.1.3

**URL:** <https://forum.croco-ocean.org/t/compilation-error-with-diagnostics-ts-mld-dens-in-croco-v2-1-3/7698>\
**Category:** compilation-installation\
**Tags:** compilation-installation\
**Created:** [October 2, 2026, 1:57pm UTC](https://forum.croco-ocean.org/t/compilation-error-with-diagnostics-ts-mld-dens-in-croco-v2-1-3/7698 "2026-10-02T13:57:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fanny-Chenillat](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/fanny-chenillat/32/696_2.png) [@Fanny-Chenillat](https://forum.croco-ocean.org/u/Fanny-Chenillat)\
**Post date:** [October 2, 2026, 1:57pm UTC](https://forum.croco-ocean.org/t/compilation-error-with-diagnostics-ts-mld-dens-in-croco-v2-1-3/7698/1 "2026-10-02T13:57:53Z")

</div>

Hi everyone,

In the latest version of CROCO (v2.1.3), I encountered a compilation error when using the CPP key `DIAGNOSTICS_TS_MLD_DENS` (activated along with `DIAGNOSTICS_TS_MLD`).

The compiler failed because the variable `kbl1` was not declared in several routines. Trying to include `diagnostics.h` or `mixing.h` did not solve the issue as it created dimension redundancy errors for other variables (like `TXadv` and `TYadv`).

To fix this and successfully compile the code, I had to manually declare the array:

```auto
integer kbl1(GLOBAL_2D_ARRAY)

```

inside the following files: `init_arrays.F`, `step3d_t.F`, and `t3dmix_spg.F`.

Hope this helps

---

<div class="post-metadata">

**Author:** ![swapnil](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/swapnil/32/855_2.png) [@swapnil](https://forum.croco-ocean.org/u/swapnil)\
**Post date:** [October 2, 2026, 4:11pm UTC](https://forum.croco-ocean.org/t/compilation-error-with-diagnostics-ts-mld-dens-in-croco-v2-1-3/7698/2 "2026-10-02T16:11:03Z")

</div>

Hi, @Fanny-Chenillat  
Is it resolved or need to more to diagnostic it.  
Please share you comilation log.  
When your work is good.  
Best regards,

---

<div class="post-metadata">

**Author:** ![slegac](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/slegac/32/267_2.png) [@slegac](https://forum.croco-ocean.org/u/slegac)\
**Post date:** [October 2, 2026, 5:06pm UTC](https://forum.croco-ocean.org/t/compilation-error-with-diagnostics-ts-mld-dens-in-croco-v2-1-3/7698/3 "2026-10-02T17:06:15Z")

</div>

Hello,

I cannot reproduce the error locally with the BENGUELA\_LR case using tag v2.1.3.

Note that mixing.h is already included in init\_arrays.F, step3d\_t.F, and t3dmix\_spg.F, so there should be no need to add it manually.

Could you share your param.h, cppdefs.h, and the compilation log showing the error? This should help us understand what is happening and identify the cause.

Regards,

---

<div class="post-metadata">

**Author:** ![Fanny-Chenillat](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/fanny-chenillat/32/696_2.png) [@Fanny-Chenillat](https://forum.croco-ocean.org/u/Fanny-Chenillat)\
**Post date:** [October 5, 2026, 7:07am UTC](https://forum.croco-ocean.org/t/compilation-error-with-diagnostics-ts-mld-dens-in-croco-v2-1-3/7698/5 "2026-10-05T07:07:22Z")

</div>

Hi,

I am note sure I am allowed to share the configuration files here.

@slegac : Since the system functions properly with other configurations, there may be a conflict with the CPP keys. I have forwarded the files to you via email.

@swapnil : I resolved the issue by adding the declaration directly into the Fortran files.

Cheers,

Fanny

---

<div class="post-metadata">

**Author:** ![swapnil](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/swapnil/32/855_2.png) [@swapnil](https://forum.croco-ocean.org/u/swapnil)\
**Post date:** [October 5, 2026, 9:04am UTC](https://forum.croco-ocean.org/t/compilation-error-with-diagnostics-ts-mld-dens-in-croco-v2-1-3/7698/6 "2026-10-05T09:04:15Z")

</div>

@Fanny-Chenillat  
OK. Thank you!  
Best regards,

---

<div class="post-metadata">

**Author:** ![Aparies](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/aparies/32/745_2.png) [@Aparies](https://forum.croco-ocean.org/u/Aparies)\
**Post date:** [October 7, 2026, 2:34pm UTC](https://forum.croco-ocean.org/t/compilation-error-with-diagnostics-ts-mld-dens-in-croco-v2-1-3/7698/7 "2026-10-07T14:34:00Z")

</div>

Hi,

I had the same error a few days ago. I figured out that it was because I was using GLS and not KPP. And apparently this diagnostic can only be used with KPP. Maybe we share the same problem.

I hope this helps!

Alice

---

<div class="post-metadata">

**Author:** ![cmazoyer](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/cmazoyer/32/256_2.png) [@cmazoyer](https://forum.croco-ocean.org/u/cmazoyer)\
**Post date:** [October 8, 2026, 8:43am UTC](https://forum.croco-ocean.org/t/compilation-error-with-diagnostics-ts-mld-dens-in-croco-v2-1-3/7698/8 "2026-10-08T08:43:02Z")

</div>

Hi @Fanny-Chenillat !

Do you use GLS or KPP ?  
With @Aparies , we use GLS, we are having the same problem and @sjullien told us MLD diags only work with KPP for the moment. I didn’t try your solution yet.  
Cheers,

Camille

---

<div class="post-metadata">

**Author:** ![Fanny-Chenillat](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/fanny-chenillat/32/696_2.png) [@Fanny-Chenillat](https://forum.croco-ocean.org/u/Fanny-Chenillat)\
**Post date:** [October 8, 2026, 9:46am UTC](https://forum.croco-ocean.org/t/compilation-error-with-diagnostics-ts-mld-dens-in-croco-v2-1-3/7698/9 "2026-10-08T09:46:50Z")

</div>

Hi @cmazoyer and @Aparies ,

I use GLS too.

When @sjullien says MLD diags only work with KPP for the moment, does it mean technically with CROCO, or mathematically, thus we should use another function ?

Cheers,

Fanny

---

<div class="post-metadata">

**Author:** ![cmazoyer](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/cmazoyer/32/256_2.png) [@cmazoyer](https://forum.croco-ocean.org/u/cmazoyer)\
**Post date:** [October 12, 2026, 1:32pm UTC](https://forum.croco-ocean.org/t/compilation-error-with-diagnostics-ts-mld-dens-in-croco-v2-1-3/7698/10 "2026-10-12T13:32:38Z")

</div>

Hi @Fanny-Chenillat !

Technically, this does not work with GLS. According to @sjullien (tell me if I’m wring Swen) the MLD is calculated during the KPP calculations and then recorded in the outputs afterwards.

Even if you fix the declaration of kbl1, `dens_mld_depth` is not calculated, and it contains nothing (or wrong values).

The documentation specifies that `dens_mld_depth` diagnostic is only possible for KPP ( [15. I/O and Online Diagnostics — Croco Doc 2.1.3 documentation](https://croco-ocean.gitlabpages.inria.fr/croco_doc/model/model.diag.html#tracer-budget-terms) ).

How to calculate the MLD offline:

- if you have `rho` in your outputs, you should calculate the MLD thanks to the criterion in density, see [15. I/O and Online Diagnostics — Croco Doc 2.1.3 documentation](https://croco-ocean.gitlabpages.inria.fr/croco_doc/model/model.diag.html#id2)

- An issue will be created to add `dens_mld_depth` for GLS
