Nudging time scale
Firstly, all derivation are located at $modelroot/src/driver.F90
To simplify the calculation, we define two variables represent the time scale of heat and freshwater nudging.
In subroutine set_ts_nudging
t_nudstr=max(1./(30.d0*daodt),0.)
s_nudstr=max(1./(30.d0*daodt),0.)
Algorithm
In subroutine fsglo
! instantaneous nudging term
do j=2,j1
do i=2,i1
! climatological value interpolated to present time
tkli=fold*tclis(i,j,1,nld)+fnew*tclis(i,j,1,new)
skli=fold*sclis(i,j,1,nld)+fnew*sclis(i,j,1,new)
!Temperature, nudge_tmp >0 --> dval>0
tnud_tmp(i-1,j-1)=t_nudstr*(tkli-t2(i,j,1))
snud_tmp(i-1,j-1)=s_nudstr*(skli-s2(i,j,1))
! accumulate nudgings from present month for later qavg calc.
tnudge(i-1,j-1)=tnudge(i-1,j-1)+tnud_tmp(i-1,j-1)
snudge(i-1,j-1)=snudge(i-1,j-1)+snud_tmp(i-1,j-1)
enddo
enddo
!calculating model determined monthly surface fluxes term at the end of the month,
!first year use initialized value
if(abs(syng_days-epday(nmon)).gt.1.e-6 .or. days.le.365.) go to 575
if(myid==0) write(*,*) 'deriving monthly determined ensemble fluxes'
temp=1./(dmonth(nmon)*itfday)
nsombo(nmon)= nsombo(nmon)+1
do j=1,j2
do i=1,i2
wtmp(i,j,nld)=wtmp(i,j,nld)+wavg(i,j,nld)+ &
temp*(snudge(i,j)+sclis(i+1,j+1,1,new)-s2(i+1,j+1,1))
qtmp(i,j,nld)=qtmp(i,j,nld)+qavg(i,j,nld)+ &
temp*(tnudge(i,j)+tclis(i+1,j+1,1,new)-t2(i+1,j+1,1))
qavg(i,j,nld)=in(i+1,j+1,1)*qtmp(i,j,nld)/nsombo(nmon)
wavg(i,j,nld)=in(i+1,j+1,1)*wtmp(i,j,nld)/nsombo(nmon)
! Initialize accumulated nudgings for the next month
tnudge(i,j)=0.d0
snudge(i,j)=0.d0
enddo
enddo
!Finally, update the restoring and nudging fluxes.
!heat flux.
575 if(myid==0) write(*,*) 'update restoring fluxes'
do j=2,j1
do i=2,i1
!temperature
temp=in(i,j,1)*qavg(i-1,j-1,nld)
t2(i,j,1)=t2(i,j,1)+temp+tnud_tmp(i-1,j-1)
t1(i,j,1)=t1(i,j,1)+temp+tnud_tmp(i-1,j-1)
tlf(i,j,1)=tlf(i,j,1)+temp+tnud_tmp(i-1,j-1)
!Salinity
temp=in(i,j,1)*wavg(i-1,j-1,nld)
s2(i,j,1)=s2(i,j,1)+temp+snud_tmp(i-1,j-1)
s1(i,j,1)=s1(i,j,1)+temp+snud_tmp(i-1,j-1)
slf(i,j,1)=slf(i,j,1)+temp+snud_tmp(i-1,j-1)
enddo
enddo