SCALE-RM
scale_land_grid_cartesC.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
9 !-------------------------------------------------------------------------------
10 #include "scalelib.h"
12  !-----------------------------------------------------------------------------
13  !
14  !++ used modules
15  !
16  use scale_precision
17  use scale_io
18  use scale_prof
21  !-----------------------------------------------------------------------------
22  implicit none
23  private
24  !-----------------------------------------------------------------------------
25  !
26  !++ Public procedure
27  !
28  public :: land_grid_cartesc_setup
29 
30  !-----------------------------------------------------------------------------
31  !
32  !++ Public parameters & variables
33  !
34  real(rp), public, allocatable :: land_grid_cartesc_cz (:)
35  real(rp), public, allocatable :: land_grid_cartesc_fz (:)
36  real(rp), public, allocatable :: land_grid_cartesc_cdz(:)
37 
38  !-----------------------------------------------------------------------------
39  !
40  !++ Private procedure
41  !
42  private :: land_grid_cartesc_read
43  private :: land_grid_cartesc_generate
44 
45  !-----------------------------------------------------------------------------
46  !
47  !++ Private parameters & variables
48  !
49  real(rp), private :: ldz(100)
50 
51  character(len=H_LONG) :: land_grid_cartesc_in_basename = ''
52  logical :: land_grid_cartesc_in_aggregate
53 
54  !-----------------------------------------------------------------------------
55 contains
56  !-----------------------------------------------------------------------------
58  subroutine land_grid_cartesc_setup
59  use scale_prc, only: &
60  prc_abort
61  use scale_file, only: &
63  implicit none
64 
65  namelist / param_land_grid_cartesc / &
66  land_grid_cartesc_in_basename, &
67  land_grid_cartesc_in_aggregate, &
68  ldz
69 
70  integer :: ierr
71  integer :: k
72  !---------------------------------------------------------------------------
73 
74  log_newline
75  log_info("LAND_GRID_CARTESC_setup",*) 'Setup'
76 
77  if ( lkmax < 1 ) then
78  log_info("LAND_GRID_CARTESC_setup",*) 'Skip because LKMAX < 1'
79  return
80  end if
81 
82  ldz(:) = 0.0_rp
83 
84  land_grid_cartesc_in_aggregate = file_aggregate
85 
86  !--- read namelist
87  rewind(io_fid_conf)
88  read(io_fid_conf,nml=param_land_grid_cartesc,iostat=ierr)
89  if( ierr < 0 ) then !--- missing
90  log_info("LAND_GRID_CARTESC_setup",*) 'Not found namelist. Default used.'
91  elseif( ierr > 0 ) then !--- fatal error
92  log_error("LAND_GRID_CARTESC_setup",*) 'Not appropriate names in namelist PARAM_LAND_GRID_CARTESC. Check!'
93  call prc_abort
94  endif
95  log_nml(param_land_grid_cartesc)
96 
97  allocate( land_grid_cartesc_cz(lks :lke) )
98  allocate( land_grid_cartesc_fz(lks-1:lke) )
99  allocate( land_grid_cartesc_cdz(lks :lke) )
100 
101  log_newline
102  log_info("LAND_GRID_CARTESC_setup",*) 'Land grid information '
103 
104  if ( land_grid_cartesc_in_basename /= '' ) then
105  call land_grid_cartesc_read
106  else
107  log_info("LAND_GRID_CARTESC_setup",*) 'Not found input grid file. Grid position is calculated.'
108 
109  call land_grid_cartesc_generate
110  endif
111 
112  if ( lke == lks ) then
113  log_newline
114  log_info("LAND_GRID_CARTESC_setup",*) 'Single layer. LDZ = ', ldz(1)
115  else
116  log_newline
117  log_info_cont('(1x,A)') 'Vertical Coordinate'
118  log_info_cont('(1x,A)') '| k z zh dz k |'
119  log_info_cont('(1x,A)') '| [m] [m] [m] |'
120  k = lks-1
121  log_info_cont('(1x,A,F8.3,A,I4,A)') '| ',land_grid_cartesc_fz(k),' ',k,' | Atmosphere interface'
122  do k = lks, lke-1
123  log_info_cont('(1x,A,I4,F8.3,A,F8.3,A)') '|',k,land_grid_cartesc_cz(k),' ',land_grid_cartesc_cdz(k),' | '
124  log_info_cont('(1x,A,F8.3,A,I4,A)') '| ',land_grid_cartesc_fz(k),' |',k,' | '
125  enddo
126  k = lke
127  log_info_cont('(1x,A,I4,F8.3,A,F8.3,A)') '|',k,land_grid_cartesc_cz(k),' ',land_grid_cartesc_cdz(k),' | '
128  log_info_cont('(1x,A,F8.3,A,I4,A)') '| ',land_grid_cartesc_fz(k),' ',k,' | bedrock'
129  log_info_cont('(1x,A)') '|=================================|'
130  endif
131 
132  return
133  end subroutine land_grid_cartesc_setup
134 
135  !-----------------------------------------------------------------------------
137  subroutine land_grid_cartesc_read
138  use scale_file, only: &
139  file_open, &
140  file_read
141  use scale_prc, only: &
142  prc_myrank
143  implicit none
144 
145  integer :: fid
146  !---------------------------------------------------------------------------
147 
148  log_newline
149  log_info("LAND_GRID_CARTESC_read",*) 'Input land grid file '
150 
151  call file_open( land_grid_cartesc_in_basename, fid, rankid=prc_myrank, aggregate=land_grid_cartesc_in_aggregate )
152 
153  call file_read( fid, 'LCZ', land_grid_cartesc_cz(:) )
154  call file_read( fid, 'LCDZ', land_grid_cartesc_cdz(:) )
155  call file_read( fid, 'LFZ', land_grid_cartesc_fz(:) )
156 
157  return
158  end subroutine land_grid_cartesc_read
159 
160  !-----------------------------------------------------------------------------
162  subroutine land_grid_cartesc_generate
163  implicit none
164 
165  integer :: k
166  !---------------------------------------------------------------------------
167 
168  do k = lks, lke
169  land_grid_cartesc_cdz(k) = ldz(k)
170  enddo
171 
172  land_grid_cartesc_fz(lks-1) = 0.0_rp
173 
174  do k = lks, lke
177  enddo
178 
179  return
180  end subroutine land_grid_cartesc_generate
181 
182 end module scale_land_grid_cartesc
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:342
scale_land_grid_cartesc::land_grid_cartesc_cdz
real(rp), dimension(:), allocatable, public land_grid_cartesc_cdz
z-length of control volume [m]
Definition: scale_land_grid_cartesC.F90:36
scale_precision
module PRECISION
Definition: scale_precision.F90:14
scale_land_grid_cartesc_index::lkmax
integer, public lkmax
Definition: scale_land_grid_cartesC_index.F90:32
scale_prc::prc_myrank
integer, public prc_myrank
process num in local communicator
Definition: scale_prc.F90:90
scale_file
module file
Definition: scale_file.F90:15
scale_land_grid_cartesc_index
module land / grid / cartesianC / index
Definition: scale_land_grid_cartesC_index.F90:11
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_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_land_grid_cartesc::land_grid_cartesc_setup
subroutine, public land_grid_cartesc_setup
Setup.
Definition: scale_land_grid_cartesC.F90:59
scale_land_grid_cartesc::land_grid_cartesc_cz
real(rp), dimension(:), allocatable, public land_grid_cartesc_cz
center coordinate [m]: z, local=global
Definition: scale_land_grid_cartesC.F90:34
scale_land_grid_cartesc::land_grid_cartesc_fz
real(rp), dimension(:), allocatable, public land_grid_cartesc_fz
face coordinate [m]: z, local=global
Definition: scale_land_grid_cartesC.F90:35
scale_file::file_aggregate
logical, public file_aggregate
Definition: scale_file.F90:182
scale_land_grid_cartesc
module land / grid / cartesianC
Definition: scale_land_grid_cartesC.F90:11
scale_land_grid_cartesc_index::lke
integer, public lke
Definition: scale_land_grid_cartesC_index.F90:41
scale_io::io_fid_conf
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:56
scale_land_grid_cartesc_index::lks
integer, public lks
Definition: scale_land_grid_cartesC_index.F90:40