Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In filter_topo added extrapolation to halo points #571

Merged
merged 11 commits into from
Sep 17, 2021
39 changes: 39 additions & 0 deletions sorc/grid_tools.fd/filter_topo.fd/filter_topo.F90
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,9 @@ subroutine read_grid_file(regional)
call fill_cubic_grid_halo(geolat_c, geolat_c, ng, 1, 1, 1, 1)
if(.not. nested) call fill_bgrid_scalar_corners(geolon_c, ng, npx, npy, isd, jsd, XDir)
if(.not. nested) call fill_bgrid_scalar_corners(geolat_c, ng, npx, npy, isd, jsd, YDir)
else
call fill_regional_halo(geolon_c, ng)
call fill_regional_halo(geolat_c, ng)
endif

!--- compute grid cell center
Expand Down Expand Up @@ -1144,6 +1147,42 @@ subroutine fill_cubic_grid_halo(data, data2, halo, ioff, joff, sign1, sign2)

end subroutine fill_cubic_grid_halo

!> This routine extrapolate geolat_c and geolon_c halo points for the
!! regional standalone grid. Halo points are needed for dxc and dyc
!! calculation.
!!
RatkoVasic-NOAA marked this conversation as resolved.
Show resolved Hide resolved
!! @param[in] data ???
!! @param[in] halo ???
!! @author Ratko
subroutine fill_regional_halo(data, halo)
RatkoVasic-NOAA marked this conversation as resolved.
Show resolved Hide resolved
integer, intent(in) :: halo
real, dimension(1-halo:,1-halo:,:), intent(inout) :: data
integer :: h, i_st, i_ed, j_st, j_ed

i_st=1
i_ed=npx
j_st=1
j_ed=npy

do h = 1, halo
data(i_st:i_ed, j_st-1 , :) = 2* data(i_st:i_ed, j_st , :) - data(i_st:i_ed, j_st+1 , :)! north
data(i_st:i_ed, j_ed+1 , :) = 2* data(i_st:i_ed, j_ed , :) - data(i_st:i_ed, j_ed-1 , :)! south
data(i_st-1 , j_st:j_ed, :) = 2* data(i_st , j_st:j_ed, :) - data(i_st+1 , j_st:j_ed, :)! east
data(i_ed+1 , j_st:j_ed, :) = 2* data(i_ed , j_st:j_ed, :) - data(i_ed-1 , j_st:j_ed, :)! west

data(i_st-1, j_st-1, :) = (data(i_st-1, j_st, :) + data(i_st, j_st-1, :))*0.5 !NW Corner
data(i_ed+1, j_st-1, :) = (data(i_ed+1, j_st, :) + data(i_ed, j_st-1, :))*0.5 !NE Corner
data(i_st-1, j_ed+1, :) = (data(i_st-1, j_ed, :) + data(i_st, j_ed+1, :))*0.5 !SW Corner
data(i_ed+1, j_ed+1, :) = (data(i_ed+1, j_ed, :) + data(i_ed, j_ed+1, :))*0.5 !SE Corner

i_st=i_st-1
i_ed=i_ed+1
j_st=j_st-1
j_ed=j_ed+1
enddo

end subroutine fill_regional_halo

!> ???
!!
!! @param[in] is ???
Expand Down