SCALE-RM
Functions/Subroutines
mod_cnvtopo Module Reference

module Convert topography More...

Functions/Subroutines

subroutine, public cnvtopo_setup
 Setup. More...
 
subroutine, public cnvtopo
 Driver. More...
 

Detailed Description

module Convert topography

Description
subroutines for preparing topography data (convert from external file)
Author
Team SCALE
NAMELIST
  • PARAM_CNVTOPO
    nametypedefault valuecomment
    CNVTOPO_NAME character(len=H_SHORT) 'NONE' keep backward compatibility
    CNVTOPO_USEGTOPO30 logical .false.

  • PARAM_CNVTOPO_GTOPO30
    nametypedefault valuecomment
    GTOPO30_IN_DIR character(len=H_LONG) '.' directory contains GTOPO30 files (GrADS format)
    GTOPO30_IN_CATALOGUE character(len=H_LONG) '' metadata files for GTOPO30

  • PARAM_CNVTOPO_DEM50M
    nametypedefault valuecomment
    DEM50M_IN_DIR character(len=H_LONG) '.' directory contains DEM50M files (GrADS format)
    DEM50M_IN_CATALOGUE character(len=H_LONG) '' metadata files for DEM50M

  • PARAM_CNVTOPO_USERFILE
    nametypedefault valuecomment
    USERFILE_TYPE character(len=H_SHORT) '' ! "TILE" or "GrADS"
    USERFILE_DTYPE character(len=H_SHORT) 'REAL4' datatype (REAL4,REAL8,INT2,INT4)
    USERFILE_DLAT real(RP) -1.0_RP width of latitude tile [deg.]
    USERFILE_DLON real(RP) -1.0_RP width of longitude tile [deg.]
    USERFILE_CATALOGUE character(len=H_LONG) '' catalogue file
    USERFILE_DIR character(len=H_LONG) '.' directory contains data files (GrADS format)
    USERFILE_YREVERS logical .false. data of the latitude direction is stored in ordar of North->South?
    USERFILE_MINVAL real(RP) 0.0_RP
    USERFILE_GRADS_FILENAME character(len=H_LONG) '' single data file (GrADS format)
    USERFILE_GRADS_VARNAME character(len=H_SHORT) 'topo'
    USERFILE_GRADS_LATNAME character(len=H_SHORT) 'lat'
    USERFILE_GRADS_LONNAME character(len=H_SHORT) 'lon'
    USERFILE_INTERP_TYPE character(len=H_SHORT) 'LINEAR'
    USERFILE_INTERP_LEVEL integer 5

History Output
No history output

Function/Subroutine Documentation

◆ cnvtopo_setup()

subroutine, public mod_cnvtopo::cnvtopo_setup

Setup.

Definition at line 76 of file mod_cnvtopo.F90.

