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  !
30 
31  !-----------------------------------------------------------------------------
32  !
33  !++ Public parameters & variables
34  !
35  real(rp), public, allocatable :: atmos_grid_cartesc_metric_mapf (:,:,:,:)
36  real(rp), public, allocatable :: atmos_grid_cartesc_metric_rotc (:,:,:)
37 
38  real(rp), public, allocatable :: atmos_grid_cartesc_metric_gsqrt(:,:,:,:)
39  real(rp), public, allocatable :: atmos_grid_cartesc_metric_j13g (:,:,:,:)
40  real(rp), public, allocatable :: atmos_grid_cartesc_metric_j23g (:,:,:,:)
42 
43  real(rp), public, allocatable :: atmos_grid_cartesc_metric_limyz(:,:,:,:)
44  real(rp), public, allocatable :: atmos_grid_cartesc_metric_limxz(:,:,:,:)
45  real(rp), public, allocatable :: atmos_grid_cartesc_metric_limxy(:,:,:,:)
46 
47  !-----------------------------------------------------------------------------
48  !
49  !++ Private procedure
50  !
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
56 
57  !-----------------------------------------------------------------------------
58  !
59  !++ Private parameters & variables
60  !
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'
64 
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
68  !-----------------------------------------------------------------------------
69 contains
70  !-----------------------------------------------------------------------------
73  use scale_prc, only: &
74  prc_abort
75  use scale_prc_cartesc, only: &
76  prc_twod
77  implicit none
78 
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
85 
86  integer :: ierr
87  !---------------------------------------------------------------------------
88 
89  log_newline
90  log_info("ATMOS_GRID_CARTESC_METRIC_setup",*) 'Setup'
91 
92  !--- read namelist
93  rewind(io_fid_conf)
94  read(io_fid_conf,nml=param_atmos_grid_cartesc_metric,iostat=ierr)
95  if( ierr < 0 ) then !--- missing
96  log_info("ATMOS_GRID_CARTESC_METRIC_setup",*) 'Not found namelist. Default used.'
97  elseif( ierr > 0 ) then !--- fatal error
98  log_error("ATMOS_GRID_CARTESC_METRIC_setup",*) 'Not appropriate names in namelist PARAM_ATMOS_GRID_CARTESC_METRIC. Check!'
99  call prc_abort
100  endif
101  log_nml(param_atmos_grid_cartesc_metric)
102 
103  allocate( atmos_grid_cartesc_metric_mapf(ia,ja,2,4) )
104  atmos_grid_cartesc_metric_mapf(:,:,:,:) = 1.0_rp
105  !$acc enter data copyin(ATMOS_GRID_CARTESC_METRIC_MAPF) async
106 
107  allocate( atmos_grid_cartesc_metric_rotc(ia,ja,2) )
108  atmos_grid_cartesc_metric_rotc(:,:,1) = 1.0_rp
109  atmos_grid_cartesc_metric_rotc(:,:,1) = 0.0_rp
110  !$acc enter data copyin(ATMOS_GRID_CARTESC_METRIC_ROTC) async
111 
112  if ( prc_twod ) then
113  allocate( atmos_grid_cartesc_metric_gsqrt(ka,ia,ja,4) )
114  allocate( atmos_grid_cartesc_metric_j13g(ka,ia,ja,4) )
115  allocate( atmos_grid_cartesc_metric_j23g(ka,ia,ja,4) )
116  else
117  allocate( atmos_grid_cartesc_metric_gsqrt(ka,ia,ja,7) )
118  allocate( atmos_grid_cartesc_metric_j13g(ka,ia,ja,7) )
119  allocate( atmos_grid_cartesc_metric_j23g(ka,ia,ja,7) )
120  end if
121 
122  atmos_grid_cartesc_metric_gsqrt(:,:,:,:) = 1.0_rp
123  atmos_grid_cartesc_metric_j13g(:,:,:,:) = 0.0_rp
124  atmos_grid_cartesc_metric_j23g(:,:,:,:) = 0.0_rp
126  !$acc enter data copyin(ATMOS_GRID_CARTESC_METRIC_GSQRT, ATMOS_GRID_CARTESC_METRIC_J13G, ATMOS_GRID_CARTESC_METRIC_J23G, ATMOS_GRID_CARTESC_METRIC_J33G) async
127 
128  allocate( atmos_grid_cartesc_metric_limyz(ka,ia,ja,7) )
129  allocate( atmos_grid_cartesc_metric_limxz(ka,ia,ja,7) )
130  allocate( atmos_grid_cartesc_metric_limxy(ka,ia,ja,7) )
131  atmos_grid_cartesc_metric_limyz(:,:,:,:) = 1.0_rp
132  atmos_grid_cartesc_metric_limxz(:,:,:,:) = 1.0_rp
133  atmos_grid_cartesc_metric_limxy(:,:,:,:) = 1.0_rp
134 ! !$acc enter data copyin(ATMOS_GRID_CARTESC_METRIC_LIMYZ, ATMOS_GRID_CARTESC_METRIC_LIMXZ, ATMOS_GRID_CARTESC_METRIC_LIMXY) async
135 
136  ! calc metrics for orthogonal curvelinear coordinate
137  call atmos_grid_cartesc_metric_mapfactor
138 
139  ! calc coeficient for rotaion of velocity vector
141 
142  ! calc metrics for terrain-following,step-mountain,thin-wall coordinate
143  log_newline
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
149  case('STEPMOUNTAIN')
150  log_info_cont(*) '=> Step-mountain method'
151  call atmos_grid_cartesc_metric_thin_wall
152  call atmos_grid_cartesc_metric_step_mountain
153  case('THINWALL')
154  log_info_cont(*) '=> Thin-wall approximation method'
155  call atmos_grid_cartesc_metric_thin_wall
156  case default
157  log_error("ATMOS_GRID_CARTESC_METRIC_setup",*) 'Unsupported ATMOS_GRID_CARTESC_METRIC_TOPO_type. STOP'
158  call prc_abort
159  end select
160 
161  !$acc wait
162 
163  ! output metrics (for debug)
164  call atmos_grid_cartesc_metric_write
165 
166  return
167  end subroutine atmos_grid_cartesc_metric_setup
168 
169  !-----------------------------------------------------------------------------
172  use scale_prc_cartesc, only: &
173  prc_twod
174  implicit none
175  !---------------------------------------------------------------------------
176 
177  log_newline
178  log_info("ATMOS_GRID_CARTESC_METRIC_finalize",*) 'Finalize'
179 
180  !$acc exit data delete(ATMOS_GRID_CARTESC_METRIC_MAPF)
181  deallocate( atmos_grid_cartesc_metric_mapf )
182 
183  !$acc exit data delete(ATMOS_GRID_CARTESC_METRIC_ROTC)
184  deallocate( atmos_grid_cartesc_metric_rotc )
185 
186  !$acc exit data delete(ATMOS_GRID_CARTESC_METRIC_GSQRT, ATMOS_GRID_CARTESC_METRIC_J13G, ATMOS_GRID_CARTESC_METRIC_J23G)
187  if ( prc_twod ) then
188  deallocate( atmos_grid_cartesc_metric_gsqrt )
189  deallocate( atmos_grid_cartesc_metric_j13g )
190  deallocate( atmos_grid_cartesc_metric_j23g )
191  else
192  deallocate( atmos_grid_cartesc_metric_gsqrt )
193  deallocate( atmos_grid_cartesc_metric_j13g )
194  deallocate( atmos_grid_cartesc_metric_j23g )
195  end if
196 
197  deallocate( atmos_grid_cartesc_metric_limyz )
198  deallocate( atmos_grid_cartesc_metric_limxz )
199  deallocate( atmos_grid_cartesc_metric_limxy )
200 
201  return
203 
204  !-----------------------------------------------------------------------------
206  subroutine atmos_grid_cartesc_metric_mapfactor
207  use scale_prc_cartesc, only: &
208  prc_twod
209  use scale_mapprojection, only: &
210  mapprojection_mapfactor
211  use scale_atmos_grid_cartesc, only: &
214  use scale_atmos_grid_cartesc_real, only: &
219  use scale_topography, only: &
221  implicit none
222  real(rp) :: work(ia,ja)
223  integer :: i, j
224  !---------------------------------------------------------------------------
225 
226  call mapprojection_mapfactor( ia, 1, ia, ja, 1, ja, &
228 
229  !$omp parallel do
230  do j = 1, ja
231  do i = 1, ia
232  work(i,j) = atmos_grid_cartesc_real_latxv(i,j)
233  end do
234  end do
235  call mapprojection_mapfactor( ia, 1, ia, ja, 1, ja, &
237 
238  if ( .not. prc_twod ) then
239  !$omp parallel do
240  do j = 1, ja
241  do i = 1, ia
242  work(i,j) = atmos_grid_cartesc_real_latuy(i,j)
243  end do
244  end do
245  call mapprojection_mapfactor( ia, 1, ia, ja, 1, ja, &
247 
248  !$omp parallel do
249  do j = 1, ja
250  do i = 1, ia
251  work(i,j) = atmos_grid_cartesc_real_latuv(i,j)
252  end do
253  end do
254  call mapprojection_mapfactor( ia, 1, ia, ja, 1, ja, &
256 
257  end if
258 
259  !$acc update device(ATMOS_GRID_CARTESC_METRIC_MAPF)
260 
261  call topography_calc_tan_slope( ia, is, ie, ja, js, je, &
264 
265  return
266  end subroutine atmos_grid_cartesc_metric_mapfactor
267 
268  !-----------------------------------------------------------------------------
271  use scale_mapprojection, only: &
272  mapprojection_rotcoef
273  use scale_atmos_grid_cartesc_real, only: &
276  implicit none
277  !---------------------------------------------------------------------------
278 
279  call mapprojection_rotcoef( ia, 1, ia, ja, 1, ja, &
280  atmos_grid_cartesc_real_lon(:,:), & ! [IN]
281  atmos_grid_cartesc_real_lat(:,:), & ! [IN]
282  atmos_grid_cartesc_metric_rotc(:,:,1), & ! [OUT]
283  atmos_grid_cartesc_metric_rotc(:,:,2) ) ! [OUT]
284 
285  !$acc update device(ATMOS_GRID_CARTESC_METRIC_ROTC)
286 
287  return
288  end subroutine atmos_grid_cartesc_metric_rotcoef
289 
290  !-----------------------------------------------------------------------------
292  subroutine atmos_grid_cartesc_metric_terrainfollowing
293  use scale_prc_cartesc, only: &
294  prc_twod
295  use scale_atmos_grid_cartesc, only: &
302  use scale_atmos_grid_cartesc_real, only: &
311  use scale_comm_cartesc, only: &
312  comm_vars8, &
313  comm_wait
314  implicit none
315 
316  integer :: k, i, j
317  integer :: i_start, i_end
318  !---------------------------------------------------------------------------
319 
320  ! G^1/2
321  !$omp parallel do
322  do j = 1, ja
323  do i = 1, ia
324  ! at (x,y,z)
325  do k = 1, ka
327  enddo
328 
329  ! at (x,y,w)
330  do k = 1, ka-1
332  enddo
334 
335  ! at (x,v,w)
336  do k = 1, ka-1
338  enddo
340 
341  ! at (x,v,z)
342  do k = 1, ka
344  enddo
345  enddo
346  enddo
347  if ( .not. prc_twod ) then
348  !$omp parallel do
349  do j = 1, ja
350  do i = 1, ia
351  ! at (u,y,w)
352  do k = 1, ka-1
354  enddo
356 
357  ! at (u,y,z)
358  do k = 1, ka
360  enddo
361 
362  ! at (u,v,z)
363  do k = 1, ka
365  enddo
366  enddo
367  enddo
368  end if
369 
370  ! Jacobian * G^1/2
371  if ( .not. prc_twod ) then
372  !$omp parallel do
373  do j = 1, ja
374  do i = 2, ia
375  do k = 1, ka
380  enddo
381  enddo
382  enddo
383  !$omp parallel do
384  do j = 1, ja
385  do i = 1, ia-1
386  do k = 1, ka
390  enddo
391  enddo
392  enddo
393  end if
394 
395  !$omp parallel do
396  do j = 2, ja-1
397  do i = 1, ia
398  do k = 1, ka
403  enddo
404  enddo
405  enddo
406  if ( .not. prc_twod ) then
407  !$omp parallel do
408  do j = 2, ja-1
409  do i = 1, ia
410  do k = 1, ka
414  enddo
415  enddo
416  enddo
417  end if
418 
419  atmos_grid_cartesc_metric_j33g = 1.0_rp ! - 1 / G^1/2 * G^1/2
420 
421  !$acc update device(ATMOS_GRID_CARTESC_METRIC_GSQRT)
422  !$acc update device(ATMOS_GRID_CARTESC_METRIC_J13G,ATMOS_GRID_CARTESC_METRIC_J23G,ATMOS_GRID_CARTESC_METRIC_J33G)
423 
424 
425  if ( .not. prc_twod ) then
426  call comm_vars8( atmos_grid_cartesc_metric_j13g(:,:,:,i_xyz), 8 )
427  call comm_vars8( atmos_grid_cartesc_metric_j13g(:,:,:,i_xyw), 9 )
428  call comm_vars8( atmos_grid_cartesc_metric_j13g(:,:,:,i_xvw), 10 )
429  call comm_vars8( atmos_grid_cartesc_metric_j13g(:,:,:,i_xvz), 11 )
430  call comm_vars8( atmos_grid_cartesc_metric_j13g(:,:,:,i_uyw), 12 )
431  call comm_vars8( atmos_grid_cartesc_metric_j13g(:,:,:,i_uyz), 13 )
432  call comm_vars8( atmos_grid_cartesc_metric_j13g(:,:,:,i_uvz), 14 )
433  call comm_wait ( atmos_grid_cartesc_metric_j13g(:,:,:,i_xyz), 8, .false. )
434  call comm_wait ( atmos_grid_cartesc_metric_j13g(:,:,:,i_xyw), 9, .false. )
435  call comm_wait ( atmos_grid_cartesc_metric_j13g(:,:,:,i_xvw), 10, .false. )
436  call comm_wait ( atmos_grid_cartesc_metric_j13g(:,:,:,i_xvz), 11, .false. )
437  call comm_wait ( atmos_grid_cartesc_metric_j13g(:,:,:,i_uyw), 12, .false. )
438  call comm_wait ( atmos_grid_cartesc_metric_j13g(:,:,:,i_uyz), 13, .false. )
439  call comm_wait ( atmos_grid_cartesc_metric_j13g(:,:,:,i_uvz), 14, .false. )
440  end if
441 
442  call comm_vars8( atmos_grid_cartesc_metric_j23g(:,:,:,i_xyz), 15 )
443  call comm_vars8( atmos_grid_cartesc_metric_j23g(:,:,:,i_xyw), 16 )
444  call comm_vars8( atmos_grid_cartesc_metric_j23g(:,:,:,i_xvw), 17 )
445  call comm_vars8( atmos_grid_cartesc_metric_j23g(:,:,:,i_xvz), 18 )
446  if ( .not. prc_twod ) then
447  call comm_vars8( atmos_grid_cartesc_metric_j23g(:,:,:,i_uyw), 19 )
448  call comm_vars8( atmos_grid_cartesc_metric_j23g(:,:,:,i_uyz), 20 )
449  call comm_vars8( atmos_grid_cartesc_metric_j23g(:,:,:,i_uvz), 21 )
450  end if
451  call comm_wait ( atmos_grid_cartesc_metric_j23g(:,:,:,i_xyz), 15, .false. )
452  call comm_wait ( atmos_grid_cartesc_metric_j23g(:,:,:,i_xyw), 16, .false. )
453  call comm_wait ( atmos_grid_cartesc_metric_j23g(:,:,:,i_xvw), 17, .false. )
454  call comm_wait ( atmos_grid_cartesc_metric_j23g(:,:,:,i_xvz), 18, .false. )
455  if ( .not. prc_twod ) then
456  call comm_wait ( atmos_grid_cartesc_metric_j23g(:,:,:,i_uyw), 19, .false. )
457  call comm_wait ( atmos_grid_cartesc_metric_j23g(:,:,:,i_uyz), 20, .false. )
458  call comm_wait ( atmos_grid_cartesc_metric_j23g(:,:,:,i_uvz), 21, .false. )
459  endif
460 
461  return
462  end subroutine atmos_grid_cartesc_metric_terrainfollowing
463 
464  !-----------------------------------------------------------------------------
465  subroutine atmos_grid_cartesc_metric_thin_wall
466  use scale_prc, only: &
467  prc_abort
468  use scale_atmos_grid_cartesc, only: &
475  use scale_topography, only : &
477  use scale_comm_cartesc, only : &
478  comm_vars8, &
479  comm_wait
480  implicit none
481 
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)
487 
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)
492  real(RP) :: AQAF (3)
493  real(RP) :: XSLOPE, YSLOPE
494  real(RP) :: Ztop
495  real(RP) :: DX_piece, DY_piece
496  real(RP) :: DX, DY, DZ
497 
498  integer :: I_QLIMtoLIM(3,7)
499 
500  integer :: iii, jjj, n
501  integer :: k, i, j, kk, ii, jj
502  !---------------------------------------------------------------------------
503 
504  ! calc absolute height at staggered position
505  ! at (x,y)
506  do j = 1, ja
507  do i = 1, ia
508  topo_zsfcxy(i,j) = topography_zsfc(i,j)
509  enddo
510  enddo
511  ! at (u,y)
512  do j = 1, ja
513  do i = 1, ia-1
514  topo_zsfcuy(i,j) = 0.5_rp * ( topography_zsfc(i,j) + topography_zsfc(i+1,j) )
515  enddo
516  enddo
517  ! at (x,v)
518  do j = 1, ja-1
519  do i = 1, ia
520  topo_zsfcxv(i,j) = 0.5_rp * ( topography_zsfc(i,j) + topography_zsfc(i,j+1) )
521  enddo
522  enddo
523  ! at (u,v)
524  do j = 1, ja-1
525  do i = 1, ia-1
526  topo_zsfcuv(i,j) = 0.25_rp * ( topography_zsfc(i ,j ) + topography_zsfc(i ,j+1) &
527  + topography_zsfc(i ,j+1) + topography_zsfc(i+1,j+1) )
528  enddo
529  enddo
530 
531  ! reset topography
532  topography_zsfc(:,:) = 0.d0
533 
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 )
542 
543  ! all height
544  do j = 1, ja
545  do i = 1, ia
546  ii = (i-1) * 2 + 1
547  jj = (j-1) * 2 + 1
548 
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)
553  enddo
554  enddo
555 
556  ! length of control volume of quarter cell
557  do k = 1, ka
558  kk = (k-1) * 2 + 1
559 
560  qdz(kk ) = atmos_grid_cartesc_cz(k) - atmos_grid_cartesc_fz(k-1)
561  qdz(kk+1) = atmos_grid_cartesc_fz(k) - atmos_grid_cartesc_cz(k )
562  enddo
563 
564  do i = 1, ia-1
565  ii = (i-1) * 2 + 1
566 
567  qdx(ii ) = atmos_grid_cartesc_fx(i ) - atmos_grid_cartesc_cx(i)
568  qdx(ii+1) = atmos_grid_cartesc_cx(i+1) - atmos_grid_cartesc_fx(i)
569  enddo
570 
571  do j = 1, ja-1
572  jj = (j-1) * 2 + 1
573 
574  qdy(jj ) = atmos_grid_cartesc_fy(j ) - atmos_grid_cartesc_cy(j)
575  qdy(jj+1) = atmos_grid_cartesc_cy(j+1) - atmos_grid_cartesc_fy(j)
576  enddo
577 
578  ! quarter flux limiter
579  do jj = 1, 2*(ja-1)
580  do ii = 1, 2*(ia-1)
581  do kk = ks, 2*ke
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)
584 
585  aqaf(1:3) = 0.0_rp
586  ztop = sum(qdz(ks:kk))
587 
588  !--- y-z face ---
589  yslope = ( topo_zsfcall(ii,jj+1) - topo_zsfcall(ii,jj) ) / qdy(jj)
590 
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
594 
595  if ( dz > 0.0_rp ) then
596  if ( dz < qdz(kk) ) then
597  aqaf(i_fyz) = aqaf(i_fyz) + dz * dy_piece
598  else
599  aqaf(i_fyz) = aqaf(i_fyz) + qdz(kk) * dy_piece
600  endif
601  endif
602  enddo
603 
604  !--- x-z face ---
605  xslope = ( topo_zsfcall(ii+1,jj) - topo_zsfcall(ii,jj) ) / qdx(ii)
606 
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
610 
611  if ( dz > 0.0_rp ) then
612  if ( dz < qdz(kk) ) then
613  aqaf(i_fxz) = aqaf(i_fxz) + dz * dx_piece
614  else
615  aqaf(i_fxz) = aqaf(i_fxz) + qdz(kk) * dx_piece
616  endif
617  endif
618  enddo
619 
620  !--- x-y face ---
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
626 
627  if ( dz > 0.0_rp ) then
628  aqaf(i_fxy) = aqaf(i_fxy) + dx_piece * dy_piece
629  endif
630  enddo
631  enddo
632 
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) )
636  enddo
637  enddo
638  enddo
639 
640  ! index i,j,k
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 /)
648 
649  do n = 1, 7
650  do j = js, je
651  do i = is, ie
652  do k = ks, ke
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)
656 
657  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) &
658  + atmos_grid_cartesc_metric_qlim(kk+1,ii,jj,i_fyz) + atmos_grid_cartesc_metric_qlim(kk+1,ii ,jj+1,i_fyz) )
659  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) &
660  + atmos_grid_cartesc_metric_qlim(kk+1,ii,jj,i_fxz) + atmos_grid_cartesc_metric_qlim(kk+1,ii+1,jj ,i_fxz) )
661  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) &
662  + atmos_grid_cartesc_metric_qlim(kk ,ii,jj,i_fxy) + atmos_grid_cartesc_metric_qlim(kk ,ii+1,jj ,i_fxy) )
663 
664  if ( atmos_grid_cartesc_metric_limyz(k,i,j,n) > 1.d0 ) then
665  log_error("ATMOS_GRID_CARTESC_METRIC_thin_wall",*) 'Facter miss! Check!'
666  log_error_cont(*) k,i,j,n,atmos_grid_cartesc_metric_limyz(k,i,j,n)
667  call prc_abort
668  endif
669  enddo
670  enddo
671  enddo
672  enddo
673 
674  ! !$acc update device(ATMOS_GRID_CARTESC_METRIC_LIMXY,ATMOS_GRID_CARTESC_METRIC_LIMXZ,ATMOS_GRID_CARTESC_METRIC_LIMYZ)
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_thin_wall
723 
724  !-----------------------------------------------------------------------------
725  subroutine atmos_grid_cartesc_metric_step_mountain
726  use scale_comm_cartesc, only: &
727  comm_vars8, &
728  comm_wait
729  implicit none
730 
731  integer :: i,j,k,n
732  !---------------------------------------------------------------------------
733 
734  do n = 1, 7
735  do j = js, je
736  do i = is, ie
737  do k = ks, ke
738 
739  if ( atmos_grid_cartesc_metric_limyz(k,i,j,n) > 0.0_rp ) then
740  atmos_grid_cartesc_metric_limyz(k,i,j,n) = 1.0_rp
741  endif
742 
743  if ( atmos_grid_cartesc_metric_limxz(k,i,j,n) > 0.0_rp ) then
744  atmos_grid_cartesc_metric_limxz(k,i,j,n) = 1.0_rp
745  endif
746 
747  if ( atmos_grid_cartesc_metric_limxy(k,i,j,n) > 0.0_rp ) then
748  atmos_grid_cartesc_metric_limxy(k,i,j,n) = 1.0_rp
749  endif
750  enddo
751  enddo
752  enddo
753  enddo
754 
755  ! !$acc update device(ATMOS_GRID_CARTESC_METRIC_LIMXY,ATMOS_GRID_CARTESC_METRIC_LIMXZ,ATMOS_GRID_CARTESC_METRIC_LIMYZ)
756 
757 
758  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_xyz), 1 )
759  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_xyw), 2 )
760  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_uyw), 3 )
761  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_xvw), 4 )
762  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_uyz), 5 )
763  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_xvz), 6 )
764  call comm_vars8( atmos_grid_cartesc_metric_limyz(:,:,:,i_uvz), 7 )
765  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_xyz), 1 )
766  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_xyw), 2 )
767  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_uyw), 3 )
768  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_xvw), 4 )
769  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_uyz), 5 )
770  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_xvz), 6 )
771  call comm_wait ( atmos_grid_cartesc_metric_limyz(:,:,:,i_uvz), 7 )
772 
773  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_xyz), 8 )
774  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_xyw), 9 )
775  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_uyw), 10 )
776  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_xvw), 11 )
777  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_uyz), 12 )
778  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_xvz), 13 )
779  call comm_vars8( atmos_grid_cartesc_metric_limxz(:,:,:,i_uvz), 14 )
780  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_xyz), 8 )
781  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_xyw), 9 )
782  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_uyw), 10 )
783  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_xvw), 11 )
784  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_uyz), 12 )
785  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_xvz), 13 )
786  call comm_wait ( atmos_grid_cartesc_metric_limxz(:,:,:,i_uvz), 14 )
787 
788  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_xyz), 15 )
789  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_xyw), 16 )
790  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_uyw), 17 )
791  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_xvw), 18 )
792  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_uyz), 19 )
793  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_xvz), 20 )
794  call comm_vars8( atmos_grid_cartesc_metric_limxy(:,:,:,i_uvz), 21 )
795  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_xyz), 15 )
796  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_xyw), 16 )
797  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_uyw), 17 )
798  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_xvw), 18 )
799  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_uyz), 19 )
800  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_xvz), 20 )
801  call comm_wait ( atmos_grid_cartesc_metric_limxy(:,:,:,i_uvz), 21 )
802 
803  return
804  end subroutine atmos_grid_cartesc_metric_step_mountain
805 
806  !-----------------------------------------------------------------------------
808  subroutine atmos_grid_cartesc_metric_write
809  use scale_prc_cartesc, only: &
810  prc_twod
811  use scale_const, only: &
813  use scale_vector, only: &
815  use scale_file_cartesc, only: &
816  file_cartesc_write
817  use scale_atmos_grid_cartesc_real, only: &
822  use scale_mapprojection, only: &
823  mapprojection_lonlat2xy
824  implicit none
825 
826  real(RP) :: check_X_XY(IA,JA)
827  real(RP) :: check_Y_XY(IA,JA)
828  real(RP) :: distance (IA,JA)
829 
830  integer :: i, j
831  !---------------------------------------------------------------------------
832 
833  if ( atmos_grid_cartesc_metric_out_basename /= '' ) then
834 
835  log_newline
836  log_info("ATMOS_GRID_CARTESC_METRIC_write",*) 'Output metrics file '
837 
838  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]
839  'MAPF_X_XY', 'Map factor x-dir at XY', 'NIL', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
840  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]
841  'MAPF_Y_XY', 'Map factor y-dir at XY', 'NIL', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
842  if ( .not. prc_twod ) &
843  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]
844  'MAPF_X_UY', 'Map factor x-dir at UY', 'NIL', 'UY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
845  if ( .not. prc_twod ) &
846  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]
847  'MAPF_Y_UY', 'Map factor y-dir at UY', 'NIL', 'UY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
848  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]
849  'MAPF_X_XV', 'Map factor x-dir at XV', 'NIL', 'XV', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
850  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]
851  'MAPF_Y_XV', 'Map factor y-dir at XV', 'NIL', 'XV', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
852  if ( .not. prc_twod ) &
853  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]
854  'MAPF_X_UV', 'Map factor x-dir at UV', 'NIL', 'UV', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
855  if ( .not. prc_twod ) &
856  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]
857  'MAPF_Y_UV', 'Map factor y-dir at UV', 'NIL', 'UV', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
858 
859  call file_cartesc_write( atmos_grid_cartesc_metric_rotc(:,:,1), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
860  'ROTC_COS', 'Rotation factor (cos)', 'NIL', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
861  call file_cartesc_write( atmos_grid_cartesc_metric_rotc(:,:,2), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
862  'ROTC_SIN', 'Rotation factor (sin)', 'NIL', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
863 
864  call file_cartesc_write( atmos_grid_cartesc_metric_rotc(:,:,1), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
865  'ROTC_COS', 'Rotation factor (cos)', 'NIL', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
866 
867  do j = 1, ja
868  do i = 1, ia
869  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) )
870  enddo
871  enddo
872 
873  call file_cartesc_write( check_x_xy(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
874  'X_XY', 'x at XY for check', 'NIL', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
875  call file_cartesc_write( check_y_xy(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
876  'Y_XY', 'y at XY for check', 'NIL', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
877 
878  do j = 1, ja
879  do i = 1, ia
880  call vectr_distance( const_radius, & ! [IN]
883  atmos_grid_cartesc_real_lon(i,j), & ! [IN]
884  atmos_grid_cartesc_real_lat(i,j), & ! [IN]
885  distance(i,j) ) ! [OUT]
886  enddo
887  enddo
888 
889  call file_cartesc_write( distance(:,:), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
890  'distance', 'distance from basepoint', 'm', 'XY', atmos_grid_cartesc_metric_out_dtype ) ! [IN]
891 
892 
893  ! metrics for terrain-following coordinate
894  call file_cartesc_write( atmos_grid_cartesc_metric_gsqrt(:,:,:,i_xyz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
895  'GSQRT_ZXY', 'transformation metrics from Z to Xi, G^1/2 at ZXY', '1', 'ZXY', & ! [IN]
896  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
897  call file_cartesc_write( atmos_grid_cartesc_metric_gsqrt(:,:,:,i_xyw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
898  'GSQRT_WXY', 'transformation metrics from Z to Xi, G^1/2 at WXY', '1', 'ZHXY', & ! [IN]
899  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
900  if ( .not. prc_twod ) &
901  call file_cartesc_write( atmos_grid_cartesc_metric_gsqrt(:,:,:,i_uyw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
902  'GSQRT_WUY', 'transformation metrics from Z to Xi, G^1/2 at WUY', '1', 'ZHXHY', & ! [IN]
903  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
904  call file_cartesc_write( atmos_grid_cartesc_metric_gsqrt(:,:,:,i_xvw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
905  'GSQRT_WXV', 'transformation metrics from Z to Xi, G^1/2 at WXV', '1', 'ZHXYH', & ! [IN]
906  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
907  if ( .not. prc_twod ) &
908  call file_cartesc_write( atmos_grid_cartesc_metric_gsqrt(:,:,:,i_uyz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
909  'GSQRT_ZUY', 'transformation metrics from Z to Xi, G^1/2 at ZUY', '1', 'ZXHY', & ! [IN]
910  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
911  call file_cartesc_write( atmos_grid_cartesc_metric_gsqrt(:,:,:,i_xvz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
912  'GSQRT_ZXV', 'transformation metrics from Z to Xi, G^1/2 at ZXV', '1', 'ZXYH', & ! [IN]
913  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
914  if ( .not. prc_twod ) &
915  call file_cartesc_write( atmos_grid_cartesc_metric_gsqrt(:,:,:,i_uvz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
916  'GSQRT_ZUV', 'transformation metrics from Z to Xi, G^1/2 at ZUV', '1', 'ZXHYH', & ! [IN]
917  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
918 
919  call file_cartesc_write( atmos_grid_cartesc_metric_j13g(:,:,:,i_xyz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
920  'J13G_ZXY', '(1,3) element of Jacobian matrix * {G}^1/2 at ZXY', '1', 'ZXY', & ![IN]
921  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
922  call file_cartesc_write( atmos_grid_cartesc_metric_j13g(:,:,:,i_xyw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
923  'J13G_WXY', '(1,3) element of Jacobian matrix * {G}^1/2 at WXY', '1', 'ZHXY', & ![IN]
924  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
925  if ( .not. prc_twod ) &
926  call file_cartesc_write( atmos_grid_cartesc_metric_j13g(:,:,:,i_uyw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
927  'J13G_WUY', '(1,3) element of Jacobian matrix * {G}^1/2 at WUY', '1', 'ZHXHY', & ![IN]
928  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
929  call file_cartesc_write( atmos_grid_cartesc_metric_j13g(:,:,:,i_xvw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
930  'J13G_WXV', '(1,3) element of Jacobian matrix * {G}^1/2 at WXV', '1', 'ZHXYH', & ![IN]
931  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
932  if ( .not. prc_twod ) &
933  call file_cartesc_write( atmos_grid_cartesc_metric_j13g(:,:,:,i_uyz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
934  'J13G_ZUY', '(1,3) element of Jacobian matrix * {G}^1/2 at ZUY', '1', 'ZXHY', & ![IN]
935  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
936  call file_cartesc_write( atmos_grid_cartesc_metric_j13g(:,:,:,i_xvz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
937  'J13G_ZXV', '(1,3) element of Jacobian matrix * {G}^1/2 at ZXV', '1', 'ZXYH', & ![IN]
938  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
939  if ( .not. prc_twod ) &
940  call file_cartesc_write( atmos_grid_cartesc_metric_j13g(:,:,:,i_uvz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
941  'J13G_ZUV', '(1,3) element of Jacobian matrix * {G}^1/2 at ZUV', '1', 'ZXHYH', & ![IN]
942  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
943 
944  call file_cartesc_write( atmos_grid_cartesc_metric_j23g(:,:,:,i_xyz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
945  'J23G_ZXY', '(2,3) element of Jacobian matrix * {G}^1/2 at ZXY', '1', 'ZXY', & ![IN]
946  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
947  call file_cartesc_write( atmos_grid_cartesc_metric_j23g(:,:,:,i_xyw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
948  'J23G_WXY', '(2,3) element of Jacobian matrix * {G}^1/2 at WXY', '1', 'ZHXY', & ![IN]
949  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
950  if ( .not. prc_twod ) &
951  call file_cartesc_write( atmos_grid_cartesc_metric_j23g(:,:,:,i_uyw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
952  'J23G_WUY', '(2,3) element of Jacobian matrix * {G}^1/2 at WUY', '1', 'ZHXHY', & ![IN]
953  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
954  call file_cartesc_write( atmos_grid_cartesc_metric_j23g(:,:,:,i_xvw), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
955  'J23G_WXV', '(2,3) element of Jacobian matrix * {G}^1/2 at WXV', '1', 'ZHXYH', & ![IN]
956  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
957  if ( .not. prc_twod ) &
958  call file_cartesc_write( atmos_grid_cartesc_metric_j23g(:,:,:,i_uyz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
959  'J23G_ZUY', '(2,3) element of Jacobian matrix * {G}^1/2 at ZUY', '1', 'ZXHY', & ![IN]
960  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
961  call file_cartesc_write( atmos_grid_cartesc_metric_j23g(:,:,:,i_xvz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
962  'J23G_ZXV', '(2,3) element of Jacobian matrix * {G}^1/2 at ZXV', '1', 'ZXYH', & ![IN]
963  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
964  if ( .not. prc_twod ) &
965  call file_cartesc_write( atmos_grid_cartesc_metric_j23g(:,:,:,i_uvz), atmos_grid_cartesc_metric_out_basename, atmos_grid_cartesc_metric_out_title, & ! [IN]
966  'J23G_ZUV', '(2,3) element of Jacobian matrix * {G}^1/2 at ZUV', '1', 'ZXHYH', & ![IN]
967  atmos_grid_cartesc_metric_out_dtype ) ! [IN]
968 
969  endif
970 
971  return
972  end subroutine atmos_grid_cartesc_metric_write
973 
scale_atmos_grid_cartesc_index::i_uy
integer, public i_uy
Definition: scale_atmos_grid_cartesC_index.F90:100
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:44
scale_atmos_grid_cartesc_index::i_xv
integer, public i_xv
Definition: scale_atmos_grid_cartesC_index.F90:101
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:350
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:39
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:68
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:249
scale_atmos_grid_cartesc_index::i_fxy
integer, public i_fxy
Definition: scale_atmos_grid_cartesC_index.F90:106
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:44
scale_atmos_grid_cartesc_index::i_fyz
integer, public i_fyz
Definition: scale_atmos_grid_cartesC_index.F90:104
scale_atmos_grid_cartesc_index::i_uv
integer, public i_uv
Definition: scale_atmos_grid_cartesC_index.F90:102
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:66
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:58
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:105
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:45
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:37
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:41
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:49
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:36
scale_atmos_grid_cartesc_index::i_xyz
integer, public i_xyz
Definition: scale_atmos_grid_cartesC_index.F90:91
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:35
scale_atmos_grid_cartesc_index::i_xy
integer, public i_xy
Definition: scale_atmos_grid_cartesC_index.F90:99
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:95
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:67
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:45
scale_atmos_grid_cartesc_index::i_xvw
integer, public i_xvw
Definition: scale_atmos_grid_cartesC_index.F90:94
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:42
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:56
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:38
scale_atmos_grid_cartesc_index::i_xvz
integer, public i_xvz
Definition: scale_atmos_grid_cartesC_index.F90:96
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:59
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:54
scale_prc_cartesc
module process / cartesC
Definition: scale_prc_cartesC.F90:11
scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_finalize
subroutine, public atmos_grid_cartesc_metric_finalize
Finalize.
Definition: scale_atmos_grid_cartesC_metric.F90:172
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:93
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:40
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:45
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:271
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:55
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:39
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:42
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:73
scale_const::const_radius
real(rp), public const_radius
radius of the planet [m]
Definition: scale_const.F90:47
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:57
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:46
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:41
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:53
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:39
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:43
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:41
scale_atmos_grid_cartesc_index::i_uvz
integer, public i_uvz
Definition: scale_atmos_grid_cartesC_index.F90:97
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:43
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:69
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:46
scale_io::io_fid_conf
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:57
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:56
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:56
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:40
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:36
scale_atmos_grid_cartesc_index::i_xyw
integer, public i_xyw
Definition: scale_atmos_grid_cartesC_index.F90:92