19 #include "inc_openmp.h" 77 private :: atmos_boundary_var_fillhalo
78 private :: atmos_boundary_alpha_fillhalo
79 private :: atmos_boundary_ref_fillhalo
80 private :: atmos_boundary_setalpha
81 private :: atmos_boundary_setinitval
82 private :: atmos_boundary_read
83 private :: atmos_boundary_write
84 private :: atmos_boundary_generate
85 private :: atmos_boundary_initialize_file
86 private :: atmos_boundary_initialize_online
87 private :: atmos_boundary_update_file
88 private :: atmos_boundary_update_online_parent
89 private :: atmos_boundary_update_online_daughter
90 private :: atmos_boundary_send
91 private :: atmos_boundary_recv
106 real(RP),
intent(out) :: bnd_dens(:,:,:)
107 real(RP),
intent(out) :: bnd_velz(:,:,:)
108 real(RP),
intent(out) :: bnd_velx(:,:,:)
109 real(RP),
intent(out) :: bnd_vely(:,:,:)
110 real(RP),
intent(out) :: bnd_pott(:,:,:)
111 real(RP),
intent(out) :: bnd_qtrc(:,:,:,:)
112 integer,
intent(in) :: now_step
113 integer,
intent(in) :: update_step
114 end subroutine getbnd
117 procedure(getbnd),
pointer :: get_boundary => null()
118 private :: get_boundary
119 private :: get_boundary_same_parent
120 private :: get_boundary_nearest_neighbor
121 private :: get_boundary_lerp_initpoint
122 private :: get_boundary_lerp_midpoint
129 character(len=H_SHORT),
private :: atmos_boundary_type =
'NONE' 130 character(len=H_LONG),
private :: atmos_boundary_in_basename =
'' 131 logical,
private :: atmos_boundary_in_check_coordinates = .true.
132 character(len=H_LONG),
private :: atmos_boundary_out_basename =
'' 133 character(len=H_MID),
private :: atmos_boundary_out_title =
'SCALE-RM BOUNDARY CONDITION' 134 character(len=H_SHORT),
private :: atmos_boundary_out_dtype =
'DEFAULT' 136 logical,
private :: atmos_boundary_use_dens = .false.
137 logical,
private :: atmos_boundary_use_velz = .false.
138 logical,
private :: atmos_boundary_use_velx = .false.
139 logical,
private :: atmos_boundary_use_vely = .false.
140 logical,
private :: atmos_boundary_use_pott = .false.
141 logical,
private :: atmos_boundary_use_qv = .false.
142 logical,
private :: atmos_boundary_use_qhyd = .false.
144 real(RP),
private :: atmos_boundary_value_velz = 0.0_rp
145 real(RP),
private :: atmos_boundary_value_velx = 0.0_rp
146 real(RP),
private :: atmos_boundary_value_vely = 0.0_rp
147 real(RP),
private :: atmos_boundary_value_pott = 300.0_rp
148 real(RP),
private :: atmos_boundary_value_qtrc = 0.0_rp
150 real(RP),
private :: atmos_boundary_alphafact_dens = 1.0_rp
151 real(RP),
private :: atmos_boundary_alphafact_velz = 1.0_rp
152 real(RP),
private :: atmos_boundary_alphafact_velx = 1.0_rp
153 real(RP),
private :: atmos_boundary_alphafact_vely = 1.0_rp
154 real(RP),
private :: atmos_boundary_alphafact_pott = 1.0_rp
155 real(RP),
private :: atmos_boundary_alphafact_qtrc = 1.0_rp
157 real(RP),
private :: atmos_boundary_fracz = 1.0_rp
158 real(RP),
private :: atmos_boundary_fracx = 1.0_rp
159 real(RP),
private :: atmos_boundary_fracy = 1.0_rp
160 real(RP),
private :: atmos_boundary_tauz
161 real(RP),
private :: atmos_boundary_taux
162 real(RP),
private :: atmos_boundary_tauy
164 real(DP),
private :: atmos_boundary_update_dt = 0.0_dp
165 integer,
private :: update_nstep
167 real(RP),
private,
allocatable :: atmos_boundary_ref_dens(:,:,:,:)
168 real(RP),
private,
allocatable :: atmos_boundary_ref_velz(:,:,:,:)
169 real(RP),
private,
allocatable :: atmos_boundary_ref_velx(:,:,:,:)
170 real(RP),
private,
allocatable :: atmos_boundary_ref_vely(:,:,:,:)
171 real(RP),
private,
allocatable :: atmos_boundary_ref_pott(:,:,:,:)
172 real(RP),
private,
allocatable :: atmos_boundary_ref_qtrc(:,:,:,:,:)
174 character(len=H_LONG),
private :: atmos_boundary_interp_type =
'lerp_initpoint' 176 integer,
private :: atmos_boundary_start_date(6) = (/ -9999, 0, 0, 0, 0, 0 /)
178 integer,
private :: atmos_boundary_fid = -1
180 integer,
private :: now_step
181 integer,
private :: boundary_timestep = 0
182 logical,
private :: atmos_boundary_linear_v = .false.
183 logical,
private :: atmos_boundary_linear_h = .true.
184 real(RP),
private :: atmos_boundary_exp_h = 2.0_rp
185 logical,
private :: atmos_boundary_online = .false.
186 logical,
private :: atmos_boundary_online_master = .false.
187 logical,
private :: do_parent_process = .false.
188 logical,
private :: do_daughter_process = .false.
189 logical,
private :: l_bnd = .false.
191 real(DP),
private :: boundary_time_initdaysec
193 integer,
private :: ref_size = 3
194 integer,
private :: ref_old = 1
195 integer,
private :: ref_now = 2
196 integer,
private :: ref_new = 3
220 namelist / param_atmos_boundary / &
221 atmos_boundary_type, &
222 atmos_boundary_in_basename, &
223 atmos_boundary_in_check_coordinates, &
224 atmos_boundary_out_basename, &
225 atmos_boundary_out_title, &
226 atmos_boundary_out_dtype, &
227 atmos_boundary_use_velz, &
228 atmos_boundary_use_velx, &
229 atmos_boundary_use_vely, &
230 atmos_boundary_use_pott, &
231 atmos_boundary_use_dens, &
232 atmos_boundary_use_qv, &
233 atmos_boundary_use_qhyd, &
234 atmos_boundary_value_velz, &
235 atmos_boundary_value_velx, &
236 atmos_boundary_value_vely, &
237 atmos_boundary_value_pott, &
238 atmos_boundary_value_qtrc, &
239 atmos_boundary_alphafact_dens, &
240 atmos_boundary_alphafact_velz, &
241 atmos_boundary_alphafact_velx, &
242 atmos_boundary_alphafact_vely, &
243 atmos_boundary_alphafact_pott, &
244 atmos_boundary_alphafact_qtrc, &
246 atmos_boundary_fracz, &
247 atmos_boundary_fracx, &
248 atmos_boundary_fracy, &
249 atmos_boundary_tauz, &
250 atmos_boundary_taux, &
251 atmos_boundary_tauy, &
252 atmos_boundary_update_dt, &
253 atmos_boundary_start_date, &
254 atmos_boundary_linear_v, &
255 atmos_boundary_linear_h, &
256 atmos_boundary_exp_h, &
257 atmos_boundary_interp_type
263 if(
io_l )
write(
io_fid_log,*)
'++++++ Module[BOUNDARY] / Categ[ATMOS-RM] / Origin[SCALElib]' 265 atmos_boundary_tauz = dt * 10.0_rp
266 atmos_boundary_taux = dt * 10.0_rp
267 atmos_boundary_tauy = dt * 10.0_rp
271 read(
io_fid_conf,nml=param_atmos_boundary,iostat=ierr)
273 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 274 elseif( ierr > 0 )
then 275 write(*,*)
'xxx Not appropriate names in namelist PARAM_ATMOS_BOUNDARY. Check!' 282 atmos_boundary_online = .false.
285 atmos_boundary_online = .false.
287 atmos_boundary_online = .true.
290 do_parent_process = .false.
291 do_daughter_process = .false.
292 atmos_boundary_online_master = .false.
293 if ( atmos_boundary_online )
then 295 do_parent_process = .true.
297 atmos_boundary_online_master = .true.
301 do_daughter_process = .true.
305 if( atmos_boundary_use_qhyd )
then 307 else if (
qa_mp > 0 )
then 339 if ( atmos_boundary_type ==
'REAL' .OR. do_daughter_process )
then 347 select case(atmos_boundary_interp_type)
349 get_boundary => get_boundary_same_parent
350 case(
'nearest_neighbor')
351 get_boundary => get_boundary_nearest_neighbor
352 case(
'lerp_initpoint')
353 get_boundary => get_boundary_lerp_initpoint
354 case(
'lerp_midpoint')
355 get_boundary => get_boundary_lerp_midpoint
357 write(*,*)
'xxx Wrong parameter in ATMOS_BOUNDARY_interp_TYPE. Check!' 363 allocate( atmos_boundary_ref_dens(
ka,
ia,
ja,ref_size) )
364 allocate( atmos_boundary_ref_velz(
ka,
ia,
ja,ref_size) )
365 allocate( atmos_boundary_ref_velx(
ka,
ia,
ja,ref_size) )
366 allocate( atmos_boundary_ref_vely(
ka,
ia,
ja,ref_size) )
367 allocate( atmos_boundary_ref_pott(
ka,
ia,
ja,ref_size) )
368 allocate( atmos_boundary_ref_qtrc(
ka,
ia,
ja,
bnd_qa,ref_size) )
377 if ( do_daughter_process )
then 378 call atmos_boundary_initialize_online
380 if ( atmos_boundary_in_basename /=
'' )
then 381 call atmos_boundary_initialize_file
383 write(*,*)
'xxx You need specify ATMOS_BOUNDARY_IN_BASENAME' 388 call atmos_boundary_setalpha
392 elseif ( atmos_boundary_type ==
'NONE' )
then 396 elseif ( atmos_boundary_type ==
'CONST' )
then 398 call atmos_boundary_generate
400 call atmos_boundary_setalpha
404 elseif ( atmos_boundary_type ==
'INIT' )
then 406 call atmos_boundary_setalpha
410 elseif ( atmos_boundary_type ==
'FILE' )
then 412 if ( atmos_boundary_in_basename /=
'' )
then 413 call atmos_boundary_read
415 write(*,*)
'xxx You need specify ATMOS_BOUNDARY_IN_BASENAME' 422 write(*,*)
'xxx unsupported ATMOS_BOUNDARY_TYPE. Check!', trim(atmos_boundary_type)
430 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary parameters ***' 431 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary type : ', atmos_boundary_type
433 if(
io_l )
write(
io_fid_log,*)
'*** Is VELZ used in atmospheric boundary? : ', atmos_boundary_use_velz
434 if(
io_l )
write(
io_fid_log,*)
'*** Is VELX used in atmospheric boundary? : ', atmos_boundary_use_velx
435 if(
io_l )
write(
io_fid_log,*)
'*** Is VELY used in atmospheric boundary? : ', atmos_boundary_use_vely
436 if(
io_l )
write(
io_fid_log,*)
'*** Is POTT used in atmospheric boundary? : ', atmos_boundary_use_pott
437 if(
io_l )
write(
io_fid_log,*)
'*** Is DENS used in atmospheric boundary? : ', atmos_boundary_use_dens
438 if(
io_l )
write(
io_fid_log,*)
'*** Is QV used in atmospheric boundary? : ', atmos_boundary_use_qv
439 if(
io_l )
write(
io_fid_log,*)
'*** Is QHYD used in atmospheric boundary? : ', atmos_boundary_use_qhyd
441 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary VELZ values : ', atmos_boundary_value_velz
442 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary VELX values : ', atmos_boundary_value_velx
443 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary VELY values : ', atmos_boundary_value_vely
444 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary POTT values : ', atmos_boundary_value_pott
445 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary QTRC values : ', atmos_boundary_value_qtrc
448 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary z-fraction : ', atmos_boundary_fracz
449 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary x-fraction : ', atmos_boundary_fracx
450 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary y-fraction : ', atmos_boundary_fracy
451 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary z-relaxation time : ', atmos_boundary_tauz
452 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary x-relaxation time : ', atmos_boundary_taux
453 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary y-relaxation time : ', atmos_boundary_tauy
455 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary update dt : ', atmos_boundary_update_dt
456 if(
io_l )
write(
io_fid_log,*)
'*** Atmospheric boundary start date : ', atmos_boundary_start_date(:)
458 if(
io_l )
write(
io_fid_log,*)
'*** Linear profile in vertically relax region : ', atmos_boundary_linear_v
459 if(
io_l )
write(
io_fid_log,*)
'*** Linear profile in horizontally relax region : ', atmos_boundary_linear_h
460 if(
io_l )
write(
io_fid_log,*)
'*** Non-linear factor in horizontally relax region : ', atmos_boundary_exp_h
462 if(
io_l )
write(
io_fid_log,*)
'*** Online nesting for lateral boundary : ', atmos_boundary_online
464 if(
io_l )
write(
io_fid_log,*)
'*** Does lateral boundary exist in this domain? : ', l_bnd
466 if(
io_l )
write(
io_fid_log,*)
'*** Lateral boundary interporation type : ', atmos_boundary_interp_type
484 real(RP),
intent(in) :: momz(
ka,
ia,
ja)
485 real(RP),
intent(in) :: momx(
ka,
ia,
ja)
486 real(RP),
intent(in) :: momy(
ka,
ia,
ja)
487 real(RP),
intent(in) :: rhot(
ka,
ia,
ja)
492 dens, momz, momx, momy, rhot,
qtrc )
497 if ( do_daughter_process )
then 500 if ( atmos_boundary_in_basename /=
'' )
then 505 elseif ( atmos_boundary_type ==
'INIT' )
then 507 call atmos_boundary_setinitval(
dens, &
515 if( atmos_boundary_out_basename /=
'' )
then 516 call atmos_boundary_write
535 subroutine atmos_boundary_var_fillhalo
584 end subroutine atmos_boundary_var_fillhalo
588 subroutine atmos_boundary_alpha_fillhalo
637 end subroutine atmos_boundary_alpha_fillhalo
641 subroutine atmos_boundary_ref_fillhalo( &
649 integer,
intent(in) :: ref_idx
661 atmos_boundary_ref_dens( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_dens(
ks,i,j,ref_idx)
662 atmos_boundary_ref_velz( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_velz(
ks,i,j,ref_idx)
663 atmos_boundary_ref_velx( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_velx(
ks,i,j,ref_idx)
664 atmos_boundary_ref_vely( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_vely(
ks,i,j,ref_idx)
665 atmos_boundary_ref_pott( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_pott(
ks,i,j,ref_idx)
667 atmos_boundary_ref_dens(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_dens(
ke,i,j,ref_idx)
668 atmos_boundary_ref_velz(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_velz(
ke,i,j,ref_idx)
669 atmos_boundary_ref_velx(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_velx(
ke,i,j,ref_idx)
670 atmos_boundary_ref_vely(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_vely(
ke,i,j,ref_idx)
671 atmos_boundary_ref_pott(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_pott(
ke,i,j,ref_idx)
674 atmos_boundary_ref_qtrc( 1:
ks-1,i,j,iq,ref_idx) = atmos_boundary_ref_qtrc(
ks,i,j,iq,ref_idx)
675 atmos_boundary_ref_qtrc(
ke+1:
ka, i,j,iq,ref_idx) = atmos_boundary_ref_qtrc(
ke,i,j,iq,ref_idx)
680 call comm_vars8( atmos_boundary_ref_dens(:,:,:,ref_idx), 1 )
681 call comm_vars8( atmos_boundary_ref_velz(:,:,:,ref_idx), 2 )
682 call comm_vars8( atmos_boundary_ref_velx(:,:,:,ref_idx), 3 )
683 call comm_vars8( atmos_boundary_ref_vely(:,:,:,ref_idx), 4 )
684 call comm_vars8( atmos_boundary_ref_pott(:,:,:,ref_idx), 5 )
687 call comm_vars8( atmos_boundary_ref_qtrc(:,:,:,iq,ref_idx), 5+iq )
690 call comm_wait ( atmos_boundary_ref_dens(:,:,:,ref_idx), 1, .false. )
691 call comm_wait ( atmos_boundary_ref_velz(:,:,:,ref_idx), 2, .false. )
692 call comm_wait ( atmos_boundary_ref_velx(:,:,:,ref_idx), 3, .false. )
693 call comm_wait ( atmos_boundary_ref_vely(:,:,:,ref_idx), 4, .false. )
694 call comm_wait ( atmos_boundary_ref_pott(:,:,:,ref_idx), 5, .false. )
697 call comm_wait ( atmos_boundary_ref_qtrc(:,:,:,iq,ref_idx), 5+iq, .false. )
701 end subroutine atmos_boundary_ref_fillhalo
705 subroutine atmos_boundary_setalpha
719 real(RP) :: coef_z, alpha_z1, alpha_z2
720 real(RP) :: coef_x, alpha_x1, alpha_x2
721 real(RP) :: coef_y, alpha_y1, alpha_y2
724 integer :: i, j, k, iq
728 atmos_boundary_fracz = max( min( atmos_boundary_fracz, 1.0_rp ), eps )
729 atmos_boundary_fracx = max( min( atmos_boundary_fracx, 1.0_rp ), eps )
730 atmos_boundary_fracy = max( min( atmos_boundary_fracy, 1.0_rp ), eps )
732 if ( atmos_boundary_tauz <= 0.0_rp )
then 735 coef_z = 1.0_rp / atmos_boundary_tauz
738 if ( atmos_boundary_taux <= 0.0_rp )
then 741 coef_x = 1.0_rp / atmos_boundary_taux
744 if ( atmos_boundary_tauy <= 0.0_rp )
then 747 coef_y = 1.0_rp / atmos_boundary_tauy
766 if ( ee1 <= 1.0_rp - atmos_boundary_fracz )
then 769 ee1 = ( ee1 - 1.0_rp + atmos_boundary_fracz ) / atmos_boundary_fracz
773 if ( ee2 <= 1.0_rp - atmos_boundary_fracz )
then 776 ee2 = ( ee2 - 1.0_rp + atmos_boundary_fracz ) / atmos_boundary_fracz
781 if ( atmos_boundary_linear_v )
then 782 alpha_z1 = coef_z * ee1
783 alpha_z2 = coef_z * ee2
785 if ( ee1 > 0.0_rp .AND. ee1 <= 0.5_rp )
then 786 alpha_z1 = coef_z * 0.5_rp * ( 1.0_rp - cos( ee1*pi ) )
787 elseif( ee1 > 0.5_rp .AND. ee1 <= 1.0_rp )
then 788 alpha_z1 = coef_z * 0.5_rp * ( 1.0_rp + sin( (ee1-0.5_rp)*pi ) )
790 if ( ee2 > 0.0_rp .AND. ee2 <= 0.5_rp )
then 791 alpha_z2 = coef_z * 0.5_rp * ( 1.0_rp - cos( ee2*pi ) )
792 elseif( ee2 > 0.5_rp .AND. ee2 <= 1.0_rp )
then 793 alpha_z2 = coef_z * 0.5_rp * ( 1.0_rp + sin( (ee2-0.5_rp)*pi ) )
798 if ( ee1 <= 1.0_rp - atmos_boundary_fracx )
then 801 ee1 = ( ee1 - 1.0_rp + atmos_boundary_fracx ) / atmos_boundary_fracx
805 if ( ee2 <= 1.0_rp - atmos_boundary_fracx )
then 808 ee2 = ( ee2 - 1.0_rp + atmos_boundary_fracx ) / atmos_boundary_fracx
811 if ( atmos_boundary_linear_h )
then 812 alpha_x1 = coef_x * ee1
813 alpha_x2 = coef_x * ee2
815 alpha_x1 = coef_x * ee1 * exp( -(1.0_rp-ee1) * atmos_boundary_exp_h )
816 alpha_x2 = coef_x * ee2 * exp( -(1.0_rp-ee2) * atmos_boundary_exp_h )
820 if ( ee1 <= 1.0_rp - atmos_boundary_fracy )
then 823 ee1 = ( ee1 - 1.0_rp + atmos_boundary_fracy ) / atmos_boundary_fracy
827 if ( ee2 <= 1.0_rp - atmos_boundary_fracy )
then 830 ee2 = ( ee2 - 1.0_rp + atmos_boundary_fracy ) / atmos_boundary_fracy
833 if ( atmos_boundary_linear_h )
then 834 alpha_y1 = coef_y * ee1
835 alpha_y2 = coef_y * ee2
837 alpha_y1 = coef_y * ee1 * exp( -(1.0_rp-ee1) * atmos_boundary_exp_h )
838 alpha_y2 = coef_y * ee2 * exp( -(1.0_rp-ee2) * atmos_boundary_exp_h )
843 if ( do_daughter_process )
then 845 if( atmos_boundary_use_velz )
then 851 if ( atmos_boundary_use_velz )
then 856 if ( atmos_boundary_use_velz )
then 860 if ( atmos_boundary_use_dens )
then 866 if ( atmos_boundary_use_velx )
then 871 if ( atmos_boundary_use_vely )
then 876 if ( atmos_boundary_use_pott )
then 881 if ( atmos_boundary_use_qv )
then 886 if ( atmos_boundary_use_qhyd )
then 914 if ( .NOT. atmos_boundary_use_dens )
then 917 if ( .NOT. atmos_boundary_use_velz )
then 920 if ( .NOT. atmos_boundary_use_velx )
then 923 if ( .NOT. atmos_boundary_use_vely )
then 926 if ( .NOT. atmos_boundary_use_pott )
then 929 if ( .NOT. atmos_boundary_use_qv )
then 932 if ( .NOT. atmos_boundary_use_qhyd )
then 940 call atmos_boundary_alpha_fillhalo
943 end subroutine atmos_boundary_setalpha
947 subroutine atmos_boundary_setinitval( &
948 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC )
954 real(RP),
intent(in) :: momz(
ka,
ia,
ja)
955 real(RP),
intent(in) :: momx(
ka,
ia,
ja)
956 real(RP),
intent(in) :: momy(
ka,
ia,
ja)
957 real(RP),
intent(in) :: rhot(
ka,
ia,
ja)
960 integer :: i, j, k, iq, iqa
1003 call atmos_boundary_var_fillhalo
1006 end subroutine atmos_boundary_setinitval
1010 subroutine atmos_boundary_read
1015 fileio_check_coordinates, &
1026 call fileio_open( fid, atmos_boundary_in_basename )
1028 if ( atmos_boundary_in_check_coordinates )
then 1029 call fileio_check_coordinates( fid, atmos=.true. )
1032 if ( atmos_boundary_use_dens &
1033 .OR. atmos_boundary_use_velz &
1034 .OR. atmos_boundary_use_velx &
1035 .OR. atmos_boundary_use_vely &
1036 .OR. atmos_boundary_use_pott &
1040 if ( atmos_boundary_use_dens )
then 1044 if ( atmos_boundary_use_velz )
then 1049 if ( atmos_boundary_use_velx )
then 1054 if ( atmos_boundary_use_vely )
then 1059 if ( atmos_boundary_use_pott )
then 1064 if ( atmos_boundary_use_qv )
then 1069 if ( atmos_boundary_use_qhyd )
then 1079 call atmos_boundary_var_fillhalo
1080 call atmos_boundary_alpha_fillhalo
1083 end subroutine atmos_boundary_read
1087 subroutine atmos_boundary_write
1100 if ( atmos_boundary_use_dens &
1101 .OR. atmos_boundary_use_velz &
1102 .OR. atmos_boundary_use_velx &
1103 .OR. atmos_boundary_use_vely &
1104 .OR. atmos_boundary_use_pott &
1107 atmos_boundary_out_basename, atmos_boundary_out_title, &
1108 'DENS',
'Reference Density',
'kg/m3',
'ZXY', &
1109 atmos_boundary_out_dtype )
1111 if ( atmos_boundary_use_dens .OR. l_bnd )
then 1113 atmos_boundary_out_basename, atmos_boundary_out_title, &
1114 'ALPHA_DENS',
'Alpha for DENS',
'1',
'ZXY', &
1115 atmos_boundary_out_dtype )
1118 if ( atmos_boundary_use_velz .OR. (l_bnd .AND.
online_use_velz) )
then 1120 atmos_boundary_out_basename, atmos_boundary_out_title, &
1121 'VELZ',
'Reference Velocity w',
'm/s',
'ZXY', &
1122 atmos_boundary_out_dtype )
1124 atmos_boundary_out_basename, atmos_boundary_out_title, &
1125 'ALPHA_VELZ',
'Alpha for VELZ',
'1',
'ZXY', &
1126 atmos_boundary_out_dtype )
1129 if ( atmos_boundary_use_velx .OR. l_bnd )
then 1131 atmos_boundary_out_basename, atmos_boundary_out_title, &
1132 'VELX',
'Reference Velocity u',
'm/s',
'ZXY', &
1133 atmos_boundary_out_dtype )
1135 atmos_boundary_out_basename, atmos_boundary_out_title, &
1136 'ALPHA_VELX',
'Alpha for VELX',
'1',
'ZXY', &
1137 atmos_boundary_out_dtype )
1140 if ( atmos_boundary_use_vely .OR. l_bnd )
then 1142 atmos_boundary_out_basename, atmos_boundary_out_title, &
1143 'VELY',
'Reference Velocity y',
'm/s',
'ZXY', &
1144 atmos_boundary_out_dtype )
1146 atmos_boundary_out_basename, atmos_boundary_out_title, &
1147 'ALPHA_VELY',
'Alpha for VELY',
'1',
'ZXY', &
1148 atmos_boundary_out_dtype )
1151 if ( atmos_boundary_use_pott .OR. l_bnd )
then 1153 atmos_boundary_out_basename, atmos_boundary_out_title, &
1154 'POTT',
'Reference POTT',
'K',
'ZXY', &
1155 atmos_boundary_out_dtype )
1157 atmos_boundary_out_basename, atmos_boundary_out_title, &
1158 'ALPHA_POTT',
'Alpha for POTT',
'1',
'ZXY', &
1159 atmos_boundary_out_dtype )
1162 if ( atmos_boundary_use_qv .OR. l_bnd )
then 1164 atmos_boundary_out_basename, atmos_boundary_out_title, &
1165 'QV',
'Reference QV',
'kg/kg',
'ZXY', &
1166 atmos_boundary_out_dtype )
1168 atmos_boundary_out_basename, atmos_boundary_out_title, &
1169 'ALPHA_QV',
'Alpha for QV',
'1',
'ZXY', &
1170 atmos_boundary_out_dtype )
1173 if ( atmos_boundary_use_qhyd )
then 1176 atmos_boundary_out_basename, atmos_boundary_out_title, &
1177 aq_name(iq),
'Reference '//trim(aq_name(iq)), aq_unit(iq),
'ZXY', &
1178 atmos_boundary_out_dtype )
1180 atmos_boundary_out_basename, atmos_boundary_out_title, &
1181 'ALPHA_'//trim(aq_name(iq)),
'Alpha for '//trim(aq_name(iq)),
'1',
'ZXY', &
1182 atmos_boundary_out_dtype )
1187 end subroutine atmos_boundary_write
1191 subroutine atmos_boundary_generate
1196 integer :: i, j, k, iq
1214 call atmos_boundary_var_fillhalo
1217 end subroutine atmos_boundary_generate
1221 subroutine atmos_boundary_initialize_file
1230 fileio_check_coordinates
1233 integer :: boundary_time_startday
1234 real(DP) :: boundary_time_startsec
1235 real(DP) :: boundary_time_startms
1236 integer :: boundary_time_offset_year
1237 character(len=27) :: boundary_chardate
1239 if ( atmos_boundary_start_date(1) == -9999 )
then 1244 boundary_time_startms = 0.0_dp
1245 boundary_time_offset_year = 0
1247 atmos_boundary_start_date(:), &
1248 boundary_time_startms )
1251 boundary_time_startsec, &
1252 atmos_boundary_start_date(:), &
1253 boundary_time_startms, &
1254 boundary_time_offset_year )
1258 if(
io_l )
write(
io_fid_log,
'(1x,A,A)')
'*** BOUNDARY START Date : ', boundary_chardate
1260 call fileio_open( atmos_boundary_fid, atmos_boundary_in_basename )
1262 if ( atmos_boundary_in_check_coordinates )
then 1263 call fileio_check_coordinates( atmos_boundary_fid, atmos=.true. )
1267 end subroutine atmos_boundary_initialize_file
1284 real(RP) :: bnd_DENS(KA,IA,JA)
1285 real(RP) :: bnd_VELZ(KA,IA,JA)
1286 real(RP) :: bnd_VELX(KA,IA,JA)
1287 real(RP) :: bnd_VELY(KA,IA,JA)
1288 real(RP) :: bnd_POTT(KA,IA,JA)
1289 real(RP) :: bnd_QTRC(KA,IA,JA,BND_QA)
1291 integer :: run_time_startdate(6)
1292 integer :: run_time_startday
1293 real(DP) :: run_time_startsec
1294 real(DP) :: run_time_startms
1295 integer :: run_time_offset_year
1296 real(DP) :: run_time_nowdaysec
1298 real(DP) :: boundary_diff_daysec
1299 real(RP) :: boundary_inc_offset
1300 integer :: fillgaps_steps
1302 integer :: i, j, k, iq
1305 if ( atmos_boundary_update_dt <= 0.0_dp )
then 1306 write(*,*)
'xxx You need specify ATMOS_BOUNDARY_UPDATE_DT as larger than 0.0' 1309 update_nstep = nint( atmos_boundary_update_dt /
time_dtsec )
1310 if ( abs(update_nstep *
time_dtsec - atmos_boundary_update_dt) > 1e-10_dp )
then 1311 write(*,*)
'xxx ATMOS_BOUNDARY_UPDATE_DT is not multiple of DT' 1317 run_time_startms = 0.0_dp
1318 run_time_offset_year = 0
1321 run_time_startsec, &
1322 run_time_startdate(:), &
1324 run_time_offset_year )
1328 boundary_diff_daysec = run_time_nowdaysec - boundary_time_initdaysec
1329 boundary_timestep = 1 + int( boundary_diff_daysec / atmos_boundary_update_dt )
1330 boundary_inc_offset = mod( boundary_diff_daysec, atmos_boundary_update_dt )
1331 fillgaps_steps = int( boundary_inc_offset /
time_dtsec )
1333 if(
io_l )
write(
io_fid_log,*)
'+++ BOUNDARY TIMESTEP NUMBER FOR INIT:', boundary_timestep
1334 if(
io_l )
write(
io_fid_log,*)
'+++ BOUNDARY OFFSET:', boundary_inc_offset
1335 if(
io_l )
write(
io_fid_log,*)
'+++ BOUNDARY FILLGAPS STEPS:', fillgaps_steps
1338 call atmos_boundary_update_file( ref_now )
1340 boundary_timestep = boundary_timestep + 1
1341 call atmos_boundary_update_file( ref_new )
1350 atmos_boundary_ref_dens(k,i,j,ref_old) = atmos_boundary_ref_dens(k,i,j,ref_now)
1351 atmos_boundary_ref_velx(k,i,j,ref_old) = atmos_boundary_ref_velx(k,i,j,ref_now)
1352 atmos_boundary_ref_vely(k,i,j,ref_old) = atmos_boundary_ref_vely(k,i,j,ref_now)
1353 atmos_boundary_ref_pott(k,i,j,ref_old) = atmos_boundary_ref_pott(k,i,j,ref_now)
1355 atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now)
1376 if ( atmos_boundary_use_velz )
then 1386 now_step = fillgaps_steps
1389 call get_boundary( bnd_dens(:,:,:), &
1394 bnd_qtrc(:,:,:,:), &
1418 subroutine atmos_boundary_initialize_online
1429 integer,
parameter :: handle = 2
1433 if ( nestqa >
bnd_qa )
then 1434 write(*,*)
'xxx ERROR: NEST_BND_QA exceeds BND_QA [initialize/ATMOS_BOUNDARY]' 1435 write(*,*)
'xxx check consistency between' 1436 write(*,*)
' ONLINE_BOUNDARY_USE_QHYD and ATMOS_BOUNDARY_USE_QHYD.' 1443 end subroutine atmos_boundary_initialize_online
1460 integer,
parameter :: handle = 2
1463 integer :: i, j, k, iq
1467 boundary_timestep = 1
1468 if(
io_l )
write(
io_fid_log,*)
'+++ BOUNDARY TIMESTEP NUMBER FOR INIT:', boundary_timestep
1470 call atmos_boundary_update_online_daughter( ref_now )
1472 boundary_timestep = boundary_timestep + 1
1473 if(
io_l )
write(
io_fid_log,*)
'+++ BOUNDARY TIMESTEP NUMBER FOR INIT:', boundary_timestep
1475 call atmos_boundary_update_online_daughter( ref_new )
1481 atmos_boundary_ref_dens(k,i,j,ref_old) = atmos_boundary_ref_dens(k,i,j,ref_now)
1482 atmos_boundary_ref_velx(k,i,j,ref_old) = atmos_boundary_ref_velx(k,i,j,ref_now)
1483 atmos_boundary_ref_vely(k,i,j,ref_old) = atmos_boundary_ref_vely(k,i,j,ref_now)
1484 atmos_boundary_ref_pott(k,i,j,ref_old) = atmos_boundary_ref_pott(k,i,j,ref_now)
1486 atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now)
1515 else if ( atmos_boundary_use_velz )
then 1525 update_nstep = nint( atmos_boundary_update_dt /
time_dtsec )
1527 write(*,*)
'xxx NSTEP is not multiple of PARENT_NSTEP' 1539 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC )
1544 real(RP),
intent(in) :: momz(
ka,
ia,
ja)
1545 real(RP),
intent(in) :: momx(
ka,
ia,
ja)
1546 real(RP),
intent(in) :: momy(
ka,
ia,
ja)
1547 real(RP),
intent(in) :: rhot(
ka,
ia,
ja)
1552 if ( do_parent_process )
then 1554 call atmos_boundary_send(
dens, momz, momx, momy, rhot,
qtrc )
1575 if ( do_parent_process )
then 1580 if ( do_daughter_process )
then 1585 if ( atmos_boundary_fid > 0 )
then 1587 atmos_boundary_fid = -1
1596 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC )
1612 real(RP),
intent(inout) :: momz(
ka,
ia,
ja)
1613 real(RP),
intent(inout) :: momx(
ka,
ia,
ja)
1614 real(RP),
intent(inout) :: momy(
ka,
ia,
ja)
1615 real(RP),
intent(inout) :: rhot(
ka,
ia,
ja)
1618 real(RP) :: bnd_dens(
ka,
ia,
ja)
1619 real(RP) :: bnd_velz(
ka,
ia,
ja)
1620 real(RP) :: bnd_velx(
ka,
ia,
ja)
1621 real(RP) :: bnd_vely(
ka,
ia,
ja)
1622 real(RP) :: bnd_pott(
ka,
ia,
ja)
1626 integer :: i, j, k, iq, iqa
1629 if ( do_parent_process )
then 1631 call atmos_boundary_update_online_parent(
dens,momz,momx,momy,rhot,
qtrc )
1636 if ( now_step >= update_nstep )
then 1638 boundary_timestep = boundary_timestep + 1
1642 if ( do_daughter_process )
then 1643 call atmos_boundary_update_online_daughter( ref_new )
1645 call atmos_boundary_update_file( ref_new )
1650 now_step = now_step + 1
1653 call get_boundary( bnd_dens(:,:,:), &
1658 bnd_qtrc(:,:,:,:), &
1700 iqa = iq +
qs_mp - 1
1739 momz(k,i,j) = momz(k,
is,j)
1758 iqa = iq +
qs_mp - 1
1810 momz(k,i,j) = momz(k,
ie,j)
1831 iqa = iq +
qs_mp - 1
1870 momz(k,i,j) = momz(k,i,
js)
1889 iqa = iq +
qs_mp - 1
1941 momz(k,i,j) = momz(k,i,
je)
1948 elseif ( do_parent_process )
then 1951 write(*,*)
'xxx [BUG] invalid path' 1963 if ( do_parent_process )
then 1967 if ( do_daughter_process )
then 1977 subroutine atmos_boundary_update_file( ref )
1985 integer,
intent(in) :: ref
1990 if(
io_l )
write(
io_fid_log,*)
"*** Atmos Boundary: read from boundary file(timestep=", boundary_timestep,
")" 1992 fid = atmos_boundary_fid
1994 call fileio_read( atmos_boundary_ref_dens(:,:,:,ref), fid,
'DENS',
'ZXY', boundary_timestep )
1995 call fileio_read( atmos_boundary_ref_velx(:,:,:,ref), fid,
'VELX',
'ZXY', boundary_timestep )
1996 call fileio_read( atmos_boundary_ref_vely(:,:,:,ref), fid,
'VELY',
'ZXY', boundary_timestep )
1997 call fileio_read( atmos_boundary_ref_pott(:,:,:,ref), fid,
'POTT',
'ZXY', boundary_timestep )
1999 call fileio_read( atmos_boundary_ref_qtrc(:,:,:,iq,ref), fid, aq_name(iq),
'ZXY', boundary_timestep )
2005 call atmos_boundary_ref_fillhalo( ref )
2008 end subroutine atmos_boundary_update_file
2012 subroutine atmos_boundary_update_online_parent( &
2026 real(RP),
intent(in) :: momz(
ka,
ia,
ja)
2027 real(RP),
intent(in) :: momx(
ka,
ia,
ja)
2028 real(RP),
intent(in) :: momy(
ka,
ia,
ja)
2029 real(RP),
intent(in) :: rhot(
ka,
ia,
ja)
2032 integer,
parameter :: handle = 1
2035 if(
io_l )
write(
io_fid_log,*)
"*** ATMOS BOUNDARY update online: PARENT" 2041 call atmos_boundary_send(
dens, momz, momx, momy, rhot,
qtrc )
2044 end subroutine atmos_boundary_update_online_parent
2048 subroutine atmos_boundary_update_online_daughter( &
2056 integer,
intent(in) :: ref
2058 integer,
parameter :: handle = 2
2061 if(
io_l )
write(
io_fid_log,
'(1X,A,I5)')
'*** ATMOS BOUNDARY update online: DAUGHTER', boundary_timestep
2064 call atmos_boundary_recv( ref )
2067 call atmos_boundary_ref_fillhalo( ref )
2073 end subroutine atmos_boundary_update_online_daughter
2077 subroutine atmos_boundary_send( &
2078 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC )
2090 integer,
parameter :: handle = 1
2094 real(RP),
intent(in) :: momz(
ka,
ia,
ja)
2095 real(RP),
intent(in) :: momx(
ka,
ia,
ja)
2096 real(RP),
intent(in) :: momy(
ka,
ia,
ja)
2097 real(RP),
intent(in) :: rhot(
ka,
ia,
ja)
2105 dummy_d(:,:,:,:) = 0.0_rp
2120 dummy_d(:,:,:,1:nestqa) )
2123 end subroutine atmos_boundary_send
2127 subroutine atmos_boundary_recv( &
2143 integer,
parameter :: handle = 2
2146 integer,
intent(in) :: ref_idx
2153 dummy_p(:,:,:,:) = 0.0_rp
2162 dummy_p(:,:,:,1:nestqa), &
2163 atmos_boundary_ref_dens(:,:,:,ref_idx), &
2164 atmos_boundary_ref_velz(:,:,:,ref_idx), &
2165 atmos_boundary_ref_velx(:,:,:,ref_idx), &
2166 atmos_boundary_ref_vely(:,:,:,ref_idx), &
2167 atmos_boundary_ref_pott(:,:,:,ref_idx), &
2168 atmos_boundary_ref_qtrc(:,:,:,1:nestqa,ref_idx) )
2175 end subroutine atmos_boundary_recv
2179 subroutine get_boundary_same_parent( &
2191 real(RP),
intent(out) :: bnd_dens(:,:,:)
2192 real(RP),
intent(out) :: bnd_velz(:,:,:)
2193 real(RP),
intent(out) :: bnd_velx(:,:,:)
2194 real(RP),
intent(out) :: bnd_vely(:,:,:)
2195 real(RP),
intent(out) :: bnd_pott(:,:,:)
2196 real(RP),
intent(out) :: bnd_qtrc(:,:,:,:)
2197 integer,
intent(in) :: now_step
2198 integer,
intent(in) :: update_step
2201 integer :: i, j, k, iq
2205 if ( now_step == update_step )
then 2214 bnd_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref)
2215 bnd_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref)
2216 bnd_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref)
2217 bnd_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref)
2218 bnd_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref)
2220 bnd_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref)
2227 end subroutine get_boundary_same_parent
2231 subroutine get_boundary_nearest_neighbor( &
2243 real(RP) :: eps = 1.0e-4_rp
2246 real(RP),
intent(out) :: bnd_dens(:,:,:)
2247 real(RP),
intent(out) :: bnd_velz(:,:,:)
2248 real(RP),
intent(out) :: bnd_velx(:,:,:)
2249 real(RP),
intent(out) :: bnd_vely(:,:,:)
2250 real(RP),
intent(out) :: bnd_pott(:,:,:)
2251 real(RP),
intent(out) :: bnd_qtrc(:,:,:,:)
2252 integer,
intent(in) :: now_step
2253 integer,
intent(in) :: update_step
2256 integer :: i, j, k, iq
2259 real(RP) :: real_nstep
2260 real(RP) :: half_nstep
2263 real_nstep =
real( now_step, kind=
rp )
2264 half_nstep =
real( UPDATE_NSTEP, kind=RP ) * 0.5_rp
2267 if( ( real_nstep - eps ) < half_nstep )
then 2271 else if( ( real_nstep - 1.0_rp + eps ) > half_nstep )
then 2283 bnd_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_idx)
2284 bnd_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_idx)
2285 bnd_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_idx)
2286 bnd_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_idx)
2287 bnd_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_idx)
2289 bnd_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_idx)
2296 end subroutine get_boundary_nearest_neighbor
2300 subroutine get_boundary_lerp_initpoint( &
2312 real(RP),
intent(out) :: bnd_dens(:,:,:)
2313 real(RP),
intent(out) :: bnd_velz(:,:,:)
2314 real(RP),
intent(out) :: bnd_velx(:,:,:)
2315 real(RP),
intent(out) :: bnd_vely(:,:,:)
2316 real(RP),
intent(out) :: bnd_pott(:,:,:)
2317 real(RP),
intent(out) :: bnd_qtrc(:,:,:,:)
2318 integer,
intent(in) :: now_step
2319 integer,
intent(in) :: update_step
2322 integer :: i, j, k, iq
2327 fact =
REAL(now_step, kind=RP) / update_step
2336 bnd_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_now) * ( 1.0_rp-fact ) &
2337 + atmos_boundary_ref_dens(k,i,j,ref_new) * fact
2338 bnd_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_now) * ( 1.0_rp-fact ) &
2339 + atmos_boundary_ref_velz(k,i,j,ref_new) * fact
2340 bnd_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_now) * ( 1.0_rp-fact) &
2341 + atmos_boundary_ref_velx(k,i,j,ref_new) * fact
2342 bnd_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_now) * ( 1.0_rp-fact) &
2343 + atmos_boundary_ref_vely(k,i,j,ref_new) * fact
2344 bnd_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_now) * ( 1.0_rp-fact ) &
2345 + atmos_boundary_ref_pott(k,i,j,ref_new) * fact
2347 bnd_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now) * ( 1.0_rp-fact ) &
2348 + atmos_boundary_ref_qtrc(k,i,j,iq,ref_new) * fact
2355 end subroutine get_boundary_lerp_initpoint
2359 subroutine get_boundary_lerp_midpoint( &
2373 real(RP) :: eps = 1.0e-4_rp
2376 real(RP),
intent(out) :: bnd_dens(:,:,:)
2377 real(RP),
intent(out) :: bnd_velz(:,:,:)
2378 real(RP),
intent(out) :: bnd_velx(:,:,:)
2379 real(RP),
intent(out) :: bnd_vely(:,:,:)
2380 real(RP),
intent(out) :: bnd_pott(:,:,:)
2381 real(RP),
intent(out) :: bnd_qtrc(:,:,:,:)
2382 integer,
intent(in) :: now_step
2383 integer,
intent(in) :: update_step
2386 integer :: i, j, k, iq
2388 real(RP) :: real_nstep
2389 real(RP) :: half_nstep
2393 real_nstep =
real( now_step, kind=
rp )
2394 half_nstep =
real( UPDATE_NSTEP, kind=RP ) * 0.5_rp
2397 if( ( real_nstep - eps ) < half_nstep )
then 2399 t1 =
time_dtsec / atmos_boundary_update_dt * ( real_nstep + half_nstep - 0.5_rp )
2404 bnd_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_now) * t1 &
2405 - atmos_boundary_ref_dens(k,i,j,ref_old) * ( t1 - 1.0_rp )
2406 bnd_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_now) * t1 &
2407 - atmos_boundary_ref_velz(k,i,j,ref_old) * ( t1 - 1.0_rp )
2408 bnd_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_now) * t1 &
2409 - atmos_boundary_ref_velx(k,i,j,ref_old) * ( t1 - 1.0_rp )
2410 bnd_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_now) * t1 &
2411 - atmos_boundary_ref_vely(k,i,j,ref_old) * ( t1 - 1.0_rp )
2412 bnd_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_now) * t1 &
2413 - atmos_boundary_ref_pott(k,i,j,ref_old) * ( t1 - 1.0_rp )
2415 bnd_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now) * t1 &
2416 - atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) * ( t1 - 1.0_rp )
2423 else if( ( real_nstep - 1.0_rp + eps ) > half_nstep )
then 2425 t1 =
time_dtsec / atmos_boundary_update_dt * ( real_nstep - half_nstep - 0.5_rp )
2430 bnd_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_new) * t1 &
2431 - atmos_boundary_ref_dens(k,i,j,ref_now) * ( t1 - 1.0_rp )
2432 bnd_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_new) * t1 &
2433 - atmos_boundary_ref_velz(k,i,j,ref_now) * ( t1 - 1.0_rp )
2434 bnd_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_new) * t1 &
2435 - atmos_boundary_ref_velx(k,i,j,ref_now) * ( t1 - 1.0_rp )
2436 bnd_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_new) * t1 &
2437 - atmos_boundary_ref_vely(k,i,j,ref_now) * ( t1 - 1.0_rp )
2438 bnd_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_new) * t1 &
2439 - atmos_boundary_ref_pott(k,i,j,ref_now) * ( t1 - 1.0_rp )
2441 bnd_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_new) * t1 &
2442 - atmos_boundary_ref_qtrc(k,i,j,iq,ref_now) * ( t1 - 1.0_rp )
2451 t1 =
time_dtsec / atmos_boundary_update_dt * ( real_nstep + half_nstep - 1.0_rp )
2452 t2 =
time_dtsec / atmos_boundary_update_dt * ( real_nstep - half_nstep )
2457 bnd_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_new) * t2 * 0.25_rp &
2458 + atmos_boundary_ref_dens(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2459 - atmos_boundary_ref_dens(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp
2460 bnd_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_new) * t2 * 0.25_rp &
2461 + atmos_boundary_ref_velz(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2462 - atmos_boundary_ref_velz(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp
2463 bnd_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_new) * t2 * 0.25_rp &
2464 + atmos_boundary_ref_velx(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2465 - atmos_boundary_ref_velx(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp
2466 bnd_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_new) * t2 * 0.25_rp &
2467 + atmos_boundary_ref_vely(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2468 - atmos_boundary_ref_vely(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp
2469 bnd_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_new) * t2 * 0.25_rp &
2470 + atmos_boundary_ref_pott(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2471 - atmos_boundary_ref_pott(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp
2473 bnd_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_new) * t2 * 0.25_rp &
2474 + atmos_boundary_ref_qtrc(k,i,j,iq,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2475 - atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) * ( t1 - 1.0_rp )
2484 end subroutine get_boundary_lerp_midpoint
2503 subroutine history_bnd( &
2504 ATMOS_BOUNDARY_DENS, &
2505 ATMOS_BOUNDARY_VELZ, &
2506 ATMOS_BOUNDARY_VELX, &
2507 ATMOS_BOUNDARY_VELY, &
2508 ATMOS_BOUNDARY_POTT, &
2509 ATMOS_BOUNDARY_QTRC )
2515 real(RP),
intent(in) :: ATMOS_BOUNDARY_DENS(KA,IA,JA)
2516 real(RP),
intent(in) :: ATMOS_BOUNDARY_VELZ(KA,IA,JA)
2517 real(RP),
intent(in) :: ATMOS_BOUNDARY_VELX(KA,IA,JA)
2518 real(RP),
intent(in) :: ATMOS_BOUNDARY_VELY(KA,IA,JA)
2519 real(RP),
intent(in) :: ATMOS_BOUNDARY_POTT(KA,IA,JA)
2520 real(RP),
intent(in) :: ATMOS_BOUNDARY_QTRC(KA,IA,JA,BND_QA)
2524 call hist_in( atmos_boundary_dens(:,:,:),
'DENS_BND',
'Boundary Density',
'kg/m3' )
2525 call hist_in( atmos_boundary_velz(:,:,:),
'VELZ_BND',
'Boundary velocity z-direction',
'm/s', zdim=
'half' )
2526 call hist_in( atmos_boundary_velx(:,:,:),
'VELX_BND',
'Boundary velocity x-direction',
'm/s', xdim=
'half' )
2527 call hist_in( atmos_boundary_vely(:,:,:),
'VELY_BND',
'Boundary velocity y-direction',
'm/s', ydim=
'half' )
2528 call hist_in( atmos_boundary_pott(:,:,:),
'POTT_BND',
'Boundary potential temperature',
'K' )
2530 call hist_in( atmos_boundary_qtrc(:,:,:,iq), trim(aq_name(iq))//
'_BND',
'Boundary '//trim(aq_name(iq)),
'kg/kg' )
2534 end subroutine history_bnd
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velx
integer, public is
start point of inner domain: x, local
integer, dimension(2), public parent_ka
parent max number in z-direction (with halo)
integer, dimension(2), public daughter_ka
daughter max number in z-direction (with halo)
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velz
real(dp), dimension(2), public parent_dtsec
parent DT [sec]
integer, public je
end point of inner domain: y, local
logical, public prc_has_n
subroutine, public prc_mpistop
Abort MPI.
real(dp) function, public calendar_combine_daysec(absday, abssec)
Combine day and second.
subroutine atmos_boundary_resume_online
Resume boundary value for real case experiment [online daughter].
module GRID (nesting system)
subroutine, public calendar_date2char(chardate, ymdhms, subsec)
Convert from gregorian date to absolute day/second.
subroutine, public atmos_boundary_resume(DENS, MOMZ, MOMX, MOMY, RHOT, QTRC)
Resume.
integer, public time_nstep
total steps [number]
logical, public io_l
output log or not? (this process)
logical, public online_iam_daughter
a flag to say "I am a daughter"
subroutine update_ref_index
Update indices of array of boundary references.
subroutine, public fileio_flush(fid)
Flush all pending requests to a netCDF file (PnetCDF only)
module ATMOSPHERE / Physics Cloud Microphysics
module ATMOSPHERE / Reference state
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_pott
real(rp), dimension(:), allocatable, public grid_fbfy
face buffer factor (0-1): y
logical, public prc_has_e
integer, dimension(2), public parent_nstep
parent step [number]
integer, public ke
end point of inner domain: z, local
real(rp), dimension(0-1), allocatable, public dens
subroutine, public atmos_boundary_update(DENS, MOMZ, MOMX, MOMY, RHOT, QTRC)
Update boundary value with a constant time boundary.
subroutine, public atmos_boundary_setup
Setup.
integer, public nest_bnd_qa
number of tracer treated in nesting system
subroutine, public nest_comm_nestdown(HANDLE, BND_QA, ipt_DENS, ipt_MOMZ, ipt_MOMX, ipt_MOMY, ipt_RHOT, ipt_QTRC, interped_ref_DENS, interped_ref_VELZ, interped_ref_VELX, interped_ref_VELY, interped_ref_POTT, interped_ref_QTRC)
Boundary data transfer from parent to daughter: nestdown.
subroutine, public atmos_hydrometeor_diagnose_number_concentration(QTRC)
character(len=h_short), dimension(:), pointer, public atmos_phy_mp_name
subroutine, public atmos_boundary_firstsend(DENS, MOMZ, MOMX, MOMY, RHOT, QTRC)
First send boundary value.
logical, public prc_has_s
real(rp), public const_undef
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_velz
real(rp), dimension(0-1), allocatable, public qtrc
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_vely
subroutine, public atmos_boundary_finalize
Finalize boundary value.
logical, public io_nml
output log or not? (for namelist, this process)
real(rp), dimension(:,:,:,:), allocatable, public atmos_boundary_qtrc
integer, public ia
of whole cells: x, local, with HALO
integer, dimension(2), public daughter_ia
daughter max number in x-direction (with halo)
real(rp), dimension(:), allocatable, public grid_fbfx
face buffer factor (0-1): x
real(dp), public time_dtsec
time interval of model [sec]
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_vely
integer, public ka
of whole cells: z, local, with HALO
real(rp), dimension(:,:,:), allocatable, public atmos_refstate_dens
refernce density [kg/m3]
real(rp), dimension(:), allocatable, public grid_fbfz
face buffer factor (0-1): z
logical, public online_boundary_diagqnum
integer, public js
start point of inner domain: y, local
real(rp), dimension(:), allocatable, public grid_cbfx
center buffer factor (0-1): x
integer, dimension(2), public parent_ja
parent max number in y-direction (with halo)
character(len=h_short), dimension(:), pointer, public atmos_phy_mp_unit
logical, public comm_fill_bnd
switch whether fill boundary data
integer, dimension(2), public daughter_ja
daughter max number in y-direction (with halo)
subroutine, public nest_comm_recv_cancel(HANDLE)
Sub-command for data transfer from parent to daughter: nestdown.
integer, dimension(2), public parent_ia
parent max number in x-direction (with halo)
integer, public ks
start point of inner domain: z, local
real(rp), dimension(:), allocatable, public grid_cbfz
center buffer factor (0-1): z
logical, public use_nesting
logical, public atmos_boundary_update_flag
subroutine, public nest_comm_recvwait_issue(HANDLE, BND_QA)
Sub-command for data transfer from parent to daughter: nestdown.
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_dens
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_dens
integer, public ie
end point of inner domain: x, local
real(rp), public const_eps
small number
subroutine atmos_boundary_resume_file
Resume boundary value for real case experiment.
logical, public online_iam_parent
a flag to say "I am a parent"
subroutine, public fileio_open(fid, basename)
open a netCDF file for read
module ATMOSPHERE / Boundary treatment
real(rp), dimension(:), allocatable, public grid_cbfy
center buffer factor (0-1): y
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_pott
logical, public online_use_velz
real(rp), public const_pi
pi
integer, dimension(6), public time_nowdate
current time [YYYY MM DD HH MM SS]
subroutine, public fileio_close(fid)
Close a netCDF file.
integer, public io_fid_conf
Config file ID.
integer, public io_fid_log
Log file ID.
logical, public prc_has_w
integer, parameter, public rp
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_velx
subroutine, public calendar_date2daysec(absday, abssec, ymdhms, subsec, offset_year)
Convert from gregorian date to absolute day/second.
integer, public io_fid_nml
Log file ID (only for output namelist)
real(rp), dimension(:,:,:,:), allocatable, public atmos_boundary_alpha_qtrc
real(rp), public atmos_boundary_smoother_fact
subroutine, public nest_comm_test(HANDLE)
[check communication status] Inter-communication
integer, public ja
of whole cells: y, local, with HALO