76  use scale_prc, only: &
77  prc_abort
78  use scale_const, only: &
79  d2r => const_d2r, &
80  huge => const_huge
81  use scale_statistics, only: &
82  statistics_horizontal_min
83  use scale_atmos_grid_cartesc, only: &
84  cdz => atmos_grid_cartesc_cdz, &
85  fdx => atmos_grid_cartesc_fdx, &
87  implicit none
88 
89  character(len=H_SHORT) :: CNVTOPO_name = 'NONE' ! keep backward compatibility
90 
91  namelist / param_cnvtopo / &
92  cnvtopo_name, &
93  cnvtopo_usegtopo30, &
94 ! CNVTOPO_UseGMTED2010, &
95  cnvtopo_usedem50m, &
96  cnvtopo_useuserfile, &
97  cnvtopo_smooth_trim_ocean, &
98  cnvtopo_smooth_hypdiff_order, &
99  cnvtopo_smooth_hypdiff_niter, &
100  cnvtopo_smooth_maxslope_ratio, &
101  cnvtopo_smooth_maxslope, &
102  cnvtopo_smooth_local, &
103  cnvtopo_smooth_itelim, &
104  cnvtopo_smooth_type, &
105  cnvtopo_copy_parent
106 
107  real(RP) :: minslope(IA,JA)
108  real(RP) :: DXL(IA-1)
109  real(RP) :: DYL(JA-1)
110  real(RP) :: DZDX, DZDY
111 
112  integer :: ierr
113  integer :: k, i, j
114  !---------------------------------------------------------------------------
115 
116  log_newline
117  log_info("CNVTOPO_setup",*) 'Setup'
118 
119  dxl(:) = fdx(:)
120  dyl(:) = fdy(:)
121 
122  !--- read namelist
123  rewind(io_fid_conf)
124  read(io_fid_conf,nml=param_cnvtopo,iostat=ierr)
125  if( ierr < 0 ) then !--- missing
126  log_info("CNVTOPO_setup",*) 'Not found namelist. Default used.'
127  elseif( ierr > 0 ) then !--- fatal error
128  log_error("CNVTOPO_setup",*) 'Not appropriate names in namelist PARAM_CNVTOPO. Check!'
129  call prc_abort
130  endif
131  log_nml(param_cnvtopo)
132 
133  select case(cnvtopo_name)
134  case('NONE')
135  ! do nothing
136  case('GTOPO30')
137  cnvtopo_usegtopo30 = .true.
138  cnvtopo_usegmted2010 = .false.
139  cnvtopo_usedem50m = .false.
140  cnvtopo_useuserfile = .false.
141 !!$ case('GMTED2010')
142 !!$ CNVTOPO_UseGTOPO30 = .false.
143 !!$ CNVTOPO_UseGMTED2010 = .true.
144 !!$ CNVTOPO_UseDEM50M = .false.
145 !!$ CNVTOPO_UseUSERFILE = .false.
146  case('DEM50M')
147  cnvtopo_usegtopo30 = .false.
148  cnvtopo_usegmted2010 = .false.
149  cnvtopo_usedem50m = .true.
150  cnvtopo_useuserfile = .false.
151  case('COMBINE')
152  cnvtopo_usegtopo30 = .true.
153  cnvtopo_usegmted2010 = .true.
154  cnvtopo_usedem50m = .true.
155  cnvtopo_useuserfile = .false.
156  case('USERFILE')
157  ! You can use GTOPO30, GMTED2010, DEM50M and combine User-defined file as you like
158  cnvtopo_useuserfile = .true.
159  case default
160  log_error("CNVTOPO_setup",*) 'Unsupported TYPE: ', trim(cnvtopo_name)
161  call prc_abort
162  endselect
163 
164  cnvtopo_donothing = .true.
165 
166  if ( cnvtopo_usegtopo30 ) then
167  cnvtopo_donothing = .false.
168  log_info("CNVTOPO_setup",*) 'Use GTOPO, global 30 arcsec. data'
169  if ( cnvtopo_usegmted2010 ) then
170  log_info("CNVTOPO_setup",*) 'Use GMTED2010, new global 5 arcsec. data'
171  log_info("CNVTOPO_setup",*) 'Overwrite Existing region'
172  endif
173  if ( cnvtopo_usedem50m ) then
174  log_info("CNVTOPO_setup",*) 'Use DEM 50m data for Japan region'
175  log_info("CNVTOPO_setup",*) 'Overwrite Japan region'
176  endif
177  elseif ( cnvtopo_usegmted2010 ) then
178  cnvtopo_donothing = .false.
179  log_info("CNVTOPO_setup",*) 'Use GMTED2010, new global 5 arcsec. data'
180  if ( cnvtopo_usedem50m ) then
181  log_info("CNVTOPO_setup",*) 'Use DEM 50m data for Japan region'
182  log_info("CNVTOPO_setup",*) 'Overwrite Japan region'
183  endif
184  elseif ( cnvtopo_usedem50m ) then
185  cnvtopo_donothing = .false.
186  log_info("CNVTOPO_setup",*) 'Use DEM 50m data, Japan region only'
187  elseif ( cnvtopo_useuserfile ) then
188  cnvtopo_donothing = .false.
189  log_info("CNVTOPO_setup",*) 'Use user-defined file'
190  endif
191 
192  if ( cnvtopo_donothing ) then
193  log_info("CNVTOPO_setup",*) 'Do nothing for topography data'
194  endif
195 
196  if( cnvtopo_smooth_maxslope > 0.0_rp ) then
197 
198  cnvtopo_smooth_maxslope_limit = cnvtopo_smooth_maxslope
199 
200  else
201  minslope(:,:) = huge
202 
203  j = js-1
204  i = is-1
205  do k = ks, ke
206  dzdx = atan2( cnvtopo_smooth_maxslope_ratio * cdz(k), dxl(i) ) / d2r
207  dzdy = atan2( cnvtopo_smooth_maxslope_ratio * cdz(k), dyl(j) ) / d2r
208  minslope(is,js) = min( minslope(is,js), dzdx, dzdy )
209  enddo
210 
211  j = js-1
212  do i = is, ie
213  do k = ks, ke
214  dzdx = atan2( cnvtopo_smooth_maxslope_ratio * cdz(k), dxl(i) ) / d2r
215  dzdy = atan2( cnvtopo_smooth_maxslope_ratio * cdz(k), dyl(j) ) / d2r
216  minslope(i,js) = min( minslope(i,js), dzdx, dzdy )
217  enddo
218  enddo
219 
220  i = is-1
221  !$omp parallel do &
222  !$omp private(DZDX,DZDY)
223  do j = js, je
224  do k = ks, ke
225  dzdx = atan2( cnvtopo_smooth_maxslope_ratio * cdz(k), dxl(i) ) / d2r
226  dzdy = atan2( cnvtopo_smooth_maxslope_ratio * cdz(k), dyl(j) ) / d2r
227  minslope(is,j) = min( minslope(is,j), dzdx, dzdy )
228  enddo
229  enddo
230 
231  !$omp parallel do &
232  !$omp private(DZDX,DZDY)
233  do j = js, je
234  do i = is, ie
235  do k = ks, ke
236  dzdx = atan2( cnvtopo_smooth_maxslope_ratio * cdz(k), dxl(i) ) / d2r
237  dzdy = atan2( cnvtopo_smooth_maxslope_ratio * cdz(k), dyl(j) ) / d2r
238  minslope(i,j) = min( minslope(i,j), dzdx, dzdy )
239  enddo
240  enddo
241  enddo
242 
243  call statistics_horizontal_min( ia, is, ie, ja, js, je, &
244  minslope(:,:), cnvtopo_smooth_maxslope_limit )
245  end if
246 
247  return

