Go to the documentation of this file.
114 character(len=*),
intent(in),
optional :: basename
115 logical,
intent(in),
optional :: aggregate
117 character(len=H_LONG) :: atmos_grid_cartesc_in_basename =
''
118 logical :: atmos_grid_cartesc_in_aggregate
120 real(
rp) :: offset_x = 0.0_rp
121 real(
rp) :: offset_y = 0.0_rp
123 real(
rp) :: buffer_dz = 0.0_rp
124 real(
rp) :: buffer_dx = 0.0_rp
125 real(
rp) :: buffer_dy = 0.0_rp
126 real(
rp) :: bufffact = 1.0_rp
127 real(
rp) :: bufffact_z = -1.0_rp
128 real(
rp) :: bufffact_x = -1.0_rp
129 real(
rp) :: bufffact_y = -1.0_rp
131 integer :: buffer_nz = -1
132 integer :: buffer_nx = -1
133 integer :: buffer_ny = -1
135 integer,
parameter :: fz_max = 300
136 real(
rp) :: fz(fz_max)
138 namelist / param_atmos_grid_cartesc / &
139 atmos_grid_cartesc_in_basename, &
140 atmos_grid_cartesc_in_aggregate, &
162 log_info(
"ATMOS_GRID_CARTESC_setup",*)
'Setup'
165 log_info(
"ATMOS_GRID_CARTESC_setup",*)
'Skip because KMAX < 1'
171 if (
present(basename) ) atmos_grid_cartesc_in_basename = basename
172 if (
present(aggregate) )
then
173 atmos_grid_cartesc_in_aggregate = aggregate
180 read(
io_fid_conf,nml=param_atmos_grid_cartesc,iostat=ierr)
182 log_info(
"ATMOS_GRID_CARTESC_setup",*)
'Not found namelist. Default used.'
183 elseif( ierr > 0 )
then
184 log_error(
"ATMOS_GRID_CARTESC_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_GRID_CARTESC. Check!'
187 log_nml(param_atmos_grid_cartesc)
192 if ( atmos_grid_cartesc_in_basename /=
'' )
then
194 call atmos_grid_cartesc_read( atmos_grid_cartesc_in_basename, atmos_grid_cartesc_in_aggregate )
199 dz,
dx,
dy, fz(:), fz_max, &
200 offset_x, offset_y, &
201 buffer_dz, buffer_dx, buffer_dy, &
202 buffer_nz, buffer_nx, buffer_ny, &
204 bufffact_z, bufffact_x, bufffact_y )
337 subroutine atmos_grid_cartesc_read( &
338 basename, aggregate )
346 character(len=*),
intent(in) :: basename
347 logical,
intent(in),
optional :: aggregate
351 real(
rp) :: fdxg(0:
iag), fdyg(0:
jag)
352 real(
rp) :: fdx(0:
ia), fdy(0:
ja)
374 call file_read( fid,
'FDX', fdx(:) )
375 call file_read( fid,
'FDY', fdy(:) )
404 call file_read( fid,
'FDXG', fdxg(:) )
405 call file_read( fid,
'FDYG', fdyg(:) )
416 end subroutine atmos_grid_cartesc_read
421 DZ, DX, DY, FZ, FZ_MAX, &
422 OFFSET_X, OFFSET_Y, &
423 BUFFER_DZ, BUFFER_DX, BUFFER_DY, &
424 BUFFER_NZ, BUFFER_NX, BUFFER_NY, &
426 BUFFFACT_Z, BUFFFACT_X, BUFFFACT_Y )
436 real(
rp),
intent(in),
optional :: fz(:)
437 integer,
intent(in),
optional :: fz_max
438 real(
rp),
intent(in),
optional :: offset_x, offset_y
439 real(
rp),
intent(in),
optional :: buffer_dz, buffer_dx, buffer_dy
440 integer,
intent(in),
optional :: buffer_nz, buffer_nx, buffer_ny
441 real(
rp),
intent(in),
optional :: bufffact
442 real(
rp),
intent(in),
optional :: bufffact_z, bufffact_x, bufffact_y
444 real(
rp),
allocatable :: buffz(:), buffx(:), buffy(:)
445 real(
rp) :: bufftotz, bufftotx, bufftoty
448 integer :: kbuff, ibuff, jbuff
449 integer :: kmain, imain, jmain
453 logical :: use_user_input
455 integer ::
k, i, j, ii, jj
460 allocate( buffx(0:
iag) )
461 allocate( buffy(0:
jag) )
468 if (
present(bufffact_x) ) fact = bufffact_x
469 if ( fact < 0.0_rp .and.
present(bufffact) ) fact = bufffact
470 if ( fact < 0.0_rp ) fact = 1.0_rp
475 if (
present(buffer_nx) ) ibuff = buffer_nx
476 if ( ibuff > 0 )
then
477 if ( 2*ibuff >
imaxg )
then
478 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer grid size (', ibuff, &
479 'x2) must be smaller than global domain size (X). Use smaller BUFFER_NX!'
484 buffx(i) = buffx(i-1) * fact
485 bufftotx = bufftotx + buffx(i)
487 imain =
imaxg - 2*ibuff
488 else if (
present(buffer_dz) )
then
490 if( bufftotx >= buffer_dx )
exit
491 buffx(i) = buffx(i-1) * fact
492 bufftotx = bufftotx + buffx(i)
495 imain =
imaxg - 2*ibuff
497 if ( imain < 0 )
then
498 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer length (', bufftotx, &
499 'x2[m]) must be smaller than global domain size (X). Use smaller BUFFER_DX!'
508 if (
present(offset_x) )
then
513 do i =
ihalo-1, 0, -1
521 if ( ibuff > 0 )
then
533 if ( ibuff > 0 )
then
534 do i =
ihalo+ibuff+imain+1,
ihalo+ibuff+imain+ibuff
564 if ( ibuff > 0 )
then
570 do i =
ihalo+ibuff+imain+1,
ihalo+ibuff+imain+ibuff
589 if (
present(bufffact_y) ) fact = bufffact_y
590 if ( fact < 0.0_rp .and.
present(bufffact) )fact = bufffact
591 if ( fact < 0.0_rp ) fact = 1.0_rp
596 if (
present(buffer_ny) ) jbuff = buffer_ny
597 if ( jbuff > 0 )
then
598 if ( 2*jbuff >
jmaxg )
then
599 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer grid size (', jbuff, &
600 'x2) must be smaller than global domain size (Y). Use smaller BUFFER_NY!'
605 buffy(j) = buffy(j-1) * fact
606 bufftoty = bufftoty + buffy(j)
608 jmain =
jmaxg - 2*jbuff
609 else if (
present(buffer_dy) )
then
611 if( bufftoty >= buffer_dy )
exit
612 buffy(j) = buffy(j-1) * fact
613 bufftoty = bufftoty + buffy(j)
616 jmain =
jmaxg - 2*jbuff
618 if ( jmain < 0 )
then
619 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer length (', bufftoty, &
620 'x2[m]) must be smaller than global domain size (Y). Use smaller BUFFER_DY!'
629 if (
present(offset_y) )
then
634 do j =
jhalo-1, 0, -1
642 if ( jbuff > 0 )
then
654 if ( jbuff > 0 )
then
655 do j =
jhalo+jbuff+jmain+1,
jhalo+jbuff+jmain+jbuff
685 if ( jbuff > 0 )
then
691 do j =
jhalo+jbuff+jmain+1,
jhalo+jbuff+jmain+jbuff
710 allocate( buffz(0:
ka) )
712 use_user_input = .false.
713 if (
present(fz) )
then
714 if ( maxval(fz(:)) > 0.0_rp )
then
715 log_info(
"ATMOS_GRID_CARTESC_generate",*)
'Z coordinate is given from NAMELIST.'
718 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'KMAX must be larger than 1. Check!',
kmax
722 if (
kmax > fz_max )
then
723 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'KMAX must be smaller than ', fz_max,
'. Check!',
kmax
727 if ( minval(fz(1:
kmax)) <= 0.0_rp )
then
728 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'FZ must be positive. Check! minval(FZ(1:KMAX))=', minval(fz(1:
kmax))
732 use_user_input = .true.
736 if ( use_user_input )
then
742 if (
present(buffer_nz) ) kbuff = buffer_nz
743 if ( kbuff > 0 )
then
744 if ( kbuff >
kmax )
then
745 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer grid size (', kbuff, &
746 ') must be smaller than global domain size (Z). Use smaller BUFFER_NZ!'
752 bufftotz = bufftotz + ( fz(
k) - fz(
k-1) )
755 else if (
present(buffer_dz) )
then
756 if ( buffer_dz > fz(
kmax) )
then
757 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer length (', buffer_dz, &
758 '[m]) must be smaller than global domain size (Z). Use smaller BUFFER_DZ!'
764 if( bufftotz >= buffer_dz )
exit
765 bufftotz = bufftotz + ( fz(
k) - fz(
k-1) )
802 if (
present(bufffact_z) ) fact = bufffact_z
803 if ( fact < 0.0_rp .and.
present(bufffact) ) fact = bufffact
804 if ( fact < 0.0_rp ) fact = 1.0_rp
809 if (
present(buffer_nz) ) kbuff = buffer_nz
810 if ( kbuff > 0 )
then
811 if ( kbuff >
kmax )
then
812 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer grid size (', kbuff, &
813 ') must be smaller than global domain size (Z). Use smaller BUFFER_NZ!'
818 buffz(
k) = buffz(
k-1) * fact
819 bufftotz = bufftotz + buffz(
k)
822 else if (
present(buffer_dz) )
then
824 if( bufftotz >= buffer_dz )
exit
825 buffz(
k) = buffz(
k-1) * fact
826 bufftotz = bufftotz + buffz(
k)
831 if ( kmain < 0 )
then
832 log_error(
"ATMOS_GRID_CARTESC_generate",*)
'Buffer length (', bufftotz, &
833 '[m]) must be smaller than global domain size (Z). Use smaller BUFFER_DZ!'
851 do k =
ks,
ks+kmain-1
856 if ( kbuff > 0 )
then
874 if ( kbuff > 0 )
then
962 log_info(
"ATMOS_GRID_CARTESC_generate",*)
'Grid information '
963 log_info_cont(
'(1x,A,3(1x,F9.3))')
'delta Z, X, Y [m] :',
dz,
dx,
dy
966 log_info(
"ATMOS_GRID_CARTESC_generate",*)
'Main/buffer Grid (global) :'
967 log_info_cont(
'(1x,2(A,I6))')
'Z: buffer = ', kbuff,
' x 1, main = ',kmain
968 log_info_cont(
'(1x,2(A,I6))')
'X: buffer = ', ibuff,
' x 2, main = ',imain
969 log_info_cont(
'(1x,2(A,I6))')
'Y: buffer = ', jbuff,
' x 2, main = ',jmain
972 log_info(
"ATMOS_GRID_CARTESC_generate",*)
'Domain size [km] (global) :'
973 log_info_cont(
'(1x,7(A,F9.3))')
'Z:', &
981 log_info_cont(
'(1x,8(A,F9.3))')
'X:', &
990 log_info_cont(
'(1x,8(A,F9.3))')
'Y:', &
1011 log_info(
"ATMOS_GRID_CARTESC_output_info",*)
'Center Position of Grid (global) :'
1017 log_info(
"ATMOS_GRID_CARTESC_output_info",*)
'Domain size [km] (local) :'
1018 log_info_cont(
'(1x,6(A,F9.3))')
'X:', &
1022 log_info_cont(
'(1x,6(A,F9.3))')
'Y:', &
1029 log_info(
"ATMOS_GRID_CARTESC_output_info",
'(1x,A)')
'Vertical Coordinate'
1030 log_info_cont(
'(1x,A)')
'|===============================================|'
1031 log_info_cont(
'(1x,A)')
'| k z zh dz buffer k |'
1032 log_info_cont(
'(1x,A)')
'| [m] [m] [m] factor |'
1035 log_info_cont(
'(1x,A,F9.2,A,F9.2,I5,A)')
'| ',
atmos_grid_cartesc_fz(k),
' ',
atmos_grid_cartesc_fbfz(k),k,
' |'
1036 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),
' |'
1040 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'
1041 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),
' |'
1044 log_info_cont(
'(1x,A,F9.2,A,F9.2,I5,A)')
'| ',
atmos_grid_cartesc_fz(k),
' ',
atmos_grid_cartesc_fbfz(k),k,
' |'
1045 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),
' |'
1049 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'
1050 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),
' |'
1053 log_info_cont(
'(1x,A,F9.2,A,F9.2,I5,A)')
'| ',
atmos_grid_cartesc_fz(k),
' ',
atmos_grid_cartesc_fbfz(k),k,
' |'
1054 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),
' |'
1058 log_info_cont(
'(1x,A,F9.2,A,F9.2,I5,A)')
'| ',
atmos_grid_cartesc_fz(k),
' ',
atmos_grid_cartesc_fbfz(k),k,
' |'
1060 log_info_cont(
'(1x,A)')
'|===============================================|'
integer, public ke
end point of inner domain: z, local
subroutine, public prc_abort
Abort Process.
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdz
z-length of control volume [m]
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.
subroutine, public file_open(basename, fid, mode, single, allnodes, aggregate, rankid, postfix)
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rfdx
reciprocal of face-dx
subroutine, public atmos_grid_cartesc_setup(basename, aggregate)
Setup.
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rcdx
reciprocal of center-dx
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdyg
center coordinate [m]: y, global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_lcz
center coordinate [m]: z, local land
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fyg
face coordinate [m]: y, global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdy
y-length of control volume [m]
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fx
face coordinate [m]: x, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdyg
center coordinate [m]: y, global
integer, public prc_myrank
process num in local communicator
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdy
y-length of grid(j+1) to grid(j) [m]
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfx
face buffer factor (0-1): x
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rcdz
reciprocal of center-dz
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdxg
center coordinate [m]: x, global
real(rp), public atmos_grid_cartesc_domain_center_y
center position of global domain [m]: y
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfx
center buffer factor (0-1): x
integer, parameter, public rp
integer, public ie
end point of inner domain: x, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfxg
face buffer factor (0-1): x, global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rcdy
reciprocal of center-dy
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfz
center buffer factor (0-1): z
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cxg
center coordinate [m]: x, global
real(rp), public atmos_grid_cartesc_domain_center_x
center position of global domain [m]: x
module atmosphere / grid / cartesC index
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfy
face buffer factor (0-1): y
integer, dimension(:,:), allocatable, public prc_2drank
node index in 2D topology
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fy
face coordinate [m]: y, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfz
face buffer factor (0-1): z
subroutine atmos_grid_cartesc_output_info
Output information.
integer, public is
start point of inner domain: x, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfxg
center 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]
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_lfz
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_fxg
face coordinate [m]: x, global
integer, public ks
start point of inner domain: z, local
logical, public file_aggregate
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fz
face coordinate [m]: z, local
character(len=7), parameter, public atmos_grid_cartesc_name
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cyg
center coordinate [m]: y, global
integer, public js
start point of inner domain: y, local
integer, public prc_num_y
y length of 2D processor topology
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cy
center coordinate [m]: y, local
subroutine, public atmos_grid_cartesc_finalize
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rfdz
reciprocal of face-dz
subroutine, public atmos_grid_cartesc_allocate
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_x
x length of 2D processor topology
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdx
x-length of control volume [m]
module atmosphere / grid / cartesC
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_cz
center coordinate [m]: z, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfyg
center buffer factor (0-1): y, global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rfdy
reciprocal of face-dy
integer, public io_fid_conf
Config file ID.
integer, public je
end point of inner domain: y, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cx
center coordinate [m]: x, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdxg
center coordinate [m]: x, global