# BLOW UP error on custom bathymetry dataset - Hamilton Harbour

**URL:** <https://forum.croco-ocean.org/t/blow-up-error-on-custom-bathymetry-dataset-hamilton-harbour/7671>\
**Category:** run / config issues\
**Created:** [June 23, 2026, 6:18pm UTC](https://forum.croco-ocean.org/t/blow-up-error-on-custom-bathymetry-dataset-hamilton-harbour/7671 "2026-06-23T18:18:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kb1901](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/kb1901/32/869_2.png) [@kb1901](https://forum.croco-ocean.org/u/kb1901)\
**Post date:** [June 23, 2026, 6:18pm UTC](https://forum.croco-ocean.org/t/blow-up-error-on-custom-bathymetry-dataset-hamilton-harbour/7671/1 "2026-06-23T18:18:53Z")

</div>

Hi,

I’m using CROCO to study circulation in a small embayment in Ontario called Hamilton Harbour. It is roughly a 10km x 6km harbour in the shape of a triangle, and the resolution of the grid is 40 meters. I am using a land masking since it is enclosed, and the hmin within the harbour is set to 1 m to avoid division by zero. Here is the bathymetry field for reference.

 ![Screenshot 2026-06-23 at 2.11.50 PM](https://forum.croco-ocean.org/uploads/default/original/1X/d705246c0eeaf6145dba44a74c99b0e22493d4c3.jpeg)

I am using a customized initial temperature field that I define in croco/OCEAN/ana\_initial.F, which is a simple tilted thermocline in the (x-z) plane and extended into the spanwise (y) direction to initialize some sort of seiche. All the other initial conditions have been set to the default ones (which are zeroed).

```auto
# elif defined HAMILTON_HARBOR
# define Z0 (-7.)
# define THKNSS 2.
# define SLOPE_DEG .02 /* thermocline slope angle in degrees */
# define TEMPSURF 20.
# define TEMPBOT 10.
# ifdef TEMPERATURE
!
! Tilted thermocline: thermocline deepens moving east
! z_r is the cell-center depth (negative, 0 at surface)
! Z0 is the thermocline center depth at x = xr_min
!
        slope_val = tan(SLOPE_DEG * pi / 180.0)
        do k=1,N
          do j=JR_RANGE
            do i=IR_RANGE
              t(i,j,k,1,itemp) = TEMPBOT + 0.5*(TEMPSURF - TEMPBOT)
     & *(1. + tanh((z_r(i,j,k) - Z0
     & - slope_val * (xr(i,j) - xr(1, 1)))
     & / THKNSS))
              t(i,j,k,2,itemp) = t(i,j,k,1,itemp)
            enddo
          enddo
        enddo
# endif /* TEMPERATURE */
# undef Z0
# undef THKNSS
# undef SLOPE_DEG
# undef TEMPSURF
# undef TEMPBOT

```

Below are the cppdefs options that have been selected:

```auto
#elif defined HAMILTON_HARBOR
/*
! Hamilton Harbor tilted thermocline
! ======== ======= ====== ===========
*/
/* Parallelization */
# undef OPENMP
# undef MPI
/* Grid */
# undef SPHERICAL
# define CURVGRID
# define MASKING
# define NEW_S_COORD
/*Dynamics*/
# define UV_ADV
# undef UV_COR
# define UV_VIS2
# define SOLVE3D
# define TS_DIF2
# define BODYFORCE
/* Initial and Boundary Conditions */
# define ANA_INITIAL
# define ANA_SMFLUX
# define ANA_STFLUX
# define ANA_BTFLUX
# define NO_FRCFILE

```

[croco\_out.txt](https://forum.croco-ocean.org/uploads/short-url/7cf73o1ws849T2BWIPBYNoEZMkW.txt) (10.9 KB)

[croco\_in.txt](https://forum.croco-ocean.org/uploads/short-url/mJyvFvJKHfyXqnXrViURNkzMjk.txt) (8.9 KB)

[param.h](https://forum.croco-ocean.org/uploads/short-url/hNSNH4gSwBGzJ1FbfURw8c7oTpl.h) (34.3 KB)

Above, I have attached my config files and param which includes the grid point dimensions. jobcomp compiles without any issues. However, when I try to run the simulation, it crashes without taking a step due to a BLOW UP error. I’m not sure how to locate the blow up error or why it may be occurring. I would be grateful if someone can help point out what I am missing or how I can move further.

---

<div class="post-metadata">

**Author:** ![eleboued](https://forum.croco-ocean.org/letter_avatar_proxy/v4/letter/e/51bf81/32.png) [@eleboued](https://forum.croco-ocean.org/u/eleboued)\
**Post date:** [June 26, 2026, 6:56am UTC](https://forum.croco-ocean.org/t/blow-up-error-on-custom-bathymetry-dataset-hamilton-harbour/7671/2 "2026-06-26T06:56:09Z")

</div>

Hello,

Have you tried to reduce the time step drastically to rule out CFL-like errors ?

Your grid is very high definition, and the fact that NaNs appears at time step 1 and that time step0 is OK can point to timr-step issues.

Enzo

---

<div class="post-metadata">

**Author:** ![oartal1](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/oartal1/32/441_2.png) [@oartal1](https://forum.croco-ocean.org/u/oartal1)\
**Post date:** [June 30, 2026, 1:44pm UTC](https://forum.croco-ocean.org/t/blow-up-error-on-custom-bathymetry-dataset-hamilton-harbour/7671/3 "2026-06-30T13:44:44Z")

</div>

Hi,

While looking at the bathymetry figure, I think there may be areas with relatively steep gradients, particularly in the southeastern–eastern part of the domain (it’s a bit difficult to tell from the color bar). Did you try smoothing the bathymetry so that it satisfies the condition (r \< 0.2)?

---

<div class="post-metadata">

**Author:** ![kb1901](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/kb1901/32/869_2.png) [@kb1901](https://forum.croco-ocean.org/u/kb1901)\
**Post date:** [June 30, 2026, 3:24pm UTC](https://forum.croco-ocean.org/t/blow-up-error-on-custom-bathymetry-dataset-hamilton-harbour/7671/4 "2026-06-30T15:24:39Z")

</div>

Thanks for the suggestions! I realized this is happening because I was setting depth values in the land areas to be 0, but now I’ve realized that CROCO divides by them before masking land, which caused the blow up.
