SCALE-RM
Functions/Subroutines | Variables
scale_topography Module Reference

module TOPOGRAPHY More...

Functions/Subroutines

subroutine, public topography_setup
 Setup. More...
 
subroutine, public topography_fillhalo (Zsfc, FILL_BND)
 HALO Communication. More...
 
subroutine, public topography_finalize
 finalize More...
 
subroutine, public topography_write
 Write topography. More...
 
subroutine, public topography_calc_tan_slope (IA, IS, IE, JA, JS, JE, RCDX, RCDY, MAPF)
 

Variables

logical, public topography_exist = .false.
 topography exists? More...
 
real(rp), dimension(:,:), allocatable, public topography_zsfc
 absolute ground height [m] More...
 
real(rp), dimension(:,:), allocatable, public topography_tansl_x
 tan(slope_x) More...
 
real(rp), dimension(:,:), allocatable, public topography_tansl_y
 tan(slope_y) More...
 

Detailed Description

module TOPOGRAPHY

Description
Topography module
Author
Team SCALE
NAMELIST
  • PARAM_TOPOGRAPHY
    nametypedefault valuecomment
    TOPOGRAPHY_IN_BASENAME character(len=H_LONG) '' basename of the input file
    TOPOGRAPHY_IN_VARNAME character(len=H_LONG) 'topo' variable name of topo in the input file
    TOPOGRAPHY_IN_AGGREGATE logical > switch to use aggregated file
    TOPOGRAPHY_IN_CHECK_COORDINATES logical .false. > switch for check of coordinates
    TOPOGRAPHY_OUT_BASENAME character(len=H_LONG) '' basename of the output file
    TOPOGRAPHY_OUT_AGGREGATE logical > switch to use aggregated file
    TOPOGRAPHY_OUT_DTYPE character(len=H_SHORT) 'DEFAULT' REAL4 or REAL8

History Output
No history output

Function/Subroutine Documentation

◆ topography_setup()

subroutine, public scale_topography::topography_setup

Setup.

Definition at line 67 of file scale_topography.F90.

67  use scale_file, only: &
69  use scale_prc, only: &
70  prc_abort
71  implicit none
72 
73  namelist / param_topography / &
74  topography_in_basename, &
75  topography_in_varname, &
76  topography_in_aggregate, &
77  topography_in_check_coordinates, &
78  topography_out_basename, &
79  topography_out_aggregate, &
80  topography_out_dtype
81 
82  integer :: ierr
83  !---------------------------------------------------------------------------
84 
85  log_newline
86  log_info("TOPOGRAPHY_setup",*) 'Setup'
87 
88  topography_in_aggregate = file_aggregate
89  topography_out_aggregate = file_aggregate
90 
91  !--- read namelist
92  rewind(io_fid_conf)
93  read(io_fid_conf,nml=param_topography,iostat=ierr)
94  if( ierr < 0 ) then !--- missing
95  log_info("TOPOGRAPHY_setup",*) 'Not found namelist. Default used.'
96  elseif( ierr > 0 ) then !--- fatal error
97  log_error("TOPOGRAPHY_setup",*) 'Not appropriate names in namelist PARAM_TOPOGRAPHY. Check!'
98  call prc_abort
99  endif
100  log_nml(param_topography)
101 
102  allocate( topography_zsfc(ia,ja) )
103  allocate( topography_tansl_x(ia,ja) )
104  allocate( topography_tansl_y(ia,ja) )
105  topography_zsfc(:,:) = 0.0_rp
106  topography_tansl_x(:,:) = 0.0_rp
107  topography_tansl_y(:,:) = 0.0_rp
108  !$acc enter data copyin(TOPOGRAPHY_Zsfc, TOPOGRAPHY_TanSL_X, TOPOGRAPHY_TanSL_Y)
109 
110  ! read from file
111  call topography_read
112 
113  return

References scale_file::file_aggregate, scale_atmos_grid_cartesc_index::ia, scale_io::io_fid_conf, scale_atmos_grid_cartesc_index::ja, scale_prc::prc_abort(), topography_tansl_x, topography_tansl_y, and topography_zsfc.

Referenced by mod_rm_driver::rm_driver(), and mod_rm_prep::rm_prep().

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

◆ topography_fillhalo()

subroutine, public scale_topography::topography_fillhalo ( real(rp), dimension(ia,ja), intent(inout), optional  Zsfc,
logical, intent(in), optional  FILL_BND 
)

HALO Communication.

Definition at line 119 of file scale_topography.F90.

