113 character(len=*),
intent(in),
optional :: basename
114 logical,
intent(in),
optional :: aggregate
116 character(len=H_LONG) :: ATMOS_GRID_CARTESC_IN_BASENAME =
'' 117 logical :: ATMOS_GRID_CARTESC_IN_AGGREGATE
119 real(RP) :: OFFSET_X = 0.0_rp
120 real(RP) :: OFFSET_Y = 0.0_rp
122 real(RP) :: BUFFER_DZ = 0.0_rp
123 real(RP) :: BUFFER_DX = 0.0_rp
124 real(RP) :: BUFFER_DY = 0.0_rp
125 real(RP) :: BUFFFACT = 1.0_rp
126 real(RP) :: BUFFFACT_Z = -1.0_rp
127 real(RP) :: BUFFFACT_X = -1.0_rp
128 real(RP) :: BUFFFACT_Y = -1.0_rp
130 integer :: BUFFER_NZ = -1
131 integer :: BUFFER_NX = -1
132 integer :: BUFFER_NY = -1
134 integer,
parameter :: FZ_MAX = 300
135 real(RP) :: FZ(fz_max)
137 namelist / param_atmos_grid_cartesc / &
138 atmos_grid_cartesc_in_basename, &
139 atmos_grid_cartesc_in_aggregate, &
161 log_info(
"ATMOS_GRID_CARTESC_setup",*)
'Setup' 164 log_info(
"ATMOS_GRID_CARTESC_setup",*)
'Skip because KMAX < 1' 170 if (
present(basename) ) atmos_grid_cartesc_in_basename = basename
171 if (
present(aggregate) )
then 172 atmos_grid_cartesc_in_aggregate = aggregate
179 read(
io_fid_conf,nml=param_atmos_grid_cartesc,iostat=ierr)
181 log_info(
"ATMOS_GRID_CARTESC_setup",*)
'Not found namelist. Default used.' 182 elseif( ierr > 0 )
then 183 log_error(
"ATMOS_GRID_CARTESC_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_GRID_CARTESC. Check!' 186 log_nml(param_atmos_grid_cartesc)
191 if ( atmos_grid_cartesc_in_basename /=
'' )
then 193 call atmos_grid_cartesc_read( atmos_grid_cartesc_in_basename, atmos_grid_cartesc_in_aggregate )
198 dz,
dx,
dy, fz(:), fz_max, &
199 offset_x, offset_y, &
200 buffer_dz, buffer_dx, buffer_dy, &
201 buffer_nz, buffer_nx, buffer_ny, &
203 bufffact_z, bufffact_x, bufffact_y )
270 subroutine atmos_grid_cartesc_read( &
271 basename, aggregate )
279 character(len=*),
intent(in) :: basename
280 logical,
intent(in),
optional :: aggregate
284 real(RP) :: FDXG(0:
iag), FDYG(0:
jag)
285 real(RP) :: FDX(0:
ia), FDY(0:
ja)
304 call file_read( fid,
'FDX', fdx(:) )
305 call file_read( fid,
'FDY', fdy(:) )
330 call file_read( fid,
'FDXG', fdxg(:) )
331 call file_read( fid,
'FDYG', fdyg(:) )
340 end subroutine atmos_grid_cartesc_read
345 DZ, DX, DY, FZ, FZ_MAX, &
346 OFFSET_X, OFFSET_Y, &
347 BUFFER_DZ, BUFFER_DX, BUFFER_DY, &
348 BUFFER_NZ, BUFFER_NX, BUFFER_NY, &
350 BUFFFACT_Z, BUFFFACT_X, BUFFFACT_Y )
359 real(RP),
intent(in) :: DZ, DX, DY
360 real(RP),
intent(in),
optional :: FZ(:)
361 integer,
intent(in),
optional :: FZ_MAX
362 real(RP),
intent(in),
optional :: OFFSET_X, OFFSET_Y
363 real(RP),
intent(in),
optional :: BUFFER_DZ, BUFFER_DX, BUFFER_DY
364 integer,
intent(in),
optional :: BUFFER_NZ, BUFFER_NX, BUFFER_NY
365 real(RP),
intent(in),
optional :: BUFFFACT
366 real(RP),
intent(in),
optional :: BUFFFACT_Z, BUFFFACT_X, BUFFFACT_Y
368 real(RP),
allocatable :: buffz(:), buffx(:), buffy(:)
369 real(RP) :: bufftotz, bufftotx, bufftoty
372 integer :: kbuff, ibuff, jbuff
373 integer :: kmain, imain, jmain
377 logical :: use_user_input
379 integer :: k, i, j, ii, jj
384 allocate( buffx(0:
iag) )
385 allocate( buffy(0:
jag) )
392 if (
present(bufffact_x) ) fact = bufffact_x
393 if ( fact < 0.0_rp .and.
present(bufffact) ) fact = bufffact
394 if ( fact < 0.0_rp ) fact = 1.0_rp
399 if (
present(buffer_nx) ) ibuff = buffer_nx
400 if ( ibuff > 0 )
then 401 if ( 2*ibuff >
imaxg )
then 402 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer grid size (', ibuff, &
403 'x2) must be smaller than global domain size (X). Use smaller BUFFER_NX!' 408 buffx(i) = buffx(i-1) * fact
409 bufftotx = bufftotx + buffx(i)
411 imain =
imaxg - 2*ibuff
412 else if (
present(buffer_dz) )
then 414 if( bufftotx >= buffer_dx )
exit 415 buffx(i) = buffx(i-1) * fact
416 bufftotx = bufftotx + buffx(i)
419 imain =
imaxg - 2*ibuff
421 if ( imain < 0 )
then 422 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer length (', bufftotx, &
423 'x2[m]) must be smaller than global domain size (X). Use smaller BUFFER_DX!' 432 if (
present(offset_x) )
then 437 do i =
ihalo-1, 0, -1
445 if ( ibuff > 0 )
then 457 if ( ibuff > 0 )
then 458 do i =
ihalo+ibuff+imain+1,
ihalo+ibuff+imain+ibuff
486 if ( ibuff > 0 )
then 492 do i =
ihalo+ibuff+imain+1,
ihalo+ibuff+imain+ibuff
510 if (
present(bufffact_y) ) fact = bufffact_y
511 if ( fact < 0.0_rp .and.
present(bufffact) )fact = bufffact
512 if ( fact < 0.0_rp ) fact = 1.0_rp
517 if (
present(buffer_ny) ) jbuff = buffer_ny
518 if ( jbuff > 0 )
then 519 if ( 2*jbuff >
jmaxg )
then 520 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer grid size (', jbuff, &
521 'x2) must be smaller than global domain size (Y). Use smaller BUFFER_NY!' 526 buffy(j) = buffy(j-1) * fact
527 bufftoty = bufftoty + buffy(j)
529 jmain =
jmaxg - 2*jbuff
530 else if (
present(buffer_dy) )
then 532 if( bufftoty >= buffer_dy )
exit 533 buffy(j) = buffy(j-1) * fact
534 bufftoty = bufftoty + buffy(j)
537 jmain =
jmaxg - 2*jbuff
539 if ( jmain < 0 )
then 540 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer length (', bufftoty, &
541 'x2[m]) must be smaller than global domain size (Y). Use smaller BUFFER_DY!' 550 if (
present(offset_y) )
then 555 do j =
jhalo-1, 0, -1
563 if ( jbuff > 0 )
then 575 if ( jbuff > 0 )
then 576 do j =
jhalo+jbuff+jmain+1,
jhalo+jbuff+jmain+jbuff
604 if ( jbuff > 0 )
then 610 do j =
jhalo+jbuff+jmain+1,
jhalo+jbuff+jmain+jbuff
628 allocate( buffz(0:
ka) )
630 use_user_input = .false.
631 if (
present(fz) )
then 632 if ( maxval(fz(:)) > 0.0_rp )
then 633 log_info(
"ATMOS_GRID_CARTESC_generate",*)
'Z coordinate is given from NAMELIST.' 636 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'KMAX must be larger than 1. Check!',
kmax 640 if (
kmax > fz_max )
then 641 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'KMAX must be smaller than ', fz_max,
'. Check!',
kmax 645 if ( minval(fz(1:
kmax)) <= 0.0_rp )
then 646 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'FZ must be positive. Check! minval(FZ(1:KMAX))=', minval(fz(1:
kmax))
650 use_user_input = .true.
654 if ( use_user_input )
then 660 if (
present(buffer_nz) ) kbuff = buffer_nz
661 if ( kbuff > 0 )
then 662 if ( kbuff >
kmax )
then 663 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer grid size (', kbuff, &
664 ') must be smaller than global domain size (Z). Use smaller BUFFER_NZ!' 670 bufftotz = bufftotz + ( fz(k) - fz(k-1) )
673 else if (
present(buffer_dz) )
then 674 if ( buffer_dz > fz(
kmax) )
then 675 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer length (', buffer_dz, &
676 '[m]) must be smaller than global domain size (Z). Use smaller BUFFER_DZ!' 682 if( bufftotz >= buffer_dz )
exit 683 bufftotz = bufftotz + ( fz(k) - fz(k-1) )
720 if (
present(bufffact_z) ) fact = bufffact_z
721 if ( fact < 0.0_rp .and.
present(bufffact) ) fact = bufffact
722 if ( fact < 0.0_rp ) fact = 1.0_rp
727 if (
present(buffer_nz) ) kbuff = buffer_nz
728 if ( kbuff > 0 )
then 729 if ( kbuff >
kmax )
then 730 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer grid size (', kbuff, &
731 ') must be smaller than global domain size (Z). Use smaller BUFFER_NZ!' 736 buffz(k) = buffz(k-1) * fact
737 bufftotz = bufftotz + buffz(k)
740 else if (
present(buffer_dz) )
then 742 if( bufftotz >= buffer_dz )
exit 743 buffz(k) = buffz(k-1) * fact
744 bufftotz = bufftotz + buffz(k)
749 if ( kmain < 0 )
then 750 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer length (', bufftotz, &
751 '[m]) must be smaller than global domain size (Z). Use smaller BUFFER_DZ!' 769 do k =
ks,
ks+kmain-1
774 if ( kbuff > 0 )
then 791 if ( kbuff > 0 )
then 875 log_info(
"ATMOS_GRID_CARTESC_generate",*)
'Grid information ' 876 log_info_cont(
'(1x,A,3(1x,F9.3))')
'delta Z, X, Y [m] :', dz, dx, dy
879 log_info(
"ATMOS_GRID_CARTESC_generate",*)
'Main/buffer Grid (global) :' 880 log_info_cont(
'(1x,2(A,I6))')
'Z: buffer = ', kbuff,
' x 1, main = ',kmain
881 log_info_cont(
'(1x,2(A,I6))')
'X: buffer = ', ibuff,
' x 2, main = ',imain
882 log_info_cont(
'(1x,2(A,I6))')
'Y: buffer = ', jbuff,
' x 2, main = ',jmain
885 log_info(
"ATMOS_GRID_CARTESC_generate",*)
'Domain size [km] (global) :' 886 log_info_cont(
'(1x,7(A,F9.3))')
'Z:', &
894 log_info_cont(
'(1x,8(A,F9.3))')
'X:', &
903 log_info_cont(
'(1x,8(A,F9.3))')
'Y:', &
922 log_info(
"ATMOS_GRID_CARTESC_output_info",*)
'Center Position of Grid (global) :' 928 log_info(
"ATMOS_GRID_CARTESC_output_info",*)
'Domain size [km] (local) :' 929 log_info_cont(
'(1x,6(A,F9.3))')
'X:', &
933 log_info_cont(
'(1x,6(A,F9.3))')
'Y:', &
940 log_info(
"ATMOS_GRID_CARTESC_output_info",
'(1x,A)')
'Vertical Coordinate' 941 log_info_cont(
'(1x,A)')
'|===============================================|' 942 log_info_cont(
'(1x,A)')
'| k z zh dz buffer k |' 943 log_info_cont(
'(1x,A)')
'| [m] [m] [m] factor |' 946 log_info_cont(
'(1x,A,F9.2,A,F9.2,I5,A)')
'| ',
atmos_grid_cartesc_fz(k),
' ',
atmos_grid_cartesc_fbfz(k),k,
' |' 947 log_info_cont(
'(1x,A,I5,F9.2,A,2F9.2,A)')
'|',k,
atmos_grid_cartesc_cz(k),
' ',
atmos_grid_cartesc_cdz(k),
atmos_grid_cartesc_cbfz(k),
' |' 951 log_info_cont(
'(1x,A,F9.2,A,F9.2,I5,A)')
'| ',
atmos_grid_cartesc_fz(k),
' ',
atmos_grid_cartesc_fbfz(k),k,
' | KE = TOA' 952 log_info_cont(
'(1x,A,I5,F9.2,A,2F9.2,A)')
'|',k,
atmos_grid_cartesc_cz(k),
' ',
atmos_grid_cartesc_cdz(k),
atmos_grid_cartesc_cbfz(k),
' |' 955 log_info_cont(
'(1x,A,F9.2,A,F9.2,I5,A)')
'| ',
atmos_grid_cartesc_fz(k),
' ',
atmos_grid_cartesc_fbfz(k),k,
' |' 956 log_info_cont(
'(1x,A,I5,F9.2,A,2F9.2,A)')
'|',k,
atmos_grid_cartesc_cz(k),
' ',
atmos_grid_cartesc_cdz(k),
atmos_grid_cartesc_cbfz(k),
' |' 960 log_info_cont(
'(1x,A,F9.2,A,F9.2,I5,A)')
'| ',
atmos_grid_cartesc_fz(k),
' ',
atmos_grid_cartesc_fbfz(k),k,
' | KS-1 = surface' 961 log_info_cont(
'(1x,A,I5,F9.2,A,2F9.2,A)')
'|',k,
atmos_grid_cartesc_cz(k),
' ',
atmos_grid_cartesc_cdz(k),
atmos_grid_cartesc_cbfz(k),
' |' 964 log_info_cont(
'(1x,A,F9.2,A,F9.2,I5,A)')
'| ',
atmos_grid_cartesc_fz(k),
' ',
atmos_grid_cartesc_fbfz(k),k,
' |' 965 log_info_cont(
'(1x,A,I5,F9.2,A,2F9.2,A)')
'|',k,
atmos_grid_cartesc_cz(k),
' ',
atmos_grid_cartesc_cdz(k),
atmos_grid_cartesc_cbfz(k),
' |' 969 log_info_cont(
'(1x,A,F9.2,A,F9.2,I5,A)')
'| ',
atmos_grid_cartesc_fz(k),
' ',
atmos_grid_cartesc_fbfz(k),k,
' |' 971 log_info_cont(
'(1x,A)')
'|===============================================|' real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdy
y-length of control volume [m]
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_lfz
face coordinate [m]: z, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cxg
center coordinate [m]: x, global
integer, public jmax
of computational cells: y, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdx
x-length of control volume [m]
integer, public ihalo
of halo cells: x
subroutine atmos_grid_cartesc_output_info
Output information.
integer, public imax
of computational cells: x, local
integer, public jhalo
of halo cells: y
integer, public ia
of whole cells: x, local, with HALO
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cyg
center coordinate [m]: y, global
logical, public file_aggregate
integer, public iag
of computational grids
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfxg
center buffer factor (0-1): x, global
subroutine, public atmos_grid_cartesc_allocate
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfz
center buffer factor (0-1): z
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fxg
face coordinate [m]: x, global
integer, public ja
of whole cells: y, local, with HALO
integer, public io_fid_conf
Config file ID.
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdz
z-length of grid(i+1) to grid(i) [m]
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fz
face coordinate [m]: z, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfyg
face buffer factor (0-1): y, global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdy
y-length of grid(j+1) to grid(j) [m]
subroutine, public file_open(basename, fid, mode, single, aggregate, rankid, postfix)
integer, public jmaxg
of computational cells: y, global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rcdy
reciprocal of center-dy
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cy
center coordinate [m]: y, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rfdz
reciprocal of face-dz
integer, public is
start point of inner domain: x, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdyg
center coordinate [m]: y, global
integer, public ie
end point of inner domain: x, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rcdz
reciprocal of center-dz
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfxg
face buffer factor (0-1): x, global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdx
x-length of grid(i+1) to grid(i) [m]
module atmosphere / grid / cartesC index
integer, public ke
end point of inner domain: z, local
integer, public je
end point of inner domain: y, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdz
z-length of control volume [m]
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cx
center coordinate [m]: x, local
subroutine, public atmos_grid_cartesc_setup(basename, aggregate)
Setup.
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdxg
center coordinate [m]: x, global
module atmosphere / grid / cartesC
integer, public ks
start point of inner domain: z, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfx
center buffer factor (0-1): x
integer, public prc_myrank
process num in local communicator
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdyg
center coordinate [m]: y, global
integer, dimension(:,:), allocatable, public prc_2drank
node index in 2D topology
integer, public kmax
of computational cells: z, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdxg
center coordinate [m]: x, global
subroutine, public prc_abort
Abort Process.
integer, public jag
of computational grids
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fy
face coordinate [m]: y, local
integer, public js
start point of inner domain: y, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfx
face buffer factor (0-1): x
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_lcdz
z-length of control volume [m]
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfy
center buffer factor (0-1): y
integer, public prc_num_y
y length of 2D processor topology
integer, public imaxg
of computational cells: x, global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfyg
center buffer factor (0-1): y, global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfz
face buffer factor (0-1): z
character(len=7), parameter, public atmos_grid_cartesc_name
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfy
face buffer factor (0-1): y
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rcdx
reciprocal of center-dx
integer, public ka
of whole cells: z, local, with HALO
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fx
face coordinate [m]: x, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fyg
face coordinate [m]: y, global
real(rp), public atmos_grid_cartesc_domain_center_x
center position of global domain [m]: x
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rfdy
reciprocal of face-dy
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_lcz
center coordinate [m]: z, local land
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cz
center coordinate [m]: z, local
real(rp), public atmos_grid_cartesc_domain_center_y
center position of global domain [m]: y
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rfdx
reciprocal of face-dx
subroutine, public atmos_grid_cartesc_generate(DZ, DX, DY, FZ, FZ_MAX, OFFSET_X, OFFSET_Y, BUFFER_DZ, BUFFER_DX, BUFFER_DY, BUFFER_NZ, BUFFER_NX, BUFFER_NY, BUFFFACT, BUFFFACT_Z, BUFFFACT_X, BUFFFACT_Y)
Generate horizontal&vertical grid.
integer, public prc_num_x
x length of 2D processor topology