References scale_atmos_grid_cartesc::atmos_grid_cartesc_cdz, scale_atmos_grid_cartesc::atmos_grid_cartesc_fdx, scale_atmos_grid_cartesc::atmos_grid_cartesc_fdy, scale_const::const_d2r, scale_const::const_huge, scale_atmos_grid_cartesc_index::ia, scale_atmos_grid_cartesc_index::ie, scale_io::io_fid_conf, scale_atmos_grid_cartesc_index::is, scale_atmos_grid_cartesc_index::ja, scale_atmos_grid_cartesc_index::je, scale_atmos_grid_cartesc_index::js, scale_tracer::k, scale_atmos_grid_cartesc_index::ke, scale_atmos_grid_cartesc_index::ks, and scale_prc::prc_abort().

Referenced by mod_convert::convert_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cnvtopo()

subroutine, public mod_cnvtopo::cnvtopo

Driver.

Definition at line 253 of file mod_cnvtopo.F90.

253  use scale_const, only: &
254  undef => const_undef, &
255  d2r => const_d2r
256  use scale_prc, only: &
257  prc_abort
258  use scale_topography, only: &
261  use mod_copytopo, only: &
262  copytopo
263  use scale_atmos_grid_cartesc_real, only: &
266  implicit none
267 
268  integer :: i, j
269  !---------------------------------------------------------------------------
270 
271  if ( cnvtopo_donothing ) then
272  log_newline
273  log_progress(*) 'skip convert topography data'
274  else
275  log_newline
276  log_progress(*) 'start convert topography data'
277 
278  !$omp parallel do
279 !OCL XFILL
280  do j = 1, ja
281  do i = 1, ia
282  topography_zsfc(i,j) = 0.0_rp
283  end do
284  end do
285 
286  if ( cnvtopo_usegtopo30 ) then
287  call cnvtopo_gtopo30( topography_zsfc(:,:) ) ! [INOUT]
288  endif
289 
290  if ( cnvtopo_usegmted2010 ) then
291  call cnvtopo_gmted2010( topography_zsfc(:,:) ) ! [INOUT]
292  endif
293 
294  if ( cnvtopo_usedem50m ) then
295  call cnvtopo_dem50m( topography_zsfc(:,:) ) ! [INOUT]
296  endif
297 
298  if ( cnvtopo_useuserfile ) then
299  call cnvtopo_userfile( topography_zsfc(:,:) ) ! [INOUT]
300  endif
301 
302  call cnvtopo_smooth( topography_zsfc(:,:) ) ! (inout)
303  call topography_fillhalo( fill_bnd=.true. )
304 
305  if( cnvtopo_copy_parent ) call copytopo( topography_zsfc )
306 
307  log_progress(*) 'end convert topography data'
308 
309  endif
310 
311  return

