57 integer,
public ::
i_xy = 1
58 integer,
public ::
i_uy = 2
59 integer,
public ::
i_xv = 3
60 integer,
public ::
i_uv = 4
70 private :: gtrans_mapfactor
71 private :: gtrans_terrainfollowing
72 private :: gtrans_thin_wall
73 private :: gtrans_step_mountain
74 private :: gtrans_write
80 character(len=H_LONG),
private :: gtrans_out_basename =
'' 81 character(len=H_MID),
private :: gtrans_out_title =
'SCALE-RM GEOMETRICS' 82 character(len=H_MID),
private :: gtrans_out_dtype =
'DEFAULT' 84 character(len=H_MID),
private :: gtrans_topo_type =
'TERRAINFOLLOWING' 85 integer,
private :: gtrans_thinwall_xdiv = 50
86 integer,
private :: gtrans_thinwall_ydiv = 50
87 logical,
private :: debug = .false.
97 namelist / param_gtrans / &
98 gtrans_out_basename, &
101 gtrans_thinwall_xdiv, &
102 gtrans_thinwall_ydiv, &
109 if(
io_l )
write(
io_fid_log,*)
'++++++ Module[GRIDTRANS] / Categ[ATMOS-RM GRID] / Origin[SCALElib]' 115 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 116 elseif( ierr > 0 )
then 117 write(*,*)
'xxx Not appropriate names in namelist PARAM_GTRANS. Check!' 143 call gtrans_mapfactor
149 select case(gtrans_topo_type)
150 case (
'TERRAINFOLLOWING')
151 if(
io_l )
write(
io_fid_log,*)
'=> Use terrain-following coordinate' 152 call gtrans_terrainfollowing
153 case (
'STEPMOUNTAIN')
155 call gtrans_thin_wall
156 call gtrans_step_mountain
159 call gtrans_thin_wall
161 write(*,*)
'xxx Not appropriate name for GTRANS_TOPO_TYPE : ', trim(gtrans_topo_type)
173 subroutine gtrans_mapfactor
193 end subroutine gtrans_mapfactor
215 subroutine gtrans_terrainfollowing
231 real(RP) :: REAL_CZ_U (
ka,
ia,
ja)
232 real(RP) :: REAL_CZ_V (
ka,
ia,
ja)
233 real(RP) :: REAL_CZ_UV(
ka,
ia,
ja)
234 real(RP) :: REAL_FZ_U (0:
ka,
ia,
ja)
235 real(RP) :: REAL_FZ_V (0:
ka,
ia,
ja)
236 real(RP) :: REAL_FZ_UV(0:
ka,
ia,
ja)
277 real_cz_uv(k,i,j) = 0.25_rp * (
real_cz(k,i+1,j+1) +
real_cz(k,i+1,j) &
286 real_fz_uv(k,i,j) = 0.25_rp * (
real_fz(k,i+1,j+1) +
real_fz(k,i+1,j) &
412 end subroutine gtrans_terrainfollowing
415 subroutine gtrans_thin_wall
432 real(RP) :: TOPO_ZsfcALL(2*
ia,2*
ja)
433 real(RP) :: TOPO_ZsfcXY (
ia,
ja)
434 real(RP) :: TOPO_ZsfcUY (
ia,
ja)
435 real(RP) :: TOPO_ZsfcXV (
ia,
ja)
436 real(RP) :: TOPO_ZsfcUV (
ia,
ja)
438 real(RP) :: GTRANS_QLIM (2*
ka,2*
ia,2*
ja,3)
439 real(RP) :: QDZ(2*
ka)
440 real(RP) :: QDX(2*
ia)
441 real(RP) :: QDY(2*
ja)
443 real(RP) :: XSLOPE, YSLOPE
445 real(RP) :: DX_piece, DY_piece
446 real(RP) :: DX, DY, DZ
448 integer :: I_QLIMtoLIM(3,7)
450 integer :: iii, jjj, n
451 integer :: k, i, j, kk, ii, jj
484 call comm_vars8( topo_zsfcxy(:,:), 1 )
485 call comm_vars8( topo_zsfcuy(:,:), 2 )
486 call comm_vars8( topo_zsfcxv(:,:), 3 )
487 call comm_vars8( topo_zsfcuv(:,:), 4 )
488 call comm_wait ( topo_zsfcxy(:,:), 1 )
489 call comm_wait ( topo_zsfcuy(:,:), 2 )
490 call comm_wait ( topo_zsfcxv(:,:), 3 )
491 call comm_wait ( topo_zsfcuv(:,:), 4 )
499 topo_zsfcall(ii ,jj ) = topo_zsfcxy(i,j)
500 topo_zsfcall(ii+1,jj ) = topo_zsfcuy(i,j)
501 topo_zsfcall(ii ,jj+1) = topo_zsfcxv(i,j)
502 topo_zsfcall(ii+1,jj+1) = topo_zsfcuv(i,j)
532 dx_piece = qdx(ii) /
real(gtrans_thinwall_xdiv,kind=
rp)
533 dy_piece = qdy(jj) /
real(gtrans_thinwall_ydiv,kind=
rp)
536 ztop = sum(qdz(
ks:kk))
539 yslope = ( topo_zsfcall(ii,jj+1) - topo_zsfcall(ii,jj) ) / qdy(jj)
541 do jjj = 1, gtrans_thinwall_ydiv
542 dy = (
real(jjj,kind=RP) - 0.5_rp ) * dy_piece
543 dz = ztop - topo_zsfcall(ii,jj) - yslope * dy
545 if ( dz > 0.0_rp )
then 546 if ( dz < qdz(kk) )
then 549 aqaf(
i_fyz) = aqaf(
i_fyz) + qdz(kk) * dy_piece
555 xslope = ( topo_zsfcall(ii+1,jj) - topo_zsfcall(ii,jj) ) / qdx(ii)
557 do iii = 1, gtrans_thinwall_xdiv
558 dx = (
real(iii,kind=RP) - 0.5_RP ) * dx_piece
559 dz = ztop - topo_zsfcall(ii,jj) + xslope * dx
561 if ( dz > 0.0_rp )
then 562 if ( dz < qdz(kk) )
then 565 aqaf(
i_fxz) = aqaf(
i_fxz) + qdz(kk) * dx_piece
571 do jjj = 1, gtrans_thinwall_ydiv
572 do iii = 1, gtrans_thinwall_xdiv
573 dx = (
real(iii,kind=RP) - 0.5_RP ) * dx_piece
574 dy = (
real(jjj,kind=RP) - 0.5_RP ) * dy_piece
575 dz = ztop - topo_zsfcall(ii,jj) - xslope * dx - yslope * dy
577 if ( dz > 0.0_rp )
then 578 aqaf(
i_fxy) = aqaf(
i_fxy) + dx_piece * dy_piece
583 gtrans_qlim(kk,ii,jj,
i_fyz) = aqaf(
i_fyz) / ( qdy(jj) * qdz(kk) )
584 gtrans_qlim(kk,ii,jj,
i_fxz) = aqaf(
i_fxz) / ( qdx(ii) * qdz(kk) )
585 gtrans_qlim(kk,ii,jj,
i_fxy) = aqaf(
i_fxy) / ( qdy(jj) * qdx(ii) )
591 i_qlimtolim(1:3,
i_xyz) = (/ 1, 1, 1 /)
592 i_qlimtolim(1:3,
i_xyw) = (/ 1, 1, 0 /)
593 i_qlimtolim(1:3,
i_uyw) = (/ 0, 1, 0 /)
594 i_qlimtolim(1:3,
i_xvw) = (/ 1, 0, 0 /)
595 i_qlimtolim(1:3,
i_uyz) = (/ 0, 1, 1 /)
596 i_qlimtolim(1:3,
i_xvz) = (/ 1, 0, 1 /)
597 i_qlimtolim(1:3,
i_uvz) = (/ 0, 0, 1 /)
603 ii = (i-1) * 2 + 1 - i_qlimtolim(1,n)
604 jj = (j-1) * 2 + 1 - i_qlimtolim(2,n)
605 kk = (k-1) * 2 + 1 - i_qlimtolim(3,n)
608 + gtrans_qlim(kk+1,ii,jj,
i_fyz) + gtrans_qlim(kk+1,ii ,jj+1,
i_fyz) )
610 + gtrans_qlim(kk+1,ii,jj,
i_fxz) + gtrans_qlim(kk+1,ii+1,jj ,
i_fxz) )
612 + gtrans_qlim(kk ,ii,jj,
i_fxy) + gtrans_qlim(kk ,ii+1,jj ,
i_fxy) )
615 write(*,*)
'xxx Facter miss! Check!' 670 end subroutine gtrans_thin_wall
673 subroutine gtrans_step_mountain
749 end subroutine gtrans_step_mountain
753 subroutine gtrans_write
759 if ( gtrans_out_basename /=
'' )
then 764 call fileio_write(
gtrans_mapf(:,:,1,
i_xy), gtrans_out_basename, gtrans_out_title, &
765 'MAPF_X_XY',
'Map factor x-dir at XY',
'NIL',
'XY', gtrans_out_dtype )
766 call fileio_write(
gtrans_mapf(:,:,2,
i_xy), gtrans_out_basename, gtrans_out_title, &
767 'MAPF_Y_XY',
'Map factor y-dir at XY',
'NIL',
'XY', gtrans_out_dtype )
768 call fileio_write(
gtrans_mapf(:,:,1,
i_uy), gtrans_out_basename, gtrans_out_title, &
769 'MAPF_X_UY',
'Map factor x-dir at UY',
'NIL',
'UY', gtrans_out_dtype )
770 call fileio_write(
gtrans_mapf(:,:,2,
i_uy), gtrans_out_basename, gtrans_out_title, &
771 'MAPF_Y_UY',
'Map factor y-dir at UY',
'NIL',
'UY', gtrans_out_dtype )
772 call fileio_write(
gtrans_mapf(:,:,1,
i_xv), gtrans_out_basename, gtrans_out_title, &
773 'MAPF_X_XV',
'Map factor x-dir at XV',
'NIL',
'XY', gtrans_out_dtype )
774 call fileio_write(
gtrans_mapf(:,:,2,
i_xv), gtrans_out_basename, gtrans_out_title, &
775 'MAPF_Y_XV',
'Map factor y-dir at XV',
'NIL',
'XY', gtrans_out_dtype )
776 call fileio_write(
gtrans_mapf(:,:,1,
i_uv), gtrans_out_basename, gtrans_out_title, &
777 'MAPF_X_UV',
'Map factor x-dir at UV',
'NIL',
'UY', gtrans_out_dtype )
778 call fileio_write(
gtrans_mapf(:,:,2,
i_uv), gtrans_out_basename, gtrans_out_title, &
779 'MAPF_Y_UV',
'Map factor y-dir at UV',
'NIL',
'UY', gtrans_out_dtype )
781 call fileio_write(
gtrans_rotc(:,:,1), gtrans_out_basename, gtrans_out_title, &
782 'ROTC_COS',
'Rotation factor (cos)',
'NIL',
'XY', gtrans_out_dtype )
783 call fileio_write(
gtrans_rotc(:,:,2), gtrans_out_basename, gtrans_out_title, &
784 'ROTC_SIN',
'Rotation factor (sin)',
'NIL',
'XY', gtrans_out_dtype )
786 call fileio_write(
gtrans_rotc(:,:,1), gtrans_out_basename, gtrans_out_title, &
787 'ROTC_COS',
'Rotation factor (cos)',
'NIL',
'XY', gtrans_out_dtype )
792 end subroutine gtrans_write
integer, public is
start point of inner domain: x, local
integer, public je
end point of inner domain: y, local
real(rp), dimension(:), allocatable, public grid_rcdy
reciprocal of center-dy
subroutine, public prc_mpistop
Abort MPI.
real(rp), dimension(:,:,:,:), allocatable, public gtrans_limxy
flux limiter x-y face
real(rp), dimension(:,:,:,:), allocatable, public gtrans_j23g
(2,3) element of Jacobian matrix * {G}^1/2
logical, public io_l
output log or not? (this process)
real(rp), dimension(:), allocatable, public grid_rcdx
reciprocal of center-dx
real(rp), dimension(:), allocatable, public grid_cz
center coordinate [m]: z, local=global
integer, public ke
end point of inner domain: z, local
real(rp), public gtrans_j33g
(3,3) element of Jacobian matrix * {G}^1/2
real(rp), dimension(:,:,:), allocatable, public real_fz
geopotential height [m] (cell face )
real(rp), dimension(:,:,:), allocatable, public real_cz
geopotential height [m] (cell center)
real(rp), dimension(:), allocatable, public grid_rfdy
reciprocal of face-dy
real(rp), dimension(:), allocatable, public grid_rcdz
reciprocal of center-dz
real(rp), dimension(:,:,:,:), allocatable, public gtrans_limyz
flux limiter y-z face
real(rp), dimension(:,:,:,:), allocatable, public gtrans_limxz
flux limiter x-z face
real(rp), dimension(:), allocatable, public grid_fx
face coordinate [m]: x, local
real(rp), dimension(:,:,:,:), allocatable, public gtrans_mapf
map factor
integer, public ia
of x whole cells (local, with HALO)
real(rp), dimension(:,:), allocatable, public real_latx
latitude at staggered point (uy) [rad,-pi,pi]
integer, public ka
of z whole cells (local, with HALO)
real(rp), dimension(:), allocatable, public grid_fz
face coordinate [m]: z, local=global
integer, public js
start point of inner domain: y, local
real(rp), dimension(:,:,:), allocatable, public gtrans_rotc
rotation coefficient
real(rp), dimension(:,:,:,:), allocatable, public gtrans_j13g
(1,3) element of Jacobian matrix * {G}^1/2
subroutine, public gtrans_setup
Setup.
subroutine, public mprj_mapfactor(lat, m1, m2)
(x,y) -> (lon,lat)
integer, public ks
start point of inner domain: z, local
real(rp), dimension(:), allocatable, public grid_cx
center coordinate [m]: x, local
integer, public ie
end point of inner domain: x, local
real(rp), dimension(:,:,:,:), allocatable, public gtrans_gsqrt
transformation metrics from Z to Xi, {G}^1/2
subroutine, public real_calc_areavol(MAPF)
Calc control area/volume.
logical, public io_lnml
output log or not? (for namelist, this process)
real(rp), dimension(:,:), allocatable, public real_lon
longitude [rad,0-2pi]
real(rp), dimension(:,:), allocatable, public topo_zsfc
absolute ground height [m]
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.
real(rp), dimension(:,:), allocatable, public real_lat
latitude [rad,-pi,pi]
integer, public io_fid_log
Log file ID.
integer, parameter, public rp
real(rp), dimension(:,:), allocatable, public real_latxy
latitude at staggered point (uv) [rad,-pi,pi]
real(rp), dimension(:), allocatable, public grid_cy
center coordinate [m]: y, local
subroutine gtrans_rotcoef
Calculate rotation coeffient.
real(rp), dimension(:,:), allocatable, public real_laty
latitude at staggered point (xv) [rad,-pi,pi]
integer, public ja
of y whole cells (local, with HALO)
real(rp), dimension(:), allocatable, public grid_fy
face coordinate [m]: y, local