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_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 66 of file scale_topography.F90.

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

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

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

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 190 of file scale_topography.F90.

190  use scale_file_cartesc, only: &
194  file_cartesc_write_var, &
196  implicit none
197 
198  integer :: fid, vid
199  !---------------------------------------------------------------------------
200 
201  if ( topography_out_basename /= '' .and. topography_out_basename /= topography_in_basename ) then
202 
203  log_newline
204  log_info("TOPOGRAPHY_write",*) 'Output topography file '
205 
206  call topography_fillhalo( fill_bnd=.false. )
207 
208  call file_cartesc_create( topography_out_basename, topography_out_title, topography_out_dtype, & ! [IN]
209  fid, & ! [OUT]
210  haszcoord=.false., aggregate=topography_out_aggregate ) ! [IN]
211 
212  call file_cartesc_def_var( fid, 'topo', 'Topography', 'm', 'XY', topography_out_dtype, & ! [IN]
213  vid, & ! [OUT]
214  standard_name="surface_altitude" ) ! [IN]
215 
216  call file_cartesc_enddef( fid )
217 
218  call file_cartesc_write_var( fid, vid, topography_zsfc(:,:), 'topo', 'XY' ) ! [IN]
219 
220 
221  call file_cartesc_close( fid )
222 
223  endif
224 
225  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 231 of file scale_topography.F90.

231  use scale_prc_cartesc, only: &
232  prc_twod
233  implicit none
234  integer, intent(in) :: IA, IS, IE
235  integer, intent(in) :: JA, JS, JE
236  real(RP), intent(in) :: RCDX(IA), RCDY(JA)
237  real(RP), intent(in) :: MAPF(IA,JA,2)
238 
239  integer :: i, j
240 
241  if ( prc_twod ) then
242  !$omp parallel do
243  do j = js, je
244  do i = is, ie
245  topography_tansl_x(i,j) = 0.0_rp
246  end do
247  end do
248  else
249  !$omp parallel do
250  do j = js, je
251  do i = is, ie
252  topography_tansl_x(i,j) = ( ( topography_zsfc(i+1,j) + topography_zsfc(i ,j) ) * 0.5_rp &
253  - ( topography_zsfc(i ,j) + topography_zsfc(i-1,j) ) * 0.5_rp ) &
254  * rcdx(i) * mapf(i,j,1)
255  end do
256  end do
257  end if
258  !$omp parallel do
259  do j = js, je
260  do i = is, ie
261  topography_tansl_y(i,j) = ( ( topography_zsfc(i,j+1) + topography_zsfc(i,j ) ) * 0.5_rp &
262  - ( topography_zsfc(i,j ) + topography_zsfc(i,j-1) ) * 0.5_rp ) &
263  * rcdy(j) * mapf(i,j,2)
264  end do
265  end do
266 
267  call topography_fillhalo( topography_tansl_x(:,:), .true. )
268  call topography_fillhalo( topography_tansl_y(:,:), .true. )
269 
270  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_setup().

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 36 of file scale_topography.F90.

36  logical, public :: TOPOGRAPHY_exist = .false.

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

◆ 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:342
scale_file_cartesc::file_cartesc_enddef
subroutine, public file_cartesc_enddef(fid)
Exit netCDF file define mode.
Definition: scale_file_cartesC.F90:943
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:3307
scale_topography::topography_tansl_y
real(rp), dimension(:,:), allocatable, public topography_tansl_y
tan(slope_y)
Definition: scale_topography.F90:40
scale_file
module file
Definition: scale_file.F90:15
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_topography::topography_tansl_x
real(rp), dimension(:,:), allocatable, public topography_tansl_x
tan(slope_x)
Definition: scale_topography.F90:39
scale_file_cartesc::file_cartesc_close
subroutine, public file_cartesc_close(fid)
Close a netCDF file.
Definition: scale_file_cartesC.F90:1023
scale_prc_cartesc
module process / cartesC
Definition: scale_prc_cartesC.F90:11
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:780
scale_comm_cartesc
module COMMUNICATION
Definition: scale_comm_cartesC.F90:11
scale_file_cartesc
module file / cartesianC
Definition: scale_file_cartesC.F90:11