I found a bug when I test 2 way nesting with wetting & drying function.
Once wet cell became dry, the dry cell could not return to wet cell, even if surrounding zeta values were higher than h-DCRIT.
Maybe because zeta value on dry cell sets zero (zeta = 0 is lower than h-DCRIT) in fine2coarse2d routine, the dry cell don't have a chance for changing wet cell.
For fixing the bug, I think the lines 3477-3515 in nesting.F should be modified as following:
Code: Select all
!
! Free-surface.
!
AreaAvg=.FALSE.
# ifdef SOLVE3D
CALL fine2coarse2d (rg, dg, model, tile, &
& r2dvar, 'Zt_avg1', &
& AreaAvg, RefineScale(dg), &
& cr, Rcontact(cr)%Npoints, Rcontact, &
& LBiD, UBiD, LBjD, UBjD, &
& LBiR, UBiR, LBjR, UBjR, &
& GRID(dg)%om_r, &
& GRID(dg)%on_r, &
& GRID(rg)%pm, &
& GRID(rg)%pn, &
# ifdef MASKING
& GRID(dg)%rmask, & !!! rmask_full -> rmask
& GRID(rg)%rmask, & !!! rmask_full -> rmask
# endif
& COUPLING(dg)%Zt_avg1, &
& COUPLING(rg)%Zt_avg1)
# else
CALL fine2coarse2d (rg, dg, model, tile, &
& r2dvar, Vname(1,idFsur), &
& AreaAvg, RefineScale(dg), &
& cr, Rcontact(cr)%Npoints, Rcontact, &
& LBiD, UBiD, LBjD, UBjD, &
& LBiR, UBiR, LBjR, UBjR, &
& GRID(dg)%om_r, &
& GRID(dg)%on_r, &
& GRID(rg)%pm, &
& GRID(rg)%pn, &
# ifdef MASKING
& GRID(dg)%rmask, & !!! rmask_full -> rmask
& GRID(rg)%rmask, & !!! rmask_full -> rmask
# endif
& OCEAN(dg)%zeta(:,:,Dindex2d), &
& OCEAN(rg)%zeta(:,:,Rindex2d))
# endif
when a cell become wet from dry, tracer values on this cell will appear as zero values.
So I think the lines 3574-3596 is better to be modified as following:
Code: Select all
!
! Tracer type-variables.
!
AreaAvg=.FALSE.
DO itrc=1,NT(rg)
CALL fine2coarse3d (rg, dg, model, tile, &
& r3dvar, Vname(1,idTvar(itrc)), &
& AreaAvg, RefineScale(dg), &
& cr, Rcontact(cr)%Npoints, Rcontact, &
& LBiD, UBiD, LBjD, UBjD, 1, N(dg), &
& LBiR, UBiR, LBjR, UBjR, 1, N(rg), &
& GRID(dg)%om_r, &
& GRID(dg)%on_r, &
& GRID(rg)%pm, &
& GRID(rg)%pn, &
# ifdef MASKING
& GRID(dg)%rmask, & !!! rmask_full -> rmask
& GRID(rg)%rmask, & !!! rmask_full -> rmask
# endif
& OCEAN(dg)%t(:,:,:,Dindex3d,itrc), &
& OCEAN(rg)%t(:,:,:,Rindex3d,itrc))
IF (exit_flag.ne.NoError) RETURN
END DO
because Lweingt values inside the donor grids set zero.
It also a problem when the cells return to wet cells.
So,the line 1293:
Code: Select all
Lweight=0.0_r8 ! all the donor grid
Code: Select all
Lweight(:)=Rcontact(cr)%LweightUnmasked(:,m)
Code: Select all
Qweight=0.0_r8 ! all the donor grid
Code: Select all
Qweight(:)=Rcontact(cr)%QweightUnmasked(:,m)
The 'END IF' codes on the lines 1839-1840 are duplicated like this.
Code: Select all
END IF ! corners are on land
END IF