41 real(RP),
public ::
dz = 500.0_rp
42 real(RP),
public ::
dx = 500.0_rp
43 real(RP),
public ::
dy = 500.0_rp
56 real(RP),
public,
allocatable ::
grid_cz (:)
57 real(RP),
public,
allocatable ::
grid_cx (:)
58 real(RP),
public,
allocatable ::
grid_cy (:)
66 real(RP),
public,
allocatable ::
grid_fz (:)
67 real(RP),
public,
allocatable ::
grid_fx (:)
68 real(RP),
public,
allocatable ::
grid_fy (:)
106 character(len=H_LONG),
private :: grid_in_basename =
'' 107 character(len=H_LONG),
private :: grid_out_basename =
'' 108 real(RP),
private :: grid_offset_x = 0.0_rp
109 real(RP),
private :: grid_offset_y = 0.0_rp
111 integer,
private :: buffer_nz = -1
112 integer,
private :: buffer_nx = -1
113 integer,
private :: buffer_ny = -1
115 integer,
private,
parameter :: kmax_user_lim = 300
116 real(RP),
private :: fz(kmax_user_lim)
118 logical,
private :: debug = .false.
129 namelist / param_grid / &
154 if(
io_l )
write(
io_fid_log,*)
'++++++ Module[GRID] / Categ[ATMOS-RM GRID] / Origin[SCALElib]' 162 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 163 elseif( ierr > 0 )
then 164 write(*,*)
'xxx Not appropriate names in namelist PARAM_GRID. Check!' 174 if(
io_l )
write(
io_fid_log,*)
'*** Atmosphere grid information ***' 177 if ( grid_in_basename /=
'' )
then 180 if(
io_l )
write(
io_fid_log,*)
'*** Not found input grid file. Grid position is calculated.' 265 character(len=H_LONG) :: bname
271 write(bname,
'(A,A,F15.3)') trim(grid_in_basename)
307 end subroutine grid_read
321 real(RP),
allocatable :: buffz(:), buffx(:), buffy(:)
322 real(RP) :: bufftotz, bufftotx, bufftoty
324 integer :: kbuff, ibuff, jbuff
325 integer :: kmain, imain, jmain
327 logical :: use_user_input
329 integer :: k, i, j, ii, jj
334 allocate( buffx(0:
iag) )
335 allocate( buffy(0:
jag) )
340 if ( buffer_nx > 0 )
then 341 if ( 2*buffer_nx >
imaxg )
then 342 write(*,*)
'xxx Buffer grid size (', buffer_nx, &
343 'x2) must be smaller than global domain size (X). Use smaller BUFFER_NX!' 351 bufftotx = bufftotx + buffx(i)
354 imain =
imaxg - 2*buffer_nx
363 bufftotx = bufftotx + buffx(i)
366 imain =
imaxg - 2*ibuff
368 if ( imain < 0 )
then 369 write(*,*)
'xxx Buffer length (', bufftotx, &
370 'x2[m]) must be smaller than global domain size (X). Use smaller BUFFER_DX!' 377 do i =
ihalo-1, 0, -1
385 if ( ibuff > 0 )
then 397 if ( ibuff > 0 )
then 398 do i =
ihalo+ibuff+imain+1,
ihalo+ibuff+imain+ibuff
424 if ( ibuff > 0 )
then 430 do i =
ihalo+ibuff+imain+1,
ihalo+ibuff+imain+ibuff
447 if ( buffer_ny > 0 )
then 448 if ( 2*buffer_ny >
jmaxg )
then 449 write(*,*)
'xxx Buffer grid size (', buffer_ny, &
450 'x2) must be smaller than global domain size (Y). Use smaller BUFFER_NY!' 458 bufftoty = bufftoty + buffy(j)
461 jmain =
jmaxg - 2*buffer_ny
470 bufftoty = bufftoty + buffy(j)
473 jmain =
jmaxg - 2*jbuff
475 if ( jmain < 0 )
then 476 write(*,*)
'xxx Buffer length (', bufftoty, &
477 'x2[m]) must be smaller than global domain size (Y). Use smaller BUFFER_DY!' 484 do j =
jhalo-1, 0, -1
492 if ( jbuff > 0 )
then 504 if ( jbuff > 0 )
then 505 do j =
jhalo+jbuff+jmain+1,
jhalo+jbuff+jmain+jbuff
531 if ( jbuff > 0 )
then 537 do j =
jhalo+jbuff+jmain+1,
jhalo+jbuff+jmain+jbuff
555 allocate( buffz(0:
ka) )
557 use_user_input = .false.
558 if ( maxval(fz(1:kmax_user_lim)) > 0.0_rp )
then 559 if(
io_l )
write(
io_fid_log,*)
'*** Z coordinate is given from NAMELIST.' 562 write(*,*)
'xxx KMAX must be larger than 1. Check!',
kmax 566 if (
kmax > kmax_user_lim )
then 567 write(*,*)
'xxx KMAX must be smaller than ', kmax_user_lim,
'. Check!',
kmax 571 if ( minval(fz(1:
kmax)) <= 0.0_rp )
then 572 write(*,*)
'xxx FZ must be positive. Check! minval(FZ(1:KMAX))=', minval(fz(1:
kmax))
576 use_user_input = .true.
579 if ( use_user_input )
then 584 if ( buffer_nz > 0 )
then 585 if ( buffer_nz >
kmax )
then 586 write(*,*)
'xxx Buffer grid size (', buffer_nz, &
587 ') must be smaller than global domain size (Z). Use smaller BUFFER_NZ!' 593 bufftotz = bufftotz + ( fz(k) - fz(k-1) )
596 kmain =
kmax - buffer_nz
601 write(*,*)
'xxx Buffer length (',
buffer_dz, &
602 '[m]) must be smaller than global domain size (Z). Use smaller BUFFER_DZ!' 609 bufftotz = bufftotz + ( fz(k) - fz(k-1) )
641 if ( buffer_nz > 0 )
then 642 if ( buffer_nz >
kmax )
then 643 write(*,*)
'xxx Buffer grid size (', buffer_nz, &
644 ') must be smaller than global domain size (Z). Use smaller BUFFER_NZ!' 652 bufftotz = bufftotz + buffz(k)
655 kmain =
kmax - buffer_nz
664 bufftotz = bufftotz + buffz(k)
669 if ( kmain < 0 )
then 670 write(*,*)
'xxx Buffer length (', bufftotz, &
671 '[m]) must be smaller than global domain size (Z). Use smaller BUFFER_DZ!' 686 do k =
ks,
ks+kmain-1
691 if ( kbuff > 0 )
then 708 if ( kbuff > 0 )
then 789 if(
io_l )
write(
io_fid_log,
'(1x,2(A,I6))')
'*** Z: buffer = ', kbuff,
' x 1, main = ',kmain
790 if(
io_l )
write(
io_fid_log,
'(1x,2(A,I6))')
'*** X: buffer = ', ibuff,
' x 2, main = ',imain
791 if(
io_l )
write(
io_fid_log,
'(1x,2(A,I6))')
'*** Y: buffer = ', jbuff,
' x 2, main = ',jmain
795 grid_fz(0) *1.e-3_rp,
' -HALO- ', &
799 grid_fz(
ke-kbuff)*1.e-3_rp,
' -buffer- ', &
803 grid_fxg(0) *1.e-3_rp,
' -HALO- ', &
812 grid_fyg(0) *1.e-3_rp,
' -HALO- ', &
821 if(
io_l )
write(
io_fid_log,*)
'*** Center Position of Grid (global) :' 827 '|============= Vertical Coordinate =============|' 829 '| k z zh dz buffer k |' 831 '| [m] [m] [m] factor |' 871 '|===============================================|' integer, public imax
of computational cells: x, local
integer, public prc_num_x
x length of 2D processor topology
integer, public is
start point of inner domain: x, local
real(rp), public buffer_dx
thickness of buffer region [m]: x
real(rp), public bufffact_z
strech factor for dz of buffer region
real(rp), public grid_domain_center_x
center position of global domain [m]: x
integer, public je
end point of inner domain: y, local
real(rp), dimension(:), allocatable, public grid_rcdy
reciprocal of center-dy
real(rp), public dy
length in the main region [m]: y
real(rp), dimension(:), allocatable, public grid_cyg
center coordinate [m]: y, global
subroutine, public prc_mpistop
Abort MPI.
real(rp), dimension(:), allocatable, public grid_cbfyg
center buffer factor (0-1): y, global
real(rp), dimension(:), allocatable, public grid_cxg
center coordinate [m]: x, global
real(rp), dimension(:), allocatable, public grid_fdy
y-length of grid(j+1) to grid(j) [m]
real(rp), public dx
length in the main region [m]: x
logical, public io_l
output log or not? (this process)
real(rp), dimension(:), allocatable, public grid_cdyg
center coordinate [m]: y, global
real(rp), dimension(:), allocatable, public grid_rcdx
reciprocal of center-dx
real(rp), dimension(:), allocatable, public grid_cz
center coordinate [m]: z, local=global
real(rp), dimension(:), allocatable, public grid_fxg
face coordinate [m]: x, global
real(rp), dimension(:), allocatable, public grid_fbfy
face buffer factor (0-1): y
integer, public ke
end point of inner domain: z, local
real(rp), public bufffact_x
strech factor for dx of buffer region
real(rp), dimension(:), allocatable, public grid_rfdy
reciprocal of face-dy
real(rp), dimension(:), allocatable, public grid_cdxg
center coordinate [m]: x, global
real(rp), dimension(:), allocatable, public grid_rcdz
reciprocal of center-dz
real(rp), public dz
length in the main region [m]: z
real(rp), dimension(:), allocatable, public grid_fx
face coordinate [m]: x, local
integer, public prc_num_y
y length of 2D processor topology
logical, public io_nml
output log or not? (for namelist, this process)
integer, public ia
of whole cells: x, local, with HALO
integer, public jag
of computational grids
real(rp), dimension(:), allocatable, public grid_fbfx
face buffer factor (0-1): x
real(rp), dimension(:), allocatable, public grid_fdz
z-length of grid(k+1) to grid(k) [m]
integer, public ka
of whole cells: z, local, with HALO
real(rp), dimension(:), allocatable, public grid_fbfxg
face buffer factor (0-1): x, global
real(rp), dimension(:), allocatable, public grid_fdyg
center coordinate [m]: y, global
integer, public kmax
of computational cells: z, local
real(rp), dimension(:), allocatable, public grid_fz
face coordinate [m]: z, local=global
real(rp), dimension(:), allocatable, public grid_fbfz
face buffer factor (0-1): z
integer, public jhalo
of halo cells: y
integer, public js
start point of inner domain: y, local
integer, public iag
of computational grids
real(rp), dimension(:), allocatable, public grid_cbfx
center buffer factor (0-1): x
real(rp), public bufffact_y
strech factor for dy of buffer region
real(rp), dimension(:), allocatable, public grid_fbfyg
face buffer factor (0-1): y, global
subroutine, public grid_generate
Generate horizontal&vertical grid.
integer, public ks
start point of inner domain: z, local
real(rp), dimension(:), allocatable, public grid_cbfz
center buffer factor (0-1): z
integer, public prc_myrank
process num in local communicator
real(rp), dimension(:), allocatable, public grid_cx
center coordinate [m]: x, local
real(rp), public buffer_dy
thickness of buffer region [m]: y
real(rp), public grid_domain_center_y
center position of global domain [m]: y
integer, public ie
end point of inner domain: x, local
integer, public imaxg
of computational cells: x, global
real(rp), public buffer_dz
thickness of buffer region [m]: z
real(rp), dimension(:), allocatable, public grid_fdxg
center coordinate [m]: x, global
integer, dimension(:,:), allocatable, public prc_2drank
node index in 2D topology
real(rp), dimension(:), allocatable, public grid_cdz
z-length of control volume [m]
real(rp), dimension(:), allocatable, public grid_fdx
x-length of grid(i+1) to grid(i) [m]
real(rp), dimension(:), allocatable, public grid_cdy
y-length of control volume [m]
real(rp), dimension(:), allocatable, public grid_cbfy
center buffer factor (0-1): y
real(rp), dimension(:), allocatable, public grid_rfdx
reciprocal of face-dx
real(rp), dimension(:), allocatable, public grid_rfdz
reciprocal of face-dz
integer, public io_fid_conf
Config file ID.
integer, public io_fid_log
Log file ID.
subroutine, public grid_allocate
Allocate arrays.
integer, public jmaxg
of computational cells: y, global
real(rp), public bufffact
default strech factor for dx/dy/dz of buffer region
real(rp), dimension(:), allocatable, public grid_cdx
x-length of control volume [m]
integer, public jmax
of computational cells: y, local
integer, public io_fid_nml
Log file ID (only for output namelist)
real(rp), dimension(:), allocatable, public grid_fyg
face coordinate [m]: y, global
real(rp), dimension(:), allocatable, public grid_cy
center coordinate [m]: y, local
subroutine, public grid_setup
Setup.
real(rp), dimension(:), allocatable, public grid_cbfxg
center buffer factor (0-1): x, global
integer, public ihalo
of halo cells: x
integer, public ja
of whole cells: y, local, with HALO
real(rp), dimension(:), allocatable, public grid_fy
face coordinate [m]: y, local