Undefined values in FCT tracer advection scheme when using MLF and "accurate" adaptive-implicit vertical advection algorithm
Context
- Branches impacted: branch_5.0
- Dependencies:
ln_traadv_fct=.true.
,ln_zad_aimp=.true.
,nn_fct_imp=2
, MLF
Analysis
In tridia_solver, all loops have bounds that include the first halo points. This means the input array arguments must also be defined on the first halo points.
In fct_up1_1stp when ll_zAimp2=.true.
, the input array arguments (zwdia
, zwsup
, zwinf
) are defined only on internal points, so tridia_solver
accesses undefined points in this case.
DO_3D( 0, 0, 0, 0, 1, jpkm1 )
zwdia(ji,jj,jk) = 1._wp + pDt * ( MAX( wi(ji,jj,jk ) , 0._wp ) - MIN( wi(ji,jj,jk+1) , 0._wp ) ) / e3t(ji,jj,jk,Kaa)
zwinf(ji,jj,jk) = pDt * MIN( wi(ji,jj,jk ) , 0._wp ) / e3t(ji,jj,jk,Kaa)
zwsup(ji,jj,jk) = - pDt * MAX( wi(ji,jj,jk+1) , 0._wp ) / e3t(ji,jj,jk,Kaa)
END_3D
!
CALL tridia_solver( zwdia, zwsup, zwinf, pt_up1, pt_up1 , 0 )
This is also true of ztmp
on line 288.
fct_up1_1stp
is called only by MLF, so this does not affect RK3. There is therefore no issue in the main.
Fix
Add an option to specify the bounds for loops in tridia_solver
and set these accordingly.
This should be done for the main branch as well as branch_5.0 even though there is no issue in the main, because the proposed changes will reduce unnecessary calculations.
Other notes
fct_up1_1stp
is no longer used- it should be removed from the main at some point.