76 private :: atmos_boundary_var_fillhalo
77 private :: atmos_boundary_alpha_fillhalo
78 private :: atmos_boundary_ref_fillhalo
79 private :: atmos_boundary_setalpha
80 private :: atmos_boundary_setinitval
81 private :: atmos_boundary_read
82 private :: atmos_boundary_write
83 private :: atmos_boundary_generate
84 private :: atmos_boundary_initialize_file
85 private :: atmos_boundary_initialize_online
86 private :: atmos_boundary_update_file
87 private :: atmos_boundary_update_online_parent
88 private :: atmos_boundary_update_online_daughter
89 private :: atmos_boundary_send
90 private :: atmos_boundary_recv
103 real(RP),
intent(out) :: inc_dens(:,:,:)
104 real(RP),
intent(out) :: inc_velz(:,:,:)
105 real(RP),
intent(out) :: inc_velx(:,:,:)
106 real(RP),
intent(out) :: inc_vely(:,:,:)
107 real(RP),
intent(out) :: inc_pott(:,:,:)
108 real(RP),
intent(out) :: inc_qtrc(:,:,:,:)
109 end subroutine getinc
112 procedure(getinc),
pointer :: get_increment => null()
113 private :: get_increment
114 private :: get_increment_same_parent
115 private :: get_increment_nearest_neighbor
116 private :: get_increment_lerp_initpoint
117 private :: get_increment_lerp_midpoint
124 character(len=H_LONG),
private :: atmos_boundary_type =
'NONE' 125 character(len=H_LONG),
private :: atmos_boundary_in_basename =
'' 126 character(len=H_LONG),
private :: atmos_boundary_out_basename =
'' 127 character(len=H_MID),
private :: atmos_boundary_out_title =
'SCALE-RM BOUNDARY CONDITION' 128 character(len=H_MID),
private :: atmos_boundary_out_dtype =
'DEFAULT' 130 logical,
private :: atmos_boundary_use_dens = .false.
131 logical,
private :: atmos_boundary_use_velz = .false.
132 logical,
private :: atmos_boundary_use_velx = .false.
133 logical,
private :: atmos_boundary_use_vely = .false.
134 logical,
private :: atmos_boundary_use_pott = .false.
135 logical,
private :: atmos_boundary_use_qv = .false.
136 logical,
private :: atmos_boundary_use_qhyd = .false.
138 real(RP),
private :: atmos_boundary_value_velz = 0.0_rp
139 real(RP),
private :: atmos_boundary_value_velx = 0.0_rp
140 real(RP),
private :: atmos_boundary_value_vely = 0.0_rp
141 real(RP),
private :: atmos_boundary_value_pott = 300.0_rp
142 real(RP),
private :: atmos_boundary_value_qtrc = 0.0_rp
144 real(RP),
private :: atmos_boundary_alphafact_dens = 1.0_rp
145 real(RP),
private :: atmos_boundary_alphafact_velz = 1.0_rp
146 real(RP),
private :: atmos_boundary_alphafact_velx = 1.0_rp
147 real(RP),
private :: atmos_boundary_alphafact_vely = 1.0_rp
148 real(RP),
private :: atmos_boundary_alphafact_pott = 1.0_rp
149 real(RP),
private :: atmos_boundary_alphafact_qtrc = 1.0_rp
151 real(RP),
private :: atmos_boundary_fracz = 1.0_rp
152 real(RP),
private :: atmos_boundary_fracx = 1.0_rp
153 real(RP),
private :: atmos_boundary_fracy = 1.0_rp
154 real(RP),
private :: atmos_boundary_tauz
155 real(RP),
private :: atmos_boundary_taux
156 real(RP),
private :: atmos_boundary_tauy
158 real(DP),
private :: atmos_boundary_update_dt = 0.0_dp
159 integer,
private :: update_nstep
161 real(RP),
private,
allocatable :: atmos_boundary_ref_dens(:,:,:,:)
162 real(RP),
private,
allocatable :: atmos_boundary_ref_velz(:,:,:,:)
163 real(RP),
private,
allocatable :: atmos_boundary_ref_velx(:,:,:,:)
164 real(RP),
private,
allocatable :: atmos_boundary_ref_vely(:,:,:,:)
165 real(RP),
private,
allocatable :: atmos_boundary_ref_pott(:,:,:,:)
166 real(RP),
private,
allocatable :: atmos_boundary_ref_qtrc(:,:,:,:,:)
168 character(len=H_LONG),
private :: atmos_boundary_increment_type =
'lerp_initpoint' 170 integer,
private :: atmos_boundary_start_date(6) = (/ -9999, 0, 0, 0, 0, 0 /)
172 integer,
private :: now_step
173 integer,
private :: boundary_timestep = 0
174 logical,
private :: atmos_boundary_linear_v = .false.
175 logical,
private :: atmos_boundary_linear_h = .true.
176 real(RP),
private :: atmos_boundary_exp_h = 2.0_rp
177 logical,
private :: atmos_boundary_online = .false.
178 logical,
private :: atmos_boundary_online_master = .false.
179 logical,
private :: do_parent_process = .false.
180 logical,
private :: do_daughter_process = .false.
181 logical,
private :: l_bnd = .false.
183 real(DP),
private :: boundary_time_initdaysec
185 integer,
private :: ref_size = 3
186 integer,
private :: ref_old = 1
187 integer,
private :: ref_now = 2
188 integer,
private :: ref_new = 3
210 namelist / param_atmos_boundary / &
211 atmos_boundary_type, &
212 atmos_boundary_in_basename, &
213 atmos_boundary_out_basename, &
214 atmos_boundary_out_title, &
215 atmos_boundary_use_velz, &
216 atmos_boundary_use_velx, &
217 atmos_boundary_use_vely, &
218 atmos_boundary_use_pott, &
219 atmos_boundary_use_dens, &
220 atmos_boundary_use_qv, &
221 atmos_boundary_use_qhyd, &
222 atmos_boundary_value_velz, &
223 atmos_boundary_value_velx, &
224 atmos_boundary_value_vely, &
225 atmos_boundary_value_pott, &
226 atmos_boundary_value_qtrc, &
227 atmos_boundary_alphafact_dens, &
228 atmos_boundary_alphafact_velz, &
229 atmos_boundary_alphafact_velx, &
230 atmos_boundary_alphafact_vely, &
231 atmos_boundary_alphafact_pott, &
232 atmos_boundary_alphafact_qtrc, &
234 atmos_boundary_fracz, &
235 atmos_boundary_fracx, &
236 atmos_boundary_fracy, &
237 atmos_boundary_tauz, &
238 atmos_boundary_taux, &
239 atmos_boundary_tauy, &
240 atmos_boundary_update_dt, &
241 atmos_boundary_start_date, &
242 atmos_boundary_linear_v, &
243 atmos_boundary_linear_h, &
244 atmos_boundary_exp_h, &
245 atmos_boundary_increment_type
251 if(
io_l )
write(
io_fid_log,*)
'+++ Module[Boundary]/Categ[ATMOS]' 253 atmos_boundary_tauz = dt * 10.0_rp
254 atmos_boundary_taux = dt * 10.0_rp
255 atmos_boundary_tauy = dt * 10.0_rp
259 read(
io_fid_conf,nml=param_atmos_boundary,iostat=ierr)
261 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 262 elseif( ierr > 0 )
then 263 write(*,*)
'xxx Not appropriate names in namelist PARAM_ATMOS_BOUNDARY. Check!' 270 atmos_boundary_online = .false.
273 atmos_boundary_online = .false.
275 atmos_boundary_online = .true.
278 do_parent_process = .false.
279 do_daughter_process = .false.
280 atmos_boundary_online_master = .false.
281 if ( atmos_boundary_online )
then 283 do_parent_process = .true.
285 atmos_boundary_online_master = .true.
289 do_daughter_process = .true.
293 if( atmos_boundary_use_qhyd )
then 325 if ( atmos_boundary_type ==
'REAL' .OR. do_daughter_process )
then 333 select case(atmos_boundary_increment_type)
335 get_increment => get_increment_same_parent
336 case (
'nearest_neighbor')
337 get_increment => get_increment_nearest_neighbor
338 case (
'lerp_initpoint')
339 get_increment => get_increment_lerp_initpoint
340 case (
'lerp_midpoint')
341 get_increment => get_increment_lerp_midpoint
343 write(*,*)
'xxx Wrong parameter in ATMOS_BOUNDARY_increment_TYPE. Check!' 349 allocate( atmos_boundary_ref_dens(
ka,
ia,
ja,ref_size) )
350 allocate( atmos_boundary_ref_velz(
ka,
ia,
ja,ref_size) )
351 allocate( atmos_boundary_ref_velx(
ka,
ia,
ja,ref_size) )
352 allocate( atmos_boundary_ref_vely(
ka,
ia,
ja,ref_size) )
353 allocate( atmos_boundary_ref_pott(
ka,
ia,
ja,ref_size) )
354 allocate( atmos_boundary_ref_qtrc(
ka,
ia,
ja,
bnd_qa,ref_size) )
363 if ( do_daughter_process )
then 364 call atmos_boundary_initialize_online
366 if ( atmos_boundary_in_basename /=
'' )
then 367 call atmos_boundary_initialize_file
369 write(*,*)
'xxx You need specify ATMOS_BOUNDARY_IN_BASENAME' 374 call atmos_boundary_setalpha
378 elseif ( atmos_boundary_type ==
'CONST' )
then 380 call atmos_boundary_generate
382 call atmos_boundary_setalpha
386 elseif ( atmos_boundary_type ==
'INIT' )
then 388 call atmos_boundary_setalpha
392 elseif ( atmos_boundary_type ==
'FILE' )
then 394 if ( atmos_boundary_in_basename /=
'' )
then 395 call atmos_boundary_read
397 write(*,*)
'xxx You need specify ATMOS_BOUNDARY_IN_BASENAME' 404 write(*,*)
'xxx unsupported ATMOS_BOUNDARY_TYPE. Check!', trim(atmos_boundary_type)
412 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary parameters' 413 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary type : ', atmos_boundary_type
415 if(
io_l )
write(
io_fid_log,*)
'*** is VELZ used in atmospheric boundary? : ', atmos_boundary_use_velz
416 if(
io_l )
write(
io_fid_log,*)
'*** is VELX used in atmospheric boundary? : ', atmos_boundary_use_velx
417 if(
io_l )
write(
io_fid_log,*)
'*** is VELY used in atmospheric boundary? : ', atmos_boundary_use_vely
418 if(
io_l )
write(
io_fid_log,*)
'*** is POTT used in atmospheric boundary? : ', atmos_boundary_use_pott
419 if(
io_l )
write(
io_fid_log,*)
'*** is DENS used in atmospheric boundary? : ', atmos_boundary_use_dens
420 if(
io_l )
write(
io_fid_log,*)
'*** is QV used in atmospheric boundary? : ', atmos_boundary_use_qv
421 if(
io_l )
write(
io_fid_log,*)
'*** is QHYD used in atmospheric boundary? : ', atmos_boundary_use_qhyd
423 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary VELZ values : ', atmos_boundary_value_velz
424 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary VELX values : ', atmos_boundary_value_velx
425 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary VELY values : ', atmos_boundary_value_vely
426 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary POTT values : ', atmos_boundary_value_pott
427 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary QTRC values : ', atmos_boundary_value_qtrc
430 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary z-fraction : ', atmos_boundary_fracz
431 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary x-fraction : ', atmos_boundary_fracx
432 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary y-fraction : ', atmos_boundary_fracy
433 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary z-relaxation time : ', atmos_boundary_tauz
434 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary x-relaxation time : ', atmos_boundary_taux
435 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary y-relaxation time : ', atmos_boundary_tauy
437 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary update dt : ', atmos_boundary_update_dt
438 if(
io_l )
write(
io_fid_log,*)
'*** atmospheric boundary start date : ', atmos_boundary_start_date(:)
440 if(
io_l )
write(
io_fid_log,*)
'*** linear profile in vertically relax region : ', atmos_boundary_linear_v
441 if(
io_l )
write(
io_fid_log,*)
'*** linear profile in horizontally relax region : ', atmos_boundary_linear_h
442 if(
io_l )
write(
io_fid_log,*)
'*** non-linear factor in horizontally relax region : ', atmos_boundary_exp_h
444 if(
io_l )
write(
io_fid_log,*)
'*** online nesting for lateral boundary : ', atmos_boundary_online
446 if(
io_l )
write(
io_fid_log,*)
'*** does lateral boundary exist in this domain? : ', l_bnd
448 if(
io_l )
write(
io_fid_log,*)
'*** lateral boundary increment type : ', atmos_boundary_increment_type
465 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
466 real(RP),
intent(in) :: MOMZ(
ka,
ia,
ja)
467 real(RP),
intent(in) :: MOMX(
ka,
ia,
ja)
468 real(RP),
intent(in) :: MOMY(
ka,
ia,
ja)
469 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
470 real(RP),
intent(in) :: QTRC(
ka,
ia,
ja,
qa)
474 dens, momz, momx, momy, rhot, qtrc )
479 if ( do_daughter_process )
then 482 if ( atmos_boundary_in_basename /=
'' )
then 487 elseif ( atmos_boundary_type ==
'INIT' )
then 489 call atmos_boundary_setinitval( dens, &
497 if( atmos_boundary_out_basename /=
'' )
then 498 call atmos_boundary_write
517 subroutine atmos_boundary_var_fillhalo
566 end subroutine atmos_boundary_var_fillhalo
570 subroutine atmos_boundary_alpha_fillhalo
619 end subroutine atmos_boundary_alpha_fillhalo
623 subroutine atmos_boundary_ref_fillhalo( &
631 integer,
intent(in) :: ref_idx
639 atmos_boundary_ref_dens( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_dens(
ks,i,j,ref_idx)
640 atmos_boundary_ref_velz( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_velz(
ks,i,j,ref_idx)
641 atmos_boundary_ref_velx( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_velx(
ks,i,j,ref_idx)
642 atmos_boundary_ref_vely( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_vely(
ks,i,j,ref_idx)
643 atmos_boundary_ref_pott( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_pott(
ks,i,j,ref_idx)
645 atmos_boundary_ref_dens(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_dens(
ke,i,j,ref_idx)
646 atmos_boundary_ref_velz(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_velz(
ke,i,j,ref_idx)
647 atmos_boundary_ref_velx(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_velx(
ke,i,j,ref_idx)
648 atmos_boundary_ref_vely(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_vely(
ke,i,j,ref_idx)
649 atmos_boundary_ref_pott(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_pott(
ke,i,j,ref_idx)
652 atmos_boundary_ref_qtrc( 1:
ks-1,i,j,iq,ref_idx) = atmos_boundary_ref_qtrc(
ks,i,j,iq,ref_idx)
653 atmos_boundary_ref_qtrc(
ke+1:
ka, i,j,iq,ref_idx) = atmos_boundary_ref_qtrc(
ke,i,j,iq,ref_idx)
658 call comm_vars8( atmos_boundary_ref_dens(:,:,:,ref_idx), 1 )
659 call comm_vars8( atmos_boundary_ref_velz(:,:,:,ref_idx), 2 )
660 call comm_vars8( atmos_boundary_ref_velx(:,:,:,ref_idx), 3 )
661 call comm_vars8( atmos_boundary_ref_vely(:,:,:,ref_idx), 4 )
662 call comm_vars8( atmos_boundary_ref_pott(:,:,:,ref_idx), 5 )
665 call comm_vars8( atmos_boundary_ref_qtrc(:,:,:,iq,ref_idx), 5+iq )
668 call comm_wait ( atmos_boundary_ref_dens(:,:,:,ref_idx), 1, .false. )
669 call comm_wait ( atmos_boundary_ref_velz(:,:,:,ref_idx), 2, .false. )
670 call comm_wait ( atmos_boundary_ref_velx(:,:,:,ref_idx), 3, .false. )
671 call comm_wait ( atmos_boundary_ref_vely(:,:,:,ref_idx), 4, .false. )
672 call comm_wait ( atmos_boundary_ref_pott(:,:,:,ref_idx), 5, .false. )
675 call comm_wait ( atmos_boundary_ref_qtrc(:,:,:,iq,ref_idx), 5+iq, .false. )
679 end subroutine atmos_boundary_ref_fillhalo
683 subroutine atmos_boundary_setalpha
697 real(RP) :: coef_z, alpha_z1, alpha_z2
698 real(RP) :: coef_x, alpha_x1, alpha_x2
699 real(RP) :: coef_y, alpha_y1, alpha_y2
702 integer :: i, j, k, iq
706 atmos_boundary_fracz = max( min( atmos_boundary_fracz, 1.0_rp ), eps )
707 atmos_boundary_fracx = max( min( atmos_boundary_fracx, 1.0_rp ), eps )
708 atmos_boundary_fracy = max( min( atmos_boundary_fracy, 1.0_rp ), eps )
710 if ( atmos_boundary_tauz <= 0.0_rp )
then 713 coef_z = 1.0_rp / atmos_boundary_tauz
716 if ( atmos_boundary_taux <= 0.0_rp )
then 719 coef_x = 1.0_rp / atmos_boundary_taux
722 if ( atmos_boundary_tauy <= 0.0_rp )
then 725 coef_y = 1.0_rp / atmos_boundary_tauy
732 if ( ee1 <= 1.0_rp - atmos_boundary_fracz )
then 735 ee1 = ( ee1 - 1.0_rp + atmos_boundary_fracz ) / atmos_boundary_fracz
739 if ( ee2 <= 1.0_rp - atmos_boundary_fracz )
then 742 ee2 = ( ee2 - 1.0_rp + atmos_boundary_fracz ) / atmos_boundary_fracz
747 if ( atmos_boundary_linear_v )
then 748 alpha_z1 = coef_z * ee1
749 alpha_z2 = coef_z * ee2
751 if ( ee1 > 0.0_rp .AND. ee1 <= 0.5_rp )
then 752 alpha_z1 = coef_z * 0.5_rp * ( 1.0_rp - cos( ee1*pi ) )
753 elseif( ee1 > 0.5_rp .AND. ee1 <= 1.0_rp )
then 754 alpha_z1 = coef_z * 0.5_rp * ( 1.0_rp + sin( (ee1-0.5_rp)*pi ) )
756 if ( ee2 > 0.0_rp .AND. ee2 <= 0.5_rp )
then 757 alpha_z2 = coef_z * 0.5_rp * ( 1.0_rp - cos( ee2*pi ) )
758 elseif( ee2 > 0.5_rp .AND. ee2 <= 1.0_rp )
then 759 alpha_z2 = coef_z * 0.5_rp * ( 1.0_rp + sin( (ee2-0.5_rp)*pi ) )
764 if ( ee1 <= 1.0_rp - atmos_boundary_fracx )
then 767 ee1 = ( ee1 - 1.0_rp + atmos_boundary_fracx ) / atmos_boundary_fracx
771 if ( ee2 <= 1.0_rp - atmos_boundary_fracx )
then 774 ee2 = ( ee2 - 1.0_rp + atmos_boundary_fracx ) / atmos_boundary_fracx
777 if ( atmos_boundary_linear_h )
then 778 alpha_x1 = coef_x * ee1
779 alpha_x2 = coef_x * ee2
781 alpha_x1 = coef_x * ee1 * exp( -(1.0_rp-ee1) * atmos_boundary_exp_h )
782 alpha_x2 = coef_x * ee2 * exp( -(1.0_rp-ee2) * atmos_boundary_exp_h )
786 if ( ee1 <= 1.0_rp - atmos_boundary_fracy )
then 789 ee1 = ( ee1 - 1.0_rp + atmos_boundary_fracy ) / atmos_boundary_fracy
793 if ( ee2 <= 1.0_rp - atmos_boundary_fracy )
then 796 ee2 = ( ee2 - 1.0_rp + atmos_boundary_fracy ) / atmos_boundary_fracy
799 if ( atmos_boundary_linear_h )
then 800 alpha_y1 = coef_y * ee1
801 alpha_y2 = coef_y * ee2
803 alpha_y1 = coef_y * ee1 * exp( -(1.0_rp-ee1) * atmos_boundary_exp_h )
804 alpha_y2 = coef_y * ee2 * exp( -(1.0_rp-ee2) * atmos_boundary_exp_h )
810 if ( atmos_boundary_use_velz )
then 818 if ( atmos_boundary_use_dens )
then 824 if ( atmos_boundary_use_velx )
then 829 if ( atmos_boundary_use_vely )
then 834 if ( atmos_boundary_use_pott )
then 839 if ( atmos_boundary_use_qv )
then 844 if ( atmos_boundary_use_qhyd )
then 872 if ( .NOT. atmos_boundary_use_dens )
then 875 if ( .NOT. atmos_boundary_use_velz )
then 878 if ( .NOT. atmos_boundary_use_velx )
then 881 if ( .NOT. atmos_boundary_use_vely )
then 884 if ( .NOT. atmos_boundary_use_pott )
then 887 if ( .NOT. atmos_boundary_use_qv )
then 890 if ( .NOT. atmos_boundary_use_qhyd )
then 898 call atmos_boundary_alpha_fillhalo
901 end subroutine atmos_boundary_setalpha
905 subroutine atmos_boundary_setinitval( &
906 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC )
909 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
910 real(RP),
intent(in) :: MOMZ(
ka,
ia,
ja)
911 real(RP),
intent(in) :: MOMX(
ka,
ia,
ja)
912 real(RP),
intent(in) :: MOMY(
ka,
ia,
ja)
913 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
914 real(RP),
intent(in) :: QTRC(
ka,
ia,
ja,
qa)
916 integer :: i, j, k, iq
958 call atmos_boundary_var_fillhalo
961 end subroutine atmos_boundary_setinitval
965 subroutine atmos_boundary_read
981 character(len=H_LONG) :: bname
984 real(RP) :: tmp_CBFZ(
ka), tmp_CBFX(
ia), tmp_CBFY(
ja)
988 bname = atmos_boundary_in_basename
990 if ( atmos_boundary_use_dens &
991 .OR. atmos_boundary_use_velz &
992 .OR. atmos_boundary_use_velx &
993 .OR. atmos_boundary_use_vely &
994 .OR. atmos_boundary_use_pott &
996 call fileread( reference_atmos(:,:,:), bname,
'DENS', 1,
prc_myrank )
999 if ( atmos_boundary_use_dens )
then 1000 call fileread( reference_atmos(:,:,:), bname,
'ALPHA_DENS', 1,
prc_myrank )
1004 if ( atmos_boundary_use_velz )
then 1005 call fileread( reference_atmos(:,:,:), bname,
'VELZ', 1,
prc_myrank )
1007 call fileread( reference_atmos(:,:,:), bname,
'ALPHA_VELZ', 1,
prc_myrank )
1011 if ( atmos_boundary_use_velx )
then 1012 call fileread( reference_atmos(:,:,:), bname,
'VELX', 1,
prc_myrank )
1014 call fileread( reference_atmos(:,:,:), bname,
'ALPHA_VELX', 1,
prc_myrank )
1018 if ( atmos_boundary_use_vely )
then 1019 call fileread( reference_atmos(:,:,:), bname,
'VELY', 1,
prc_myrank )
1021 call fileread( reference_atmos(:,:,:), bname,
'ALPHA_VELY', 1,
prc_myrank )
1025 if ( atmos_boundary_use_pott )
then 1026 call fileread( reference_atmos(:,:,:), bname,
'POTT', 1,
prc_myrank )
1028 call fileread( reference_atmos(:,:,:), bname,
'ALPHA_POTT', 1,
prc_myrank )
1032 if ( atmos_boundary_use_qv )
then 1033 call fileread( reference_atmos(:,:,:), bname,
'QV', 1,
prc_myrank )
1035 call fileread( reference_atmos(:,:,:), bname,
'ALPHA_QV', 1,
prc_myrank )
1039 if ( atmos_boundary_use_qhyd )
then 1043 call fileread( reference_atmos(:,:,:), bname,
'ALPHA_'//trim(
aq_name(iq)), 1,
prc_myrank )
1048 call fileread( tmp_cbfz(:), bname,
'CBFZ', 1,
prc_myrank )
1049 call fileread( tmp_cbfx(:), bname,
'CBFX', 1,
prc_myrank )
1050 call fileread( tmp_cbfy(:), bname,
'CBFY', 1,
prc_myrank )
1053 if( abs(tmp_cbfx(i) -
grid_cbfx(i)) > eps )
then 1055 '*** Buffer layer (X) in ATMOS_BOUNDARY_IN_BASENAME is different from GRID_IN_BASENAME ***: i=', &
1061 if( abs(tmp_cbfy(j) -
grid_cbfy(j)) > eps )
then 1063 '*** Buffer layer (Y) in ATMOS_BOUNDARY_IN_BASENAME is different from GRID_IN_BASENAME ***: j=', &
1069 if( abs(tmp_cbfz(k) -
grid_cbfz(k)) > eps )
then 1071 '*** Buffer layer (Z) in ATMOS_BOUNDARY_IN_BASENAME is different from GRID_IN_BASENAME ***: k=', &
1077 call atmos_boundary_var_fillhalo
1078 call atmos_boundary_alpha_fillhalo
1081 end subroutine atmos_boundary_read
1085 subroutine atmos_boundary_write
1095 if ( atmos_boundary_use_dens &
1096 .OR. atmos_boundary_use_velz &
1097 .OR. atmos_boundary_use_velx &
1098 .OR. atmos_boundary_use_vely &
1099 .OR. atmos_boundary_use_pott &
1102 atmos_boundary_out_basename, atmos_boundary_out_title, &
1103 'DENS',
'Reference Density',
'kg/m3',
'ZXY', &
1104 atmos_boundary_out_dtype )
1106 if ( atmos_boundary_use_dens .OR. l_bnd )
then 1108 atmos_boundary_out_basename, atmos_boundary_out_title, &
1109 'ALPHA_DENS',
'Alpha for DENS',
'1',
'ZXY', &
1110 atmos_boundary_out_dtype )
1113 if ( atmos_boundary_use_velz .OR. (l_bnd .AND.
online_use_velz) )
then 1115 atmos_boundary_out_basename, atmos_boundary_out_title, &
1116 'VELZ',
'Reference Velocity w',
'm/s',
'ZXY', &
1117 atmos_boundary_out_dtype )
1119 atmos_boundary_out_basename, atmos_boundary_out_title, &
1120 'ALPHA_VELZ',
'Alpha for VELZ',
'1',
'ZXY', &
1121 atmos_boundary_out_dtype )
1124 if ( atmos_boundary_use_velx .OR. l_bnd )
then 1126 atmos_boundary_out_basename, atmos_boundary_out_title, &
1127 'VELX',
'Reference Velocity u',
'm/s',
'ZXY', &
1128 atmos_boundary_out_dtype )
1130 atmos_boundary_out_basename, atmos_boundary_out_title, &
1131 'ALPHA_VELX',
'Alpha for VELX',
'1',
'ZXY', &
1132 atmos_boundary_out_dtype )
1135 if ( atmos_boundary_use_vely .OR. l_bnd )
then 1137 atmos_boundary_out_basename, atmos_boundary_out_title, &
1138 'VELY',
'Reference Velocity y',
'm/s',
'ZXY', &
1139 atmos_boundary_out_dtype )
1141 atmos_boundary_out_basename, atmos_boundary_out_title, &
1142 'ALPHA_VELY',
'Alpha for VELY',
'1',
'ZXY', &
1143 atmos_boundary_out_dtype )
1146 if ( atmos_boundary_use_pott .OR. l_bnd )
then 1148 atmos_boundary_out_basename, atmos_boundary_out_title, &
1149 'POTT',
'Reference POTT',
'K',
'ZXY', &
1150 atmos_boundary_out_dtype )
1152 atmos_boundary_out_basename, atmos_boundary_out_title, &
1153 'ALPHA_POTT',
'Alpha for POTT',
'1',
'ZXY', &
1154 atmos_boundary_out_dtype )
1157 if ( atmos_boundary_use_qv .OR. l_bnd )
then 1159 atmos_boundary_out_basename, atmos_boundary_out_title, &
1160 'QV',
'Reference QV',
'kg/kg',
'ZXY', &
1161 atmos_boundary_out_dtype )
1163 atmos_boundary_out_basename, atmos_boundary_out_title, &
1164 'ALPHA_QV',
'Alpha for QV',
'1',
'ZXY', &
1165 atmos_boundary_out_dtype )
1168 if ( atmos_boundary_use_qhyd )
then 1171 atmos_boundary_out_basename, atmos_boundary_out_title, &
1173 atmos_boundary_out_dtype )
1175 atmos_boundary_out_basename, atmos_boundary_out_title, &
1176 'ALPHA_'//trim(
aq_name(iq)),
'Alpha for '//trim(
aq_name(iq)),
'1',
'ZXY', &
1177 atmos_boundary_out_dtype )
1182 end subroutine atmos_boundary_write
1186 subroutine atmos_boundary_generate
1191 integer :: i, j, k, iq
1209 call atmos_boundary_var_fillhalo
1212 end subroutine atmos_boundary_generate
1216 subroutine atmos_boundary_initialize_file
1225 integer :: boundary_time_startday
1226 real(DP) :: boundary_time_startsec
1227 real(DP) :: boundary_time_startms
1228 integer :: boundary_time_offset_year
1230 character(len=27) :: boundary_chardate
1232 if ( atmos_boundary_start_date(1) == -9999 )
then 1237 boundary_time_startms = 0.0_dp
1238 boundary_time_offset_year = 0
1240 atmos_boundary_start_date(:), &
1241 boundary_time_startms )
1244 boundary_time_startsec, &
1245 atmos_boundary_start_date(:), &
1246 boundary_time_startms, &
1247 boundary_time_offset_year )
1251 if(
io_l )
write(
io_fid_log,
'(1x,A,A)')
'*** BOUNDARY START Date : ', boundary_chardate
1254 end subroutine atmos_boundary_initialize_file
1271 real(RP) :: inc_DENS(
ka,
ia,
ja)
1272 real(RP) :: inc_VELZ(
ka,
ia,
ja)
1273 real(RP) :: inc_VELX(
ka,
ia,
ja)
1274 real(RP) :: inc_VELY(
ka,
ia,
ja)
1275 real(RP) :: inc_POTT(
ka,
ia,
ja)
1278 integer :: run_time_startdate(6)
1279 integer :: run_time_startday
1280 real(DP) :: run_time_startsec
1281 real(DP) :: run_time_startms
1282 integer :: run_time_offset_year
1283 real(DP) :: run_time_nowdaysec
1285 real(DP) :: boundary_diff_daysec
1286 real(RP) :: boundary_inc_offset
1287 integer :: fillgaps_steps
1289 character(len=H_LONG) :: bname
1291 integer :: i, j, k, iq, n
1294 bname = atmos_boundary_in_basename
1298 run_time_startms = 0.0_dp
1299 run_time_offset_year = 0
1302 run_time_startsec, &
1303 run_time_startdate(:), &
1305 run_time_offset_year )
1309 boundary_diff_daysec = run_time_nowdaysec - boundary_time_initdaysec
1310 boundary_timestep = 1 + int( boundary_diff_daysec / atmos_boundary_update_dt )
1311 boundary_inc_offset = mod( boundary_diff_daysec, atmos_boundary_update_dt )
1312 fillgaps_steps = int( boundary_inc_offset /
time_dtsec )
1314 if(
io_l )
write(
io_fid_log,*)
'+++ BOUNDARY TIMESTEP NUMBER FOR INIT:', boundary_timestep
1315 if(
io_l )
write(
io_fid_log,*)
'+++ BOUNDARY INCREMENT OFFSET:', boundary_inc_offset
1316 if(
io_l )
write(
io_fid_log,*)
'+++ BOUNDARY FILLGAPS STEPS:', fillgaps_steps
1319 call atmos_boundary_update_file( ref_now )
1321 boundary_timestep = boundary_timestep + 1
1322 call atmos_boundary_update_file( ref_new )
1328 atmos_boundary_ref_dens(k,i,j,ref_old) = atmos_boundary_ref_dens(k,i,j,ref_now)
1329 atmos_boundary_ref_velx(k,i,j,ref_old) = atmos_boundary_ref_velx(k,i,j,ref_now)
1330 atmos_boundary_ref_vely(k,i,j,ref_old) = atmos_boundary_ref_vely(k,i,j,ref_now)
1331 atmos_boundary_ref_pott(k,i,j,ref_old) = atmos_boundary_ref_pott(k,i,j,ref_now)
1333 atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now)
1354 if ( atmos_boundary_use_velz )
then 1364 now_step = fillgaps_steps
1367 call get_increment( inc_dens(:,:,:), &
1378 do n = 1, fillgaps_steps
1391 if ( atmos_boundary_update_dt <= 0.0_dp )
then 1392 write(*,*)
'xxx You need specify ATMOS_BOUNDARY_UPDATE_DT as larger than 0.0' 1395 update_nstep = nint( atmos_boundary_update_dt /
time_dtsec )
1396 if ( abs(update_nstep *
time_dtsec - atmos_boundary_update_dt) > 1e-10_dp )
then 1397 write(*,*)
'xxx ATMOS_BOUNDARY_UPDATE_DT is not multiple of DT' 1406 subroutine atmos_boundary_initialize_online
1417 integer,
parameter :: handle = 2
1421 if ( nestqa /=
bnd_qa )
then 1422 write(*,*)
'xxx ERROR: NEST_BND_QA exceeds BND_QA [initialize/ATMOS_BOUNDARY]' 1423 write(*,*)
'xxx check consistency between' 1424 write(*,*)
' ONLINE_BOUNDARY_USE_QHYD and ATMOS_BOUNDARY_USE_QHYD.' 1431 end subroutine atmos_boundary_initialize_online
1448 integer,
parameter :: handle = 2
1451 integer :: i, j, k, iq
1455 boundary_timestep = 1
1456 if(
io_l )
write(
io_fid_log,*)
'+++ BOUNDARY TIMESTEP NUMBER FOR INIT:', boundary_timestep
1458 call atmos_boundary_update_online_daughter( ref_now )
1460 boundary_timestep = boundary_timestep + 1
1461 if(
io_l )
write(
io_fid_log,*)
'+++ BOUNDARY TIMESTEP NUMBER FOR INIT:', boundary_timestep
1463 call atmos_boundary_update_online_daughter( ref_new )
1469 atmos_boundary_ref_dens(k,i,j,ref_old) = atmos_boundary_ref_dens(k,i,j,ref_now)
1470 atmos_boundary_ref_velx(k,i,j,ref_old) = atmos_boundary_ref_velx(k,i,j,ref_now)
1471 atmos_boundary_ref_vely(k,i,j,ref_old) = atmos_boundary_ref_vely(k,i,j,ref_now)
1472 atmos_boundary_ref_pott(k,i,j,ref_old) = atmos_boundary_ref_pott(k,i,j,ref_now)
1474 atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now)
1503 else if ( atmos_boundary_use_velz )
then 1513 update_nstep = nint( atmos_boundary_update_dt /
time_dtsec )
1515 write(*,*)
'xxx NSTEP is not multiple of PARENT_NSTEP' 1527 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC )
1531 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
1532 real(RP),
intent(in) :: MOMZ(
ka,
ia,
ja)
1533 real(RP),
intent(in) :: MOMX(
ka,
ia,
ja)
1534 real(RP),
intent(in) :: MOMY(
ka,
ia,
ja)
1535 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
1536 real(RP),
intent(in) :: QTRC(
ka,
ia,
ja,
qa)
1540 if ( do_parent_process )
then 1542 call atmos_boundary_send( dens, momz, momx, momy, rhot, qtrc )
1561 if ( do_parent_process )
then 1566 if ( do_daughter_process )
then 1577 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC )
1590 real(RP),
intent(inout) :: DENS(
ka,
ia,
ja)
1591 real(RP),
intent(inout) :: MOMZ(
ka,
ia,
ja)
1592 real(RP),
intent(inout) :: MOMX(
ka,
ia,
ja)
1593 real(RP),
intent(inout) :: MOMY(
ka,
ia,
ja)
1594 real(RP),
intent(inout) :: RHOT(
ka,
ia,
ja)
1595 real(RP),
intent(inout) :: QTRC(
ka,
ia,
ja,
qa)
1597 real(RP) :: inc_DENS(
ka,
ia,
ja)
1598 real(RP) :: inc_VELZ(
ka,
ia,
ja)
1599 real(RP) :: inc_VELX(
ka,
ia,
ja)
1600 real(RP) :: inc_VELY(
ka,
ia,
ja)
1601 real(RP) :: inc_POTT(
ka,
ia,
ja)
1605 integer :: i, j, k, iq
1608 if ( do_parent_process )
then 1610 call atmos_boundary_update_online_parent( dens,momz,momx,momy,rhot,qtrc )
1615 if ( now_step >= update_nstep )
then 1617 boundary_timestep = boundary_timestep + 1
1621 if ( do_daughter_process )
then 1622 call atmos_boundary_update_online_daughter( ref_new )
1624 call atmos_boundary_update_file( ref_new )
1629 now_step = now_step + 1
1632 call get_increment( inc_dens(:,:,:), &
1676 qtrc(k,i,j,iq) = qtrc(k,
is,j,iq) &
1709 momz(k,i,j) = momz(k,
is,j)
1727 qtrc(k,i,j,iq) = qtrc(k,
ie,j,iq) &
1773 momz(k,i,j) = momz(k,
ie,j)
1793 qtrc(k,i,j,iq) = qtrc(k,i,
js,iq) &
1826 momz(k,i,j) = momz(k,i,
js)
1844 qtrc(k,i,j,iq) = qtrc(k,i,
je,iq) &
1890 momz(k,i,j) = momz(k,i,
je)
1897 elseif ( do_parent_process )
then 1900 write(*,*)
'xxx [BUG] invalid path' 1912 if ( do_parent_process )
then 1916 if ( do_daughter_process )
then 1926 subroutine atmos_boundary_update_file( ref )
1933 integer,
intent(in) :: ref
1936 character(len=H_LONG) :: bname
1941 if (
io_l)
write(
io_fid_log,*)
"*** Atmos Boundary: read from boundary file(timestep=", boundary_timestep,
")" 1943 bname = atmos_boundary_in_basename
1945 call fileread( reference_atmos(:,:,:), bname,
'DENS', boundary_timestep,
prc_myrank )
1946 atmos_boundary_ref_dens(
ks:
ke,
isb:
ieb,
jsb:
jeb,ref) = reference_atmos(:,:,:)
1947 call fileread( reference_atmos(:,:,:), bname,
'VELX', boundary_timestep,
prc_myrank )
1948 atmos_boundary_ref_velx(
ks:
ke,
isb:
ieb,
jsb:
jeb,ref) = reference_atmos(:,:,:)
1949 call fileread( reference_atmos(:,:,:), bname,
'VELY', boundary_timestep,
prc_myrank )
1950 atmos_boundary_ref_vely(
ks:
ke,
isb:
ieb,
jsb:
jeb,ref) = reference_atmos(:,:,:)
1951 call fileread( reference_atmos(:,:,:), bname,
'POTT', boundary_timestep,
prc_myrank )
1952 atmos_boundary_ref_pott(
ks:
ke,
isb:
ieb,
jsb:
jeb,ref) = reference_atmos(:,:,:)
1954 call fileread( reference_atmos(:,:,:), bname,
aq_name(iq), boundary_timestep,
prc_myrank )
1955 atmos_boundary_ref_qtrc(
ks:
ke,
isb:
ieb,
jsb:
jeb,iq,ref) = reference_atmos(:,:,:)
1959 call atmos_boundary_ref_fillhalo( ref )
1962 end subroutine atmos_boundary_update_file
1966 subroutine atmos_boundary_update_online_parent( &
1979 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
1980 real(RP),
intent(in) :: MOMZ(
ka,
ia,
ja)
1981 real(RP),
intent(in) :: MOMX(
ka,
ia,
ja)
1982 real(RP),
intent(in) :: MOMY(
ka,
ia,
ja)
1983 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
1984 real(RP),
intent(in) :: QTRC(
ka,
ia,
ja,
qa)
1986 integer,
parameter :: handle = 1
1989 if (
io_l )
write(
io_fid_log,*)
"*** ATMOS BOUNDARY update online: PARENT" 1995 call atmos_boundary_send( dens, momz, momx, momy, rhot, qtrc )
1998 end subroutine atmos_boundary_update_online_parent
2002 subroutine atmos_boundary_update_online_daughter( &
2010 integer,
intent(in) :: ref
2012 integer,
parameter :: handle = 2
2015 if(
io_l )
write(
io_fid_log,
'(1X,A,I5)')
'*** ATMOS BOUNDARY update online: DAUGHTER', boundary_timestep
2018 call atmos_boundary_recv( ref )
2021 call atmos_boundary_ref_fillhalo( ref )
2027 end subroutine atmos_boundary_update_online_daughter
2031 subroutine atmos_boundary_send( &
2032 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC )
2042 integer,
parameter :: handle = 1
2045 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
2046 real(RP),
intent(in) :: MOMZ(
ka,
ia,
ja)
2047 real(RP),
intent(in) :: MOMX(
ka,
ia,
ja)
2048 real(RP),
intent(in) :: MOMY(
ka,
ia,
ja)
2049 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
2050 real(RP),
intent(in) :: QTRC(
ka,
ia,
ja,
qa)
2057 dummy_d(:,:,:,:) = 0.0_rp
2066 qtrc(:,:,:,1:nestqa), &
2072 dummy_d(:,:,:,1:nestqa) )
2075 end subroutine atmos_boundary_send
2079 subroutine atmos_boundary_recv( &
2090 integer,
parameter :: handle = 2
2093 integer,
intent(in) :: ref_idx
2100 dummy_p(:,:,:,:) = 0.0_rp
2109 dummy_p(:,:,:,1:nestqa), &
2110 atmos_boundary_ref_dens(:,:,:,ref_idx), &
2111 atmos_boundary_ref_velz(:,:,:,ref_idx), &
2112 atmos_boundary_ref_velx(:,:,:,ref_idx), &
2113 atmos_boundary_ref_vely(:,:,:,ref_idx), &
2114 atmos_boundary_ref_pott(:,:,:,ref_idx), &
2115 atmos_boundary_ref_qtrc(:,:,:,1:nestqa,ref_idx) )
2118 end subroutine atmos_boundary_recv
2122 subroutine get_increment_same_parent( &
2132 real(RP),
intent(out) :: inc_DENS(:,:,:)
2133 real(RP),
intent(out) :: inc_VELZ(:,:,:)
2134 real(RP),
intent(out) :: inc_VELX(:,:,:)
2135 real(RP),
intent(out) :: inc_VELY(:,:,:)
2136 real(RP),
intent(out) :: inc_POTT(:,:,:)
2137 real(RP),
intent(out) :: inc_QTRC(:,:,:,:)
2140 integer :: i, j, k, iq
2152 inc_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now) -
atmos_boundary_qtrc(k,i,j,iq)
2159 end subroutine get_increment_same_parent
2163 subroutine get_increment_nearest_neighbor( &
2173 real(RP) :: EPS = 1.0e-4_rp
2176 real(RP),
intent(out) :: inc_DENS(:,:,:)
2177 real(RP),
intent(out) :: inc_VELZ(:,:,:)
2178 real(RP),
intent(out) :: inc_VELX(:,:,:)
2179 real(RP),
intent(out) :: inc_VELY(:,:,:)
2180 real(RP),
intent(out) :: inc_POTT(:,:,:)
2181 real(RP),
intent(out) :: inc_QTRC(:,:,:,:)
2184 integer :: i, j, k, iq
2187 real(RP) :: real_nstep
2188 real(RP) :: half_nstep
2191 real_nstep =
real( now_step, kind=
rp )
2192 half_nstep =
real( UPDATE_NSTEP, kind=RP ) * 0.5_rp
2195 if( ( real_nstep - eps ) < half_nstep )
then 2199 else if( ( real_nstep - 1.0_rp + eps ) > half_nstep )
then 2217 inc_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_idx) -
atmos_boundary_qtrc(k,i,j,iq)
2224 end subroutine get_increment_nearest_neighbor
2228 subroutine get_increment_lerp_initpoint( &
2240 real(RP),
intent(out) :: inc_DENS(:,:,:)
2241 real(RP),
intent(out) :: inc_VELZ(:,:,:)
2242 real(RP),
intent(out) :: inc_VELX(:,:,:)
2243 real(RP),
intent(out) :: inc_VELY(:,:,:)
2244 real(RP),
intent(out) :: inc_POTT(:,:,:)
2245 real(RP),
intent(out) :: inc_QTRC(:,:,:,:)
2248 integer :: i, j, k, iq
2258 inc_dens(k,i,j) = ( atmos_boundary_ref_dens(k,i,j,ref_new) - atmos_boundary_ref_dens(k,i,j,ref_now) ) * t1
2259 inc_velz(k,i,j) = ( atmos_boundary_ref_velz(k,i,j,ref_new) - atmos_boundary_ref_velz(k,i,j,ref_now) ) * t1
2260 inc_velx(k,i,j) = ( atmos_boundary_ref_velx(k,i,j,ref_new) - atmos_boundary_ref_velx(k,i,j,ref_now) ) * t1
2261 inc_vely(k,i,j) = ( atmos_boundary_ref_vely(k,i,j,ref_new) - atmos_boundary_ref_vely(k,i,j,ref_now) ) * t1
2262 inc_pott(k,i,j) = ( atmos_boundary_ref_pott(k,i,j,ref_new) - atmos_boundary_ref_pott(k,i,j,ref_now) ) * t1
2264 inc_qtrc(k,i,j,iq) = ( atmos_boundary_ref_qtrc(k,i,j,iq,ref_new) - atmos_boundary_ref_qtrc(k,i,j,iq,ref_now) ) * t1
2271 end subroutine get_increment_lerp_initpoint
2275 subroutine get_increment_lerp_midpoint( &
2287 real(RP) :: EPS = 1.0e-4_rp
2290 real(RP),
intent(out) :: inc_DENS(:,:,:)
2291 real(RP),
intent(out) :: inc_VELZ(:,:,:)
2292 real(RP),
intent(out) :: inc_VELX(:,:,:)
2293 real(RP),
intent(out) :: inc_VELY(:,:,:)
2294 real(RP),
intent(out) :: inc_POTT(:,:,:)
2295 real(RP),
intent(out) :: inc_QTRC(:,:,:,:)
2298 integer :: i, j, k, iq
2300 real(RP) :: real_nstep
2301 real(RP) :: half_nstep
2305 real_nstep =
real( now_step, kind=
rp )
2306 half_nstep =
real( UPDATE_NSTEP, kind=RP ) * 0.5_rp
2309 if( ( real_nstep - eps ) < half_nstep )
then 2311 t1 =
time_dtsec / atmos_boundary_update_dt * ( real_nstep + half_nstep - 0.5_rp )
2316 inc_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_now) * t1 &
2317 - atmos_boundary_ref_dens(k,i,j,ref_old) * ( t1 - 1.0_rp ) &
2319 inc_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_now) * t1 &
2320 - atmos_boundary_ref_velz(k,i,j,ref_old) * ( t1 - 1.0_rp ) &
2322 inc_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_now) * t1 &
2323 - atmos_boundary_ref_velx(k,i,j,ref_old) * ( t1 - 1.0_rp ) &
2325 inc_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_now) * t1 &
2326 - atmos_boundary_ref_vely(k,i,j,ref_old) * ( t1 - 1.0_rp ) &
2328 inc_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_now) * t1 &
2329 - atmos_boundary_ref_pott(k,i,j,ref_old) * ( t1 - 1.0_rp ) &
2332 inc_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now) * t1 &
2333 - atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) * ( t1 - 1.0_rp ) &
2341 else if( ( real_nstep - 1.0_rp + eps ) > half_nstep )
then 2343 t1 =
time_dtsec / atmos_boundary_update_dt * ( real_nstep - half_nstep - 0.5_rp )
2348 inc_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_new) * t1 &
2349 - atmos_boundary_ref_dens(k,i,j,ref_now) * ( t1 - 1.0_rp ) &
2351 inc_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_new) * t1 &
2352 - atmos_boundary_ref_velz(k,i,j,ref_now) * ( t1 - 1.0_rp ) &
2354 inc_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_new) * t1 &
2355 - atmos_boundary_ref_velx(k,i,j,ref_now) * ( t1 - 1.0_rp ) &
2357 inc_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_new) * t1 &
2358 - atmos_boundary_ref_vely(k,i,j,ref_now) * ( t1 - 1.0_rp ) &
2360 inc_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_new) * t1 &
2361 - atmos_boundary_ref_pott(k,i,j,ref_now) * ( t1 - 1.0_rp ) &
2364 inc_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_new) * t1 &
2365 - atmos_boundary_ref_qtrc(k,i,j,iq,ref_now) * ( t1 - 1.0_rp ) &
2375 t1 =
time_dtsec / atmos_boundary_update_dt * ( real_nstep + half_nstep - 1.0_rp )
2376 t2 =
time_dtsec / atmos_boundary_update_dt * ( real_nstep - half_nstep )
2381 inc_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_new) * t2 * 0.25_rp &
2382 + atmos_boundary_ref_dens(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2383 - atmos_boundary_ref_dens(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp &
2385 inc_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_new) * t2 * 0.25_rp &
2386 + atmos_boundary_ref_velz(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2387 - atmos_boundary_ref_velz(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp &
2389 inc_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_new) * t2 * 0.25_rp &
2390 + atmos_boundary_ref_velx(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2391 - atmos_boundary_ref_velx(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp &
2393 inc_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_new) * t2 * 0.25_rp &
2394 + atmos_boundary_ref_vely(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2395 - atmos_boundary_ref_vely(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp &
2397 inc_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_new) * t2 * 0.25_rp &
2398 + atmos_boundary_ref_pott(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2399 - atmos_boundary_ref_pott(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp &
2402 inc_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_new) * t2 * 0.25_rp &
2403 + atmos_boundary_ref_qtrc(k,i,j,iq,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2404 - atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp &
2414 end subroutine get_increment_lerp_midpoint
2433 subroutine history_bnd( &
2434 ATMOS_BOUNDARY_DENS, &
2435 ATMOS_BOUNDARY_VELZ, &
2436 ATMOS_BOUNDARY_VELX, &
2437 ATMOS_BOUNDARY_VELY, &
2438 ATMOS_BOUNDARY_POTT, &
2439 ATMOS_BOUNDARY_QTRC )
2443 real(RP),
intent(in) :: ATMOS_BOUNDARY_DENS(
ka,
ia,
ja)
2444 real(RP),
intent(in) :: ATMOS_BOUNDARY_VELZ(
ka,
ia,
ja)
2445 real(RP),
intent(in) :: ATMOS_BOUNDARY_VELX(
ka,
ia,
ja)
2446 real(RP),
intent(in) :: ATMOS_BOUNDARY_VELY(
ka,
ia,
ja)
2447 real(RP),
intent(in) :: ATMOS_BOUNDARY_POTT(
ka,
ia,
ja)
2448 real(RP),
intent(in) :: ATMOS_BOUNDARY_QTRC(
ka,
ia,
ja,
bnd_qa)
2452 call hist_in( atmos_boundary_dens(:,:,:),
'DENS_BND',
'Boundary Density',
'kg/m3' )
2453 call hist_in( atmos_boundary_velz(:,:,:),
'VELZ_BND',
'Boundary velocity z-direction',
'm/s', zdim=
'half' )
2454 call hist_in( atmos_boundary_velx(:,:,:),
'VELX_BND',
'Boundary velocity x-direction',
'm/s', xdim=
'half' )
2455 call hist_in( atmos_boundary_vely(:,:,:),
'VELY_BND',
'Boundary velocity y-direction',
'm/s', ydim=
'half' )
2456 call hist_in( atmos_boundary_pott(:,:,:),
'POTT_BND',
'Boundary potential temperature',
'K' )
2458 call hist_in( atmos_boundary_qtrc(:,:,:,iq), trim(
aq_name(iq))//
'_BND',
'Boundary '//trim(
aq_name(iq)),
'kg/kg' )
2462 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.
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
subroutine, public atmos_boundary_update(DENS, MOMZ, MOMX, MOMY, RHOT, QTRC)
Update boundary value with a constant time increment.
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_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(:,:,:), allocatable, public atmos_boundary_alpha_vely
subroutine, public atmos_boundary_finalize
Finalize boundary value.
real(rp), dimension(:,:,:,:), allocatable, public atmos_boundary_qtrc
integer, public ia
of x whole cells (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 z whole cells (local, with HALO)
real(rp), dimension(:,:,:), allocatable, public atmos_refstate_dens
refernce density [kg/m3]
integer, public kmax
of computational cells: z
real(rp), dimension(:), allocatable, public grid_fbfz
face buffer factor [0-1]: z
character(len=h_short), dimension(:), allocatable, public aq_name
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)
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.
character(len=h_short), dimension(:), allocatable, public aq_unit
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
integer, public prc_myrank
process num in local communicator
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 io_lnml
output log or not? (for namelist, this process)
logical, public online_iam_parent
a flag to say "I am a parent"
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]
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.
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 y whole cells (local, with HALO)