119  use scale_comm_cartesc, only: &
120  comm_vars8, &
121  comm_wait
122  implicit none
123 
124  real(RP), intent(inout), optional :: Zsfc(IA,JA)
125  logical, intent(in), optional :: FILL_BND
126 
127  logical :: FILL_BND_
128  !---------------------------------------------------------------------------
129 
130  fill_bnd_ = .false.
131  if ( present(fill_bnd) ) fill_bnd_ = fill_bnd
132 
133  if ( present(zsfc) ) then
134  call comm_vars8( zsfc(:,:), 1 )
135  call comm_wait ( zsfc(:,:), 1, fill_bnd_ )
136  else
137  call comm_vars8( topography_zsfc(:,:), 1 )
138  call comm_wait ( topography_zsfc(:,:), 1, fill_bnd_ )
139  end if
140 
141  return

References topography_zsfc.

Referenced by mod_cnvtopo::cnvtopo(), topography_calc_tan_slope(), topography_finalize(), and topography_write().

Here is the caller graph for this function:

◆ topography_finalize()

subroutine, public scale_topography::topography_finalize

finalize

Definition at line 147 of file scale_topography.F90.

147  implicit none
148  !---------------------------------------------------------------------------
149 
150  !$acc exit data delete(TOPOGRAPHY_Zsfc, TOPOGRAPHY_TanSL_X, TOPOGRAPHY_TanSL_Y)
151  deallocate( topography_zsfc )
152  deallocate( topography_tansl_x )
153  deallocate( topography_tansl_y )
154 
155  return

References scale_file_cartesc::file_cartesc_close(), scale_file_cartesc::file_cartesc_flush(), scale_file_cartesc::file_cartesc_open(), scale_prc::prc_abort(), topography_exist, topography_fillhalo(), topography_tansl_x, topography_tansl_y, and topography_zsfc.

Referenced by mod_rm_driver::rm_driver(), and mod_rm_prep::rm_prep().

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

◆ topography_write()

subroutine, public scale_topography::topography_write

Write topography.

Definition at line 208 of file scale_topography.F90.

208  use scale_file_cartesc, only: &
212  file_cartesc_write_var, &
214  implicit none
215 
216  integer :: fid, vid
217  !---------------------------------------------------------------------------
218 
219  if ( topography_out_basename /= '' .and. topography_out_basename /= topography_in_basename ) then
220 
221  log_newline
222  log_info("TOPOGRAPHY_write",*) 'Output topography file '
223 
224  call topography_fillhalo( fill_bnd=.false. )
225 
226  call file_cartesc_create( topography_out_basename, topography_out_title, topography_out_dtype, & ! [IN]
227  fid, & ! [OUT]
228  haszcoord=.false., aggregate=topography_out_aggregate ) ! [IN]
229 
230  call file_cartesc_def_var( fid, 'topo', 'Topography', 'm', 'XY', topography_out_dtype, & ! [IN]
231  vid, & ! [OUT]
232  standard_name="surface_altitude" ) ! [IN]
233 
234  call file_cartesc_enddef( fid )
235 
236  call file_cartesc_write_var( fid, vid, topography_zsfc(:,:), 'topo', 'XY' ) ! [IN]
237 
238 
239  call file_cartesc_close( fid )
240 
241  endif
242 
243  return

References scale_file_cartesc::file_cartesc_close(), scale_file_cartesc::file_cartesc_create(), scale_file_cartesc::file_cartesc_def_var(), scale_file_cartesc::file_cartesc_enddef(), topography_fillhalo(), and topography_zsfc.

Referenced by mod_rm_driver::rm_driver(), and mod_rm_prep::rm_prep().

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

◆ topography_calc_tan_slope()

subroutine, public scale_topography::topography_calc_tan_slope ( integer, intent(in)  IA,
integer, intent(in)  IS,
integer, intent(in)  IE,
integer, intent(in)  JA,
integer, intent(in)  JS,
integer, intent(in)  JE,
real(rp), dimension(ia), intent(in)  RCDX,
real(rp), dimension(ja), intent(in)  RCDY,
real(rp), dimension(ia,ja,2), intent(in)  MAPF 
)

Definition at line 249 of file scale_topography.F90.

