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
78 namelist / param_atmos_grid_cartesc_metric / &
79 atmos_grid_cartesc_metric_out_basename, &
80 atmos_grid_cartesc_metric_out_dtype, &
81 atmos_grid_cartesc_metric_topo_type, &
82 atmos_grid_cartesc_metric_thinwall_xdiv, &
83 atmos_grid_cartesc_metric_thinwall_ydiv
89 log_info(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Setup'
93 read(
io_fid_conf,nml=param_atmos_grid_cartesc_metric,iostat=ierr)
95 log_info(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Not found namelist. Default used.'
96 elseif( ierr > 0 )
then
97 log_error(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_GRID_CARTESC_METRIC. Check!'
100 log_nml(param_atmos_grid_cartesc_metric)
129 call atmos_grid_cartesc_metric_mapfactor
136 log_info(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Terrain coordinate type : ', trim(atmos_grid_cartesc_metric_topo_type)
137 select case(atmos_grid_cartesc_metric_topo_type)
138 case(
'TERRAINFOLLOWING')
139 log_info_cont(*)
'=> Terrain-following method'
140 call atmos_grid_cartesc_metric_terrainfollowing
142 log_info_cont(*)
'=> Step-mountain method'
143 call atmos_grid_cartesc_metric_thin_wall
144 call atmos_grid_cartesc_metric_step_mountain
146 log_info_cont(*)
'=> Thin-wall approximation method'
147 call atmos_grid_cartesc_metric_thin_wall
149 log_error(
"ATMOS_GRID_CARTESC_METRIC_setup",*)
'Unsupported ATMOS_GRID_CARTESC_METRIC_TOPO_type. STOP'
154 call atmos_grid_cartesc_metric_write
161 subroutine atmos_grid_cartesc_metric_mapfactor
165 mapprojection_mapfactor
179 call mapprojection_mapfactor(
ia, 1,
ia,
ja, 1,
ja, &
181 call mapprojection_mapfactor(
ia, 1,
ia,
ja, 1,
ja, &
184 call mapprojection_mapfactor(
ia, 1,
ia,
ja, 1,
ja, &
186 call mapprojection_mapfactor(
ia, 1,
ia,
ja, 1,
ja, &
195 end subroutine atmos_grid_cartesc_metric_mapfactor
201 mapprojection_rotcoef
208 call mapprojection_rotcoef(
ia, 1,
ia,
ja, 1,
ja, &
219 subroutine atmos_grid_cartesc_metric_terrainfollowing
244 integer :: i_start, i_end
385 end subroutine atmos_grid_cartesc_metric_terrainfollowing
388 subroutine atmos_grid_cartesc_metric_thin_wall
405 real(RP) :: TOPO_ZsfcALL(2*IA,2*JA)
406 real(RP) :: TOPO_ZsfcXY (IA,JA)
407 real(RP) :: TOPO_ZsfcUY (IA,JA)
408 real(RP) :: TOPO_ZsfcXV (IA,JA)
409 real(RP) :: TOPO_ZsfcUV (IA,JA)
411 real(RP) :: ATMOS_GRID_CARTESC_METRIC_QLIM (2*KA,2*IA,2*JA,3)
412 real(RP) :: QDZ(2*KA)
413 real(RP) :: QDX(2*IA)
414 real(RP) :: QDY(2*JA)
416 real(RP) :: XSLOPE, YSLOPE
418 real(RP) :: DX_piece, DY_piece
419 real(RP) :: DX, DY, DZ
421 integer :: I_QLIMtoLIM(3,7)
423 integer :: iii, jjj, n
424 integer :: k, i, j, kk, ii, jj
457 call comm_vars8( topo_zsfcxy(:,:), 1 )
458 call comm_vars8( topo_zsfcuy(:,:), 2 )
459 call comm_vars8( topo_zsfcxv(:,:), 3 )
460 call comm_vars8( topo_zsfcuv(:,:), 4 )
461 call comm_wait ( topo_zsfcxy(:,:), 1 )
462 call comm_wait ( topo_zsfcuy(:,:), 2 )
463 call comm_wait ( topo_zsfcxv(:,:), 3 )
464 call comm_wait ( topo_zsfcuv(:,:), 4 )
472 topo_zsfcall(ii ,jj ) = topo_zsfcxy(i,j)
473 topo_zsfcall(ii+1,jj ) = topo_zsfcuy(i,j)
474 topo_zsfcall(ii ,jj+1) = topo_zsfcxv(i,j)
475 topo_zsfcall(ii+1,jj+1) = topo_zsfcuv(i,j)
505 dx_piece = qdx(ii) / real(atmos_grid_cartesc_metric_thinwall_xdiv,kind=rp)
506 dy_piece = qdy(jj) / real(atmos_grid_cartesc_metric_thinwall_ydiv,kind=rp)
509 ztop = sum(qdz(
ks:kk))
512 yslope = ( topo_zsfcall(ii,jj+1) - topo_zsfcall(ii,jj) ) / qdy(jj)
514 do jjj = 1, atmos_grid_cartesc_metric_thinwall_ydiv
515 dy = ( real(jjj,kind=rp) - 0.5_rp ) * dy_piece
516 dz = ztop - topo_zsfcall(ii,jj) - yslope * dy
518 if ( dz > 0.0_rp )
then
519 if ( dz < qdz(kk) )
then
522 aqaf(
i_fyz) = aqaf(
i_fyz) + qdz(kk) * dy_piece
528 xslope = ( topo_zsfcall(ii+1,jj) - topo_zsfcall(ii,jj) ) / qdx(ii)
530 do iii = 1, atmos_grid_cartesc_metric_thinwall_xdiv
531 dx = ( real(iii,kind=rp) - 0.5_rp ) * dx_piece
532 dz = ztop - topo_zsfcall(ii,jj) + xslope * dx
534 if ( dz > 0.0_rp )
then
535 if ( dz < qdz(kk) )
then
538 aqaf(
i_fxz) = aqaf(
i_fxz) + qdz(kk) * dx_piece
544 do jjj = 1, atmos_grid_cartesc_metric_thinwall_ydiv
545 do iii = 1, atmos_grid_cartesc_metric_thinwall_xdiv
546 dx = ( real(iii,kind=rp) - 0.5_rp ) * dx_piece
547 dy = ( real(jjj,kind=rp) - 0.5_rp ) * dy_piece
548 dz = ztop - topo_zsfcall(ii,jj) - xslope * dx - yslope * dy
550 if ( dz > 0.0_rp )
then
551 aqaf(
i_fxy) = aqaf(
i_fxy) + dx_piece * dy_piece
556 atmos_grid_cartesc_metric_qlim(kk,ii,jj,
i_fyz) = aqaf(
i_fyz) / ( qdy(jj) * qdz(kk) )
557 atmos_grid_cartesc_metric_qlim(kk,ii,jj,
i_fxz) = aqaf(
i_fxz) / ( qdx(ii) * qdz(kk) )
558 atmos_grid_cartesc_metric_qlim(kk,ii,jj,
i_fxy) = aqaf(
i_fxy) / ( qdy(jj) * qdx(ii) )
564 i_qlimtolim(1:3,
i_xyz) = (/ 1, 1, 1 /)
565 i_qlimtolim(1:3,
i_xyw) = (/ 1, 1, 0 /)
566 i_qlimtolim(1:3,
i_uyw) = (/ 0, 1, 0 /)
567 i_qlimtolim(1:3,
i_xvw) = (/ 1, 0, 0 /)
568 i_qlimtolim(1:3,
i_uyz) = (/ 0, 1, 1 /)
569 i_qlimtolim(1:3,
i_xvz) = (/ 1, 0, 1 /)
570 i_qlimtolim(1:3,
i_uvz) = (/ 0, 0, 1 /)
576 ii = (i-1) * 2 + 1 - i_qlimtolim(1,n)
577 jj = (j-1) * 2 + 1 - i_qlimtolim(2,n)
578 kk = (k-1) * 2 + 1 - i_qlimtolim(3,n)
581 + atmos_grid_cartesc_metric_qlim(kk+1,ii,jj,
i_fyz) + atmos_grid_cartesc_metric_qlim(kk+1,ii ,jj+1,
i_fyz) )
583 + atmos_grid_cartesc_metric_qlim(kk+1,ii,jj,
i_fxz) + atmos_grid_cartesc_metric_qlim(kk+1,ii+1,jj ,
i_fxz) )
585 + atmos_grid_cartesc_metric_qlim(kk ,ii,jj,
i_fxy) + atmos_grid_cartesc_metric_qlim(kk ,ii+1,jj ,
i_fxy) )
588 log_error(
"ATMOS_GRID_CARTESC_METRIC_thin_wall",*)
'Facter miss! Check!'
643 end subroutine atmos_grid_cartesc_metric_thin_wall
646 subroutine atmos_grid_cartesc_metric_step_mountain
722 end subroutine atmos_grid_cartesc_metric_step_mountain
726 subroutine atmos_grid_cartesc_metric_write
741 mapprojection_lonlat2xy
744 real(RP) :: check_X_XY(IA,JA)
745 real(RP) :: check_Y_XY(IA,JA)
746 real(RP) :: distance (IA,JA)
751 if ( atmos_grid_cartesc_metric_out_basename /=
'' )
then
754 log_info(
"ATMOS_GRID_CARTESC_METRIC_write",*)
'Output metrics file '
757 'MAPF_X_XY',
'Map factor x-dir at XY',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
759 'MAPF_Y_XY',
'Map factor y-dir at XY',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
762 'MAPF_X_UY',
'Map factor x-dir at UY',
'NIL',
'UY', atmos_grid_cartesc_metric_out_dtype )
765 'MAPF_Y_UY',
'Map factor y-dir at UY',
'NIL',
'UY', atmos_grid_cartesc_metric_out_dtype )
767 'MAPF_X_XV',
'Map factor x-dir at XV',
'NIL',
'XV', atmos_grid_cartesc_metric_out_dtype )
769 'MAPF_Y_XV',
'Map factor y-dir at XV',
'NIL',
'XV', atmos_grid_cartesc_metric_out_dtype )
772 'MAPF_X_UV',
'Map factor x-dir at UV',
'NIL',
'UV', atmos_grid_cartesc_metric_out_dtype )
775 'MAPF_Y_UV',
'Map factor y-dir at UV',
'NIL',
'UV', atmos_grid_cartesc_metric_out_dtype )
778 'ROTC_COS',
'Rotation factor (cos)',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
780 'ROTC_SIN',
'Rotation factor (sin)',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
783 'ROTC_COS',
'Rotation factor (cos)',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
791 call file_cartesc_write( check_x_xy(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, &
792 'X_XY',
'x at XY for check',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
793 call file_cartesc_write( check_y_xy(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, &
794 'Y_XY',
'y at XY for check',
'NIL',
'XY', atmos_grid_cartesc_metric_out_dtype )
807 call file_cartesc_write( distance(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, &
808 'distance',
'distance from basepoint',
'm',
'XY', atmos_grid_cartesc_metric_out_dtype )
813 'GSQRT_ZXY',
'transformation metrics from Z to Xi, G^1/2 at ZXY',
'1',
'ZXY', &
814 atmos_grid_cartesc_metric_out_dtype )
816 'GSQRT_WXY',
'transformation metrics from Z to Xi, G^1/2 at WXY',
'1',
'ZHXY', &
817 atmos_grid_cartesc_metric_out_dtype )
820 'GSQRT_WUY',
'transformation metrics from Z to Xi, G^1/2 at WUY',
'1',
'ZHXHY', &
821 atmos_grid_cartesc_metric_out_dtype )
823 'GSQRT_WXV',
'transformation metrics from Z to Xi, G^1/2 at WXV',
'1',
'ZHXYH', &
824 atmos_grid_cartesc_metric_out_dtype )
827 'GSQRT_ZUY',
'transformation metrics from Z to Xi, G^1/2 at ZUY',
'1',
'ZXHY', &
828 atmos_grid_cartesc_metric_out_dtype )
830 'GSQRT_ZXV',
'transformation metrics from Z to Xi, G^1/2 at ZXV',
'1',
'ZXYH', &
831 atmos_grid_cartesc_metric_out_dtype )
834 'GSQRT_ZUV',
'transformation metrics from Z to Xi, G^1/2 at ZUV',
'1',
'ZXHYH', &
835 atmos_grid_cartesc_metric_out_dtype )
838 'J13G_ZXY',
'(1,3) element of Jacobian matrix * {G}^1/2 at ZXY',
'1',
'ZXY', &
839 atmos_grid_cartesc_metric_out_dtype )
841 'J13G_WXY',
'(1,3) element of Jacobian matrix * {G}^1/2 at WXY',
'1',
'ZHXY', &
842 atmos_grid_cartesc_metric_out_dtype )
845 'J13G_WUY',
'(1,3) element of Jacobian matrix * {G}^1/2 at WUY',
'1',
'ZHXHY', &
846 atmos_grid_cartesc_metric_out_dtype )
848 'J13G_WXV',
'(1,3) element of Jacobian matrix * {G}^1/2 at WXV',
'1',
'ZHXYH', &
849 atmos_grid_cartesc_metric_out_dtype )
852 'J13G_ZUY',
'(1,3) element of Jacobian matrix * {G}^1/2 at ZUY',
'1',
'ZXHY', &
853 atmos_grid_cartesc_metric_out_dtype )
855 'J13G_ZXV',
'(1,3) element of Jacobian matrix * {G}^1/2 at ZXV',
'1',
'ZXYH', &
856 atmos_grid_cartesc_metric_out_dtype )
859 'J13G_ZUV',
'(1,3) element of Jacobian matrix * {G}^1/2 at ZUV',
'1',
'ZXHYH', &
860 atmos_grid_cartesc_metric_out_dtype )
863 'J23G_ZXY',
'(2,3) element of Jacobian matrix * {G}^1/2 at ZXY',
'1',
'ZXY', &
864 atmos_grid_cartesc_metric_out_dtype )
866 'J23G_WXY',
'(2,3) element of Jacobian matrix * {G}^1/2 at WXY',
'1',
'ZHXY', &
867 atmos_grid_cartesc_metric_out_dtype )
870 'J23G_WUY',
'(2,3) element of Jacobian matrix * {G}^1/2 at WUY',
'1',
'ZHXHY', &
871 atmos_grid_cartesc_metric_out_dtype )
873 'J23G_WXV',
'(2,3) element of Jacobian matrix * {G}^1/2 at WXV',
'1',
'ZHXYH', &
874 atmos_grid_cartesc_metric_out_dtype )
877 'J23G_ZUY',
'(2,3) element of Jacobian matrix * {G}^1/2 at ZUY',
'1',
'ZXHY', &
878 atmos_grid_cartesc_metric_out_dtype )
880 'J23G_ZXV',
'(2,3) element of Jacobian matrix * {G}^1/2 at ZXV',
'1',
'ZXYH', &
881 atmos_grid_cartesc_metric_out_dtype )
884 'J23G_ZUV',
'(2,3) element of Jacobian matrix * {G}^1/2 at ZUV',
'1',
'ZXHYH', &
885 atmos_grid_cartesc_metric_out_dtype )
890 end subroutine atmos_grid_cartesc_metric_write