References scale_atmos_grid_cartesc::atmos_grid_cartesc_fdx, scale_atmos_grid_cartesc::atmos_grid_cartesc_fdy, scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_latxv, scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_lonuy, mod_cnv2d::cnv2d_exec(), mod_cnv2d::cnv2d_grads_init(), mod_cnv2d::cnv2d_tile_init(), scale_const::const_d2r, scale_const::const_eps, scale_const::const_undef, mod_copytopo::copytopo(), scale_atmos_grid_cartesc_index::ia, scale_atmos_grid_cartesc_index::ie, scale_io::io_fid_conf, scale_atmos_grid_cartesc_index::is, scale_atmos_grid_cartesc_index::ja, scale_atmos_grid_cartesc_index::je, scale_atmos_grid_cartesc_index::js, scale_landuse::landuse_fact_ocean, scale_prc::prc_abort(), scale_topography::topography_fillhalo(), and scale_topography::topography_zsfc.

Referenced by mod_convert::convert().

Here is the call graph for this function:
Here is the caller graph for this function:
scale_statistics
module Statistics
Definition: scale_statistics.F90:11
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:342
scale_atmos_grid_cartesc::atmos_grid_cartesc_cdz
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdz
z-length of control volume [m]
Definition: scale_atmos_grid_cartesC.F90:42
scale_atmos_grid_cartesc::atmos_grid_cartesc_fdy
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdy
y-length of grid(j+1) to grid(j) [m]
Definition: scale_atmos_grid_cartesC.F90:63
mod_copytopo::copytopo
subroutine, public copytopo(TOPO_child)
Setup and Main.
Definition: mod_copytopo.F90:74
scale_topography
module TOPOGRAPHY
Definition: scale_topography.F90:11
scale_atmos_grid_cartesc_real
module Atmosphere GRID CartesC Real(real space)
Definition: scale_atmos_grid_cartesC_real.F90:11
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_const
module CONSTANT
Definition: scale_const.F90:11
scale_const::const_huge
real(rp), public const_huge
huge number
Definition: scale_const.F90:35
scale_atmos_grid_cartesc::atmos_grid_cartesc_fdx
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdx
x-length of grid(i+1) to grid(i) [m]
Definition: scale_atmos_grid_cartesC.F90:62
mod_copytopo
module Copy topography
Definition: mod_copytopo.F90:11
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_latxv
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_latxv
latitude at staggered point (xv) [rad,-pi,pi]
Definition: scale_atmos_grid_cartesC_real.F90:54
scale_topography::topography_zsfc
real(rp), dimension(:,:), allocatable, public topography_zsfc
absolute ground height [m]
Definition: scale_topography.F90:38
scale_const::const_d2r
real(rp), public const_d2r
degree to radian
Definition: scale_const.F90:32
scale_atmos_grid_cartesc
module atmosphere / grid / cartesC
Definition: scale_atmos_grid_cartesC.F90:12
scale_const::const_undef
real(rp), public const_undef
Definition: scale_const.F90:41
scale_topography::topography_fillhalo
subroutine, public topography_fillhalo(Zsfc, FILL_BND)
HALO Communication.
Definition: scale_topography.F90:117
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_lonuy
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lonuy
longitude at staggered point (uy) [rad,0-2pi]
Definition: scale_atmos_grid_cartesC_real.F90:49