SCALE-RM
scale_urban_grid_cartesC.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
10 !-------------------------------------------------------------------------------
11 #include "scalelib.h"
13  !-----------------------------------------------------------------------------
14  !
15  !++ used modules
16  !
17  use scale_precision
18  use scale_io
19  use scale_prof
22  !-----------------------------------------------------------------------------
23  implicit none
24  private
25  !-----------------------------------------------------------------------------
26  !
27  !++ Public procedure
28  !
29  public :: urban_grid_cartesc_setup
30 
31  !-----------------------------------------------------------------------------
32  !
33  !++ Public parameters & variables
34  !
35  real(rp), public, allocatable :: urban_grid_cartesc_cz (:)
36  real(rp), public, allocatable :: urban_grid_cartesc_fz (:)
37  real(rp), public, allocatable :: urban_grid_cartesc_cdz (:)
38 
39  !-----------------------------------------------------------------------------
40  !
41  !++ Private procedure
42  !
43  private :: urban_grid_cartesc_read
44  private :: urban_grid_cartesc_generate
45 
46  !-----------------------------------------------------------------------------
47  !
48  !++ Private parameters & variables
49  !
50  real(rp), private :: udz(200)
51 
52  character(len=H_LONG) :: urban_grid_cartesc_in_basename = ''
53  logical :: urban_grid_cartesc_in_aggregate
54 
55  !-----------------------------------------------------------------------------
56 contains
57  !-----------------------------------------------------------------------------
59  subroutine urban_grid_cartesc_setup
60  use scale_prc, only: &
61  prc_abort
62  use scale_file, only: &
64  implicit none
65 
66  namelist / param_urban_grid_cartesc / &
67  urban_grid_cartesc_in_basename, &
68  urban_grid_cartesc_in_aggregate, &
69  udz
70 
71  integer :: ierr
72  integer :: k
73  !---------------------------------------------------------------------------
74 
75  log_newline
76  log_info("URBAN_GRID_CARTESC_setup",*) 'Setup'
77 
78  if ( ukmax < 1 ) then
79  log_info("URBAN_GRID_CARTESC_setup",*) 'Skip because UKMAX < 1'
80  return
81  end if
82 
83  udz(:) = 0.0_rp
84 
85  urban_grid_cartesc_in_aggregate = file_aggregate
86 
87  !--- read namelist
88  rewind(io_fid_conf)
89  read(io_fid_conf,nml=param_urban_grid_cartesc,iostat=ierr)
90  if( ierr < 0 ) then !--- missing
91  log_info("URBAN_GRID_CARTESC_setup",*) 'Not found namelist. Default used.'
92  elseif( ierr > 0 ) then !--- fatal error
93  log_error("URBAN_GRID_CARTESC_setup",*) 'Not appropriate names in namelist PARAM_URBAN_GRID_CARTESC. Check!'
94  call prc_abort
95  endif
96  log_nml(param_urban_grid_cartesc)
97 
98  allocate( urban_grid_cartesc_cz(uks :uke) )
99  allocate( urban_grid_cartesc_fz(uks-1:uke) )
100  allocate( urban_grid_cartesc_cdz(uks :uke) )
101 
102  log_newline
103  log_info("URBAN_GRID_CARTESC_setup",*) 'Urban grid information '
104 
105  if ( urban_grid_cartesc_in_basename /= '' ) then
106  call urban_grid_cartesc_read
107  else
108  log_info("URBAN_GRID_CARTESC_setup",*) 'Not found input grid file. Grid position is calculated.'
109 
110  call urban_grid_cartesc_generate
111  endif
112 
113  if ( uke == uks ) then
114  log_newline
115  log_info("URBAN_GRID_CARTESC_setup",*) 'Single layer. LDZ = ', udz(1)
116  else
117  log_newline
118  log_info("URBAN_GRID_CARTESC_setup",'(1x,A)') 'Vertical Coordinate'
119  log_info_cont('(1x,A)') '| k z zh dz k |'
120  log_info_cont('(1x,A)') '| [m] [m] [m] |'
121  k = uks-1
122  log_info_cont('(1x,A,F8.3,A,I4,A)') '| ',urban_grid_cartesc_fz(k),' ',k,' | Atmosphere interface'
123  do k = uks, uke-1
124  log_info_cont('(1x,A,I4,F8.3,A,F8.3,A)') '|',k,urban_grid_cartesc_cz(k),' ',urban_grid_cartesc_cdz(k),' | '
125  log_info_cont('(1x,A,F8.3,A,I4,A)') '| ',urban_grid_cartesc_fz(k),' |',k,' | '
126  enddo
127  k = uke
128  log_info_cont('(1x,A,I4,F8.3,A,F8.3,A)') '|',k,urban_grid_cartesc_cz(k),' ',urban_grid_cartesc_cdz(k),' | '
129  log_info_cont('(1x,A,F8.3,A,I4,A)') '| ',urban_grid_cartesc_fz(k),' ',k,' | bedrock'
130  log_info_cont('(1x,A)') '|=================================|'
131  endif
132 
133  return
134  end subroutine urban_grid_cartesc_setup
135 
136  !-----------------------------------------------------------------------------
138  subroutine urban_grid_cartesc_read
139  use scale_file, only: &
140  file_open, &
141  file_read
142  use scale_prc, only: &
143  prc_myrank
144  implicit none
145 
146  integer :: fid
147  !---------------------------------------------------------------------------
148 
149  log_newline
150  log_info("URBAN_GRID_CARTESC_read",*) 'Input urban grid file '
151 
152  call file_open( urban_grid_cartesc_in_basename, fid, rankid=prc_myrank, aggregate=urban_grid_cartesc_in_aggregate )
153 
154  call file_read( fid, 'UCZ', urban_grid_cartesc_cz(:) )
155  call file_read( fid, 'UCDZ', urban_grid_cartesc_cdz(:) )
156  call file_read( fid, 'UFZ', urban_grid_cartesc_fz(:) )
157 
158  return
159  end subroutine urban_grid_cartesc_read
160 
161  !-----------------------------------------------------------------------------
163  subroutine urban_grid_cartesc_generate
164  implicit none
165 
166  integer :: k
167  !---------------------------------------------------------------------------
168 
169  do k = uks, uke
170  urban_grid_cartesc_cdz(k) = udz(k)
171  enddo
172 
173  urban_grid_cartesc_fz(uks-1) = 0.0_rp
174 
175  do k = uks, uke
178  enddo
179 
180  return
181  end subroutine urban_grid_cartesc_generate
182 
183 end module scale_urban_grid_cartesc
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:342
scale_urban_grid_cartesc::urban_grid_cartesc_cdz
real(rp), dimension(:), allocatable, public urban_grid_cartesc_cdz
z-length of control volume [m]
Definition: scale_urban_grid_cartesC.F90:37
scale_precision
module PRECISION
Definition: scale_precision.F90:14
scale_prc::prc_myrank
integer, public prc_myrank
process num in local communicator
Definition: scale_prc.F90:90
scale_urban_grid_cartesc_index
module urban / grid / icosahedralA / index
Definition: scale_urban_grid_cartesC_index.F90:11
scale_urban_grid_cartesc::urban_grid_cartesc_cz
real(rp), dimension(:), allocatable, public urban_grid_cartesc_cz
center coordinate [m]: z, local=global
Definition: scale_urban_grid_cartesC.F90:35
scale_file
module file
Definition: scale_file.F90:15
scale_urban_grid_cartesc_index::ukmax
integer, public ukmax
Definition: scale_urban_grid_cartesC_index.F90:32
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_precision::rp
integer, parameter, public rp
Definition: scale_precision.F90:41
scale_io
module STDIO
Definition: scale_io.F90:10
scale_atmos_grid_cartesc_index
module atmosphere / grid / cartesC index
Definition: scale_atmos_grid_cartesC_index.F90:12
scale_urban_grid_cartesc
module urban / grid / cartesianC
Definition: scale_urban_grid_cartesC.F90:12
scale_file::file_open
subroutine, public file_open(basename, fid, mode, single, aggregate, rankid, postfix)
Definition: scale_file.F90:487
scale_prof
module profiler
Definition: scale_prof.F90:11
scale_urban_grid_cartesc_index::uks
integer, public uks
Definition: scale_urban_grid_cartesC_index.F90:37
scale_file::file_aggregate
logical, public file_aggregate
Definition: scale_file.F90:182
scale_urban_grid_cartesc::urban_grid_cartesc_setup
subroutine, public urban_grid_cartesc_setup
Setup.
Definition: scale_urban_grid_cartesC.F90:60
scale_io::io_fid_conf
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:56
scale_urban_grid_cartesc_index::uke
integer, public uke
Definition: scale_urban_grid_cartesC_index.F90:38
scale_urban_grid_cartesc::urban_grid_cartesc_fz
real(rp), dimension(:), allocatable, public urban_grid_cartesc_fz
face coordinate [m]: z, local=global
Definition: scale_urban_grid_cartesC.F90:36