From 67c59e6f4c186998a6b6f1709ac0896edb3b32e6 Mon Sep 17 00:00:00 2001 From: jagurs-admin Date: Fri, 2 Feb 2024 15:28:36 +0900 Subject: [PATCH] release of V0520 --- src/HISTORY | 7 +++-- src/mod_fxy.f90 | 48 +++++++++++++++++----------------- src/mod_fxy_cartesian.f90 | 44 +++++++++++++++---------------- src/mod_fxy_disp.f90 | 48 +++++++++++++++++----------------- src/mod_fxy_disp_cartesian.f90 | 44 +++++++++++++++---------------- src/mod_ncdio.f90 | 8 +++--- src/mod_rwg.f90 | 8 +++--- 7 files changed, 105 insertions(+), 102 deletions(-) diff --git a/src/HISTORY b/src/HISTORY index cbb8e26..b0869b4 100644 --- a/src/HISTORY +++ b/src/HISTORY @@ -595,7 +595,7 @@ Interpolation is NOT performed if one of the two referred coarse grids is "dry" If you want the old version to work, specify "-DNONESTDEBUG" on Makefile and make again. -------------------------------------------------------------------------------- -2024.01.01 V0520 +2024.01.31 V0520 - "nf"-format is supported as GMT netCDF format. Note that the format may vary across different domains, but the file format for a single domain must be consistent. @@ -608,8 +608,11 @@ If you want the old version to work, specify "-DNONESTDEBUG" on Makefile and mak - The following DEBUGs are applied. + - Fixed a bug that values were not updated at the four corners of the root domain + (contributed by M.Minami @ MRI. Thanks!). + - A bug for the flow-rate to velocity conversion during linear calculation to - outputting velocity grid file is corrected. + outputting velocity grid file is corrected (contributed by H.Tsushima @ MRI. Thanks!). - Typos are corrected (contributed by T.Miyashita @ Kyoto Univ. Thanks!). diff --git a/src/mod_fxy.f90 b/src/mod_fxy.f90 index 5aefb11..14c36be 100644 --- a/src/mod_fxy.f90 +++ b/src/mod_fxy.f90 @@ -985,7 +985,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(i,1) = fx(i,1) - (0.5d0*(dz(i+1,1)+dz(i,1)))*gdtdss*(hz_old(i+1,1)-hz_old(i,1)) fy(i,1) = fy(i,1) - (0.5d0*(dz(i, 2)+dz(i,1)))*gdtds *(hz_old(i, 2)-hz_old(i,1)) #else - ddx_tmp = half*(hz(i+1,1) + hz(i,1) + dz(i+1,1) + dz(i,1)) + ddx_tmp = half*(hz_old(i+1,1) + hz_old(i,1) + dz(i+1,1) + dz(i,1)) if(dz(i,1) > zap .AND. dz(i+1,1) > zap .AND. ddx_tmp > zap) then fybar = half*(fy_old(i,1) + fy_old(i+1,1)) fx(i,1) = fx_old(i,1) - ddx_tmp*gdtdss*(hz_old(i+1,1)-hz_old(i,1))-crls*fybar @@ -1012,7 +1012,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(i,1) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,2) + hz(i,1) + dz(i,2) + dz(i,1)) + ddy_tmp = half*(hz_old(i,2) + hz_old(i,1) + dz(i,2) + dz(i,1)) if(dz(i,1) > zap .AND. dz(i,2) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,1) + fx_old(i-1,1) + fx_old(i-1,2) + fx_old(i,2)) @@ -1080,7 +1080,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(i,2) = fx(i,2) - (0.5d0*(dz(i+1,2)+dz(i,2)))*gdtdss*(hz_old(i+1,2)-hz_old(i,2)) fy(i,2) = fy(i,2) - (0.5d0*(dz(i, 3)+dz(i,2)))*gdtds *(hz_old(i, 3)-hz_old(i,2)) #else - ddx_tmp = half*(hz(i+1,2) + hz(i,2) + dz(i+1,2) + dz(i,2)) + ddx_tmp = half*(hz_old(i+1,2) + hz_old(i,2) + dz(i+1,2) + dz(i,2)) if(dz(i,2) > zap .AND. dz(i+1,2) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,2) + fy_old(i+1,2) + fy_old(i,1) + fy_old(i+1,1)) fx(i,2) = fx_old(i,2) - ddx_tmp*gdtdss*(hz_old(i+1,2)-hz_old(i,2))-crls*fybar @@ -1107,7 +1107,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(i,2) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,3) + hz(i,2) + dz(i,3) + dz(i,2)) + ddy_tmp = half*(hz_old(i,3) + hz_old(i,2) + dz(i,3) + dz(i,2)) if(dz(i,2) > zap .AND. dz(i,3) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,2) + fx_old(i-1,2) + fx_old(i-1,3) + fx_old(i,3)) @@ -1176,7 +1176,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(i,3) = fx(i,3) - (0.5d0*(dz(i+1,3)+dz(i,3)))*gdtdss*(hz_old(i+1,3)-hz_old(i,3)) fy(i,3) = fy(i,3) - (0.5d0*(dz(i, 4)+dz(i,3)))*gdtds *(hz_old(i, 4)-hz_old(i,3)) #else - ddx_tmp = half*(hz(i+1,3) + hz(i,3) + dz(i+1,3) + dz(i,3)) + ddx_tmp = half*(hz_old(i+1,3) + hz_old(i,3) + dz(i+1,3) + dz(i,3)) if(dz(i,3) > zap .AND. dz(i+1,3) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,3) + fy_old(i+1,3) + fy_old(i,2) + fy_old(i+1,2)) fx(i,3) = fx_old(i,3) - ddx_tmp*gdtdss*(hz_old(i+1,3)-hz_old(i,3))-crls*fybar @@ -1201,7 +1201,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, else fx(i,3) = zap end if - ddy_tmp = half*(hz(i,4) + hz(i,3) + dz(i,4) + dz(i,3)) + ddy_tmp = half*(hz_old(i,4) + hz_old(i,3) + dz(i,4) + dz(i,3)) if(dz(i,3) > zap .AND. dz(i,4) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,3) + fx_old(i-1,3) + fx_old(i-1,4) + fx_old(i,4)) @@ -1276,7 +1276,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(i,nlat-1) = fx(i,nlat-1) - (0.5d0*(dz(i+1,nlat-1)+dz(i,nlat-1)))*gdtdss*(hz_old(i+1,nlat-1)-hz_old(i,nlat-1)) fy(i,nlat-1) = fy(i,nlat-1) - (0.5d0*(dz(i, nlat) +dz(i,nlat-1)))*gdtds *(hz_old(i, nlat) -hz_old(i,nlat-1)) #else - ddx_tmp = half*(hz(i+1,nlat-1) + hz(i,nlat-1) + dz(i+1,nlat-1) + dz(i,nlat-1)) + ddx_tmp = half*(hz_old(i+1,nlat-1) + hz_old(i,nlat-1) + dz(i+1,nlat-1) + dz(i,nlat-1)) if(dz(i,nlat-1) > zap .AND. dz(i+1,nlat-1) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,nlat-1) + fy_old(i+1,nlat-1) + fy_old(i,nlat-2) + fy_old(i+1,nlat-2)) fx(i,nlat-1) = fx_old(i,nlat-1) - ddx_tmp*gdtdss*(hz_old(i+1,nlat-1)-hz_old(i,nlat-1))-crls*fybar @@ -1303,7 +1303,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(i,nlat-1) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,nlat) + hz(i,nlat-1) + dz(i,nlat) + dz(i,nlat-1)) + ddy_tmp = half*(hz_old(i,nlat) + hz_old(i,nlat-1) + dz(i,nlat) + dz(i,nlat-1)) if(dz(i,nlat-1) > zap .AND. dz(i,nlat) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,nlat-1) + fx_old(i-1,nlat-1) + fx_old(i-1,nlat) + fx_old(i,nlat)) @@ -1373,7 +1373,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(i,nlat-2) = fx(i,nlat-2) - (0.5d0*(dz(i+1,nlat-2)+dz(i,nlat-2)))*gdtdss*(hz_old(i+1,nlat-2)-hz_old(i,nlat-2)) fy(i,nlat-2) = fy(i,nlat-2) - (0.5d0*(dz(i, nlat-1)+dz(i,nlat-2)))*gdtds *(hz_old(i, nlat-1)-hz_old(i,nlat-2)) #else - ddx_tmp = half*(hz(i+1,nlat-2) + hz(i,nlat-2) + dz(i+1,nlat-2) + dz(i,nlat-2)) + ddx_tmp = half*(hz_old(i+1,nlat-2) + hz_old(i,nlat-2) + dz(i+1,nlat-2) + dz(i,nlat-2)) if(dz(i,nlat-2) > zap .AND. dz(i+1,nlat-2) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,nlat-2) + fy_old(i+1,nlat-2) + fy_old(i,nlat-3) + fy_old(i+1,nlat-3)) fx(i,nlat-2) = fx_old(i,nlat-2) - ddx_tmp*gdtdss*(hz_old(i+1,nlat-2)-hz_old(i,nlat-2))-crls*fybar @@ -1400,7 +1400,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(i,nlat-2) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,nlat-1) + hz(i,nlat-2) + dz(i,nlat-1) + dz(i,nlat-2)) + ddy_tmp = half*(hz_old(i,nlat-1) + hz_old(i,nlat-2) + dz(i,nlat-1) + dz(i,nlat-2)) if(dz(i,nlat-2) > zap .AND. dz(i,nlat-1) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,nlat-2) + fx_old(i-1,nlat-2) + fx_old(i-1,nlat-1) + fx_old(i,nlat-1)) @@ -1440,7 +1440,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, #ifdef OLD_SCHEME !$omp do private(theta, sint, gdtdss) #else -!$omp do private(theta, sint, gdtdss, fxbar, fybar, cf, cf2, bcf, bcf2, fric, fric2, ddx_tmp, ddy_tmp) +!$omp do private(theta, sint, gdtdss, crls, fxbar, fybar, cf, cf2, bcf, bcf2, fric, fric2, ddx_tmp, ddy_tmp) #endif #ifndef UPWIND3 do j = 2, nlat-2 @@ -1481,7 +1481,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(nlon-1,j) = fx(nlon-1,j) - (0.5d0*(dz(nlon, j) +dz(nlon-1,j)))*gdtdss*(hz_old(nlon, j) -hz_old(nlon-1,j)) fy(nlon-1,j) = fy(nlon-1,j) - (0.5d0*(dz(nlon-1,j+1)+dz(nlon-1,j)))*gdtds *(hz_old(nlon-1,j+1)-hz_old(nlon-1,j)) #else - ddx_tmp = half*(hz(nlon,j) + hz(nlon-1,j) + dz(nlon,j) + dz(nlon-1,j)) + ddx_tmp = half*(hz_old(nlon,j) + hz_old(nlon-1,j) + dz(nlon,j) + dz(nlon-1,j)) if(dz(nlon-1,j) > zap .AND. dz(nlon,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(nlon-1,j) + fy_old(nlon,j) + fy_old(nlon-1,j-1) + fy_old(nlon,j-1)) @@ -1512,7 +1512,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(nlon-1,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(nlon-1,j+1) + hz(nlon-1,j) + dz(nlon-1,j+1) + dz(nlon-1,j)) + ddy_tmp = half*(hz_old(nlon-1,j+1) + hz_old(nlon-1,j) + dz(nlon-1,j+1) + dz(nlon-1,j)) if(dz(nlon-1,j) > zap .AND. dz(nlon-1,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(nlon-1,j) + fx_old(nlon-2,j) + fx_old(nlon-2,j+1) + fx_old(nlon-1,j+1)) fy(nlon-1,j) = fy_old(nlon-1,j) - ddy_tmp*gdtds *(hz_old(nlon-1,j+1)-hz_old(nlon-1,j))+crls*fxbar @@ -1574,7 +1574,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(1,j) = fx(1,j) - (0.5d0*(dz(2,j) +dz(1,j)))*gdtdss*(hz_old(2,j) -hz_old(1,j)) fy(1,j) = fy(1,j) - (0.5d0*(dz(1,j+1)+dz(1,j)))*gdtds *(hz_old(1,j+1)-hz_old(1,j)) #else - ddx_tmp = half*(hz(2,j) + hz(1,j) + dz(2,j) + dz(1,j)) + ddx_tmp = half*(hz_old(2,j) + hz_old(1,j) + dz(2,j) + dz(1,j)) if(dz(1,j) > zap .AND. dz(2,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(1,j) + fy_old(2,j) + fy_old(1,j-1) + fy_old(2,j-1)) @@ -1605,7 +1605,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(1,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(1,j+1) + hz(1,j) + dz(1,j+1) + dz(1,j)) + ddy_tmp = half*(hz_old(1,j+1) + hz_old(1,j) + dz(1,j+1) + dz(1,j)) if(dz(1,j) > zap .AND. dz(1,j+1) > zap .AND. ddy_tmp > zap) then fxbar = half*(fx_old(1,j) + fx_old(1,j+1)) fy(1,j) = fy_old(1,j) - ddy_tmp*gdtds *(hz_old(1,j+1)-hz_old(1,j))+crls*fxbar @@ -1658,7 +1658,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(2,j) = fx(2,j) - (0.5d0*(dz(3,j) +dz(2,j)))*gdtdss*(hz_old(3,j) -hz_old(2,j)) fy(2,j) = fy(2,j) - (0.5d0*(dz(2,j+1)+dz(2,j)))*gdtds *(hz_old(2,j+1)-hz_old(2,j)) #else - ddx_tmp = half*(hz(3,j) + hz(2,j) + dz(3,j) + dz(2,j)) + ddx_tmp = half*(hz_old(3,j) + hz_old(2,j) + dz(3,j) + dz(2,j)) if(dz(2,j) > zap .AND. dz(3,j) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(2,j) + fy_old(3,j) + fy_old(2,j-1) + fy_old(3,j-1)) fx(2,j) = fx_old(2,j) - ddx_tmp*gdtdss*(hz_old(3,j)-hz_old(2,j))-crls*fybar @@ -1685,7 +1685,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(2,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(2,j+1) + hz(2,j) + dz(2,j+1) + dz(2,j)) + ddy_tmp = half*(hz_old(2,j+1) + hz_old(2,j) + dz(2,j+1) + dz(2,j)) if(dz(2,j) > zap .AND. dz(2,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(2,j) + fx_old(1,j) + fx_old(1,j+1) + fx_old(2,j+1)) fy(2,j) = fy_old(2,j) - ddy_tmp*gdtds *(hz_old(2,j+1)-hz_old(2,j))+crls*fxbar @@ -1748,7 +1748,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fy(2,j) = zap end if #else - ddx_tmp = half*(hz(3,j) + hz(2,j) + dz(3,j) + dz(2,j)) + ddx_tmp = half*(hz_old(3,j) + hz_old(2,j) + dz(3,j) + dz(2,j)) if(dz(2,j) > zap .AND. dz(3,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(2,j) + fy_old(3,j) + fy_old(2,j-1) + fy_old(3,j-1)) @@ -1777,7 +1777,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, else fx(2,j) = zap end if - ddy_tmp = half*(hz(2,j+1) + hz(2,j) + dz(2,j+1) + dz(2,j)) + ddy_tmp = half*(hz_old(2,j+1) + hz_old(2,j) + dz(2,j+1) + dz(2,j)) if(dz(2,j) > zap .AND. dz(2,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(2,j) + fx_old(1,j) + fx_old(1,j+1) + fx_old(2,j+1)) fy(2,j) = fy_old(2,j) - ddy_tmp*gdtds *(hz_old(2,j+1)-hz_old(2,j))+crls*fxbar @@ -1811,7 +1811,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, #ifdef OLD_SCHEME !$omp do private(theta, sint, gdtdss) #else -!$omp do private(theta, sint, gdtdss, fxbar, fybar, cf, cf2, bcf, bcf2, fric, fric2, ddx_tmp, ddy_tmp) +!$omp do private(theta, sint, gdtdss, crls, fxbar, fybar, cf, cf2, bcf, bcf2, fric, fric2, ddx_tmp, ddy_tmp) #endif do j = 4, nlat-3 theta = th0 + (j-1)*dth @@ -1843,7 +1843,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(nlon-2,j) = fx(nlon-2,j) - (0.5d0*(dz(nlon-1,j) +dz(nlon-2,j)))*gdtdss*(hz_old(nlon-1,j) -hz_old(nlon-2,j)) fy(nlon-2,j) = fy(nlon-2,j) - (0.5d0*(dz(nlon-2,j+1)+dz(nlon-2,j)))*gdtds *(hz_old(nlon-2,j+1)-hz_old(nlon-2,j)) #else - ddx_tmp = half*(hz(nlon-1,j) + hz(nlon-2,j) + dz(nlon-1,j) + dz(nlon-2,j)) + ddx_tmp = half*(hz_old(nlon-1,j) + hz_old(nlon-2,j) + dz(nlon-1,j) + dz(nlon-2,j)) if(dz(nlon-1,j) > zap .AND. dz(nlon-2,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(nlon-2,j) + fy_old(nlon-1,j) + fy_old(nlon-2,j-1) + fy_old(nlon-1,j-1)) @@ -1874,7 +1874,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(nlon-2,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(nlon-2,j+1) + hz(nlon-2,j) + dz(nlon-2,j+1) + dz(nlon-2,j)) + ddy_tmp = half*(hz_old(nlon-2,j+1) + hz_old(nlon-2,j) + dz(nlon-2,j+1) + dz(nlon-2,j)) if(dz(nlon-2,j) > zap .AND. dz(nlon-2,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(nlon-2,j) + fx_old(nlon-3,j) + fx_old(nlon-3,j+1) + fx_old(nlon-2,j+1)) fy(nlon-2,j) = fy_old(nlon-2,j) - ddy_tmp*gdtds *(hz_old(nlon-2,j+1)-hz_old(nlon-2,j))+crls*fxbar @@ -1931,7 +1931,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(3,j) = fx(3,j) - (0.5d0*(dz(4,j) +dz(3,j)))*gdtdss*(hz_old(4,j) -hz_old(3,j)) fy(3,j) = fy(3,j) - (0.5d0*(dz(3,j+1)+dz(3,j)))*gdtds *(hz_old(3,j+1)-hz_old(3,j)) #else - ddx_tmp = half*(hz(4,j) + hz(3,j) + dz(4,j) + dz(3,j)) + ddx_tmp = half*(hz_old(4,j) + hz_old(3,j) + dz(4,j) + dz(3,j)) if(dz(3,j) > zap .AND. dz(4,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(3,j) + fy_old(4,j) + fy_old(3,j-1) + fy_old(4,j-1)) @@ -1962,7 +1962,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon,nlat, fx(3,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(3,j+1) + hz(3,j) + dz(3,j+1) + dz(3,j)) + ddy_tmp = half*(hz_old(3,j+1) + hz_old(3,j) + dz(3,j+1) + dz(3,j)) if(dz(3,j) > zap .AND. dz(3,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(3,j) + fx_old(2,j) + fx_old(2,j+1) + fx_old(3,j+1)) fy(3,j) = fy_old(3,j) - ddy_tmp*gdtds *(hz_old(3,j+1)-hz_old(3,j))+crls*fxbar diff --git a/src/mod_fxy_cartesian.f90 b/src/mod_fxy_cartesian.f90 index 41d1f25..524f97e 100644 --- a/src/mod_fxy_cartesian.f90 +++ b/src/mod_fxy_cartesian.f90 @@ -908,7 +908,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(i,1) = fx(i,1) - (0.5d0*(dz(i+1,1)+dz(i,1)))*gdtds*(hz_old(i+1,1)-hz_old(i,1)) fy(i,1) = fy(i,1) - (0.5d0*(dz(i, 2)+dz(i,1)))*gdtds*(hz_old(i, 2)-hz_old(i,1)) #else - ddx_tmp = half*(hz(i+1,1) + hz(i,1) + dz(i+1,1) + dz(i,1)) + ddx_tmp = half*(hz_old(i+1,1) + hz_old(i,1) + dz(i+1,1) + dz(i,1)) if(dz(i,1) > zap .AND. dz(i+1,1) > zap .AND. ddx_tmp > zap) then fybar = half*(fy_old(i,1) + fy_old(i+1,1)) fx(i,1) = fx_old(i,1) - ddx_tmp*gdtds*(hz_old(i+1,1)-hz_old(i,1)) @@ -935,7 +935,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(i,1) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,2) + hz(i,1) + dz(i,2) + dz(i,1)) + ddy_tmp = half*(hz_old(i,2) + hz_old(i,1) + dz(i,2) + dz(i,1)) if(dz(i,1) > zap .AND. dz(i,2) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,1) + fx_old(i-1,1) + fx_old(i-1,2) + fx_old(i,2)) @@ -992,7 +992,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(i,2) = fx(i,2) - (0.5d0*(dz(i+1,2)+dz(i,2)))*gdtds*(hz_old(i+1,2)-hz_old(i,2)) fy(i,2) = fy(i,2) - (0.5d0*(dz(i, 3)+dz(i,2)))*gdtds*(hz_old(i, 3)-hz_old(i,2)) #else - ddx_tmp = half*(hz(i+1,2) + hz(i,2) + dz(i+1,2) + dz(i,2)) + ddx_tmp = half*(hz_old(i+1,2) + hz_old(i,2) + dz(i+1,2) + dz(i,2)) if(dz(i,2) > zap .AND. dz(i+1,2) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,2) + fy_old(i+1,2) + fy_old(i,1) + fy_old(i+1,1)) fx(i,2) = fx_old(i,2) - ddx_tmp*gdtds*(hz_old(i+1,2)-hz_old(i,2)) @@ -1019,7 +1019,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(i,2) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,3) + hz(i,2) + dz(i,3) + dz(i,2)) + ddy_tmp = half*(hz_old(i,3) + hz_old(i,2) + dz(i,3) + dz(i,2)) if(dz(i,2) > zap .AND. dz(i,3) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,2) + fx_old(i-1,2) + fx_old(i-1,3) + fx_old(i,3)) @@ -1077,7 +1077,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(i,3) = fx(i,3) - (0.5d0*(dz(i+1,3)+dz(i,3)))*gdtds*(hz_old(i+1,3)-hz_old(i,3)) fy(i,3) = fy(i,3) - (0.5d0*(dz(i, 4)+dz(i,3)))*gdtds*(hz_old(i, 4)-hz_old(i,3)) #else - ddx_tmp = half*(hz(i+1,3) + hz(i,3) + dz(i+1,3) + dz(i,3)) + ddx_tmp = half*(hz_old(i+1,3) + hz_old(i,3) + dz(i+1,3) + dz(i,3)) if(dz(i,3) > zap .AND. dz(i+1,3) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,3) + fy_old(i+1,3) + fy_old(i,2) + fy_old(i+1,2)) fx(i,3) = fx_old(i,3) - ddx_tmp*gdtds*(hz_old(i+1,3)-hz_old(i,3)) @@ -1102,7 +1102,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b else fx(i,3) = zap end if - ddy_tmp = half*(hz(i,4) + hz(i,3) + dz(i,4) + dz(i,3)) + ddy_tmp = half*(hz_old(i,4) + hz_old(i,3) + dz(i,4) + dz(i,3)) if(dz(i,3) > zap .AND. dz(i,4) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,3) + fx_old(i-1,3) + fx_old(i-1,4) + fx_old(i,4)) @@ -1166,7 +1166,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(i,nlat-1) = fx(i,nlat-1) - (0.5d0*(dz(i+1,nlat-1)+dz(i,nlat-1)))*gdtds*(hz_old(i+1,nlat-1)-hz_old(i,nlat-1)) fy(i,nlat-1) = fy(i,nlat-1) - (0.5d0*(dz(i, nlat) +dz(i,nlat-1)))*gdtds*(hz_old(i, nlat) -hz_old(i,nlat-1)) #else - ddx_tmp = half*(hz(i+1,nlat-1) + hz(i,nlat-1) + dz(i+1,nlat-1) + dz(i,nlat-1)) + ddx_tmp = half*(hz_old(i+1,nlat-1) + hz_old(i,nlat-1) + dz(i+1,nlat-1) + dz(i,nlat-1)) if(dz(i,nlat-1) > zap .AND. dz(i+1,nlat-1) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,nlat-1) + fy_old(i+1,nlat-1) + fy_old(i,nlat-2) + fy_old(i+1,nlat-2)) fx(i,nlat-1) = fx_old(i,nlat-1) - ddx_tmp*gdtds*(hz_old(i+1,nlat-1)-hz_old(i,nlat-1)) @@ -1193,7 +1193,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(i,nlat-1) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,nlat) + hz(i,nlat-1) + dz(i,nlat) + dz(i,nlat-1)) + ddy_tmp = half*(hz_old(i,nlat) + hz_old(i,nlat-1) + dz(i,nlat) + dz(i,nlat-1)) if(dz(i,nlat-1) > zap .AND. dz(i,nlat) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,nlat-1) + fx_old(i-1,nlat-1) + fx_old(i-1,nlat) + fx_old(i,nlat)) @@ -1252,7 +1252,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(i,nlat-2) = fx(i,nlat-2) - (0.5d0*(dz(i+1,nlat-2)+dz(i,nlat-2)))*gdtds*(hz_old(i+1,nlat-2)-hz_old(i,nlat-2)) fy(i,nlat-2) = fy(i,nlat-2) - (0.5d0*(dz(i, nlat-1)+dz(i,nlat-2)))*gdtds*(hz_old(i, nlat-1)-hz_old(i,nlat-2)) #else - ddx_tmp = half*(hz(i+1,nlat-2) + hz(i,nlat-2) + dz(i+1,nlat-2) + dz(i,nlat-2)) + ddx_tmp = half*(hz_old(i+1,nlat-2) + hz_old(i,nlat-2) + dz(i+1,nlat-2) + dz(i,nlat-2)) if(dz(i,nlat-2) > zap .AND. dz(i+1,nlat-2) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,nlat-2) + fy_old(i+1,nlat-2) + fy_old(i,nlat-3) + fy_old(i+1,nlat-3)) fx(i,nlat-2) = fx_old(i,nlat-2) - ddx_tmp*gdtds*(hz_old(i+1,nlat-2)-hz_old(i,nlat-2)) @@ -1279,7 +1279,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(i,nlat-2) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,nlat-1) + hz(i,nlat-2) + dz(i,nlat-1) + dz(i,nlat-2)) + ddy_tmp = half*(hz_old(i,nlat-1) + hz_old(i,nlat-2) + dz(i,nlat-1) + dz(i,nlat-2)) if(dz(i,nlat-2) > zap .AND. dz(i,nlat-1) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,nlat-2) + fx_old(i-1,nlat-2) + fx_old(i-1,nlat-1) + fx_old(i,nlat-1)) @@ -1352,7 +1352,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(nlon-1,j) = fx(nlon-1,j) - (0.5d0*(dz(nlon, j) +dz(nlon-1,j)))*gdtds*(hz_old(nlon, j) -hz_old(nlon-1,j)) fy(nlon-1,j) = fy(nlon-1,j) - (0.5d0*(dz(nlon-1,j+1)+dz(nlon-1,j)))*gdtds*(hz_old(nlon-1,j+1)-hz_old(nlon-1,j)) #else - ddx_tmp = half*(hz(nlon,j) + hz(nlon-1,j) + dz(nlon,j) + dz(nlon-1,j)) + ddx_tmp = half*(hz_old(nlon,j) + hz_old(nlon-1,j) + dz(nlon,j) + dz(nlon-1,j)) if(dz(nlon-1,j) > zap .AND. dz(nlon,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(nlon-1,j) + fy_old(nlon,j) + fy_old(nlon-1,j-1) + fy_old(nlon,j-1)) @@ -1383,7 +1383,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(nlon-1,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(nlon-1,j+1) + hz(nlon-1,j) + dz(nlon-1,j+1) + dz(nlon-1,j)) + ddy_tmp = half*(hz_old(nlon-1,j+1) + hz_old(nlon-1,j) + dz(nlon-1,j+1) + dz(nlon-1,j)) if(dz(nlon-1,j) > zap .AND. dz(nlon-1,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(nlon-1,j) + fx_old(nlon-2,j) + fx_old(nlon-2,j+1) + fx_old(nlon-1,j+1)) fy(nlon-1,j) = fy_old(nlon-1,j) - ddy_tmp*gdtds*(hz_old(nlon-1,j+1)-hz_old(nlon-1,j)) @@ -1438,7 +1438,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(1,j) = fx(1,j) - (0.5d0*(dz(2,j) +dz(1,j)))*gdtds*(hz_old(2,j) -hz_old(1,j)) fy(1,j) = fy(1,j) - (0.5d0*(dz(1,j+1)+dz(1,j)))*gdtds*(hz_old(1,j+1)-hz_old(1,j)) #else - ddx_tmp = half*(hz(2,j) + hz(1,j) + dz(2,j) + dz(1,j)) + ddx_tmp = half*(hz_old(2,j) + hz_old(1,j) + dz(2,j) + dz(1,j)) if(dz(1,j) > zap .AND. dz(2,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(1,j) + fy_old(2,j) + fy_old(1,j-1) + fy_old(2,j-1)) @@ -1469,7 +1469,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(1,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(1,j+1) + hz(1,j) + dz(1,j+1) + dz(1,j)) + ddy_tmp = half*(hz_old(1,j+1) + hz_old(1,j) + dz(1,j+1) + dz(1,j)) if(dz(1,j) > zap .AND. dz(1,j+1) > zap .AND. ddy_tmp > zap) then fxbar = half*(fx_old(1,j) + fx_old(1,j+1)) fy(1,j) = fy_old(1,j) - ddy_tmp*gdtds*(hz_old(1,j+1)-hz_old(1,j)) @@ -1516,7 +1516,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(2,j) = fx(2,j) - (0.5d0*(dz(3,j) +dz(2,j)))*gdtds*(hz_old(3,j) -hz_old(2,j)) fy(2,j) = fy(2,j) - (0.5d0*(dz(2,j+1)+dz(2,j)))*gdtds*(hz_old(2,j+1)-hz_old(2,j)) #else - ddx_tmp = half*(hz(3,j) + hz(2,j) + dz(3,j) + dz(2,j)) + ddx_tmp = half*(hz_old(3,j) + hz_old(2,j) + dz(3,j) + dz(2,j)) if(dz(2,j) > zap .AND. dz(3,j) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(2,j) + fy_old(3,j) + fy_old(2,j-1) + fy_old(3,j-1)) fx(2,j) = fx_old(2,j) - ddx_tmp*gdtds*(hz_old(3,j)-hz_old(2,j)) @@ -1543,7 +1543,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(2,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(2,j+1) + hz(2,j) + dz(2,j+1) + dz(2,j)) + ddy_tmp = half*(hz_old(2,j+1) + hz_old(2,j) + dz(2,j+1) + dz(2,j)) if(dz(2,j) > zap .AND. dz(2,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(2,j) + fx_old(1,j) + fx_old(1,j+1) + fx_old(2,j+1)) fy(2,j) = fy_old(2,j) - ddy_tmp*gdtds*(hz_old(2,j+1)-hz_old(2,j)) @@ -1595,7 +1595,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(2,j) = fx(2,j) - (0.5d0*(dz(3,j) +dz(2,j)))*gdtds*(hz_old(3,j) -hz_old(2,j)) fy(2,j) = fy(2,j) - (0.5d0*(dz(2,j+1)+dz(2,j)))*gdtds*(hz_old(2,j+1)-hz_old(2,j)) #else - ddx_tmp = half*(hz(3,j) + hz(2,j) + dz(3,j) + dz(2,j)) + ddx_tmp = half*(hz_old(3,j) + hz_old(2,j) + dz(3,j) + dz(2,j)) if(dz(2,j) > zap .AND. dz(3,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(2,j) + fy_old(3,j) + fy_old(2,j-1) + fy_old(3,j-1)) @@ -1626,7 +1626,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(2,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(2,j+1) + hz(2,j) + dz(2,j+1) + dz(2,j)) + ddy_tmp = half*(hz_old(2,j+1) + hz_old(2,j) + dz(2,j+1) + dz(2,j)) if(dz(2,j) > zap .AND. dz(2,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(2,j) + fx_old(1,j) + fx_old(1,j+1) + fx_old(2,j+1)) fy(2,j) = fy_old(2,j) - ddy_tmp*gdtds*(hz_old(2,j+1)-hz_old(2,j)) @@ -1684,7 +1684,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(nlon-2,j) = fx(nlon-2,j) - (0.5d0*(dz(nlon-1,j) +dz(nlon-2,j)))*gdtds*(hz_old(nlon-1,j) -hz_old(nlon-2,j)) fy(nlon-2,j) = fy(nlon-2,j) - (0.5d0*(dz(nlon-2,j+1)+dz(nlon-2,j)))*gdtds*(hz_old(nlon-2,j+1)-hz_old(nlon-2,j)) #else - ddx_tmp = half*(hz(nlon-1,j) + hz(nlon-2,j) + dz(nlon-1,j) + dz(nlon-2,j)) + ddx_tmp = half*(hz_old(nlon-1,j) + hz_old(nlon-2,j) + dz(nlon-1,j) + dz(nlon-2,j)) if(dz(nlon-1,j) > zap .AND. dz(nlon-2,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(nlon-2,j) + fy_old(nlon-1,j) + fy_old(nlon-2,j-1) + fy_old(nlon-1,j-1)) @@ -1715,7 +1715,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(nlon-2,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(nlon-2,j+1) + hz(nlon-2,j) + dz(nlon-2,j+1) + dz(nlon-2,j)) + ddy_tmp = half*(hz_old(nlon-2,j+1) + hz_old(nlon-2,j) + dz(nlon-2,j+1) + dz(nlon-2,j)) if(dz(nlon-2,j) > zap .AND. dz(nlon-2,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(nlon-2,j) + fx_old(nlon-3,j) + fx_old(nlon-3,j+1) + fx_old(nlon-2,j+1)) fy(nlon-2,j) = fy_old(nlon-2,j) - ddy_tmp*gdtds*(hz_old(nlon-2,j+1)-hz_old(nlon-2,j)) @@ -1766,7 +1766,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(3,j) = fx(3,j) - (0.5d0*(dz(4,j) +dz(3,j)))*gdtds*(hz_old(4,j) -hz_old(3,j)) fy(3,j) = fy(3,j) - (0.5d0*(dz(3,j+1)+dz(3,j)))*gdtds*(hz_old(3,j+1)-hz_old(3,j)) #else - ddx_tmp = half*(hz(4,j) + hz(3,j) + dz(4,j) + dz(3,j)) + ddx_tmp = half*(hz_old(4,j) + hz_old(3,j) + dz(4,j) + dz(3,j)) if(dz(3,j) > zap .AND. dz(4,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(3,j) + fy_old(4,j) + fy_old(3,j-1) + fy_old(4,j-1)) @@ -1797,7 +1797,7 @@ subroutine fxynl_rwg(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat,gflag,smallh,b fx(3,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(3,j+1) + hz(3,j) + dz(3,j+1) + dz(3,j)) + ddy_tmp = half*(hz_old(3,j+1) + hz_old(3,j) + dz(3,j+1) + dz(3,j)) if(dz(3,j) > zap .AND. dz(3,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(3,j) + fx_old(2,j) + fx_old(2,j+1) + fx_old(3,j+1)) fy(3,j) = fy_old(3,j) - ddy_tmp*gdtds*(hz_old(3,j+1)-hz_old(3,j)) diff --git a/src/mod_fxy_disp.f90 b/src/mod_fxy_disp.f90 index 14b86cf..e81b93b 100644 --- a/src/mod_fxy_disp.f90 +++ b/src/mod_fxy_disp.f90 @@ -1798,7 +1798,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(i,1) = fx(i,1) - (0.5d0*(dz(i+1,1)+dz(i,1)))*gdtdss*(hz_old(i+1,1)-hz_old(i,1)) fy(i,1) = fy(i,1) - (0.5d0*(dz(i, 2)+dz(i,1)))*gdtds *(hz_old(i, 2)-hz_old(i,1)) #else - ddx_tmp = half*(hz(i+1,1) + hz(i,1) + dz(i+1,1) + dz(i,1)) + ddx_tmp = half*(hz_old(i+1,1) + hz_old(i,1) + dz(i+1,1) + dz(i,1)) if(dz(i,1) > zap .AND. dz(i+1,1) > zap .AND. ddx_tmp > zap) then fybar = half*(fy_old(i,1) + fy_old(i+1,1)) fx(i,1) = fx_old(i,1) - ddx_tmp*gdtdss*(hz_old(i+1,1)-hz_old(i,1))-crls*fybar @@ -1825,7 +1825,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(i,1) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,2) + hz(i,1) + dz(i,2) + dz(i,1)) + ddy_tmp = half*(hz_old(i,2) + hz_old(i,1) + dz(i,2) + dz(i,1)) if(dz(i,1) > zap .AND. dz(i,2) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,1) + fx_old(i-1,1) + fx_old(i-1,2) + fx_old(i,2)) @@ -1893,7 +1893,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(i,2) = fx(i,2) - (0.5d0*(dz(i+1,2)+dz(i,2)))*gdtdss*(hz_old(i+1,2)-hz_old(i,2)) fy(i,2) = fy(i,2) - (0.5d0*(dz(i, 3)+dz(i,2)))*gdtds *(hz_old(i, 3)-hz_old(i,2)) #else - ddx_tmp = half*(hz(i+1,2) + hz(i,2) + dz(i+1,2) + dz(i,2)) + ddx_tmp = half*(hz_old(i+1,2) + hz_old(i,2) + dz(i+1,2) + dz(i,2)) if(dz(i,2) > zap .AND. dz(i+1,2) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,2) + fy_old(i+1,2) + fy_old(i,1) + fy_old(i+1,1)) fx(i,2) = fx_old(i,2) - ddx_tmp*gdtdss*(hz_old(i+1,2)-hz_old(i,2))-crls*fybar @@ -1920,7 +1920,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(i,2) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,3) + hz(i,2) + dz(i,3) + dz(i,2)) + ddy_tmp = half*(hz_old(i,3) + hz_old(i,2) + dz(i,3) + dz(i,2)) if(dz(i,2) > zap .AND. dz(i,3) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,2) + fx_old(i-1,2) + fx_old(i-1,3) + fx_old(i,3)) @@ -1989,7 +1989,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(i,3) = fx(i,3) - (0.5d0*(dz(i+1,3)+dz(i,3)))*gdtdss*(hz_old(i+1,3)-hz_old(i,3)) fy(i,3) = fy(i,3) - (0.5d0*(dz(i, 4)+dz(i,3)))*gdtds *(hz_old(i, 4)-hz_old(i,3)) #else - ddx_tmp = half*(hz(i+1,3) + hz(i,3) + dz(i+1,3) + dz(i,3)) + ddx_tmp = half*(hz_old(i+1,3) + hz_old(i,3) + dz(i+1,3) + dz(i,3)) if(dz(i,3) > zap .AND. dz(i+1,3) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,3) + fy_old(i+1,3) + fy_old(i,2) + fy_old(i+1,2)) fx(i,3) = fx_old(i,3) - ddx_tmp*gdtdss*(hz_old(i+1,3)-hz_old(i,3))-crls*fybar @@ -2014,7 +2014,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, else fx(i,3) = zap end if - ddy_tmp = half*(hz(i,4) + hz(i,3) + dz(i,4) + dz(i,3)) + ddy_tmp = half*(hz_old(i,4) + hz_old(i,3) + dz(i,4) + dz(i,3)) if(dz(i,3) > zap .AND. dz(i,4) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,3) + fx_old(i-1,3) + fx_old(i-1,4) + fx_old(i,4)) @@ -2089,7 +2089,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(i,nlat-1) = fx(i,nlat-1) - (0.5d0*(dz(i+1,nlat-1)+dz(i,nlat-1)))*gdtdss*(hz_old(i+1,nlat-1)-hz_old(i,nlat-1)) fy(i,nlat-1) = fy(i,nlat-1) - (0.5d0*(dz(i, nlat) +dz(i,nlat-1)))*gdtds *(hz_old(i, nlat) -hz_old(i,nlat-1)) #else - ddx_tmp = half*(hz(i+1,nlat-1) + hz(i,nlat-1) + dz(i+1,nlat-1) + dz(i,nlat-1)) + ddx_tmp = half*(hz_old(i+1,nlat-1) + hz_old(i,nlat-1) + dz(i+1,nlat-1) + dz(i,nlat-1)) if(dz(i,nlat-1) > zap .AND. dz(i+1,nlat-1) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,nlat-1) + fy_old(i+1,nlat-1) + fy_old(i,nlat-2) + fy_old(i+1,nlat-2)) fx(i,nlat-1) = fx_old(i,nlat-1) - ddx_tmp*gdtdss*(hz_old(i+1,nlat-1)-hz_old(i,nlat-1))-crls*fybar @@ -2116,7 +2116,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(i,nlat-1) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,nlat) + hz(i,nlat-1) + dz(i,nlat) + dz(i,nlat-1)) + ddy_tmp = half*(hz_old(i,nlat) + hz_old(i,nlat-1) + dz(i,nlat) + dz(i,nlat-1)) if(dz(i,nlat-1) > zap .AND. dz(i,nlat) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,nlat-1) + fx_old(i-1,nlat-1) + fx_old(i-1,nlat) + fx_old(i,nlat)) @@ -2186,7 +2186,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(i,nlat-2) = fx(i,nlat-2) - (0.5d0*(dz(i+1,nlat-2)+dz(i,nlat-2)))*gdtdss*(hz_old(i+1,nlat-2)-hz_old(i,nlat-2)) fy(i,nlat-2) = fy(i,nlat-2) - (0.5d0*(dz(i, nlat-1)+dz(i,nlat-2)))*gdtds *(hz_old(i, nlat-1)-hz_old(i,nlat-2)) #else - ddx_tmp = half*(hz(i+1,nlat-2) + hz(i,nlat-2) + dz(i+1,nlat-2) + dz(i,nlat-2)) + ddx_tmp = half*(hz_old(i+1,nlat-2) + hz_old(i,nlat-2) + dz(i+1,nlat-2) + dz(i,nlat-2)) if(dz(i,nlat-2) > zap .AND. dz(i+1,nlat-2) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,nlat-2) + fy_old(i+1,nlat-2) + fy_old(i,nlat-3) + fy_old(i+1,nlat-3)) fx(i,nlat-2) = fx_old(i,nlat-2) - ddx_tmp*gdtdss*(hz_old(i+1,nlat-2)-hz_old(i,nlat-2))-crls*fybar @@ -2213,7 +2213,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(i,nlat-2) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,nlat-1) + hz(i,nlat-2) + dz(i,nlat-1) + dz(i,nlat-2)) + ddy_tmp = half*(hz_old(i,nlat-1) + hz_old(i,nlat-2) + dz(i,nlat-1) + dz(i,nlat-2)) if(dz(i,nlat-2) > zap .AND. dz(i,nlat-1) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,nlat-2) + fx_old(i-1,nlat-2) + fx_old(i-1,nlat-1) + fx_old(i,nlat-1)) @@ -2253,7 +2253,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, #ifdef OLD_SCHEME !$omp do private(theta, sint, gdtdss) #else -!$omp do private(theta, sint, gdtdss, fxbar, fybar, cf, cf2, bcf, bcf2, fric, fric2, ddx_tmp, ddy_tmp) +!$omp do private(theta, sint, gdtdss, crls, fxbar, fybar, cf, cf2, bcf, bcf2, fric, fric2, ddx_tmp, ddy_tmp) #endif #ifndef UPWIND3 do j = 2, nlat-2 @@ -2294,7 +2294,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(nlon-1,j) = fx(nlon-1,j) - (0.5d0*(dz(nlon, j) +dz(nlon-1,j)))*gdtdss*(hz_old(nlon, j) -hz_old(nlon-1,j)) fy(nlon-1,j) = fy(nlon-1,j) - (0.5d0*(dz(nlon-1,j+1)+dz(nlon-1,j)))*gdtds *(hz_old(nlon-1,j+1)-hz_old(nlon-1,j)) #else - ddx_tmp = half*(hz(nlon,j) + hz(nlon-1,j) + dz(nlon,j) + dz(nlon-1,j)) + ddx_tmp = half*(hz_old(nlon,j) + hz_old(nlon-1,j) + dz(nlon,j) + dz(nlon-1,j)) if(dz(nlon-1,j) > zap .AND. dz(nlon,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(nlon-1,j) + fy_old(nlon,j) + fy_old(nlon-1,j-1) + fy_old(nlon,j-1)) @@ -2325,7 +2325,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(nlon-1,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(nlon-1,j+1) + hz(nlon-1,j) + dz(nlon-1,j+1) + dz(nlon-1,j)) + ddy_tmp = half*(hz_old(nlon-1,j+1) + hz_old(nlon-1,j) + dz(nlon-1,j+1) + dz(nlon-1,j)) if(dz(nlon-1,j) > zap .AND. dz(nlon-1,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(nlon-1,j) + fx_old(nlon-2,j) + fx_old(nlon-2,j+1) + fx_old(nlon-1,j+1)) fy(nlon-1,j) = fy_old(nlon-1,j) - ddy_tmp*gdtds *(hz_old(nlon-1,j+1)-hz_old(nlon-1,j))+crls*fxbar @@ -2387,7 +2387,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(1,j) = fx(1,j) - (0.5d0*(dz(2,j) +dz(1,j)))*gdtdss*(hz_old(2,j) -hz_old(1,j)) fy(1,j) = fy(1,j) - (0.5d0*(dz(1,j+1)+dz(1,j)))*gdtds *(hz_old(1,j+1)-hz_old(1,j)) #else - ddx_tmp = half*(hz(2,j) + hz(1,j) + dz(2,j) + dz(1,j)) + ddx_tmp = half*(hz_old(2,j) + hz_old(1,j) + dz(2,j) + dz(1,j)) if(dz(1,j) > zap .AND. dz(2,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(1,j) + fy_old(2,j) + fy_old(1,j-1) + fy_old(2,j-1)) @@ -2418,7 +2418,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(1,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(1,j+1) + hz(1,j) + dz(1,j+1) + dz(1,j)) + ddy_tmp = half*(hz_old(1,j+1) + hz_old(1,j) + dz(1,j+1) + dz(1,j)) if(dz(1,j) > zap .AND. dz(1,j+1) > zap .AND. ddy_tmp > zap) then fxbar = half*(fx_old(1,j) + fx_old(1,j+1)) fy(1,j) = fy_old(1,j) - ddy_tmp*gdtds *(hz_old(1,j+1)-hz_old(1,j))+crls*fxbar @@ -2471,7 +2471,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(2,j) = fx(2,j) - (0.5d0*(dz(3,j) +dz(2,j)))*gdtdss*(hz_old(3,j) -hz_old(2,j)) fy(2,j) = fy(2,j) - (0.5d0*(dz(2,j+1)+dz(2,j)))*gdtds *(hz_old(2,j+1)-hz_old(2,j)) #else - ddx_tmp = half*(hz(3,j) + hz(2,j) + dz(3,j) + dz(2,j)) + ddx_tmp = half*(hz_old(3,j) + hz_old(2,j) + dz(3,j) + dz(2,j)) if(dz(2,j) > zap .AND. dz(3,j) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(2,j) + fy_old(3,j) + fy_old(2,j-1) + fy_old(3,j-1)) fx(2,j) = fx_old(2,j) - ddx_tmp*gdtdss*(hz_old(3,j)-hz_old(2,j))-crls*fybar @@ -2498,7 +2498,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(2,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(2,j+1) + hz(2,j) + dz(2,j+1) + dz(2,j)) + ddy_tmp = half*(hz_old(2,j+1) + hz_old(2,j) + dz(2,j+1) + dz(2,j)) if(dz(2,j) > zap .AND. dz(2,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(2,j) + fx_old(1,j) + fx_old(1,j+1) + fx_old(2,j+1)) fy(2,j) = fy_old(2,j) - ddy_tmp*gdtds *(hz_old(2,j+1)-hz_old(2,j))+crls*fxbar @@ -2557,7 +2557,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(2,j) = fx(2,j) - (0.5d0*(dz(3,j) +dz(2,j)))*gdtdss*(hz_old(3,j) -hz_old(2,j)) fy(2,j) = fy(2,j) - (0.5d0*(dz(2,j+1)+dz(2,j)))*gdtds *(hz_old(2,j+1)-hz_old(2,j)) #else - ddx_tmp = half*(hz(3,j) + hz(2,j) + dz(3,j) + dz(2,j)) + ddx_tmp = half*(hz_old(3,j) + hz_old(2,j) + dz(3,j) + dz(2,j)) if(dz(2,j) > zap .AND. dz(3,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(2,j) + fy_old(3,j) + fy_old(2,j-1) + fy_old(3,j-1)) @@ -2591,7 +2591,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, else fx(2,j) = zap end if - ddy_tmp = half*(hz(2,j+1) + hz(2,j) + dz(2,j+1) + dz(2,j)) + ddy_tmp = half*(hz_old(2,j+1) + hz_old(2,j) + dz(2,j+1) + dz(2,j)) if(dz(2,j) > zap .AND. dz(2,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(2,j) + fx_old(1,j) + fx_old(1,j+1) + fx_old(2,j+1)) fy(2,j) = fy_old(2,j) - ddy_tmp*gdtds *(hz_old(2,j+1)-hz_old(2,j))+crls*fxbar @@ -2627,7 +2627,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, #ifdef OLD_SCHEME !$omp do private(theta, sint, gdtdss) #else -!$omp do private(theta, sint, gdtdss, fxbar, fybar, cf, cf2, bcf, bcf2, fric, fric2, ddx_tmp, ddy_tmp) +!$omp do private(theta, sint, gdtdss, crls, fxbar, fybar, cf, cf2, bcf, bcf2, fric, fric2, ddx_tmp, ddy_tmp) #endif do j = 4, nlat-3 theta = th0 + (j-1)*dth @@ -2659,7 +2659,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(nlon-2,j) = fx(nlon-2,j) - (0.5d0*(dz(nlon-1,j) +dz(nlon-2,j)))*gdtdss*(hz_old(nlon-1,j) -hz_old(nlon-2,j)) fy(nlon-2,j) = fy(nlon-2,j) - (0.5d0*(dz(nlon-2,j+1)+dz(nlon-2,j)))*gdtds *(hz_old(nlon-2,j+1)-hz_old(nlon-2,j)) #else - ddx_tmp = half*(hz(nlon-1,j) + hz(nlon-2,j) + dz(nlon-1,j) + dz(nlon-2,j)) + ddx_tmp = half*(hz_old(nlon-1,j) + hz_old(nlon-2,j) + dz(nlon-1,j) + dz(nlon-2,j)) if(dz(nlon-1,j) > zap .AND. dz(nlon-2,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(nlon-2,j) + fy_old(nlon-1,j) + fy_old(nlon-2,j-1) + fy_old(nlon-1,j-1)) @@ -2690,7 +2690,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(nlon-2,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(nlon-2,j+1) + hz(nlon-2,j) + dz(nlon-2,j+1) + dz(nlon-2,j)) + ddy_tmp = half*(hz_old(nlon-2,j+1) + hz_old(nlon-2,j) + dz(nlon-2,j+1) + dz(nlon-2,j)) if(dz(nlon-2,j) > zap .AND. dz(nlon-2,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(nlon-2,j) + fx_old(nlon-3,j) + fx_old(nlon-3,j+1) + fx_old(nlon-2,j+1)) fy(nlon-2,j) = fy_old(nlon-2,j) - ddy_tmp*gdtds *(hz_old(nlon-2,j+1)-hz_old(nlon-2,j))+crls*fxbar @@ -2747,7 +2747,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(3,j) = fx(3,j) - (0.5d0*(dz(4,j) +dz(3,j)))*gdtdss*(hz_old(4,j) -hz_old(3,j)) fy(3,j) = fy(3,j) - (0.5d0*(dz(3,j+1)+dz(3,j)))*gdtds *(hz_old(3,j+1)-hz_old(3,j)) #else - ddx_tmp = half*(hz(4,j) + hz(3,j) + dz(4,j) + dz(3,j)) + ddx_tmp = half*(hz_old(4,j) + hz_old(3,j) + dz(4,j) + dz(3,j)) if(dz(3,j) > zap .AND. dz(4,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(3,j) + fy_old(4,j) + fy_old(3,j-1) + fy_old(4,j-1)) @@ -2778,7 +2778,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,cflag,dt,th0,dth,joff,nlon, fx(3,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(3,j+1) + hz(3,j) + dz(3,j+1) + dz(3,j)) + ddy_tmp = half*(hz_old(3,j+1) + hz_old(3,j) + dz(3,j+1) + dz(3,j)) if(dz(3,j) > zap .AND. dz(3,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(3,j) + fx_old(2,j) + fx_old(2,j+1) + fx_old(3,j+1)) fy(3,j) = fy_old(3,j) - ddy_tmp*gdtds *(hz_old(3,j+1)-hz_old(3,j))+crls*fxbar diff --git a/src/mod_fxy_disp_cartesian.f90 b/src/mod_fxy_disp_cartesian.f90 index 6cebe43..f2eec8e 100644 --- a/src/mod_fxy_disp_cartesian.f90 +++ b/src/mod_fxy_disp_cartesian.f90 @@ -1625,7 +1625,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(i,1) = fx(i,1) - (0.5d0*(dz(i+1,1)+dz(i,1)))*gdtds*(hz_old(i+1,1)-hz_old(i,1)) fy(i,1) = fy(i,1) - (0.5d0*(dz(i, 2)+dz(i,1)))*gdtds*(hz_old(i, 2)-hz_old(i,1)) #else - ddx_tmp = half*(hz(i+1,1) + hz(i,1) + dz(i+1,1) + dz(i,1)) + ddx_tmp = half*(hz_old(i+1,1) + hz_old(i,1) + dz(i+1,1) + dz(i,1)) if(dz(i,1) > zap .AND. dz(i+1,1) > zap .AND. ddx_tmp > zap) then fybar = half*(fy_old(i,1) + fy_old(i+1,1)) fx(i,1) = fx_old(i,1) - ddx_tmp*gdtds*(hz_old(i+1,1)-hz_old(i,1)) @@ -1652,7 +1652,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(i,1) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,2) + hz(i,1) + dz(i,2) + dz(i,1)) + ddy_tmp = half*(hz_old(i,2) + hz_old(i,1) + dz(i,2) + dz(i,1)) if(dz(i,1) > zap .AND. dz(i,2) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,1) + fx_old(i-1,1) + fx_old(i-1,2) + fx_old(i,2)) @@ -1709,7 +1709,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(i,2) = fx(i,2) - (0.5d0*(dz(i+1,2)+dz(i,2)))*gdtds*(hz_old(i+1,2)-hz_old(i,2)) fy(i,2) = fy(i,2) - (0.5d0*(dz(i, 3)+dz(i,2)))*gdtds*(hz_old(i, 3)-hz_old(i,2)) #else - ddx_tmp = half*(hz(i+1,2) + hz(i,2) + dz(i+1,2) + dz(i,2)) + ddx_tmp = half*(hz_old(i+1,2) + hz_old(i,2) + dz(i+1,2) + dz(i,2)) if(dz(i,2) > zap .AND. dz(i+1,2) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,2) + fy_old(i+1,2) + fy_old(i,1) + fy_old(i+1,1)) fx(i,2) = fx_old(i,2) - ddx_tmp*gdtds*(hz_old(i+1,2)-hz_old(i,2)) @@ -1736,7 +1736,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(i,2) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,3) + hz(i,2) + dz(i,3) + dz(i,2)) + ddy_tmp = half*(hz_old(i,3) + hz_old(i,2) + dz(i,3) + dz(i,2)) if(dz(i,2) > zap .AND. dz(i,3) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,2) + fx_old(i-1,2) + fx_old(i-1,3) + fx_old(i,3)) @@ -1794,7 +1794,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(i,3) = fx(i,3) - (0.5d0*(dz(i+1,3)+dz(i,3)))*gdtds*(hz_old(i+1,3)-hz_old(i,3)) fy(i,3) = fy(i,3) - (0.5d0*(dz(i, 4)+dz(i,3)))*gdtds*(hz_old(i, 4)-hz_old(i,3)) #else - ddx_tmp = half*(hz(i+1,3) + hz(i,3) + dz(i+1,3) + dz(i,3)) + ddx_tmp = half*(hz_old(i+1,3) + hz_old(i,3) + dz(i+1,3) + dz(i,3)) if(dz(i,3) > zap .AND. dz(i+1,3) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,3) + fy_old(i+1,3) + fy_old(i,2) + fy_old(i+1,2)) fx(i,3) = fx_old(i,3) - ddx_tmp*gdtds*(hz_old(i+1,3)-hz_old(i,3)) @@ -1819,7 +1819,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & else fx(i,3) = zap end if - ddy_tmp = half*(hz(i,4) + hz(i,3) + dz(i,4) + dz(i,3)) + ddy_tmp = half*(hz_old(i,4) + hz_old(i,3) + dz(i,4) + dz(i,3)) if(dz(i,3) > zap .AND. dz(i,4) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,3) + fx_old(i-1,3) + fx_old(i-1,4) + fx_old(i,4)) @@ -1883,7 +1883,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(i,nlat-1) = fx(i,nlat-1) - (0.5d0*(dz(i+1,nlat-1)+dz(i,nlat-1)))*gdtds*(hz_old(i+1,nlat-1)-hz_old(i,nlat-1)) fy(i,nlat-1) = fy(i,nlat-1) - (0.5d0*(dz(i, nlat) +dz(i,nlat-1)))*gdtds*(hz_old(i, nlat) -hz_old(i,nlat-1)) #else - ddx_tmp = half*(hz(i+1,nlat-1) + hz(i,nlat-1) + dz(i+1,nlat-1) + dz(i,nlat-1)) + ddx_tmp = half*(hz_old(i+1,nlat-1) + hz_old(i,nlat-1) + dz(i+1,nlat-1) + dz(i,nlat-1)) if(dz(i,nlat-1) > zap .AND. dz(i+1,nlat-1) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,nlat-1) + fy_old(i+1,nlat-1) + fy_old(i,nlat-2) + fy_old(i+1,nlat-2)) fx(i,nlat-1) = fx_old(i,nlat-1) - ddx_tmp*gdtds*(hz_old(i+1,nlat-1)-hz_old(i,nlat-1)) @@ -1910,7 +1910,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(i,nlat-1) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,nlat) + hz(i,nlat-1) + dz(i,nlat) + dz(i,nlat-1)) + ddy_tmp = half*(hz_old(i,nlat) + hz_old(i,nlat-1) + dz(i,nlat) + dz(i,nlat-1)) if(dz(i,nlat-1) > zap .AND. dz(i,nlat) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,nlat-1) + fx_old(i-1,nlat-1) + fx_old(i-1,nlat) + fx_old(i,nlat)) @@ -1969,7 +1969,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(i,nlat-2) = fx(i,nlat-2) - (0.5d0*(dz(i+1,nlat-2)+dz(i,nlat-2)))*gdtds*(hz_old(i+1,nlat-2)-hz_old(i,nlat-2)) fy(i,nlat-2) = fy(i,nlat-2) - (0.5d0*(dz(i, nlat-1)+dz(i,nlat-2)))*gdtds*(hz_old(i, nlat-1)-hz_old(i,nlat-2)) #else - ddx_tmp = half*(hz(i+1,nlat-2) + hz(i,nlat-2) + dz(i+1,nlat-2) + dz(i,nlat-2)) + ddx_tmp = half*(hz_old(i+1,nlat-2) + hz_old(i,nlat-2) + dz(i+1,nlat-2) + dz(i,nlat-2)) if(dz(i,nlat-2) > zap .AND. dz(i+1,nlat-2) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(i,nlat-2) + fy_old(i+1,nlat-2) + fy_old(i,nlat-3) + fy_old(i+1,nlat-3)) fx(i,nlat-2) = fx_old(i,nlat-2) - ddx_tmp*gdtds*(hz_old(i+1,nlat-2)-hz_old(i,nlat-2)) @@ -1996,7 +1996,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(i,nlat-2) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(i,nlat-1) + hz(i,nlat-2) + dz(i,nlat-1) + dz(i,nlat-2)) + ddy_tmp = half*(hz_old(i,nlat-1) + hz_old(i,nlat-2) + dz(i,nlat-1) + dz(i,nlat-2)) if(dz(i,nlat-2) > zap .AND. dz(i,nlat-1) > zap .AND. ddy_tmp > zap) then if (i > 1) then fxbar = quart*(fx_old(i,nlat-2) + fx_old(i-1,nlat-2) + fx_old(i-1,nlat-1) + fx_old(i,nlat-1)) @@ -2069,7 +2069,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(nlon-1,j) = fx(nlon-1,j) - (0.5d0*(dz(nlon, j) +dz(nlon-1,j)))*gdtds*(hz_old(nlon, j) -hz_old(nlon-1,j)) fy(nlon-1,j) = fy(nlon-1,j) - (0.5d0*(dz(nlon-1,j+1)+dz(nlon-1,j)))*gdtds*(hz_old(nlon-1,j+1)-hz_old(nlon-1,j)) #else - ddx_tmp = half*(hz(nlon,j) + hz(nlon-1,j) + dz(nlon,j) + dz(nlon-1,j)) + ddx_tmp = half*(hz_old(nlon,j) + hz_old(nlon-1,j) + dz(nlon,j) + dz(nlon-1,j)) if(dz(nlon-1,j) > zap .AND. dz(nlon,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(nlon-1,j) + fy_old(nlon,j) + fy_old(nlon-1,j-1) + fy_old(nlon,j-1)) @@ -2100,7 +2100,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(nlon-1,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(nlon-1,j+1) + hz(nlon-1,j) + dz(nlon-1,j+1) + dz(nlon-1,j)) + ddy_tmp = half*(hz_old(nlon-1,j+1) + hz_old(nlon-1,j) + dz(nlon-1,j+1) + dz(nlon-1,j)) if(dz(nlon-1,j) > zap .AND. dz(nlon-1,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(nlon-1,j) + fx_old(nlon-2,j) + fx_old(nlon-2,j+1) + fx_old(nlon-1,j+1)) fy(nlon-1,j) = fy_old(nlon-1,j) - ddy_tmp*gdtds*(hz_old(nlon-1,j+1)-hz_old(nlon-1,j)) @@ -2155,7 +2155,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(1,j) = fx(1,j) - (0.5d0*(dz(2,j) +dz(1,j)))*gdtds*(hz_old(2,j) -hz_old(1,j)) fy(1,j) = fy(1,j) - (0.5d0*(dz(1,j+1)+dz(1,j)))*gdtds*(hz_old(1,j+1)-hz_old(1,j)) #else - ddx_tmp = half*(hz(2,j) + hz(1,j) + dz(2,j) + dz(1,j)) + ddx_tmp = half*(hz_old(2,j) + hz_old(1,j) + dz(2,j) + dz(1,j)) if(dz(1,j) > zap .AND. dz(2,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(1,j) + fy_old(2,j) + fy_old(1,j-1) + fy_old(2,j-1)) @@ -2186,7 +2186,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(1,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(1,j+1) + hz(1,j) + dz(1,j+1) + dz(1,j)) + ddy_tmp = half*(hz_old(1,j+1) + hz_old(1,j) + dz(1,j+1) + dz(1,j)) if(dz(1,j) > zap .AND. dz(1,j+1) > zap .AND. ddy_tmp > zap) then fxbar = half*(fx_old(1,j) + fx_old(1,j+1)) fy(1,j) = fy_old(1,j) - ddy_tmp*gdtds*(hz_old(1,j+1)-hz_old(1,j)) @@ -2233,7 +2233,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(2,j) = fx(2,j) - (0.5d0*(dz(3,j) +dz(2,j)))*gdtds*(hz_old(3,j) -hz_old(2,j)) fy(2,j) = fy(2,j) - (0.5d0*(dz(2,j+1)+dz(2,j)))*gdtds*(hz_old(2,j+1)-hz_old(2,j)) #else - ddx_tmp = half*(hz(3,j) + hz(2,j) + dz(3,j) + dz(2,j)) + ddx_tmp = half*(hz_old(3,j) + hz_old(2,j) + dz(3,j) + dz(2,j)) if(dz(2,j) > zap .AND. dz(3,j) > zap .AND. ddx_tmp > zap) then fybar = quart*(fy_old(2,j) + fy_old(3,j) + fy_old(2,j-1) + fy_old(3,j-1)) fx(2,j) = fx_old(2,j) - ddx_tmp*gdtds*(hz_old(3,j)-hz_old(2,j)) @@ -2260,7 +2260,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(2,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(2,j+1) + hz(2,j) + dz(2,j+1) + dz(2,j)) + ddy_tmp = half*(hz_old(2,j+1) + hz_old(2,j) + dz(2,j+1) + dz(2,j)) if(dz(2,j) > zap .AND. dz(2,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(2,j) + fx_old(1,j) + fx_old(1,j+1) + fx_old(2,j+1)) fy(2,j) = fy_old(2,j) - ddy_tmp*gdtds*(hz_old(2,j+1)-hz_old(2,j)) @@ -2312,7 +2312,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(2,j) = fx(2,j) - (0.5d0*(dz(3,j) +dz(2,j)))*gdtds*(hz_old(3,j) -hz_old(2,j)) fy(2,j) = fy(2,j) - (0.5d0*(dz(2,j+1)+dz(2,j)))*gdtds*(hz_old(2,j+1)-hz_old(2,j)) #else - ddx_tmp = half*(hz(3,j) + hz(2,j) + dz(3,j) + dz(2,j)) + ddx_tmp = half*(hz_old(3,j) + hz_old(2,j) + dz(3,j) + dz(2,j)) if(dz(2,j) > zap .AND. dz(3,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(2,j) + fy_old(3,j) + fy_old(2,j-1) + fy_old(3,j-1)) @@ -2343,7 +2343,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(2,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(2,j+1) + hz(2,j) + dz(2,j+1) + dz(2,j)) + ddy_tmp = half*(hz_old(2,j+1) + hz_old(2,j) + dz(2,j+1) + dz(2,j)) if(dz(2,j) > zap .AND. dz(2,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(2,j) + fx_old(1,j) + fx_old(1,j+1) + fx_old(2,j+1)) fy(2,j) = fy_old(2,j) - ddy_tmp*gdtds*(hz_old(2,j+1)-hz_old(2,j)) @@ -2401,7 +2401,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(nlon-2,j) = fx(nlon-2,j) - (0.5d0*(dz(nlon-1,j) +dz(nlon-2,j)))*gdtds*(hz_old(nlon-1,j) -hz_old(nlon-2,j)) fy(nlon-2,j) = fy(nlon-2,j) - (0.5d0*(dz(nlon-2,j+1)+dz(nlon-2,j)))*gdtds*(hz_old(nlon-2,j+1)-hz_old(nlon-2,j)) #else - ddx_tmp = half*(hz(nlon-1,j) + hz(nlon-2,j) + dz(nlon-1,j) + dz(nlon-2,j)) + ddx_tmp = half*(hz_old(nlon-1,j) + hz_old(nlon-2,j) + dz(nlon-1,j) + dz(nlon-2,j)) if(dz(nlon-1,j) > zap .AND. dz(nlon-2,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(nlon-2,j) + fy_old(nlon-1,j) + fy_old(nlon-2,j-1) + fy_old(nlon-1,j-1)) @@ -2432,7 +2432,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(nlon-2,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(nlon-2,j+1) + hz(nlon-2,j) + dz(nlon-2,j+1) + dz(nlon-2,j)) + ddy_tmp = half*(hz_old(nlon-2,j+1) + hz_old(nlon-2,j) + dz(nlon-2,j+1) + dz(nlon-2,j)) if(dz(nlon-2,j) > zap .AND. dz(nlon-2,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(nlon-2,j) + fx_old(nlon-3,j) + fx_old(nlon-3,j+1) + fx_old(nlon-2,j+1)) fy(nlon-2,j) = fy_old(nlon-2,j) - ddy_tmp*gdtds*(hz_old(nlon-2,j+1)-hz_old(nlon-2,j)) @@ -2482,7 +2482,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(3,j) = fx(3,j) - (0.5d0*(dz(4,j) +dz(3,j)))*gdtds*(hz_old(4,j) -hz_old(3,j)) fy(3,j) = fy(3,j) - (0.5d0*(dz(3,j+1)+dz(3,j)))*gdtds*(hz_old(3,j+1)-hz_old(3,j)) #else - ddx_tmp = half*(hz(4,j) + hz(3,j) + dz(4,j) + dz(3,j)) + ddx_tmp = half*(hz_old(4,j) + hz_old(3,j) + dz(4,j) + dz(3,j)) if(dz(3,j) > zap .AND. dz(4,j) > zap .AND. ddx_tmp > zap) then if (j > 1) then fybar = quart*(fy_old(3,j) + fy_old(4,j) + fy_old(3,j-1) + fy_old(4,j-1)) @@ -2513,7 +2513,7 @@ subroutine fxynl_rwg_disp(wfld,dfld,ffld,ifz,cfs,cfl,dt,dxdy,nlon,nlat, & fx(3,j) = zap #ifndef OLD_SCHEME end if - ddy_tmp = half*(hz(3,j+1) + hz(3,j) + dz(3,j+1) + dz(3,j)) + ddy_tmp = half*(hz_old(3,j+1) + hz_old(3,j) + dz(3,j+1) + dz(3,j)) if(dz(3,j) > zap .AND. dz(3,j+1) > zap .AND. ddy_tmp > zap) then fxbar = quart*(fx_old(3,j) + fx_old(2,j) + fx_old(2,j+1) + fx_old(3,j+1)) fy(3,j) = fy_old(3,j) - ddy_tmp*gdtds*(hz_old(3,j+1)-hz_old(3,j)) diff --git a/src/mod_ncdio.f90 b/src/mod_ncdio.f90 index 5a6437d..24eecf8 100644 --- a/src/mod_ncdio.f90 +++ b/src/mod_ncdio.f90 @@ -943,8 +943,8 @@ subroutine write_snapshot(dgrid, t, istep, mode, bflag, myrank, linear_flag) ip = i + 1 if(iand(bflag, WEST_BOUND) /= 0) im = max(1, im) if(iand(bflag, EAST_BOUND) /= 0) ip = min(ien,ip) - tdxm = 0.5d0*(dz(i,j) + hz(i,j) + dz(im,j) + hz(im,j)) - tdxp = 0.5d0*(dz(i,j) + hz(i,j) + dz(ip,j) + hz(ip,j)) + tdxm = 0.5d0*(dz(i,j) + dz(im,j)) + tdxp = 0.5d0*(dz(i,j) + dz(ip,j)) if(wod(im,j) == 1 .and. tdxm > td_min .and. & wod(ip,j) == 1 .and. tdxp > td_min .and. & wod(i,j) == 1) then @@ -957,8 +957,8 @@ subroutine write_snapshot(dgrid, t, istep, mode, bflag, myrank, linear_flag) jp = j + 1 if(iand(bflag, NORTH_BOUND) /= 0) jm = max(1, jm) if(iand(bflag, SOUTH_BOUND) /= 0) jp = min(jen,jp) - tdym = 0.5d0*(dz(i,j) + hz(i,j) + dz(i,jm) + hz(i,jm)) - tdyp = 0.5d0*(dz(i,j) + hz(i,j) + dz(i,jp) + hz(i,jp)) + tdym = 0.5d0*(dz(i,j) + dz(i,jm)) + tdyp = 0.5d0*(dz(i,j) + dz(i,jp)) if(wod(i,jm) == 1 .and. tdym > td_min .and. & wod(i,jp) == 1 .and. tdyp > td_min .and. & wod(i,j) == 1) then diff --git a/src/mod_rwg.f90 b/src/mod_rwg.f90 index c517668..f5cb77e 100644 --- a/src/mod_rwg.f90 +++ b/src/mod_rwg.f90 @@ -343,7 +343,7 @@ subroutine outsea_rwg(wfld,dfld,hbnd,ubnd,nlon,nlat,bflag) if(iand(bflag, NORTH_BOUND) /= 0) then #endif !$omp do - do i = 2, nlon-1 + do i = 1, nlon-1 if(dz(i,1) <= zap) then hz(i,1) = zap else @@ -363,7 +363,7 @@ subroutine outsea_rwg(wfld,dfld,hbnd,ubnd,nlon,nlat,bflag) if(iand(bflag, EAST_BOUND) /= 0) then #endif !$omp do - do j = 2, nlat-1 + do j = 1, nlat-1 if(dz(nlon,j) <= zap) then hz(nlon,j) = zap else @@ -383,7 +383,7 @@ subroutine outsea_rwg(wfld,dfld,hbnd,ubnd,nlon,nlat,bflag) if(iand(bflag, SOUTH_BOUND) /= 0) then #endif !$omp do - do i = 2, nlon-1 + do i = 1, nlon-1 if(dz(nlon-i+1,nlat) <= zap) then hz(nlon-i+1,nlat) = zap else @@ -403,7 +403,7 @@ subroutine outsea_rwg(wfld,dfld,hbnd,ubnd,nlon,nlat,bflag) if(iand(bflag, WEST_BOUND) /= 0) then #endif !$omp do - do j = 2, nlat-1 + do j = 1, nlat-1 if(dz(1,nlat-j+1) <= zap) then hz(1,nlat-j+1) = zap else