249  use scale_prc_cartesc, only: &
250  prc_twod
251  implicit none
252  integer, intent(in) :: IA, IS, IE
253  integer, intent(in) :: JA, JS, JE
254  real(RP), intent(in) :: RCDX(IA), RCDY(JA)
255  real(RP), intent(in) :: MAPF(IA,JA,2)
256 
257  integer :: i, j
258 
259  if ( prc_twod ) then
260  !$omp parallel do
261  !$acc kernels
262  do j = js, je
263  do i = is, ie
264  topography_tansl_x(i,j) = 0.0_rp
265  end do
266  end do
267  !$acc end kernels
268  else
269  !$omp parallel do
270  !$acc kernels
271  do j = js, je
272  do i = is, ie
273  topography_tansl_x(i,j) = ( ( topography_zsfc(i+1,j) + topography_zsfc(i ,j) ) * 0.5_rp &
274  - ( topography_zsfc(i ,j) + topography_zsfc(i-1,j) ) * 0.5_rp ) &
275  * rcdx(i) * mapf(i,j,1)
276  end do
277  end do
278  !$acc end kernels
279  end if
280  !$omp parallel do
281  !$acc kernels
282  do j = js, je
283  do i = is, ie
284  topography_tansl_y(i,j) = ( ( topography_zsfc(i,j+1) + topography_zsfc(i,j ) ) * 0.5_rp &
285  - ( topography_zsfc(i,j ) + topography_zsfc(i,j-1) ) * 0.5_rp ) &
286  * rcdy(j) * mapf(i,j,2)
287  end do
288  end do
289  !$acc end kernels
290 
291  call topography_fillhalo( topography_tansl_x(:,:), .true. )
292  call topography_fillhalo( topography_tansl_y(:,:), .true. )
293  !$acc update host(TOPOGRAPHY_TanSL_X, TOPOGRAPHY_TanSL_Y)
294 
295  return

References scale_atmos_grid_cartesc_index::ie, scale_atmos_grid_cartesc_index::is, scale_atmos_grid_cartesc_index::je, scale_atmos_grid_cartesc_index::js, scale_prc_cartesc::prc_twod, topography_fillhalo(), topography_tansl_x, topography_tansl_y, and topography_zsfc.

Referenced by scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_finalize().

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

Variable Documentation

◆ topography_exist

logical, public scale_topography::topography_exist = .false.

topography exists?

Definition at line 37 of file scale_topography.F90.

37  logical, public :: TOPOGRAPHY_exist = .false.

Referenced by scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_setup(), and topography_finalize().

◆ topography_zsfc

real(rp), dimension (:,:), allocatable, public scale_topography::topography_zsfc

◆ topography_tansl_x

real(rp), dimension(:,:), allocatable, public scale_topography::topography_tansl_x

◆ topography_tansl_y

real(rp), dimension(:,:), allocatable, public scale_topography::topography_tansl_y
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:350
scale_file_cartesc::file_cartesc_enddef
subroutine, public file_cartesc_enddef(fid)
Exit netCDF file define mode.
Definition: scale_file_cartesC.F90:964
scale_file_cartesc::file_cartesc_def_var
subroutine, public file_cartesc_def_var(fid, varname, desc, unit, dim_type, datatype, vid, standard_name, timeintv, nsteps, cell_measures)
Define a variable to file.
Definition: scale_file_cartesC.F90:3360
scale_topography::topography_tansl_y
real(rp), dimension(:,:), allocatable, public topography_tansl_y
tan(slope_y)
Definition: scale_topography.F90:41
scale_file
module file
Definition: scale_file.F90:15
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_atmos_grid_cartesc_index::ie
integer, public ie
end point of inner domain: x, local
Definition: scale_atmos_grid_cartesC_index.F90:54
scale_atmos_grid_cartesc_index::ia
integer, public ia
Definition: scale_atmos_grid_cartesC_index.F90:48
scale_topography::topography_tansl_x
real(rp), dimension(:,:), allocatable, public topography_tansl_x
tan(slope_x)
Definition: scale_topography.F90:40
scale_file_cartesc::file_cartesc_close
subroutine, public file_cartesc_close(fid)
Close a netCDF file.
Definition: scale_file_cartesC.F90:1044
scale_prc_cartesc
module process / cartesC
Definition: scale_prc_cartesC.F90:11
scale_atmos_grid_cartesc_index::is
integer, public is
start point of inner domain: x, local
Definition: scale_atmos_grid_cartesC_index.F90:53
scale_atmos_grid_cartesc_index::ja
integer, public ja
Definition: scale_atmos_grid_cartesC_index.F90:49
scale_file::file_aggregate
logical, public file_aggregate
Definition: scale_file.F90:196
scale_file_cartesc::file_cartesc_create
subroutine, public file_cartesc_create(basename, title, datatype, fid, date, subsec, haszcoord, append, aggregate, single)
Create/open a netCDF file.
Definition: scale_file_cartesC.F90:796
scale_comm_cartesc
module COMMUNICATION
Definition: scale_comm_cartesC.F90:11
scale_atmos_grid_cartesc_index::js
integer, public js
start point of inner domain: y, local
Definition: scale_atmos_grid_cartesC_index.F90:55
scale_atmos_grid_cartesc_index::je
integer, public je
end point of inner domain: y, local
Definition: scale_atmos_grid_cartesC_index.F90:56
scale_prc_cartesc::prc_twod
logical, public prc_twod
2D experiment
Definition: scale_prc_cartesC.F90:56
scale_file_cartesc
module file / cartesianC
Definition: scale_file_cartesC.F90:11