Skip to content

Commit 24749f9

Browse files
committed
backport: postpone call to start_gotm_fabm to ensure density is valid
1 parent 1dcb60a commit 24749f9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/gotm/gotm.F90

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,18 +328,19 @@ subroutine init_gotm(t1,t2)
328328
call setup_restart()
329329
! call init_output(title,nlev,latitude,longitude)
330330

331-
#ifdef _FABM_
332-
! Accept the current biogeochemical state and used it to compute derived diagnostics.
333-
if (fabm_calc) call start_gotm_fabm(nlev)
334-
#endif
335-
336331
call do_air_sea(julianday,secondsofday)
337332

338333
! Call stratification to make sure density has sensible value.
339334
! This is needed to ensure the initial density is saved correctly, and also for FABM.
340335
call shear(nlev,cnpar)
341336
call stratification(nlev,buoy_method,dt,cnpar,nuh,gamh)
342337

338+
#ifdef _FABM_
339+
! Accept the current biogeochemical state and used it to compute derived diagnostics.
340+
! This MUST be preceded with a call to stratification, in order to ensure FABM has a valid density.
341+
if (fabm_calc) call start_gotm_fabm(nlev)
342+
#endif
343+
343344
if (list_fields) call fm%list()
344345

345346
LEVEL2 'done.'

0 commit comments

Comments
 (0)