51 private :: atmos_grid_cartesc_metric_mapfactor
52 private :: atmos_grid_cartesc_metric_terrainfollowing
53 private :: atmos_grid_cartesc_metric_thin_wall
54 private :: atmos_grid_cartesc_metric_step_mountain
55 private :: atmos_grid_cartesc_metric_write
61 character(len=H_LONG),
private :: atmos_grid_cartesc_metric_out_basename =
''
62 character(len=H_MID),
private :: atmos_grid_cartesc_metric_out_title =
'SCALE-RM GEOMETRICS'
63 character(len=H_SHORT),
private :: atmos_grid_cartesc_metric_out_dtype =
'DEFAULT'
65 character(len=H_SHORT),
private :: atmos_grid_cartesc_metric_topo_type =
'TERRAINFOLLOWING'
66 integer,
private :: atmos_grid_cartesc_metric_thinwall_xdiv = 50
67 integer,
private :: atmos_grid_cartesc_metric_thinwall_ydiv = 50
79 namelist / param_atmos_grid_cartesc_metric / &
80 atmos_grid_cartesc_metric_out_basename, &
81 atmos_grid_cartesc_metric_out_dtype, &
82 atmos_grid_cartesc_metric_topo_type, &
83 atmos_grid_cartesc_metric_thinwall_xdiv, &
84 atmos_grid_cartesc_metric_thinwall_ydiv
90 log_info(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Setup'
94 read(
io_fid_conf,nml=param_atmos_grid_cartesc_metric,iostat=ierr)
96 log_info(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Not found namelist. Default used.'
97 elseif( ierr > 0 )
then
98 log_error(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_GRID_CARTESC_METRIC. Check!'
101 log_nml(param_atmos_grid_cartesc_metric)
137 call atmos_grid_cartesc_metric_mapfactor
144 log_info(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Terrain coordinate type : ', trim(atmos_grid_cartesc_metric_topo_type)
145 select case(atmos_grid_cartesc_metric_topo_type)
146 case(
'TERRAINFOLLOWING')
147 log_info_cont(*)
'=> Terrain-following method'
148 call atmos_grid_cartesc_metric_terrainfollowing
150 log_info_cont(*)
'=> Step-mountain method'
151 call atmos_grid_cartesc_metric_thin_wall
152 call atmos_grid_cartesc_metric_step_mountain
154 log_info_cont(*)
'=> Thin-wall approximation method'
155 call atmos_grid_cartesc_metric_thin_wall
157 log_error(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Unsupported ATMOS_GRID_CARTESC_METRIC_TOPO_type. STOP'
164 call atmos_grid_cartesc_metric_write
178 log_info(
"ATMOS_GRID_CARTESC_METRIC_finalize",*)
'Finalize'
206 subroutine atmos_grid_cartesc_metric_mapfactor
210 mapprojection_mapfactor
226 call mapprojection_mapfactor(
ia, 1,
ia,
ja, 1,
ja, &
235 call mapprojection_mapfactor(
ia, 1,
ia,
ja, 1,
ja, &
245 call mapprojection_mapfactor(
ia, 1,
ia,
ja, 1,
ja, &
254 call mapprojection_mapfactor(
ia, 1,
ia,
ja, 1,
ja, &
266 end subroutine atmos_grid_cartesc_metric_mapfactor
272 mapprojection_rotcoef
279 call mapprojection_rotcoef(
ia, 1,
ia,
ja, 1,
ja, &
292 subroutine atmos_grid_cartesc_metric_terrainfollowing
317 integer :: i_start, i_end
462 end subroutine atmos_grid_cartesc_metric_terrainfollowing
465 subroutine atmos_grid_cartesc_metric_thin_wall
482 real(RP) :: TOPO_ZsfcALL(2*IA,2*JA)
483 real(RP) :: TOPO_ZsfcXY (IA,JA)
484 real(RP) :: TOPO_ZsfcUY (IA,JA)
485 real(RP) :: TOPO_ZsfcXV (IA,JA)
486 real(RP) :: TOPO_ZsfcUV (IA,JA)
488 real(RP) :: ATMOS_GRID_CARTESC_METRIC_QLIM (2*KA,2*IA,2*JA,3)
489 real(RP) :: QDZ(2*KA)
490 real(RP) :: QDX(2*IA)
491 real(RP) :: QDY(2*JA)
493 real(RP) :: XSLOPE, YSLOPE
495 real(RP) :: DX_piece, DY_piece
496 real(RP) :: DX, DY, DZ
498 integer :: I_QLIMtoLIM(3,7)
500 integer :: iii, jjj, n
501 integer :: k, i, j, kk, ii, jj
534 call comm_vars8( topo_zsfcxy(:,:), 1 )
535 call comm_vars8( topo_zsfcuy(:,:), 2 )
536 call comm_vars8( topo_zsfcxv(:,:), 3 )
537 call comm_vars8( topo_zsfcuv(:,:), 4 )
538 call comm_wait ( topo_zsfcxy(:,:), 1 )
539 call comm_wait ( topo_zsfcuy(:,:), 2 )
540 call comm_wait ( topo_zsfcxv(:,:), 3 )
541 call comm_wait ( topo_zsfcuv(:,:), 4 )
549 topo_zsfcall(ii ,jj ) = topo_zsfcxy(i,j)
550 topo_zsfcall(ii+1,jj ) = topo_zsfcuy(i,j)
551 topo_zsfcall(ii ,jj+1) = topo_zsfcxv(i,j)
552 topo_zsfcall(ii+1,jj+1) = topo_zsfcuv(i,j)
582 dx_piece = qdx(ii) / real(atmos_grid_cartesc_metric_thinwall_xdiv,kind=rp)
583 dy_piece = qdy(jj) / real(atmos_grid_cartesc_metric_thinwall_ydiv,kind=rp)
586 ztop = sum(qdz(
ks:kk))
589 yslope = ( topo_zsfcall(ii,jj+1) - topo_zsfcall(ii,jj) ) / qdy(jj)
591 do jjj = 1, atmos_grid_cartesc_metric_thinwall_ydiv
592 dy = ( real(jjj,kind=rp) - 0.5_rp ) * dy_piece
593 dz = ztop - topo_zsfcall(ii,jj) - yslope * dy
595 if ( dz > 0.0_rp )
then
596 if ( dz < qdz(kk) )
then
599 aqaf(
i_fyz) = aqaf(
i_fyz) + qdz(kk) * dy_piece
605 xslope = ( topo_zsfcall(ii+1,jj) - topo_zsfcall(ii,jj) ) / qdx(ii)
607 do iii = 1, atmos_grid_cartesc_metric_thinwall_xdiv
608 dx = ( real(iii,kind=rp) - 0.5_rp ) * dx_piece
609 dz = ztop - topo_zsfcall(ii,jj) + xslope * dx
611 if ( dz > 0.0_rp )
then
612 if ( dz < qdz(kk) )
then
615 aqaf(
i_fxz) = aqaf(
i_fxz) + qdz(kk) * dx_piece
621 do jjj = 1, atmos_grid_cartesc_metric_thinwall_ydiv
622 do iii = 1, atmos_grid_cartesc_metric_thinwall_xdiv
623 dx = ( real(iii,kind=rp) - 0.5_rp ) * dx_piece
624 dy = ( real(jjj,kind=rp) - 0.5_rp ) * dy_piece
625 dz = ztop - topo_zsfcall(ii,jj) - xslope * dx - yslope * dy
627 if ( dz > 0.0_rp )
then
628 aqaf(
i_fxy) = aqaf(
i_fxy) + dx_piece * dy_piece
633 atmos_grid_cartesc_metric_qlim(kk,ii,jj,
i_fyz) = aqaf(
i_fyz) / ( qdy(jj) * qdz(kk) )
634 atmos_grid_cartesc_metric_qlim(kk,ii,jj,
i_fxz) = aqaf(
i_fxz) / ( qdx(ii) * qdz(kk) )
635 atmos_grid_cartesc_metric_qlim(kk,ii,jj,
i_fxy) = aqaf(
i_fxy) / ( qdy(jj) * qdx(ii) )
641 i_qlimtolim(1:3,
i_xyz) = (/ 1, 1, 1 /)
642 i_qlimtolim(1:3,
i_xyw) = (/ 1, 1, 0 /)
643 i_qlimtolim(1:3,
i_uyw) = (/ 0, 1, 0 /)
644 i_qlimtolim(1:3,
i_xvw) = (/ 1, 0, 0 /)
645 i_qlimtolim(1:3,
i_uyz) = (/ 0, 1, 1 /)
646 i_qlimtolim(1:3,
i_xvz) = (/ 1, 0, 1 /)
647 i_qlimtolim(1:3,
i_uvz) = (/ 0, 0, 1 /)
653 ii = (i-1) * 2 + 1 - i_qlimtolim(1,n)
654 jj = (j-1) * 2 + 1 - i_qlimtolim(2,n)
655 kk = (k-1) * 2 + 1 - i_qlimtolim(3,n)
658 + atmos_grid_cartesc_metric_qlim(kk+1,ii,jj,
i_fyz) + atmos_grid_cartesc_metric_qlim(kk+1,ii ,jj+1,
i_fyz) )
660 + atmos_grid_cartesc_metric_qlim(kk+1,ii,jj,
i_fxz) + atmos_grid_cartesc_metric_qlim(kk+1,ii+1,jj ,
i_fxz) )
662 + atmos_grid_cartesc_metric_qlim(kk ,ii,jj,
i_fxy) + atmos_grid_cartesc_metric_qlim(kk ,ii+1,jj ,
i_fxy) )
665 log_error(
"ATMOS_GRID_CARTESC_METRIC_thin_wall",*)
'Facter miss! Check!'
722 end subroutine atmos_grid_cartesc_metric_thin_wall
725 subroutine atmos_grid_cartesc_metric_step_mountain
804 end subroutine atmos_grid_cartesc_metric_step_mountain
808 subroutine atmos_grid_cartesc_metric_write
823 mapprojection_lonlat2xy
826 real(RP) :: check_X_XY(IA,JA)
827 real(RP) :: check_Y_XY(IA,JA)
828 real(RP) :: distance (IA,JA)
833 if ( atmos_grid_cartesc_metric_out_basename /=
'' )
then
836 log_info(
"ATMOS_GRID_CARTESC_METRIC_write",*)
'Output metrics file '
839 'MAPF_X_XY',
'Map factor x-dir at XY',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
841 'MAPF_Y_XY',
'Map factor y-dir at XY',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
844 'MAPF_X_UY',
'Map factor x-dir at UY',
'NIL',
'UY', atmos_grid_cartesc_metric_out_dtype )
847 'MAPF_Y_UY',
'Map factor y-dir at UY',
'NIL',
'UY', atmos_grid_cartesc_metric_out_dtype )
849 'MAPF_X_XV',
'Map factor x-dir at XV',
'NIL',
'XV', atmos_grid_cartesc_metric_out_dtype )
851 'MAPF_Y_XV',
'Map factor y-dir at XV',
'NIL',
'XV', atmos_grid_cartesc_metric_out_dtype )
854 'MAPF_X_UV',
'Map factor x-dir at UV',
'NIL',
'UV', atmos_grid_cartesc_metric_out_dtype )
857 'MAPF_Y_UV',
'Map factor y-dir at UV',
'NIL',
'UV', atmos_grid_cartesc_metric_out_dtype )
860 'ROTC_COS',
'Rotation factor (cos)',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
862 'ROTC_SIN',
'Rotation factor (sin)',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
865 'ROTC_COS',
'Rotation factor (cos)',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
873 call file_cartesc_write( check_x_xy(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, &
874 'X_XY',
'x at XY for check',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
875 call file_cartesc_write( check_y_xy(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, &
876 'Y_XY',
'y at XY for check',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
889 call file_cartesc_write( distance(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, &
890 'distance',
'distance from basepoint',
'm',
'XY', atmos_grid_cartesc_metric_out_dtype )
895 'GSQRT_ZXY',
'transformation metrics from Z to Xi, G^1/2 at ZXY',
'1',
'ZXY', &
896 atmos_grid_cartesc_metric_out_dtype )
898 'GSQRT_WXY',
'transformation metrics from Z to Xi, G^1/2 at WXY',
'1',
'ZHXY', &
899 atmos_grid_cartesc_metric_out_dtype )
902 'GSQRT_WUY',
'transformation metrics from Z to Xi, G^1/2 at WUY',
'1',
'ZHXHY', &
903 atmos_grid_cartesc_metric_out_dtype )
905 'GSQRT_WXV',
'transformation metrics from Z to Xi, G^1/2 at WXV',
'1',
'ZHXYH', &
906 atmos_grid_cartesc_metric_out_dtype )
909 'GSQRT_ZUY',
'transformation metrics from Z to Xi, G^1/2 at ZUY',
'1',
'ZXHY', &
910 atmos_grid_cartesc_metric_out_dtype )
912 'GSQRT_ZXV',
'transformation metrics from Z to Xi, G^1/2 at ZXV',
'1',
'ZXYH', &
913 atmos_grid_cartesc_metric_out_dtype )
916 'GSQRT_ZUV',
'transformation metrics from Z to Xi, G^1/2 at ZUV',
'1',
'ZXHYH', &
917 atmos_grid_cartesc_metric_out_dtype )
920 'J13G_ZXY',
'(1,3) element of Jacobian matrix * {G}^1/2 at ZXY',
'1',
'ZXY', &
921 atmos_grid_cartesc_metric_out_dtype )
923 'J13G_WXY',
'(1,3) element of Jacobian matrix * {G}^1/2 at WXY',
'1',
'ZHXY', &
924 atmos_grid_cartesc_metric_out_dtype )
927 'J13G_WUY',
'(1,3) element of Jacobian matrix * {G}^1/2 at WUY',
'1',
'ZHXHY', &
928 atmos_grid_cartesc_metric_out_dtype )
930 'J13G_WXV',
'(1,3) element of Jacobian matrix * {G}^1/2 at WXV',
'1',
'ZHXYH', &
931 atmos_grid_cartesc_metric_out_dtype )
934 'J13G_ZUY',
'(1,3) element of Jacobian matrix * {G}^1/2 at ZUY',
'1',
'ZXHY', &
935 atmos_grid_cartesc_metric_out_dtype )
937 'J13G_ZXV',
'(1,3) element of Jacobian matrix * {G}^1/2 at ZXV',
'1',
'ZXYH', &
938 atmos_grid_cartesc_metric_out_dtype )
941 'J13G_ZUV',
'(1,3) element of Jacobian matrix * {G}^1/2 at ZUV',
'1',
'ZXHYH', &
942 atmos_grid_cartesc_metric_out_dtype )
945 'J23G_ZXY',
'(2,3) element of Jacobian matrix * {G}^1/2 at ZXY',
'1',
'ZXY', &
946 atmos_grid_cartesc_metric_out_dtype )
948 'J23G_WXY',
'(2,3) element of Jacobian matrix * {G}^1/2 at WXY',
'1',
'ZHXY', &
949 atmos_grid_cartesc_metric_out_dtype )
952 'J23G_WUY',
'(2,3) element of Jacobian matrix * {G}^1/2 at WUY',
'1',
'ZHXHY', &
953 atmos_grid_cartesc_metric_out_dtype )
955 'J23G_WXV',
'(2,3) element of Jacobian matrix * {G}^1/2 at WXV',
'1',
'ZHXYH', &
956 atmos_grid_cartesc_metric_out_dtype )
959 'J23G_ZUY',
'(2,3) element of Jacobian matrix * {G}^1/2 at ZUY',
'1',
'ZXHY', &
960 atmos_grid_cartesc_metric_out_dtype )
962 'J23G_ZXV',
'(2,3) element of Jacobian matrix * {G}^1/2 at ZXV',
'1',
'ZXYH', &
963 atmos_grid_cartesc_metric_out_dtype )
966 'J23G_ZUV',
'(2,3) element of Jacobian matrix * {G}^1/2 at ZUV',
'1',
'ZXHYH', &
967 atmos_grid_cartesc_metric_out_dtype )
972 end subroutine atmos_grid_cartesc_metric_write