50 private :: atmos_grid_cartesc_metric_mapfactor
51 private :: atmos_grid_cartesc_metric_terrainfollowing
52 private :: atmos_grid_cartesc_metric_thin_wall
53 private :: atmos_grid_cartesc_metric_step_mountain
54 private :: atmos_grid_cartesc_metric_write
60 character(len=H_LONG),
private :: atmos_grid_cartesc_metric_out_basename =
'' 61 character(len=H_MID),
private :: atmos_grid_cartesc_metric_out_title =
'SCALE-RM GEOMETRICS' 62 character(len=H_SHORT),
private :: atmos_grid_cartesc_metric_out_dtype =
'DEFAULT' 64 character(len=H_SHORT),
private :: atmos_grid_cartesc_metric_topo_type =
'TERRAINFOLLOWING' 65 integer,
private :: atmos_grid_cartesc_metric_thinwall_xdiv = 50
66 integer,
private :: atmos_grid_cartesc_metric_thinwall_ydiv = 50
76 namelist / param_atmos_grid_cartesc_metric / &
77 atmos_grid_cartesc_metric_out_basename, &
78 atmos_grid_cartesc_metric_out_dtype, &
79 atmos_grid_cartesc_metric_topo_type, &
80 atmos_grid_cartesc_metric_thinwall_xdiv, &
81 atmos_grid_cartesc_metric_thinwall_ydiv
87 log_info(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Setup' 91 read(
io_fid_conf,nml=param_atmos_grid_cartesc_metric,iostat=ierr)
93 log_info(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Not found namelist. Default used.' 94 elseif( ierr > 0 )
then 95 log_error(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_GRID_CARTESC_METRIC. Check!' 98 log_nml(param_atmos_grid_cartesc_metric)
121 call atmos_grid_cartesc_metric_mapfactor
128 log_info(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Terrain coordinate type : ', trim(atmos_grid_cartesc_metric_topo_type)
129 select case(atmos_grid_cartesc_metric_topo_type)
130 case(
'TERRAINFOLLOWING')
131 log_info_cont(*)
'=> Terrain-following method' 132 call atmos_grid_cartesc_metric_terrainfollowing
134 log_info_cont(*)
'=> Step-mountain method' 135 call atmos_grid_cartesc_metric_thin_wall
136 call atmos_grid_cartesc_metric_step_mountain
138 log_info_cont(*)
'=> Thin-wall approximation method' 139 call atmos_grid_cartesc_metric_thin_wall
141 log_error(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Unsupported ATMOS_GRID_CARTESC_METRIC_TOPO_type. STOP' 146 call atmos_grid_cartesc_metric_write
153 subroutine atmos_grid_cartesc_metric_mapfactor
177 end subroutine atmos_grid_cartesc_metric_mapfactor
200 subroutine atmos_grid_cartesc_metric_terrainfollowing
345 end subroutine atmos_grid_cartesc_metric_terrainfollowing
348 subroutine atmos_grid_cartesc_metric_thin_wall
365 real(RP) :: TOPO_ZsfcALL(2*
ia,2*
ja)
366 real(RP) :: TOPO_ZsfcXY (
ia,
ja)
367 real(RP) :: TOPO_ZsfcUY (
ia,
ja)
368 real(RP) :: TOPO_ZsfcXV (
ia,
ja)
369 real(RP) :: TOPO_ZsfcUV (
ia,
ja)
371 real(RP) :: ATMOS_GRID_CARTESC_METRIC_QLIM (2*
ka,2*
ia,2*
ja,3)
372 real(RP) :: QDZ(2*
ka)
373 real(RP) :: QDX(2*
ia)
374 real(RP) :: QDY(2*
ja)
376 real(RP) :: XSLOPE, YSLOPE
378 real(RP) :: DX_piece, DY_piece
379 real(RP) :: DX, DY, DZ
381 integer :: I_QLIMtoLIM(3,7)
383 integer :: iii, jjj, n
384 integer :: k, i, j, kk, ii, jj
417 call comm_vars8( topo_zsfcxy(:,:), 1 )
418 call comm_vars8( topo_zsfcuy(:,:), 2 )
419 call comm_vars8( topo_zsfcxv(:,:), 3 )
420 call comm_vars8( topo_zsfcuv(:,:), 4 )
421 call comm_wait ( topo_zsfcxy(:,:), 1 )
422 call comm_wait ( topo_zsfcuy(:,:), 2 )
423 call comm_wait ( topo_zsfcxv(:,:), 3 )
424 call comm_wait ( topo_zsfcuv(:,:), 4 )
432 topo_zsfcall(ii ,jj ) = topo_zsfcxy(i,j)
433 topo_zsfcall(ii+1,jj ) = topo_zsfcuy(i,j)
434 topo_zsfcall(ii ,jj+1) = topo_zsfcxv(i,j)
435 topo_zsfcall(ii+1,jj+1) = topo_zsfcuv(i,j)
465 dx_piece = qdx(ii) /
real(atmos_grid_cartesc_metric_thinwall_xdiv,kind=
rp)
466 dy_piece = qdy(jj) /
real(atmos_grid_cartesc_metric_thinwall_ydiv,kind=
rp)
469 ztop = sum(qdz(
ks:kk))
472 yslope = ( topo_zsfcall(ii,jj+1) - topo_zsfcall(ii,jj) ) / qdy(jj)
474 do jjj = 1, atmos_grid_cartesc_metric_thinwall_ydiv
475 dy = (
real(jjj,kind=RP) - 0.5_rp ) * dy_piece
476 dz = ztop - topo_zsfcall(ii,jj) - yslope * dy
478 if ( dz > 0.0_rp )
then 479 if ( dz < qdz(kk) )
then 482 aqaf(
i_fyz) = aqaf(
i_fyz) + qdz(kk) * dy_piece
488 xslope = ( topo_zsfcall(ii+1,jj) - topo_zsfcall(ii,jj) ) / qdx(ii)
490 do iii = 1, atmos_grid_cartesc_metric_thinwall_xdiv
491 dx = (
real(iii,kind=RP) - 0.5_RP ) * dx_piece
492 dz = ztop - topo_zsfcall(ii,jj) + xslope * dx
494 if ( dz > 0.0_rp )
then 495 if ( dz < qdz(kk) )
then 498 aqaf(
i_fxz) = aqaf(
i_fxz) + qdz(kk) * dx_piece
504 do jjj = 1, atmos_grid_cartesc_metric_thinwall_ydiv
505 do iii = 1, atmos_grid_cartesc_metric_thinwall_xdiv
506 dx = (
real(iii,kind=RP) - 0.5_RP ) * dx_piece
507 dy = (
real(jjj,kind=RP) - 0.5_RP ) * dy_piece
508 dz = ztop - topo_zsfcall(ii,jj) - xslope * dx - yslope * dy
510 if ( dz > 0.0_rp )
then 511 aqaf(
i_fxy) = aqaf(
i_fxy) + dx_piece * dy_piece
516 atmos_grid_cartesc_metric_qlim(kk,ii,jj,
i_fyz) = aqaf(
i_fyz) / ( qdy(jj) * qdz(kk) )
517 atmos_grid_cartesc_metric_qlim(kk,ii,jj,
i_fxz) = aqaf(
i_fxz) / ( qdx(ii) * qdz(kk) )
518 atmos_grid_cartesc_metric_qlim(kk,ii,jj,
i_fxy) = aqaf(
i_fxy) / ( qdy(jj) * qdx(ii) )
524 i_qlimtolim(1:3,
i_xyz) = (/ 1, 1, 1 /)
525 i_qlimtolim(1:3,
i_xyw) = (/ 1, 1, 0 /)
526 i_qlimtolim(1:3,
i_uyw) = (/ 0, 1, 0 /)
527 i_qlimtolim(1:3,
i_xvw) = (/ 1, 0, 0 /)
528 i_qlimtolim(1:3,
i_uyz) = (/ 0, 1, 1 /)
529 i_qlimtolim(1:3,
i_xvz) = (/ 1, 0, 1 /)
530 i_qlimtolim(1:3,
i_uvz) = (/ 0, 0, 1 /)
536 ii = (i-1) * 2 + 1 - i_qlimtolim(1,n)
537 jj = (j-1) * 2 + 1 - i_qlimtolim(2,n)
538 kk = (k-1) * 2 + 1 - i_qlimtolim(3,n)
541 + atmos_grid_cartesc_metric_qlim(kk+1,ii,jj,
i_fyz) + atmos_grid_cartesc_metric_qlim(kk+1,ii ,jj+1,
i_fyz) )
543 + atmos_grid_cartesc_metric_qlim(kk+1,ii,jj,
i_fxz) + atmos_grid_cartesc_metric_qlim(kk+1,ii+1,jj ,
i_fxz) )
545 + atmos_grid_cartesc_metric_qlim(kk ,ii,jj,
i_fxy) + atmos_grid_cartesc_metric_qlim(kk ,ii+1,jj ,
i_fxy) )
548 log_error(
"ATMOS_GRID_CARTESC_METRIC_thin_wall",*)
'Facter miss! Check!' 603 end subroutine atmos_grid_cartesc_metric_thin_wall
606 subroutine atmos_grid_cartesc_metric_step_mountain
682 end subroutine atmos_grid_cartesc_metric_step_mountain
686 subroutine atmos_grid_cartesc_metric_write
699 mapprojection_lonlat2xy
702 real(RP) :: check_X_XY(
ia,
ja)
703 real(RP) :: check_Y_XY(
ia,
ja)
704 real(RP) :: distance (
ia,
ja)
709 if ( atmos_grid_cartesc_metric_out_basename /=
'' )
then 712 log_info(
"ATMOS_GRID_CARTESC_METRIC_write",*)
'Output metrics file ' 715 'MAPF_X_XY',
'Map factor x-dir at XY',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
717 'MAPF_Y_XY',
'Map factor y-dir at XY',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
719 'MAPF_X_UY',
'Map factor x-dir at UY',
'NIL',
'UY', atmos_grid_cartesc_metric_out_dtype )
721 'MAPF_Y_UY',
'Map factor y-dir at UY',
'NIL',
'UY', atmos_grid_cartesc_metric_out_dtype )
723 'MAPF_X_XV',
'Map factor x-dir at XV',
'NIL',
'XV', atmos_grid_cartesc_metric_out_dtype )
725 'MAPF_Y_XV',
'Map factor y-dir at XV',
'NIL',
'XV', atmos_grid_cartesc_metric_out_dtype )
727 'MAPF_X_UV',
'Map factor x-dir at UV',
'NIL',
'UV', atmos_grid_cartesc_metric_out_dtype )
729 'MAPF_Y_UV',
'Map factor y-dir at UV',
'NIL',
'UV', atmos_grid_cartesc_metric_out_dtype )
732 'ROTC_COS',
'Rotation factor (cos)',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
734 'ROTC_SIN',
'Rotation factor (sin)',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
737 'ROTC_COS',
'Rotation factor (cos)',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
745 call file_cartesc_write( check_x_xy(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, &
746 'X_XY',
'x at XY for check',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
747 call file_cartesc_write( check_y_xy(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, &
748 'Y_XY',
'y at XY for check',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
761 call file_cartesc_write( distance(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, &
762 'distance',
'distance from basepoint',
'm',
'XY', atmos_grid_cartesc_metric_out_dtype )
767 end subroutine atmos_grid_cartesc_metric_write
real(rp), dimension(:,:,:,:), allocatable, public atmos_grid_cartesc_metric_gsqrt
transformation metrics from Z to Xi, {G}^1/2
real(rp), public atmos_grid_cartesc_real_basepoint_lon
position of base point in real world [rad,0-2pi]
integer, public ia
of whole cells: x, local, with HALO
subroutine, public mapprojection_rotcoef(IA, IS, IE, JA, JS, JE, lon, lat, rotc)
u(lat,lon) = cos u(x,y) - sin v(x,y) v(lat,lon) = sin u(x,y) + cos v(x,y)
module Atmosphere Grid CartesianC metirc
subroutine, public atmos_grid_cartesc_metric_setup
Setup.
real(rp), dimension(:,:,:,:), allocatable, public atmos_grid_cartesc_metric_limxz
flux limiter x-z face
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lat
latitude [rad,-pi,pi]
real(rp), public const_radius
radius of the planet [m]
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_fzuy
geopotential height [m] (wuy)
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_fzuv
geopotential height [m] (wuv)
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_fz
geopotential height [m] (wxy)
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_fz
face coordinate [m]: z, local
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lon
longitude [rad,0-2pi]
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_czxv
geopotential height [m] (zxv)
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_real_czuy
geopotential height [m] (zuy)
integer, public ie
end point of inner domain: x, local
real(rp), public atmos_grid_cartesc_metric_j33g
(3,3) element of Jacobian matrix * {G}^1/2
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rcdz
reciprocal of center-dz
subroutine, public vectr_distance(r, lon1, lat1, lon2, lat2, dist)
Get horizontal distance on the sphere.
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_latuy
latitude at staggered point (uy) [rad,-pi,pi]
module atmosphere / grid / cartesC index
integer, public ke
end point of inner domain: z, local
real(rp), dimension(:,:,:,:), allocatable, public atmos_grid_cartesc_metric_limxy
flux limiter x-y face
real(rp), public atmos_grid_cartesc_real_basepoint_lat
position of base point in real world [rad,-pi,pi]
integer, public je
end point of inner domain: y, local
subroutine atmos_grid_cartesc_metric_rotcoef
Calculate rotation coeffient.
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cx
center coordinate [m]: x, local
module atmosphere / grid / cartesC
integer, public ks
start point of inner domain: z, local
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_metric_rotc
rotation coefficient
real(rp), dimension(:,:,:,:), allocatable, public atmos_grid_cartesc_metric_limyz
flux limiter y-z face
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_czuv
geopotential height [m] (zuv)
subroutine, public prc_abort
Abort Process.
subroutine, public mapprojection_mapfactor(IA, IS, IE, JA, JS, JE, lat, m1, m2)
(x,y) -> (lon,lat)
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_metric_mapf
map factor
real(rp), dimension(:,:,:,:), allocatable, public atmos_grid_cartesc_metric_j23g
(2,3) element of Jacobian matrix * {G}^1/2
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_cz
geopotential height [m] (zxy)
real(rp), dimension(:,:,:,:), allocatable, public atmos_grid_cartesc_metric_j13g
(1,3) element of Jacobian matrix * {G}^1/2
module Atmosphere GRID CartesC Real(real space)
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rcdx
reciprocal of center-dx
real(rp), dimension(:,:), allocatable, public topo_zsfc
absolute ground height [m]
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fx
face coordinate [m]: x, local
integer, public ka
of whole cells: z, local, with HALO
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_fzxv
geopotential height [m] (wxv)
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_latuv
latitude at staggered point (uv) [rad,-pi,pi]
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_latxv
latitude at staggered point (xv) [rad,-pi,pi]
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rfdy
reciprocal of face-dy
integer, parameter, public rp
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cz
center coordinate [m]: z, local
subroutine, public atmos_grid_cartesc_real_calc_areavol(MAPF)
Calc control area/volume.
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rfdx
reciprocal of face-dx