SCALE-RM
scale_atmos_grid_cartesC_metric.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
10 !-------------------------------------------------------------------------------
11 #include "scalelib.h"
13  !-----------------------------------------------------------------------------
14  !
15  !++ used modules
16  !
17  use scale_precision
18  use scale_io
19  use scale_prof
21  !-----------------------------------------------------------------------------
22  implicit none
23  private
24  !-----------------------------------------------------------------------------
25  !
26  !++ Public procedure
27  !
29 
30  !-----------------------------------------------------------------------------
31  !
32  !++ Public parameters & variables
33  !
34  real(rp), public, allocatable :: atmos_grid_cartesc_metric_mapf (:,:,:,:)
35  real(rp), public, allocatable :: atmos_grid_cartesc_metric_rotc (:,:,:)
36 
37  real(rp), public, allocatable :: atmos_grid_cartesc_metric_gsqrt(:,:,:,:)
38  real(rp), public, allocatable :: atmos_grid_cartesc_metric_j13g (:,:,:,:)
39  real(rp), public, allocatable :: atmos_grid_cartesc_metric_j23g (:,:,:,:)
41 
42  real(rp), public, allocatable :: atmos_grid_cartesc_metric_limyz(:,:,:,:)
43  real(rp), public, allocatable :: atmos_grid_cartesc_metric_limxz(:,:,:,:)
44  real(rp), public, allocatable :: atmos_grid_cartesc_metric_limxy(:,:,:,:)
45 
46  !-----------------------------------------------------------------------------
47  !
48  !++ Private procedure
49  !
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
55 
56  !-----------------------------------------------------------------------------
57  !
58  !++ Private parameters & variables
59  !
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'
63 
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
67  !-----------------------------------------------------------------------------
68 contains
69  !-----------------------------------------------------------------------------
72  use scale_prc, only: &
73  prc_abort
74  use scale_prc_cartesc, only: &
75  prc_twod
76  implicit none
77 
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
84 
85  integer :: ierr
86  !---------------------------------------------------------------------------
87 
88  log_newline
89  log_info("ATMOS_GRID_CARTESC_METRIC_setup",*) 'Setup'
90 
91  !--- read namelist
92  rewind(io_fid_conf)
93  read(io_fid_conf,nml=param_atmos_grid_cartesc_metric,iostat=ierr)
94  if( ierr < 0 ) then !--- missing
95  log_info("ATMOS_GRID_CARTESC_METRIC_setup",*) 'Not found namelist. Default used.'
96  elseif( ierr > 0 ) then !--- fatal error
97  log_error("ATMOS_GRID_CARTESC_METRIC_setup",*) 'Not appropriate names in namelist PARAM_ATMOS_GRID_CARTESC_METRIC. Check!'
98  call prc_abort
99  endif
100  log_nml(param_atmos_grid_cartesc_metric)
101 
102  allocate( atmos_grid_cartesc_metric_mapf(ia,ja,2,4) )
103 
104  allocate( atmos_grid_cartesc_metric_rotc(ia,ja,2) )
105 
106  if ( prc_twod ) then
107  allocate( atmos_grid_cartesc_metric_gsqrt(ka,ia,ja,4) )
108  allocate( atmos_grid_cartesc_metric_j13g(ka,ia,ja,4) )
109  allocate( atmos_grid_cartesc_metric_j23g(ka,ia,ja,4) )
110  else
111  allocate( atmos_grid_cartesc_metric_gsqrt(ka,ia,ja,7) )
112  allocate( atmos_grid_cartesc_metric_j13g(ka,ia,ja,7) )
113  allocate( atmos_grid_cartesc_metric_j23g(ka,ia,ja,7) )
114  end if
115 
116  atmos_grid_cartesc_metric_gsqrt(:,:,:,:) = 1.0_rp
117  atmos_grid_cartesc_metric_j13g(:,:,:,:) = 0.0_rp
118  atmos_grid_cartesc_metric_j23g(:,:,:,:) = 0.0_rp
120 
121  allocate( atmos_grid_cartesc_metric_limyz(ka,ia,ja,7) )
122  allocate( atmos_grid_cartesc_metric_limxz(ka,ia,ja,7) )
123  allocate( atmos_grid_cartesc_metric_limxy(ka,ia,ja,7) )
124  atmos_grid_cartesc_metric_limyz(:,:,:,:) = 1.0_rp
125  atmos_grid_cartesc_metric_limxz(:,:,:,:) = 1.0_rp
126  atmos_grid_cartesc_metric_limxy(:,:,:,:) = 1.0_rp
127 
128  ! calc metrics for orthogonal curvelinear coordinate
129  call atmos_grid_cartesc_metric_mapfactor
130 
131  ! calc coeficient for rotaion of velocity vector
133 
134  ! calc metrics for terrain-following,step-mountain,thin-wall coordinate
135  log_newline
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
141  case('STEPMOUNTAIN')
142  log_info_cont(*) '=> Step-mountain method'
143  call atmos_grid_cartesc_metric_thin_wall
144  call atmos_grid_cartesc_metric_step_mountain
145  case('THINWALL')
146  log_info_cont(*) '=> Thin-wall approximation method'
147  call atmos_grid_cartesc_metric_thin_wall
148  case default
149  log_error("ATMOS_GRID_CARTESC_METRIC_setup",*) 'Unsupported ATMOS_GRID_CARTESC_METRIC_TOPO_type. STOP'
150  call prc_abort
151  end select
152 
153  ! output metrics (for debug)
154  call atmos_grid_cartesc_metric_write
155 
156  return
157  end subroutine atmos_grid_cartesc_metric_setup
158 
159  !-----------------------------------------------------------------------------
161  subroutine atmos_grid_cartesc_metric_mapfactor
162  use scale_prc_cartesc, only: &
163  prc_twod
164  use scale_mapprojection, only: &
165  mapprojection_mapfactor
166  use scale_atmos_grid_cartesc, only: &
169  use scale_atmos_grid_cartesc_real, only: &
174  use scale_topography, only: &
176  implicit none
177  !---------------------------------------------------------------------------
178 
179  call mapprojection_mapfactor( ia, 1, ia, ja, 1, ja, &
181  call mapprojection_mapfactor( ia, 1, ia, ja, 1, ja, &
183  if ( .not. prc_twod ) then
184  call mapprojection_mapfactor( ia, 1, ia, ja, 1, ja, &
186  call mapprojection_mapfactor( ia, 1, ia, ja, 1, ja, &
188  end if
189 
190  call topography_calc_tan_slope( ia, is, ie, ja, js, je, &
193 
194  return
195  end subroutine atmos_grid_cartesc_metric_mapfactor
196 
197  !-----------------------------------------------------------------------------
200  use scale_mapprojection, only: &
201  mapprojection_rotcoef
202  use scale_atmos_grid_cartesc_real, only: &
205  implicit none
206  !---------------------------------------------------------------------------
207 
208  call mapprojection_rotcoef( ia, 1, ia, ja, 1, ja, &
209  atmos_grid_cartesc_real_lon(:,:), & ! [IN]
210  atmos_grid_cartesc_real_lat(:,:), & ! [IN]
211  atmos_grid_cartesc_metric_rotc(:,:,1), & ! [OUT]
212  atmos_grid_cartesc_metric_rotc(:,:,2) ) ! [OUT]
213 
214  return
215  end subroutine atmos_grid_cartesc_metric_rotcoef
216 
217  !-----------------------------------------------------------------------------
219  subroutine atmos_grid_cartesc_metric_terrainfollowing
220  use scale_prc_cartesc, only: &
221  prc_twod
222  use scale_atmos_grid_cartesc, only: &
229  use scale_atmos_grid_cartesc_real, only: &
238  use scale_comm_cartesc, only: &
239  comm_vars8, &
240  comm_wait
241  implicit none
242 
243  integer :: k, i, j
244  integer :: i_start, i_end
245  !---------------------------------------------------------------------------
246 
247  ! G^1/2
248  !$omp parallel do
249  do j = 1, ja
250  do i = 1, ia
251  ! at (x,y,z)
252  do k = 1, ka
254  enddo
255 
256  ! at (x,y,w)
257  do k = 1, ka-1
259  enddo
261 
262  ! at (x,v,w)
263  do k = 1, ka-1
265  enddo
267 
268  ! at (x,v,z)
269  do k = 1, ka
271  enddo
272  enddo
273  enddo
274  if ( .not. prc_twod ) then
275  !$omp parallel do
276  do j = 1, ja
277  do i = 1, ia
278  ! at (u,y,w)
279  do k = 1, ka-1
281  enddo
283 
284  ! at (u,y,z)
285  do k = 1, ka
287  enddo
288 
289  ! at (u,v,z)
290  do k = 1, ka
292  enddo
293  enddo
294  enddo
295  end if
296 
297  ! Jacobian * G^1/2
298  if ( .not. prc_twod ) then
299  !$omp parallel do
300  do j = 1, ja
301  do i = 2, ia
302  do k = 1, ka
307  enddo
308  enddo
309  enddo
310  !$omp parallel do
311  do j = 1, ja
312  do i = 1, ia-1
313  do k = 1, ka
317  enddo
318  enddo
319  enddo
320  end if
321 
322  !$omp parallel do
323  do j = 2, ja-1
324  do i = 1, ia
325  do k = 1, ka
330  enddo
331  enddo
332  enddo
333  if ( .not. prc_twod ) then
334  !$omp parallel do
335  do j = 2, ja-1
336  do i = 1, ia
337  do k = 1, ka
341  enddo
342  enddo
343  enddo
344  end if
345 
346  atmos_grid_cartesc_metric_j33g = 1.0_rp ! - 1 / G^1/2 * G^1/2
347 
348  if ( .not. prc_twod ) then
349  call comm_vars8( atmos_grid_cartesc_metric_j13g(:,:,:,i_xyz), 8 )
350  call comm_vars8( atmos_grid_cartesc_metric_j13g(:,:,:,i_xyw), 9 )
351  call comm_vars8( atmos_grid_cartesc_metric_j13g(:,:,:,i_xvw), 10 )
352  call comm_vars8( atmos_grid_cartesc_metric_j13g(:,:,:,i_xvz), 11 )
353  call comm_vars8( atmos_grid_cartesc_metric_j13g(:,:,:,i_uyw), 12 )
354  call comm_vars8( atmos_grid_cartesc_metric_j13g(:,:,:,i_uyz), 13 )
355  call comm_vars8( atmos_grid_cartesc_metric_j13g(:,:,:,i_uvz), 14 )
356  call comm_wait ( atmos_grid_cartesc_metric_j13g(:,:,:,i_xyz), 8, .false. )
357  call comm_wait ( atmos_grid_cartesc_metric_j13g(:,:,:,i_xyw), 9, .false. )
358  call comm_wait ( atmos_grid_cartesc_metric_j13g(:,:,:,i_xvw), 10, .false. )
359  call comm_wait ( atmos_grid_cartesc_metric_j13g(:,:,:,i_xvz), 11, .false. )
360  call comm_wait ( atmos_grid_cartesc_metric_j13g(:,:,:,i_uyw), 12, .false. )
361  call comm_wait ( atmos_grid_cartesc_metric_j13g(:,:,:,i_uyz), 13, .false. )
362  call comm_wait ( atmos_grid_cartesc_metric_j13g(:,:,:,i_uvz), 14, .false. )
363  end if
364 
365  call comm_vars8( atmos_grid_cartesc_metric_j23g(:,:,:,i_xyz), 15 )
366  call comm_vars8( atmos_grid_cartesc_metric_j23g(:,:,:,i_xyw), 16 )
367  call comm_vars8( atmos_grid_cartesc_metric_j23g(:,:,:,i_xvw), 17 )
368  call comm_vars8( atmos_grid_cartesc_metric_j23g(:,:,:,i_xvz), 18 )
369  if ( .not. prc_twod ) then
370  call comm_vars8( atmos_grid_cartesc_metric_j23g(:,:,:,i_uyw), 19 )
371  call comm_vars8( atmos_grid_cartesc_metric_j23g(:,:,:,i_uyz), 20 )
372  call comm_vars8( atmos_grid_cartesc_metric_j23g(:,:,:,i_uvz), 21 )
373  end if
374  call comm_wait ( atmos_grid_cartesc_metric_j23g(:,:,:,i_xyz), 15, .false. )
375  call comm_wait ( atmos_grid_cartesc_metric_j23g(:,:,:,i_xyw), 16, .false. )
376  call comm_wait ( atmos_grid_cartesc_metric_j23g(:,:,:,i_xvw), 17, .false. )
377  call comm_wait ( atmos_grid_cartesc_metric_j23g(:,:,:,i_xvz), 18, .false. )
378  if ( .not. prc_twod ) then
379  call comm_wait ( atmos_grid_cartesc_metric_j23g(:,:,:,i_uyw), 19, .false. )
380  call comm_wait ( atmos_grid_cartesc_metric_j23g(:,:,:,i_uyz), 20, .false. )
381  call comm_wait ( atmos_grid_cartesc_metric_j23g(:,:,:,i_uvz), 21, .false. )
382  endif
383 
384  return
385  end subroutine atmos_grid_cartesc_metric_terrainfollowing
386 
387  !-----------------------------------------------------------------------------
388  subroutine atmos_grid_cartesc_metric_thin_wall
389  use scale_prc, only: &
390  prc_abort
391  use scale_atmos_grid_cartesc, only: &
398  use scale_topography, only : &
400  use scale_comm_cartesc, only : &
401  comm_vars8, &
402  comm_wait
403  implicit none
404 
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)
410 
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)
415  real(RP) :: AQAF (3)
416  real(RP) :: XSLOPE, YSLOPE
417  real(RP) :: Ztop
418  real(RP) :: DX_piece, DY_piece
419  real(RP) :: DX, DY, DZ
420 
421  integer :: I_QLIMtoLIM(3,7)
422 
423  integer :: iii, jjj, n
424  integer :: k, i, j, kk, ii, jj
425  !---------------------------------------------------------------------------
426 
427  ! calc absolute height at staggered position
428  ! at (x,y)
429  do j = 1, ja
430  do i = 1, ia
431  topo_zsfcxy(i,j) = topography_zsfc(i,j)
432  enddo
433  enddo
434  ! at (u,y)
435  do j = 1, ja
436  do i = 1, ia-1
437  topo_zsfcuy(i,j) = 0.5_rp * ( topography_zsfc(i,j) + topography_zsfc(i+1,j) )
438  enddo
439  enddo
440  ! at (x,v)
441  do j = 1, ja-1
442  do i = 1, ia
443  topo_zsfcxv(i,j) = 0.5_rp * ( topography_zsfc(i,j) + topography_zsfc(i,j+1) )
444  enddo
445  enddo
446  ! at (u,v)
447  do j = 1, ja-1
448  do i = 1, ia-1
449  topo_zsfcuv(i,j) = 0.25_rp * ( topography_zsfc(i ,j ) + topography_zsfc(i ,j+1) &
450  + topography_zsfc(i ,j+1) + topography_zsfc(i+1,j+1) )
451  enddo
452  enddo
453 
454  ! reset topography
455  topography_zsfc(:,:) = 0.d0
456 
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 )
465 
466  ! all height
467  do j = 1, ja
468  do i = 1, ia
469  ii = (i-1) * 2 + 1
470  jj = (j-1) * 2 + 1
471 
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)
476  enddo
477  enddo
478 
479  ! length of control volume of quarter cell
480  do k = 1, ka
481  kk = (k-1) * 2 + 1
482 
483  qdz(kk ) = atmos_grid_cartesc_cz(k) - atmos_grid_cartesc_fz(k-1)
484  qdz(kk+1) = atmos_grid_cartesc_fz(k) - atmos_grid_cartesc_cz(k )
485  enddo
486 
487  do i = 1, ia-1
488  ii = (i-1) * 2 + 1
489 
490  qdx(ii ) = atmos_grid_cartesc_fx(i ) - atmos_grid_cartesc_cx(i)
491  qdx(ii+1) = atmos_grid_cartesc_cx(i+1) - atmos_grid_cartesc_fx(i)
492  enddo
493 
494  do j = 1, ja-1
495  jj = (j-1) * 2 + 1
496 
497  qdy(jj ) = atmos_grid_cartesc_fy(j ) - atmos_grid_cartesc_cy(j)
498  qdy(jj+1) = atmos_grid_cartesc_cy(j+1) - atmos_grid_cartesc_fy(j)
499  enddo
500 
501  ! quarter flux limiter
502  do jj = 1, 2*(ja-1)
503  do ii = 1, 2*(ia-1)
504  do kk = ks, 2*ke
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)
507 
508  aqaf(1:3) = 0.0_rp
509  ztop = sum(qdz(ks:kk))
510 
511  !--- y-z face ---
512  yslope = ( topo_zsfcall(ii,jj+1) - topo_zsfcall(ii,jj) ) / qdy(jj)
513 
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
517 
518  if ( dz > 0.0_rp ) then
519  if ( dz < qdz(kk) ) then
520  aqaf(i_fyz) = aqaf(i_fyz) + dz * dy_piece
521  else
522  aqaf(i_fyz) = aqaf(i_fyz) + qdz(kk) * dy_piece
523  endif
524  endif
525  enddo
526 
527  !--- x-z face ---
528  xslope = ( topo_zsfcall(ii+1,jj) - topo_zsfcall(ii,jj) ) / qdx(ii)
529 
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
533 
534  if ( dz > 0.0_rp ) then
535  if ( dz < qdz(kk) ) then
536  aqaf(i_fxz) = aqaf(i_fxz) + dz * dx_piece
537  else
538  aqaf(i_fxz) = aqaf(i_fxz) + qdz(kk) * dx_piece
539  endif
540  endif
541  enddo
542 
543  !--- x-y face ---
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
549 
550  if ( dz > 0.0_rp ) then
551  aqaf(i_fxy) = aqaf(i_fxy) + dx_piece * dy_piece
552  endif
553  enddo
554  enddo
555 
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) )
559  enddo
560  enddo
561  enddo
562 
563  ! index i,j,k
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 /)
571 
572  do n = 1, 7
573  do j = js, je
574  do i = is, ie
575  do k = ks, ke
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)
579 
580  atmos_grid_cartesc_metric_limyz(k,i,j,n) = 0.25_rp * ( atmos_grid_cartesc_metric_qlim(kk ,ii,jj,i_fyz) + atmos_grid_cartesc_metric_qlim(kk ,ii ,jj+1,i_fyz) &
581  + atmos_grid_cartesc_metric_qlim(kk+1,ii,jj,i_fyz) + atmos_grid_cartesc_metric_qlim(kk+1,ii ,jj+1,i_fyz) )
582  atmos_grid_cartesc_metric_limxz(k,i,j,n) = 0.25_rp * ( atmos_grid_cartesc_metric_qlim(kk ,ii,jj,i_fxz) + atmos_grid_cartesc_metric_qlim(kk ,ii+1,jj ,i_fxz) &
583  + atmos_grid_cartesc_metric_qlim(kk+1,ii,jj,i_fxz) + atmos_grid_cartesc_metric_qlim(kk+1,ii+1,jj ,i_fxz) )
584  atmos_grid_cartesc_metric_limxy(k,i,j,n) = 0.25_rp * ( atmos_grid_cartesc_metric_qlim(kk ,ii,jj,i_fxy) + atmos_grid_cartesc_metric_qlim(kk ,ii+1,jj+1,i_fxy) &
585  + atmos_grid_cartesc_metric_qlim(kk ,ii,jj,i_fxy) + atmos_grid_cartesc_metric_qlim(kk ,ii+1,jj ,i_fxy) )
586 
587  if ( atmos_grid_cartesc_metric_limyz(k,i,j,n) > 1.d0 ) then
588  log_error("ATMOS_GRID_CARTESC_METRIC_thin_wall",*) 'Facter miss! Check!'
589  log_error_cont(*) k,i,j,n,atmos_grid_cartesc_metric_limyz(k,i,j,n)
590  call prc_abort
591  endif
592  enddo
593  enddo
594  enddo
595  enddo
596 
597  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_xyz), 1 )
598  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_xyw), 2 )
599  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_uyw), 3 )
600  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_xvw), 4 )
601  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_uyz), 5 )
602  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_xvz), 6 )
603  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_uvz), 7 )
604  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_xyz), 1 )
605  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_xyw), 2 )
606  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_uyw), 3 )
607  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_xvw), 4 )
608  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_uyz), 5 )
609  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_xvz), 6 )
610  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_uvz), 7 )
611 
612  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_xyz), 8 )
613  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_xyw), 9 )
614  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_uyw), 10 )
615  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_xvw), 11 )
616  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_uyz), 12 )
617  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_xvz), 13 )
618  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_uvz), 14 )
619  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_xyz), 8 )
620  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_xyw), 9 )
621  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_uyw), 10 )
622  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_xvw), 11 )
623  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_uyz), 12 )
624  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_xvz), 13 )
625  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_uvz), 14 )
626 
627  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_xyz), 15 )
628  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_xyw), 16 )
629  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_uyw), 17 )
630  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_xvw), 18 )
631  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_uyz), 19 )
632  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_xvz), 20 )
633  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_uvz), 21 )
634  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_xyz), 15 )
635  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_xyw), 16 )
636  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_uyw), 17 )
637  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_xvw), 18 )
638  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_uyz), 19 )
639  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_xvz), 20 )
640  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_uvz), 21 )
641 
642  return
643  end subroutine atmos_grid_cartesc_metric_thin_wall
644 
645  !-----------------------------------------------------------------------------
646  subroutine atmos_grid_cartesc_metric_step_mountain
647  use scale_comm_cartesc, only: &
648  comm_vars8, &
649  comm_wait
650  implicit none
651 
652  integer :: i,j,k,n
653  !---------------------------------------------------------------------------
654 
655  do n = 1, 7
656  do j = js, je
657  do i = is, ie
658  do k = ks, ke
659 
660  if ( atmos_grid_cartesc_metric_limyz(k,i,j,n) > 0.0_rp ) then
661  atmos_grid_cartesc_metric_limyz(k,i,j,n) = 1.0_rp
662  endif
663 
664  if ( atmos_grid_cartesc_metric_limxz(k,i,j,n) > 0.0_rp ) then
665  atmos_grid_cartesc_metric_limxz(k,i,j,n) = 1.0_rp
666  endif
667 
668  if ( atmos_grid_cartesc_metric_limxy(k,i,j,n) > 0.0_rp ) then
669  atmos_grid_cartesc_metric_limxy(k,i,j,n) = 1.0_rp
670  endif
671  enddo
672  enddo
673  enddo
674  enddo
675 
676  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_xyz), 1 )
677  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_xyw), 2 )
678  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_uyw), 3 )
679  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_xvw), 4 )
680  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_uyz), 5 )
681  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_xvz), 6 )
682  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_uvz), 7 )
683  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_xyz), 1 )
684  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_xyw), 2 )
685  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_uyw), 3 )
686  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_xvw), 4 )
687  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_uyz), 5 )
688  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_xvz), 6 )
689  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_uvz), 7 )
690 
691  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_xyz), 8 )
692  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_xyw), 9 )
693  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_uyw), 10 )
694  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_xvw), 11 )
695  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_uyz), 12 )
696  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_xvz), 13 )
697  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_uvz), 14 )
698  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_xyz), 8 )
699  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_xyw), 9 )
700  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_uyw), 10 )
701  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_xvw), 11 )
702  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_uyz), 12 )
703  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_xvz), 13 )
704  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_uvz), 14 )
705 
706  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_xyz), 15 )
707  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_xyw), 16 )
708  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_uyw), 17 )
709  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_xvw), 18 )
710  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_uyz), 19 )
711  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_xvz), 20 )
712  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_uvz), 21 )
713  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_xyz), 15 )
714  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_xyw), 16 )
715  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_uyw), 17 )
716  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_xvw), 18 )
717  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_uyz), 19 )
718  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_xvz), 20 )
719  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_uvz), 21 )
720 
721  return
722  end subroutine atmos_grid_cartesc_metric_step_mountain
723 
724  !-----------------------------------------------------------------------------
726  subroutine atmos_grid_cartesc_metric_write
727  use scale_prc_cartesc, only: &
728  prc_twod
729  use scale_const, only: &
731  use scale_vector, only: &
733  use scale_file_cartesc, only: &
734  file_cartesc_write
735  use scale_atmos_grid_cartesc_real, only: &
740  use scale_mapprojection, only: &
741  mapprojection_lonlat2xy
742  implicit none
743 
744  real(RP) :: check_X_XY(IA,JA)
745  real(RP) :: check_Y_XY(IA,JA)
746  real(RP) :: distance (IA,JA)
747 
748  integer :: i, j
749  !---------------------------------------------------------------------------
750 
751  if ( atmos_grid_cartesc_metric_out_basename /= '' ) then
752 
753  log_newline
754  log_info("ATMOS_GRID_CARTESC_METRIC_write",*) 'Output metrics file '
755 
756  call file_cartesc_write( atmos_grid_cartesc_metric_mapf(:,:,1,i_xy), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
757  'MAPF_X_XY', 'Map factor x-dir at XY', 'NIL', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
758  call file_cartesc_write( atmos_grid_cartesc_metric_mapf(:,:,2,i_xy), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
759  'MAPF_Y_XY', 'Map factor y-dir at XY', 'NIL', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
760  if ( .not. prc_twod ) &
761  call file_cartesc_write( atmos_grid_cartesc_metric_mapf(:,:,1,i_uy), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
762  'MAPF_X_UY', 'Map factor x-dir at UY', 'NIL', 'UY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
763  if ( .not. prc_twod ) &
764  call file_cartesc_write( atmos_grid_cartesc_metric_mapf(:,:,2,i_uy), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
765  'MAPF_Y_UY', 'Map factor y-dir at UY', 'NIL', 'UY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
766  call file_cartesc_write( atmos_grid_cartesc_metric_mapf(:,:,1,i_xv), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
767  'MAPF_X_XV', 'Map factor x-dir at XV', 'NIL', 'XV', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
768  call file_cartesc_write( atmos_grid_cartesc_metric_mapf(:,:,2,i_xv), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
769  'MAPF_Y_XV', 'Map factor y-dir at XV', 'NIL', 'XV', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
770  if ( .not. prc_twod ) &
771  call file_cartesc_write( atmos_grid_cartesc_metric_mapf(:,:,1,i_uv), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
772  'MAPF_X_UV', 'Map factor x-dir at UV', 'NIL', 'UV', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
773  if ( .not. prc_twod ) &
774  call file_cartesc_write( atmos_grid_cartesc_metric_mapf(:,:,2,i_uv), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
775  'MAPF_Y_UV', 'Map factor y-dir at UV', 'NIL', 'UV', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
776 
777  call file_cartesc_write( atmos_grid_cartesc_metric_rotc(:,:,1), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
778  'ROTC_COS', 'Rotation factor (cos)', 'NIL', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
779  call file_cartesc_write( atmos_grid_cartesc_metric_rotc(:,:,2), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
780  'ROTC_SIN', 'Rotation factor (sin)', 'NIL', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
781 
782  call file_cartesc_write( atmos_grid_cartesc_metric_rotc(:,:,1), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
783  'ROTC_COS', 'Rotation factor (cos)', 'NIL', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
784 
785  do j = 1, ja
786  do i = 1, ia
787  call mapprojection_lonlat2xy( atmos_grid_cartesc_real_lon(i,j), atmos_grid_cartesc_real_lat(i,j), check_x_xy(i,j), check_y_xy(i,j) )
788  enddo
789  enddo
790 
791  call file_cartesc_write( check_x_xy(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
792  'X_XY', 'x at XY for check', 'NIL', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
793  call file_cartesc_write( check_y_xy(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
794  'Y_XY', 'y at XY for check', 'NIL', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
795 
796  do j = 1, ja
797  do i = 1, ia
798  call vectr_distance( const_radius, & ! [IN]
801  atmos_grid_cartesc_real_lon(i,j), & ! [IN]
802  atmos_grid_cartesc_real_lat(i,j), & ! [IN]
803  distance(i,j) ) ! [OUT]
804  enddo
805  enddo
806 
807  call file_cartesc_write( distance(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
808  'distance', 'distance from basepoint', 'm', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
809 
810 
811  ! metrics for terrain-following coordinate
812  call file_cartesc_write( atmos_grid_cartesc_metric_gsqrt(:,:,:,i_xyz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
813  'GSQRT_ZXY', 'transformation metrics from Z to Xi, G^1/2 at ZXY', '1', 'ZXY', & ! [IN]
814  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
815  call file_cartesc_write( atmos_grid_cartesc_metric_gsqrt(:,:,:,i_xyw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
816  'GSQRT_WXY', 'transformation metrics from Z to Xi, G^1/2 at WXY', '1', 'ZHXY', & ! [IN]
817  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
818  if ( .not. prc_twod ) &
819  call file_cartesc_write( atmos_grid_cartesc_metric_gsqrt(:,:,:,i_uyw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
820  'GSQRT_WUY', 'transformation metrics from Z to Xi, G^1/2 at WUY', '1', 'ZHXHY', & ! [IN]
821  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
822  call file_cartesc_write( atmos_grid_cartesc_metric_gsqrt(:,:,:,i_xvw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
823  'GSQRT_WXV', 'transformation metrics from Z to Xi, G^1/2 at WXV', '1', 'ZHXYH', & ! [IN]
824  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
825  if ( .not. prc_twod ) &
826  call file_cartesc_write( atmos_grid_cartesc_metric_gsqrt(:,:,:,i_uyz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
827  'GSQRT_ZUY', 'transformation metrics from Z to Xi, G^1/2 at ZUY', '1', 'ZXHY', & ! [IN]
828  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
829  call file_cartesc_write( atmos_grid_cartesc_metric_gsqrt(:,:,:,i_xvz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
830  'GSQRT_ZXV', 'transformation metrics from Z to Xi, G^1/2 at ZXV', '1', 'ZXYH', & ! [IN]
831  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
832  if ( .not. prc_twod ) &
833  call file_cartesc_write( atmos_grid_cartesc_metric_gsqrt(:,:,:,i_uvz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
834  'GSQRT_ZUV', 'transformation metrics from Z to Xi, G^1/2 at ZUV', '1', 'ZXHYH', & ! [IN]
835  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
836 
837  call file_cartesc_write( atmos_grid_cartesc_metric_j13g(:,:,:,i_xyz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
838  'J13G_ZXY', '(1,3) element of Jacobian matrix * {G}^1/2 at ZXY', '1', 'ZXY', & ![IN]
839  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
840  call file_cartesc_write( atmos_grid_cartesc_metric_j13g(:,:,:,i_xyw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
841  'J13G_WXY', '(1,3) element of Jacobian matrix * {G}^1/2 at WXY', '1', 'ZHXY', & ![IN]
842  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
843  if ( .not. prc_twod ) &
844  call file_cartesc_write( atmos_grid_cartesc_metric_j13g(:,:,:,i_uyw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
845  'J13G_WUY', '(1,3) element of Jacobian matrix * {G}^1/2 at WUY', '1', 'ZHXHY', & ![IN]
846  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
847  call file_cartesc_write( atmos_grid_cartesc_metric_j13g(:,:,:,i_xvw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
848  'J13G_WXV', '(1,3) element of Jacobian matrix * {G}^1/2 at WXV', '1', 'ZHXYH', & ![IN]
849  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
850  if ( .not. prc_twod ) &
851  call file_cartesc_write( atmos_grid_cartesc_metric_j13g(:,:,:,i_uyz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
852  'J13G_ZUY', '(1,3) element of Jacobian matrix * {G}^1/2 at ZUY', '1', 'ZXHY', & ![IN]
853  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
854  call file_cartesc_write( atmos_grid_cartesc_metric_j13g(:,:,:,i_xvz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
855  'J13G_ZXV', '(1,3) element of Jacobian matrix * {G}^1/2 at ZXV', '1', 'ZXYH', & ![IN]
856  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
857  if ( .not. prc_twod ) &
858  call file_cartesc_write( atmos_grid_cartesc_metric_j13g(:,:,:,i_uvz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
859  'J13G_ZUV', '(1,3) element of Jacobian matrix * {G}^1/2 at ZUV', '1', 'ZXHYH', & ![IN]
860  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
861 
862  call file_cartesc_write( atmos_grid_cartesc_metric_j23g(:,:,:,i_xyz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
863  'J23G_ZXY', '(2,3) element of Jacobian matrix * {G}^1/2 at ZXY', '1', 'ZXY', & ![IN]
864  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
865  call file_cartesc_write( atmos_grid_cartesc_metric_j23g(:,:,:,i_xyw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
866  'J23G_WXY', '(2,3) element of Jacobian matrix * {G}^1/2 at WXY', '1', 'ZHXY', & ![IN]
867  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
868  if ( .not. prc_twod ) &
869  call file_cartesc_write( atmos_grid_cartesc_metric_j23g(:,:,:,i_uyw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
870  'J23G_WUY', '(2,3) element of Jacobian matrix * {G}^1/2 at WUY', '1', 'ZHXHY', & ![IN]
871  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
872  call file_cartesc_write( atmos_grid_cartesc_metric_j23g(:,:,:,i_xvw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
873  'J23G_WXV', '(2,3) element of Jacobian matrix * {G}^1/2 at WXV', '1', 'ZHXYH', & ![IN]
874  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
875  if ( .not. prc_twod ) &
876  call file_cartesc_write( atmos_grid_cartesc_metric_j23g(:,:,:,i_uyz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
877  'J23G_ZUY', '(2,3) element of Jacobian matrix * {G}^1/2 at ZUY', '1', 'ZXHY', & ![IN]
878  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
879  call file_cartesc_write( atmos_grid_cartesc_metric_j23g(:,:,:,i_xvz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
880  'J23G_ZXV', '(2,3) element of Jacobian matrix * {G}^1/2 at ZXV', '1', 'ZXYH', & ![IN]
881  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
882  if ( .not. prc_twod ) &
883  call file_cartesc_write( atmos_grid_cartesc_metric_j23g(:,:,:,i_uvz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
884  'J23G_ZUV', '(2,3) element of Jacobian matrix * {G}^1/2 at ZUV', '1', 'ZXHYH', & ![IN]
885  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
886 
887  endif
888 
889  return
890  end subroutine atmos_grid_cartesc_metric_write
891 
scale_atmos_grid_cartesc_index::i_uy
integer, public i_uy
Definition: scale_atmos_grid_cartesC_index.F90:99
scale_atmos_grid_cartesc_index::ke
integer, public ke
end point of inner domain: z, local
Definition: scale_atmos_grid_cartesC_index.F90:52
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_fzuy
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_fzuy
geopotential height [m] (wuy)
Definition: scale_atmos_grid_cartesC_real.F90:43
scale_atmos_grid_cartesc_index::i_xv
integer, public i_xv
Definition: scale_atmos_grid_cartesC_index.F90:100
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:342
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_cz
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_cz
geopotential height [m] (zxy)
Definition: scale_atmos_grid_cartesC_real.F90:38
scale_atmos_grid_cartesc::atmos_grid_cartesc_rfdx
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rfdx
reciprocal of face-dx
Definition: scale_atmos_grid_cartesC.F90:67
scale_topography::topography_calc_tan_slope
subroutine, public topography_calc_tan_slope(IA, IS, IE, JA, JS, JE, RCDX, RCDY, MAPF)
Definition: scale_topography.F90:231
scale_atmos_grid_cartesc_index::i_fxy
integer, public i_fxy
Definition: scale_atmos_grid_cartesC_index.F90:105
scale_precision
module PRECISION
Definition: scale_precision.F90:14
scale_atmos_grid_cartesc_index::ka
integer, public ka
Definition: scale_atmos_grid_cartesC_index.F90:47
scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_limxz
real(rp), dimension(:,:,:,:), allocatable, public atmos_grid_cartesc_metric_limxz
flux limiter x-z face
Definition: scale_atmos_grid_cartesC_metric.F90:43
scale_atmos_grid_cartesc_index::i_fyz
integer, public i_fyz
Definition: scale_atmos_grid_cartesC_index.F90:103
scale_atmos_grid_cartesc_index::i_uv
integer, public i_uv
Definition: scale_atmos_grid_cartesC_index.F90:101
scale_atmos_grid_cartesc::atmos_grid_cartesc_rcdx
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rcdx
reciprocal of center-dx
Definition: scale_atmos_grid_cartesC.F90:65
scale_atmos_grid_cartesc_metric
module Atmosphere Grid CartesianC metirc
Definition: scale_atmos_grid_cartesC_metric.F90:12
scale_atmos_grid_cartesc::atmos_grid_cartesc_fx
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fx
face coordinate [m]: x, local
Definition: scale_atmos_grid_cartesC.F90:57
scale_topography
module TOPOGRAPHY
Definition: scale_topography.F90:11
scale_atmos_grid_cartesc_index::i_fxz
integer, public i_fxz
Definition: scale_atmos_grid_cartesC_index.F90:104
scale_atmos_grid_cartesc::atmos_grid_cartesc_rcdz
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rcdz
reciprocal of center-dz
Definition: scale_atmos_grid_cartesC.F90:44
scale_atmos_grid_cartesc_real
module Atmosphere GRID CartesC Real(real space)
Definition: scale_atmos_grid_cartesC_real.F90:11
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_basepoint_lat
real(rp), public atmos_grid_cartesc_real_basepoint_lat
position of base point in real world [rad,-pi,pi]
Definition: scale_atmos_grid_cartesC_real.F90:36
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_czxv
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_czxv
geopotential height [m] (zxv)
Definition: scale_atmos_grid_cartesC_real.F90:40
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_lon
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lon
longitude [rad,0-2pi]
Definition: scale_atmos_grid_cartesC_real.F90:48
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_basepoint_lon
real(rp), public atmos_grid_cartesc_real_basepoint_lon
position of base point in real world [rad,0-2pi]
Definition: scale_atmos_grid_cartesC_real.F90:35
scale_atmos_grid_cartesc_index::i_xyz
integer, public i_xyz
Definition: scale_atmos_grid_cartesC_index.F90:90
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_vector::vectr_distance
subroutine, public vectr_distance(r, lon1, lat1, lon2, lat2, dist)
Get horizontal distance on the sphere.
Definition: scale_vector.F90:539
scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_mapf
real(rp), dimension(:,:,:,:), allocatable, public atmos_grid_cartesc_metric_mapf
map factor
Definition: scale_atmos_grid_cartesC_metric.F90:34
scale_atmos_grid_cartesc_index::i_xy
integer, public i_xy
Definition: scale_atmos_grid_cartesC_index.F90:98
scale_precision::rp
integer, parameter, public rp
Definition: scale_precision.F90:41
scale_mapprojection
module Map projection
Definition: scale_mapprojection.F90:12
scale_atmos_grid_cartesc_index::ie
integer, public ie
end point of inner domain: x, local
Definition: scale_atmos_grid_cartesC_index.F90:54
scale_atmos_grid_cartesc_index::i_uyz
integer, public i_uyz
Definition: scale_atmos_grid_cartesC_index.F90:94
scale_io
module STDIO
Definition: scale_io.F90:10
scale_atmos_grid_cartesc::atmos_grid_cartesc_rcdy
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rcdy
reciprocal of center-dy
Definition: scale_atmos_grid_cartesC.F90:66
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_fzxv
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_fzxv
geopotential height [m] (wxv)
Definition: scale_atmos_grid_cartesC_real.F90:44
scale_atmos_grid_cartesc_index::i_xvw
integer, public i_xvw
Definition: scale_atmos_grid_cartesC_index.F90:93
scale_atmos_grid_cartesc_index
module atmosphere / grid / cartesC index
Definition: scale_atmos_grid_cartesC_index.F90:12
scale_const
module CONSTANT
Definition: scale_const.F90:11
scale_atmos_grid_cartesc_index::ia
integer, public ia
Definition: scale_atmos_grid_cartesC_index.F90:48
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_czuv
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_czuv
geopotential height [m] (zuv)
Definition: scale_atmos_grid_cartesC_real.F90:41
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_latuv
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_latuv
latitude at staggered point (uv) [rad,-pi,pi]
Definition: scale_atmos_grid_cartesC_real.F90:55
scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_gsqrt
real(rp), dimension(:,:,:,:), allocatable, public atmos_grid_cartesc_metric_gsqrt
transformation metrics from Z to Xi, {G}^1/2
Definition: scale_atmos_grid_cartesC_metric.F90:37
scale_atmos_grid_cartesc_index::i_xvz
integer, public i_xvz
Definition: scale_atmos_grid_cartesC_index.F90:95
scale_atmos_grid_cartesc::atmos_grid_cartesc_fy
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fy
face coordinate [m]: y, local
Definition: scale_atmos_grid_cartesC.F90:58
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_latuy
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_latuy
latitude at staggered point (uy) [rad,-pi,pi]
Definition: scale_atmos_grid_cartesC_real.F90:53
scale_prc_cartesc
module process / cartesC
Definition: scale_prc_cartesC.F90:11
scale_prof
module profiler
Definition: scale_prof.F90:11
scale_atmos_grid_cartesc_index::i_uyw
integer, public i_uyw
Definition: scale_atmos_grid_cartesC_index.F90:92
scale_atmos_grid_cartesc_index::is
integer, public is
start point of inner domain: x, local
Definition: scale_atmos_grid_cartesC_index.F90:53
scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_j23g
real(rp), dimension(:,:,:,:), allocatable, public atmos_grid_cartesc_metric_j23g
(2,3) element of Jacobian matrix * {G}^1/2
Definition: scale_atmos_grid_cartesC_metric.F90:39
scale_atmos_grid_cartesc_index::ja
integer, public ja
Definition: scale_atmos_grid_cartesC_index.F90:49
scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_limxy
real(rp), dimension(:,:,:,:), allocatable, public atmos_grid_cartesc_metric_limxy
flux limiter x-y face
Definition: scale_atmos_grid_cartesC_metric.F90:44
scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_rotcoef
subroutine atmos_grid_cartesc_metric_rotcoef
Calculate rotation coeffient.
Definition: scale_atmos_grid_cartesC_metric.F90:200
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_latxv
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_latxv
latitude at staggered point (xv) [rad,-pi,pi]
Definition: scale_atmos_grid_cartesC_real.F90:54
scale_atmos_grid_cartesc_index::ks
integer, public ks
start point of inner domain: z, local
Definition: scale_atmos_grid_cartesC_index.F90:51
scale_topography::topography_zsfc
real(rp), dimension(:,:), allocatable, public topography_zsfc
absolute ground height [m]
Definition: scale_topography.F90:38
scale_atmos_grid_cartesc::atmos_grid_cartesc_fz
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fz
face coordinate [m]: z, local
Definition: scale_atmos_grid_cartesC.F90:41
scale_comm_cartesc
module COMMUNICATION
Definition: scale_comm_cartesC.F90:11
scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_setup
subroutine, public atmos_grid_cartesc_metric_setup
Setup.
Definition: scale_atmos_grid_cartesC_metric.F90:72
scale_const::const_radius
real(rp), public const_radius
radius of the planet [m]
Definition: scale_const.F90:44
scale_atmos_grid_cartesc_index::js
integer, public js
start point of inner domain: y, local
Definition: scale_atmos_grid_cartesC_index.F90:55
scale_atmos_grid_cartesc::atmos_grid_cartesc_cy
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cy
center coordinate [m]: y, local
Definition: scale_atmos_grid_cartesC.F90:56
scale_atmos_grid_cartesc::atmos_grid_cartesc_rfdz
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rfdz
reciprocal of face-dz
Definition: scale_atmos_grid_cartesC.F90:45
scale_vector
module vector
Definition: scale_vector.F90:11
scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_j33g
real(rp), public atmos_grid_cartesc_metric_j33g
(3,3) element of Jacobian matrix * {G}^1/2
Definition: scale_atmos_grid_cartesC_metric.F90:40
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_lat
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lat
latitude [rad,-pi,pi]
Definition: scale_atmos_grid_cartesC_real.F90:52
scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_j13g
real(rp), dimension(:,:,:,:), allocatable, public atmos_grid_cartesc_metric_j13g
(1,3) element of Jacobian matrix * {G}^1/2
Definition: scale_atmos_grid_cartesC_metric.F90:38
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_fz
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_fz
geopotential height [m] (wxy)
Definition: scale_atmos_grid_cartesC_real.F90:42
scale_atmos_grid_cartesc
module atmosphere / grid / cartesC
Definition: scale_atmos_grid_cartesC.F90:12
scale_atmos_grid_cartesc::atmos_grid_cartesc_cz
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cz
center coordinate [m]: z, local
Definition: scale_atmos_grid_cartesC.F90:40
scale_atmos_grid_cartesc_index::i_uvz
integer, public i_uvz
Definition: scale_atmos_grid_cartesC_index.F90:96
scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_limyz
real(rp), dimension(:,:,:,:), allocatable, public atmos_grid_cartesc_metric_limyz
flux limiter y-z face
Definition: scale_atmos_grid_cartesC_metric.F90:42
scale_atmos_grid_cartesc::atmos_grid_cartesc_rfdy
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_rfdy
reciprocal of face-dy
Definition: scale_atmos_grid_cartesC.F90:68
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_fzuv
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_fzuv
geopotential height [m] (wuv)
Definition: scale_atmos_grid_cartesC_real.F90:45
scale_io::io_fid_conf
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:56
scale_atmos_grid_cartesc_index::je
integer, public je
end point of inner domain: y, local
Definition: scale_atmos_grid_cartesC_index.F90:56
scale_prc_cartesc::prc_twod
logical, public prc_twod
2D experiment
Definition: scale_prc_cartesC.F90:55
scale_file_cartesc
module file / cartesianC
Definition: scale_file_cartesC.F90:11
scale_atmos_grid_cartesc::atmos_grid_cartesc_cx
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cx
center coordinate [m]: x, local
Definition: scale_atmos_grid_cartesC.F90:55
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_czuy
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_czuy
geopotential height [m] (zuy)
Definition: scale_atmos_grid_cartesC_real.F90:39
scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_rotc
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_metric_rotc
rotation coefficient
Definition: scale_atmos_grid_cartesC_metric.F90:35
scale_atmos_grid_cartesc_index::i_xyw
integer, public i_xyw
Definition: scale_atmos_grid_cartesC_index.F90:91