66 private :: atmos_boundary_var_fillhalo
67 private :: atmos_boundary_alpha_fillhalo
68 private :: atmos_boundary_ref_fillhalo
69 private :: atmos_boundary_setalpha
70 private :: atmos_boundary_setinitval
71 private :: atmos_boundary_read
72 private :: atmos_boundary_write
73 private :: atmos_boundary_generate
74 private :: atmos_boundary_initialize_file
75 private :: atmos_boundary_initialize_online
76 private :: atmos_boundary_update_file
77 private :: atmos_boundary_update_online_parent
78 private :: atmos_boundary_update_online_daughter
79 private :: atmos_boundary_firstsend
80 private :: atmos_boundary_send
81 private :: atmos_boundary_recv
96 real(RP),
intent(out) :: bnd_dens(:,:,:)
97 real(RP),
intent(out) :: bnd_velz(:,:,:)
98 real(RP),
intent(out) :: bnd_velx(:,:,:)
99 real(RP),
intent(out) :: bnd_vely(:,:,:)
100 real(RP),
intent(out) :: bnd_pott(:,:,:)
101 real(RP),
intent(out) :: bnd_qtrc(:,:,:,:)
102 integer,
intent(in) :: now_step
103 integer,
intent(in) :: update_step
104 end subroutine getbnd
107 procedure(getbnd),
pointer :: get_boundary => null()
108 private :: get_boundary
109 private :: get_boundary_same_parent
110 private :: get_boundary_nearest_neighbor
111 private :: get_boundary_lerp_initpoint
112 private :: get_boundary_lerp_midpoint
119 character(len=H_SHORT),
private :: atmos_boundary_type =
'NONE' 120 character(len=H_LONG),
private :: atmos_boundary_in_basename =
'' 121 logical,
private :: atmos_boundary_in_check_coordinates = .true.
122 character(len=H_LONG),
private :: atmos_boundary_out_basename =
'' 123 character(len=H_MID),
private :: atmos_boundary_out_title =
'SCALE-RM BOUNDARY CONDITION' 124 character(len=H_SHORT),
private :: atmos_boundary_out_dtype =
'DEFAULT' 126 logical,
private :: atmos_boundary_use_dens = .false.
127 logical,
private :: atmos_boundary_use_velz = .false.
128 logical,
private :: atmos_boundary_use_velx = .false.
129 logical,
private :: atmos_boundary_use_vely = .false.
130 logical,
private :: atmos_boundary_use_pott = .false.
131 logical,
private :: atmos_boundary_use_qv = .false.
132 logical,
private :: atmos_boundary_use_qhyd = .false.
133 logical,
private :: atmos_boundary_use_chem = .false.
135 real(RP),
private :: atmos_boundary_value_velz = 0.0_rp
136 real(RP),
private :: atmos_boundary_value_velx = 0.0_rp
137 real(RP),
private :: atmos_boundary_value_vely = 0.0_rp
138 real(RP),
private :: atmos_boundary_value_pott = 300.0_rp
139 real(RP),
private :: atmos_boundary_value_qtrc = 0.0_rp
141 real(RP),
private :: atmos_boundary_alphafact_dens = 1.0_rp
142 real(RP),
private :: atmos_boundary_alphafact_velz = 1.0_rp
143 real(RP),
private :: atmos_boundary_alphafact_velx = 1.0_rp
144 real(RP),
private :: atmos_boundary_alphafact_vely = 1.0_rp
145 real(RP),
private :: atmos_boundary_alphafact_pott = 1.0_rp
146 real(RP),
private :: atmos_boundary_alphafact_qtrc = 1.0_rp
148 real(RP),
private :: atmos_boundary_fracz = 1.0_rp
149 real(RP),
private :: atmos_boundary_fracx = 1.0_rp
150 real(RP),
private :: atmos_boundary_fracy = 1.0_rp
151 real(RP),
private :: atmos_boundary_tauz
152 real(RP),
private :: atmos_boundary_taux
153 real(RP),
private :: atmos_boundary_tauy
155 real(DP),
private :: atmos_boundary_update_dt = 0.0_dp
156 integer,
private :: update_nstep
158 real(RP),
private,
allocatable :: atmos_boundary_ref_dens(:,:,:,:)
159 real(RP),
private,
allocatable :: atmos_boundary_ref_velz(:,:,:,:)
160 real(RP),
private,
allocatable :: atmos_boundary_ref_velx(:,:,:,:)
161 real(RP),
private,
allocatable :: atmos_boundary_ref_vely(:,:,:,:)
162 real(RP),
private,
allocatable :: atmos_boundary_ref_pott(:,:,:,:)
163 real(RP),
private,
allocatable,
target :: atmos_boundary_ref_qtrc(:,:,:,:,:)
166 real(RP),
private,
allocatable,
target :: q_work(:,:,:,:)
169 character(len=H_LONG),
private :: atmos_boundary_interp_type =
'lerp_initpoint' 171 integer,
private :: atmos_boundary_start_date(6) = (/ -9999, 0, 0, 0, 0, 0 /)
173 integer,
private :: atmos_boundary_fid = -1
175 integer,
private :: now_step
176 integer,
private :: boundary_timestep = 0
177 logical,
private :: atmos_boundary_linear_v = .false.
178 logical,
private :: atmos_boundary_linear_h = .true.
179 real(RP),
private :: atmos_boundary_exp_h = 2.0_rp
180 logical,
private :: atmos_boundary_online = .false.
181 logical,
private :: atmos_boundary_online_master = .false.
183 logical,
private :: do_parent_process = .false.
184 logical,
private :: do_daughter_process = .false.
185 logical,
private :: l_bnd = .false.
187 real(DP),
private :: boundary_time_initdaysec
189 integer,
private :: ref_size = 3
190 integer,
private :: ref_old = 1
191 integer,
private :: ref_now = 2
192 integer,
private :: ref_new = 3
219 namelist / param_atmos_boundary / &
220 atmos_boundary_type, &
221 atmos_boundary_in_basename, &
222 atmos_boundary_in_check_coordinates, &
223 atmos_boundary_out_basename, &
224 atmos_boundary_out_title, &
225 atmos_boundary_out_dtype, &
226 atmos_boundary_use_velz, &
227 atmos_boundary_use_velx, &
228 atmos_boundary_use_vely, &
229 atmos_boundary_use_pott, &
230 atmos_boundary_use_dens, &
231 atmos_boundary_use_qv, &
232 atmos_boundary_use_qhyd, &
233 atmos_boundary_use_chem, &
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 log_info(
"ATMOS_BOUNDARY_setup",*)
'Setup' 266 atmos_boundary_tauz = dt * 10.0_rp
267 atmos_boundary_taux = dt * 10.0_rp
268 atmos_boundary_tauy = dt * 10.0_rp
272 read(
io_fid_conf,nml=param_atmos_boundary,iostat=ierr)
274 log_info(
"ATMOS_BOUNDARY_setup",*)
'Not found namelist. Default used.' 275 elseif( ierr > 0 )
then 276 log_error(
"ATMOS_BOUNDARY_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_BOUNDARY. Check!' 279 log_nml(param_atmos_boundary)
283 atmos_boundary_online = .false.
286 atmos_boundary_online = .false.
288 atmos_boundary_online = .true.
291 do_parent_process = .false.
292 do_daughter_process = .false.
293 atmos_boundary_online_master = .false.
294 if ( atmos_boundary_online )
then 296 do_parent_process = .true.
298 atmos_boundary_online_master = .true.
302 do_daughter_process = .true.
307 if( atmos_boundary_use_qhyd )
then 309 if( atmos_boundary_use_chem )
then 312 else if (
qa_mp > 0 )
then 344 if ( atmos_boundary_type ==
'REAL' .OR. do_daughter_process )
then 352 select case(atmos_boundary_interp_type)
354 get_boundary => get_boundary_same_parent
355 case(
'nearest_neighbor')
356 get_boundary => get_boundary_nearest_neighbor
357 case(
'lerp_initpoint')
358 get_boundary => get_boundary_lerp_initpoint
359 case(
'lerp_midpoint')
360 get_boundary => get_boundary_lerp_midpoint
362 log_error(
"ATMOS_BOUNDARY_setup",*)
'Wrong parameter in ATMOS_BOUNDARY_interp_TYPE. Check!' 366 allocate( atmos_boundary_ref_dens(
ka,
ia,
ja,ref_size) )
367 allocate( atmos_boundary_ref_velz(
ka,
ia,
ja,ref_size) )
368 allocate( atmos_boundary_ref_velx(
ka,
ia,
ja,ref_size) )
369 allocate( atmos_boundary_ref_vely(
ka,
ia,
ja,ref_size) )
370 allocate( atmos_boundary_ref_pott(
ka,
ia,
ja,ref_size) )
371 allocate( atmos_boundary_ref_qtrc(
ka,
ia,
ja,
bnd_qa,ref_size) )
380 if ( do_daughter_process )
then 381 call atmos_boundary_initialize_online
383 if ( atmos_boundary_in_basename /=
'' )
then 384 call atmos_boundary_initialize_file
386 log_error(
"ATMOS_BOUNDARY_setup",*)
'You need specify ATMOS_BOUNDARY_IN_BASENAME' 391 call atmos_boundary_setalpha
395 elseif ( atmos_boundary_type ==
'NONE' )
then 399 elseif ( atmos_boundary_type ==
'CONST' )
then 401 call atmos_boundary_setalpha
405 elseif ( atmos_boundary_type ==
'INIT' )
then 407 call atmos_boundary_setalpha
411 elseif ( atmos_boundary_type ==
'OFFLINE' )
then 413 if ( atmos_boundary_in_basename /=
'' )
then 414 call atmos_boundary_read
416 log_error(
"ATMOS_BOUNDARY_setup",*)
'You need specify ATMOS_BOUNDARY_IN_BASENAME' 423 log_error(
"ATMOS_BOUNDARY_setup",*)
'unsupported ATMOS_BOUNDARY_TYPE. Check!', trim(atmos_boundary_type)
431 log_info(
"ATMOS_BOUNDARY_setup",*)
'Atmospheric boundary parameters ' 432 log_info_cont(*)
'Atmospheric boundary type : ', atmos_boundary_type
434 log_info_cont(*)
'Is VELZ used in atmospheric boundary? : ', atmos_boundary_use_velz
435 log_info_cont(*)
'Is VELX used in atmospheric boundary? : ', atmos_boundary_use_velx
436 log_info_cont(*)
'Is VELY used in atmospheric boundary? : ', atmos_boundary_use_vely
437 log_info_cont(*)
'Is POTT used in atmospheric boundary? : ', atmos_boundary_use_pott
438 log_info_cont(*)
'Is DENS used in atmospheric boundary? : ', atmos_boundary_use_dens
439 log_info_cont(*)
'Is QV used in atmospheric boundary? : ', atmos_boundary_use_qv
440 log_info_cont(*)
'Is QHYD used in atmospheric boundary? : ', atmos_boundary_use_qhyd
441 log_info_cont(*)
'Is CHEM used in atmospheric boundary? : ', atmos_boundary_use_chem
443 log_info_cont(*)
'Atmospheric boundary VELZ values : ', atmos_boundary_value_velz
444 log_info_cont(*)
'Atmospheric boundary VELX values : ', atmos_boundary_value_velx
445 log_info_cont(*)
'Atmospheric boundary VELY values : ', atmos_boundary_value_vely
446 log_info_cont(*)
'Atmospheric boundary POTT values : ', atmos_boundary_value_pott
447 log_info_cont(*)
'Atmospheric boundary QTRC values : ', atmos_boundary_value_qtrc
450 log_info_cont(*)
'Atmospheric boundary z-fraction : ', atmos_boundary_fracz
451 log_info_cont(*)
'Atmospheric boundary x-fraction : ', atmos_boundary_fracx
452 log_info_cont(*)
'Atmospheric boundary y-fraction : ', atmos_boundary_fracy
453 log_info_cont(*)
'Atmospheric boundary z-relaxation time : ', atmos_boundary_tauz
454 log_info_cont(*)
'Atmospheric boundary x-relaxation time : ', atmos_boundary_taux
455 log_info_cont(*)
'Atmospheric boundary y-relaxation time : ', atmos_boundary_tauy
457 log_info_cont(*)
'Atmospheric boundary update dt : ', atmos_boundary_update_dt
458 log_info_cont(*)
'Atmospheric boundary start date : ', atmos_boundary_start_date(:)
460 log_info_cont(*)
'Linear profile in vertically relax region : ', atmos_boundary_linear_v
461 log_info_cont(*)
'Linear profile in horizontally relax region : ', atmos_boundary_linear_h
462 log_info_cont(*)
'Non-linear factor in horizontally relax region : ', atmos_boundary_exp_h
464 log_info_cont(*)
'Online nesting for lateral boundary : ', atmos_boundary_online
466 log_info_cont(*)
'Does lateral boundary exist in this domain? : ', l_bnd
468 log_info_cont(*)
'Lateral boundary interporation type : ', atmos_boundary_interp_type
472 allocate( q_work(
ka,
ia,
ja,nestqa) )
495 if ( do_parent_process )
then 496 call atmos_boundary_firstsend( &
497 dens,
momz,
momx,
momy,
rhot,
qtrc(:,:,:,
qs_mp:
qe_mp),
qv,
qe )
503 if ( do_daughter_process )
then 506 if ( atmos_boundary_in_basename /=
'' )
then 511 elseif ( atmos_boundary_type ==
'CONST' )
then 513 call atmos_boundary_generate
515 elseif ( atmos_boundary_type ==
'INIT' )
then 517 call atmos_boundary_setinitval(
dens, &
525 if( atmos_boundary_out_basename /=
'' )
then 526 call atmos_boundary_write
545 subroutine atmos_boundary_var_fillhalo
594 end subroutine atmos_boundary_var_fillhalo
598 subroutine atmos_boundary_alpha_fillhalo
647 end subroutine atmos_boundary_alpha_fillhalo
651 subroutine atmos_boundary_ref_fillhalo( &
659 integer,
intent(in) :: ref_idx
671 atmos_boundary_ref_dens( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_dens(
ks,i,j,ref_idx)
672 atmos_boundary_ref_velz( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_velz(
ks,i,j,ref_idx)
673 atmos_boundary_ref_velx( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_velx(
ks,i,j,ref_idx)
674 atmos_boundary_ref_vely( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_vely(
ks,i,j,ref_idx)
675 atmos_boundary_ref_pott( 1:
ks-1,i,j,ref_idx) = atmos_boundary_ref_pott(
ks,i,j,ref_idx)
677 atmos_boundary_ref_dens(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_dens(
ke,i,j,ref_idx)
678 atmos_boundary_ref_velz(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_velz(
ke,i,j,ref_idx)
679 atmos_boundary_ref_velx(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_velx(
ke,i,j,ref_idx)
680 atmos_boundary_ref_vely(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_vely(
ke,i,j,ref_idx)
681 atmos_boundary_ref_pott(
ke+1:
ka, i,j,ref_idx) = atmos_boundary_ref_pott(
ke,i,j,ref_idx)
684 atmos_boundary_ref_qtrc( 1:
ks-1,i,j,iq,ref_idx) = atmos_boundary_ref_qtrc(
ks,i,j,iq,ref_idx)
685 atmos_boundary_ref_qtrc(
ke+1:
ka, i,j,iq,ref_idx) = atmos_boundary_ref_qtrc(
ke,i,j,iq,ref_idx)
690 call comm_vars8( atmos_boundary_ref_dens(:,:,:,ref_idx), 1 )
691 call comm_vars8( atmos_boundary_ref_velz(:,:,:,ref_idx), 2 )
692 call comm_vars8( atmos_boundary_ref_velx(:,:,:,ref_idx), 3 )
693 call comm_vars8( atmos_boundary_ref_vely(:,:,:,ref_idx), 4 )
694 call comm_vars8( atmos_boundary_ref_pott(:,:,:,ref_idx), 5 )
697 call comm_vars8( atmos_boundary_ref_qtrc(:,:,:,iq,ref_idx), 5+iq )
700 call comm_wait ( atmos_boundary_ref_dens(:,:,:,ref_idx), 1, .false. )
701 call comm_wait ( atmos_boundary_ref_velz(:,:,:,ref_idx), 2, .false. )
702 call comm_wait ( atmos_boundary_ref_velx(:,:,:,ref_idx), 3, .false. )
703 call comm_wait ( atmos_boundary_ref_vely(:,:,:,ref_idx), 4, .false. )
704 call comm_wait ( atmos_boundary_ref_pott(:,:,:,ref_idx), 5, .false. )
707 call comm_wait ( atmos_boundary_ref_qtrc(:,:,:,iq,ref_idx), 5+iq, .false. )
711 end subroutine atmos_boundary_ref_fillhalo
715 subroutine atmos_boundary_setalpha
729 real(RP) :: coef_z, alpha_z1, alpha_z2
730 real(RP) :: coef_x, alpha_x1, alpha_x2
731 real(RP) :: coef_y, alpha_y1, alpha_y2
734 integer :: i, j, k, iq
738 atmos_boundary_fracz = max( min( atmos_boundary_fracz, 1.0_rp ), eps )
739 atmos_boundary_fracx = max( min( atmos_boundary_fracx, 1.0_rp ), eps )
740 atmos_boundary_fracy = max( min( atmos_boundary_fracy, 1.0_rp ), eps )
742 if ( atmos_boundary_tauz <= 0.0_rp )
then 745 coef_z = 1.0_rp / atmos_boundary_tauz
748 if ( atmos_boundary_taux <= 0.0_rp )
then 751 coef_x = 1.0_rp / atmos_boundary_taux
754 if ( atmos_boundary_tauy <= 0.0_rp )
then 757 coef_y = 1.0_rp / atmos_boundary_tauy
776 if ( ee1 <= 1.0_rp - atmos_boundary_fracz )
then 779 ee1 = ( ee1 - 1.0_rp + atmos_boundary_fracz ) / atmos_boundary_fracz
783 if ( ee2 <= 1.0_rp - atmos_boundary_fracz )
then 786 ee2 = ( ee2 - 1.0_rp + atmos_boundary_fracz ) / atmos_boundary_fracz
791 if ( atmos_boundary_linear_v )
then 792 alpha_z1 = coef_z * ee1
793 alpha_z2 = coef_z * ee2
795 if ( ee1 > 0.0_rp .AND. ee1 <= 0.5_rp )
then 796 alpha_z1 = coef_z * 0.5_rp * ( 1.0_rp - cos( ee1*pi ) )
797 elseif( ee1 > 0.5_rp .AND. ee1 <= 1.0_rp )
then 798 alpha_z1 = coef_z * 0.5_rp * ( 1.0_rp + sin( (ee1-0.5_rp)*pi ) )
800 if ( ee2 > 0.0_rp .AND. ee2 <= 0.5_rp )
then 801 alpha_z2 = coef_z * 0.5_rp * ( 1.0_rp - cos( ee2*pi ) )
802 elseif( ee2 > 0.5_rp .AND. ee2 <= 1.0_rp )
then 803 alpha_z2 = coef_z * 0.5_rp * ( 1.0_rp + sin( (ee2-0.5_rp)*pi ) )
808 if ( ee1 <= 1.0_rp - atmos_boundary_fracx )
then 811 ee1 = ( ee1 - 1.0_rp + atmos_boundary_fracx ) / atmos_boundary_fracx
815 if ( ee2 <= 1.0_rp - atmos_boundary_fracx )
then 818 ee2 = ( ee2 - 1.0_rp + atmos_boundary_fracx ) / atmos_boundary_fracx
821 if ( atmos_boundary_linear_h )
then 822 alpha_x1 = coef_x * ee1
823 alpha_x2 = coef_x * ee2
825 alpha_x1 = coef_x * ee1 * exp( -(1.0_rp-ee1) * atmos_boundary_exp_h )
826 alpha_x2 = coef_x * ee2 * exp( -(1.0_rp-ee2) * atmos_boundary_exp_h )
830 if ( ee1 <= 1.0_rp - atmos_boundary_fracy )
then 833 ee1 = ( ee1 - 1.0_rp + atmos_boundary_fracy ) / atmos_boundary_fracy
837 if ( ee2 <= 1.0_rp - atmos_boundary_fracy )
then 840 ee2 = ( ee2 - 1.0_rp + atmos_boundary_fracy ) / atmos_boundary_fracy
843 if ( atmos_boundary_linear_h )
then 844 alpha_y1 = coef_y * ee1
845 alpha_y2 = coef_y * ee2
847 alpha_y1 = coef_y * ee1 * exp( -(1.0_rp-ee1) * atmos_boundary_exp_h )
848 alpha_y2 = coef_y * ee2 * exp( -(1.0_rp-ee2) * atmos_boundary_exp_h )
853 if ( do_daughter_process )
then 855 if( atmos_boundary_use_velz )
then 861 if ( atmos_boundary_use_velz )
then 866 if ( atmos_boundary_use_velz )
then 870 if ( atmos_boundary_use_dens )
then 876 if ( atmos_boundary_use_velx )
then 881 if ( atmos_boundary_use_vely )
then 886 if ( atmos_boundary_use_pott )
then 891 if ( atmos_boundary_use_qv )
then 896 if ( atmos_boundary_use_qhyd )
then 924 if ( .NOT. atmos_boundary_use_dens )
then 927 if ( .NOT. atmos_boundary_use_velz )
then 930 if ( .NOT. atmos_boundary_use_velx )
then 933 if ( .NOT. atmos_boundary_use_vely )
then 936 if ( .NOT. atmos_boundary_use_pott )
then 939 if ( .NOT. atmos_boundary_use_qv )
then 942 if ( .NOT. atmos_boundary_use_qhyd )
then 950 call atmos_boundary_alpha_fillhalo
953 end subroutine atmos_boundary_setalpha
957 subroutine atmos_boundary_setinitval( &
958 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC )
961 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
962 real(RP),
intent(in) :: MOMZ(
ka,
ia,
ja)
963 real(RP),
intent(in) :: MOMX(
ka,
ia,
ja)
964 real(RP),
intent(in) :: MOMY(
ka,
ia,
ja)
965 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
968 integer :: i, j, k, iq
1010 call atmos_boundary_var_fillhalo
1013 end subroutine atmos_boundary_setinitval
1017 subroutine atmos_boundary_read
1022 file_cartesc_check_coordinates, &
1023 file_cartesc_read, &
1033 if ( atmos_boundary_in_check_coordinates )
then 1034 call file_cartesc_check_coordinates( fid, atmos=.true. )
1037 if ( atmos_boundary_use_dens &
1038 .OR. atmos_boundary_use_velz &
1039 .OR. atmos_boundary_use_velx &
1040 .OR. atmos_boundary_use_vely &
1041 .OR. atmos_boundary_use_pott &
1045 if ( atmos_boundary_use_dens )
then 1049 if ( atmos_boundary_use_velz )
then 1054 if ( atmos_boundary_use_velx )
then 1059 if ( atmos_boundary_use_vely )
then 1064 if ( atmos_boundary_use_pott )
then 1069 if ( atmos_boundary_use_qv )
then 1074 if ( atmos_boundary_use_qhyd )
then 1084 call atmos_boundary_var_fillhalo
1085 call atmos_boundary_alpha_fillhalo
1088 end subroutine atmos_boundary_read
1092 subroutine atmos_boundary_write
1102 if ( atmos_boundary_use_dens &
1103 .OR. atmos_boundary_use_velz &
1104 .OR. atmos_boundary_use_velx &
1105 .OR. atmos_boundary_use_vely &
1106 .OR. atmos_boundary_use_pott &
1109 atmos_boundary_out_basename, atmos_boundary_out_title, &
1110 'DENS',
'Reference Density',
'kg/m3',
'ZXY', &
1111 atmos_boundary_out_dtype )
1113 if ( atmos_boundary_use_dens .OR. l_bnd )
then 1115 atmos_boundary_out_basename, atmos_boundary_out_title, &
1116 'ALPHA_DENS',
'Alpha for DENS',
'1',
'ZXY', &
1117 atmos_boundary_out_dtype )
1120 if ( atmos_boundary_use_velz .OR. (l_bnd .AND.
online_use_velz) )
then 1122 atmos_boundary_out_basename, atmos_boundary_out_title, &
1123 'VELZ',
'Reference Velocity w',
'm/s',
'ZHXY', &
1124 atmos_boundary_out_dtype )
1126 atmos_boundary_out_basename, atmos_boundary_out_title, &
1127 'ALPHA_VELZ',
'Alpha for VELZ',
'1',
'ZHXY', &
1128 atmos_boundary_out_dtype )
1131 if ( atmos_boundary_use_velx .OR. l_bnd )
then 1133 atmos_boundary_out_basename, atmos_boundary_out_title, &
1134 'VELX',
'Reference Velocity u',
'm/s',
'ZXHY', &
1135 atmos_boundary_out_dtype )
1137 atmos_boundary_out_basename, atmos_boundary_out_title, &
1138 'ALPHA_VELX',
'Alpha for VELX',
'1',
'ZXHY', &
1139 atmos_boundary_out_dtype )
1142 if ( atmos_boundary_use_vely .OR. l_bnd )
then 1144 atmos_boundary_out_basename, atmos_boundary_out_title, &
1145 'VELY',
'Reference Velocity y',
'm/s',
'ZXYH', &
1146 atmos_boundary_out_dtype )
1148 atmos_boundary_out_basename, atmos_boundary_out_title, &
1149 'ALPHA_VELY',
'Alpha for VELY',
'1',
'ZXYH', &
1150 atmos_boundary_out_dtype )
1153 if ( atmos_boundary_use_pott .OR. l_bnd )
then 1155 atmos_boundary_out_basename, atmos_boundary_out_title, &
1156 'POTT',
'Reference POTT',
'K',
'ZXY', &
1157 atmos_boundary_out_dtype )
1159 atmos_boundary_out_basename, atmos_boundary_out_title, &
1160 'ALPHA_POTT',
'Alpha for POTT',
'1',
'ZXY', &
1161 atmos_boundary_out_dtype )
1164 if ( atmos_boundary_use_qv .OR. l_bnd )
then 1166 atmos_boundary_out_basename, atmos_boundary_out_title, &
1167 'QV',
'Reference QV',
'kg/kg',
'ZXY', &
1168 atmos_boundary_out_dtype )
1170 atmos_boundary_out_basename, atmos_boundary_out_title, &
1171 'ALPHA_QV',
'Alpha for QV',
'1',
'ZXY', &
1172 atmos_boundary_out_dtype )
1175 if ( atmos_boundary_use_qhyd )
then 1178 atmos_boundary_out_basename, atmos_boundary_out_title, &
1181 atmos_boundary_out_dtype )
1183 atmos_boundary_out_basename, atmos_boundary_out_title, &
1186 atmos_boundary_out_dtype )
1191 end subroutine atmos_boundary_write
1195 subroutine atmos_boundary_generate
1200 integer :: i, j, k, iq
1218 call atmos_boundary_var_fillhalo
1221 end subroutine atmos_boundary_generate
1225 subroutine atmos_boundary_initialize_file
1234 file_cartesc_check_coordinates
1237 integer :: boundary_time_startday
1238 real(DP) :: boundary_time_startsec
1239 real(DP) :: boundary_time_startms
1240 integer :: boundary_time_offset_year
1241 character(len=27) :: boundary_chardate
1243 if ( atmos_boundary_start_date(1) == -9999 )
then 1248 boundary_time_startms = 0.0_dp
1249 boundary_time_offset_year = 0
1251 atmos_boundary_start_date(:), &
1252 boundary_time_startms )
1255 boundary_time_startsec, &
1256 atmos_boundary_start_date(:), &
1257 boundary_time_startms, &
1258 boundary_time_offset_year )
1262 log_info(
"ATMOS_BOUNDARY_initialize_file",
'(1x,A,A)')
'BOUNDARY START Date : ', boundary_chardate
1266 if ( atmos_boundary_in_check_coordinates )
then 1267 call file_cartesc_check_coordinates( atmos_boundary_fid, atmos=.true. )
1271 end subroutine atmos_boundary_initialize_file
1286 real(RP) :: bnd_DENS(
ka,
ia,
ja)
1287 real(RP) :: bnd_VELZ(
ka,
ia,
ja)
1288 real(RP) :: bnd_VELX(
ka,
ia,
ja)
1289 real(RP) :: bnd_VELY(
ka,
ia,
ja)
1290 real(RP) :: bnd_POTT(
ka,
ia,
ja)
1293 integer :: run_time_startdate(6)
1294 integer :: run_time_startday
1295 real(DP) :: run_time_startsec
1296 real(DP) :: run_time_startms
1297 integer :: run_time_offset_year
1298 real(DP) :: run_time_nowdaysec
1300 real(DP) :: boundary_diff_daysec
1301 real(RP) :: boundary_inc_offset
1302 integer :: fillgaps_steps
1304 integer :: i, j, k, iq
1307 if ( atmos_boundary_update_dt <= 0.0_dp )
then 1308 log_error(
"ATMOS_BOUNDARY_set_file",*)
'You need specify ATMOS_BOUNDARY_UPDATE_DT as larger than 0.0' 1311 update_nstep = nint( atmos_boundary_update_dt /
time_dtsec )
1312 if ( abs(update_nstep *
time_dtsec - atmos_boundary_update_dt) > 1e-10_dp )
then 1313 log_error(
"ATMOS_BOUNDARY_set_file",*)
'ATMOS_BOUNDARY_UPDATE_DT is not multiple of DT' 1319 run_time_startms = 0.0_dp
1320 run_time_offset_year = 0
1323 run_time_startsec, &
1324 run_time_startdate(:), &
1326 run_time_offset_year )
1330 boundary_diff_daysec = run_time_nowdaysec - boundary_time_initdaysec
1331 boundary_timestep = 1 + int( boundary_diff_daysec / atmos_boundary_update_dt )
1332 boundary_inc_offset = mod( boundary_diff_daysec, atmos_boundary_update_dt )
1333 fillgaps_steps = int( boundary_inc_offset /
time_dtsec )
1335 log_info(
"ATMOS_BOUNDARY_set_file",*)
'BOUNDARY TIMESTEP NUMBER FOR INIT:', boundary_timestep
1336 log_info(
"ATMOS_BOUNDARY_set_file",*)
'BOUNDARY OFFSET:', boundary_inc_offset
1337 log_info(
"ATMOS_BOUNDARY_set_file",*)
'BOUNDARY FILLGAPS STEPS:', fillgaps_steps
1340 call atmos_boundary_update_file( ref_now )
1342 boundary_timestep = boundary_timestep + 1
1343 call atmos_boundary_update_file( ref_new )
1352 atmos_boundary_ref_dens(k,i,j,ref_old) = atmos_boundary_ref_dens(k,i,j,ref_now)
1353 atmos_boundary_ref_velx(k,i,j,ref_old) = atmos_boundary_ref_velx(k,i,j,ref_now)
1354 atmos_boundary_ref_vely(k,i,j,ref_old) = atmos_boundary_ref_vely(k,i,j,ref_now)
1355 atmos_boundary_ref_pott(k,i,j,ref_old) = atmos_boundary_ref_pott(k,i,j,ref_now)
1357 atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now)
1378 if ( atmos_boundary_use_velz )
then 1388 now_step = fillgaps_steps
1391 call get_boundary( bnd_dens(:,:,:), &
1396 bnd_qtrc(:,:,:,:), &
1420 subroutine atmos_boundary_initialize_online
1431 integer,
parameter :: handle = 2
1435 if ( nestqa >
bnd_qa )
then 1436 log_error(
"ATMOS_BOUNDARY_initialize_online",*)
'NEST_BND_QA exceeds BND_QA' 1437 log_error_cont(*)
'This must not be occur.' 1438 log_error_cont(*)
'Please send your configuration file to SCALE develop member.' 1445 end subroutine atmos_boundary_initialize_online
1461 integer,
parameter :: handle = 2
1464 integer :: i, j, k, iq
1468 boundary_timestep = 1
1469 log_info(
"ATMOS_BOUNDARY_set_online",*)
'BOUNDARY TIMESTEP NUMBER FOR INIT:', boundary_timestep
1471 call atmos_boundary_update_online_daughter( ref_now )
1473 boundary_timestep = boundary_timestep + 1
1474 log_info(
"ATMOS_BOUNDARY_set_online",*)
'BOUNDARY TIMESTEP NUMBER FOR INIT:', boundary_timestep
1476 call atmos_boundary_update_online_daughter( ref_new )
1482 atmos_boundary_ref_dens(k,i,j,ref_old) = atmos_boundary_ref_dens(k,i,j,ref_now)
1483 atmos_boundary_ref_velx(k,i,j,ref_old) = atmos_boundary_ref_velx(k,i,j,ref_now)
1484 atmos_boundary_ref_vely(k,i,j,ref_old) = atmos_boundary_ref_vely(k,i,j,ref_now)
1485 atmos_boundary_ref_pott(k,i,j,ref_old) = atmos_boundary_ref_pott(k,i,j,ref_now)
1487 atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now)
1516 else if ( atmos_boundary_use_velz )
then 1526 update_nstep = nint( atmos_boundary_update_dt /
time_dtsec )
1527 if ( update_nstep *
time_dtsec /= atmos_boundary_update_dt )
then 1528 log_error(
"ATMOS_BOUNDARY_set_online",*)
'DT of the parent is not multiple of the DT' 1532 log_error(
"ATMOS_BOUNDARY_set_online",*)
'DURATION must be the same as that of the parent' 1543 subroutine atmos_boundary_firstsend( &
1544 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, QV, Qe )
1554 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
1555 real(RP),
intent(in) :: MOMZ(
ka,
ia,
ja)
1556 real(RP),
intent(in) :: MOMX(
ka,
ia,
ja)
1557 real(RP),
intent(in) :: MOMY(
ka,
ia,
ja)
1558 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
1560 real(RP),
intent(in) :: QV (
ka,
ia,
ja)
1565 if ( do_parent_process )
then 1567 call atmos_boundary_send( dens, momz, momx, momy, rhot, qtrc, qv, qe )
1571 end subroutine atmos_boundary_firstsend
1588 if ( do_parent_process )
then 1593 if ( do_daughter_process )
then 1598 if ( atmos_boundary_fid > 0 )
then 1600 atmos_boundary_fid = -1
1633 real(RP) :: bnd_DENS(
ka,
ia,
ja)
1634 real(RP) :: bnd_VELZ(
ka,
ia,
ja)
1635 real(RP) :: bnd_VELX(
ka,
ia,
ja)
1636 real(RP) :: bnd_VELY(
ka,
ia,
ja)
1637 real(RP) :: bnd_POTT(
ka,
ia,
ja)
1641 integer :: i, j, k, iq, iqa
1644 if ( do_parent_process )
then 1646 call atmos_boundary_update_online_parent(
dens,
momz,
momx,
momy,
rhot,
qtrc(:,:,:,
qs_mp:
qe_mp),
qv,
qe )
1651 if ( now_step >= update_nstep )
then 1653 boundary_timestep = boundary_timestep + 1
1657 if ( do_daughter_process )
then 1658 call atmos_boundary_update_online_daughter( ref_new )
1660 call atmos_boundary_update_file( ref_new )
1665 now_step = now_step + 1
1668 call get_boundary( bnd_dens(:,:,:), &
1673 bnd_qtrc(:,:,:,:), &
1715 iqa = iq +
qs_mp - 1
1773 iqa = iq +
qs_mp - 1
1846 iqa = iq +
qs_mp - 1
1904 iqa = iq +
qs_mp - 1
1963 elseif ( do_parent_process )
then 1966 log_error(
"ATMOS_BOUNDARY_update",*)
'[BUG] invalid path' 1978 if ( do_parent_process )
then 1982 if ( do_daughter_process )
then 1992 subroutine atmos_boundary_update_file( ref )
1994 file_cartesc_read, &
2000 integer,
intent(in) :: ref
2005 log_info(
"ATMOS_BOUNDARY_update_file",*)
"Atmos Boundary: read from boundary file(timestep=", boundary_timestep,
")" 2007 fid = atmos_boundary_fid
2009 call file_cartesc_read( fid,
'DENS',
'ZXY', atmos_boundary_ref_dens(:,:,:,ref), step=boundary_timestep )
2010 call file_cartesc_read( fid,
'VELX',
'ZXHY', atmos_boundary_ref_velx(:,:,:,ref), step=boundary_timestep )
2011 call file_cartesc_read( fid,
'VELY',
'ZXYH', atmos_boundary_ref_vely(:,:,:,ref), step=boundary_timestep )
2012 call file_cartesc_read( fid,
'POTT',
'ZXY', atmos_boundary_ref_pott(:,:,:,ref), step=boundary_timestep )
2014 call file_cartesc_read( fid,
tracer_name(
qs_mp+iq-1),
'ZXY', atmos_boundary_ref_qtrc(:,:,:,iq,ref), step=boundary_timestep )
2020 call atmos_boundary_ref_fillhalo( ref )
2023 end subroutine atmos_boundary_update_file
2027 subroutine atmos_boundary_update_online_parent( &
2046 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
2047 real(RP),
intent(in) :: MOMZ(
ka,
ia,
ja)
2048 real(RP),
intent(in) :: MOMX(
ka,
ia,
ja)
2049 real(RP),
intent(in) :: MOMY(
ka,
ia,
ja)
2050 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
2052 real(RP),
intent(in) :: QV (
ka,
ia,
ja)
2055 integer,
parameter :: handle = 1
2058 log_info(
"ATMOS_BOUNDARY_update_online_parent",*)
"ATMOS BOUNDARY update online: PARENT" 2064 call atmos_boundary_send( dens, momz, momx, momy, rhot, qtrc, qv, qe )
2067 end subroutine atmos_boundary_update_online_parent
2071 subroutine atmos_boundary_update_online_daughter( &
2079 integer,
intent(in) :: ref
2081 integer,
parameter :: handle = 2
2084 log_info(
"ATMOS_BOUNDARY_update_online_daughter",
'(1X,A,I5)')
'ATMOS BOUNDARY update online: DAUGHTER', boundary_timestep
2087 call atmos_boundary_recv( ref )
2090 call atmos_boundary_ref_fillhalo( ref )
2096 end subroutine atmos_boundary_update_online_daughter
2100 subroutine atmos_boundary_send( &
2101 DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, QV, Qe )
2116 integer,
parameter :: handle = 1
2119 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
2120 real(RP),
intent(in) :: MOMZ(
ka,
ia,
ja)
2121 real(RP),
intent(in) :: MOMX(
ka,
ia,
ja)
2122 real(RP),
intent(in) :: MOMY(
ka,
ia,
ja)
2123 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
2124 real(RP),
intent(in),
target :: QTRC(
ka,
ia,
ja,
qa_mp)
2125 real(RP),
intent(in) :: QV (
ka,
ia,
ja)
2129 real(RP),
pointer :: Q(:,:,:,:)
2137 q(:,:,:,1) = qv(:,:,:)
2139 q(:,:,:,iq) = qe(:,:,:,iq-1)
2161 end subroutine atmos_boundary_send
2165 subroutine atmos_boundary_recv( &
2181 integer,
parameter :: handle = 2
2184 integer,
intent(in) :: ref_idx
2187 real(RP),
pointer :: Q(:,:,:,:)
2192 dummy_p(:,:,:,:) = 0.0_rp
2197 q => atmos_boundary_ref_qtrc(:,:,:,1:nestqa,ref_idx)
2207 dummy_p(:,:,:,1:nestqa), &
2208 atmos_boundary_ref_dens(:,:,:,ref_idx), &
2209 atmos_boundary_ref_velz(:,:,:,ref_idx), &
2210 atmos_boundary_ref_velx(:,:,:,ref_idx), &
2211 atmos_boundary_ref_vely(:,:,:,ref_idx), &
2212 atmos_boundary_ref_pott(:,:,:,ref_idx), &
2218 q(:,:,:,1), q(:,:,:,2:), &
2219 atmos_boundary_ref_qtrc(:,:,:,:,ref_idx) )
2220 else if ( nestqa > 0 )
then 2221 atmos_boundary_ref_qtrc(:,:,:,1,ref_idx) = q(:,:,:,1)
2225 end subroutine atmos_boundary_recv
2229 subroutine get_boundary_same_parent( &
2241 real(RP),
intent(out) :: bnd_DENS(:,:,:)
2242 real(RP),
intent(out) :: bnd_VELZ(:,:,:)
2243 real(RP),
intent(out) :: bnd_VELX(:,:,:)
2244 real(RP),
intent(out) :: bnd_VELY(:,:,:)
2245 real(RP),
intent(out) :: bnd_POTT(:,:,:)
2246 real(RP),
intent(out) :: bnd_QTRC(:,:,:,:)
2247 integer,
intent(in) :: now_step
2248 integer,
intent(in) :: update_step
2251 integer :: i, j, k, iq
2255 if ( now_step == update_step )
then 2264 bnd_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref)
2265 bnd_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref)
2266 bnd_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref)
2267 bnd_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref)
2268 bnd_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref)
2270 bnd_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref)
2277 end subroutine get_boundary_same_parent
2281 subroutine get_boundary_nearest_neighbor( &
2293 real(RP) :: EPS = 1.0e-4_rp
2296 real(RP),
intent(out) :: bnd_DENS(:,:,:)
2297 real(RP),
intent(out) :: bnd_VELZ(:,:,:)
2298 real(RP),
intent(out) :: bnd_VELX(:,:,:)
2299 real(RP),
intent(out) :: bnd_VELY(:,:,:)
2300 real(RP),
intent(out) :: bnd_POTT(:,:,:)
2301 real(RP),
intent(out) :: bnd_QTRC(:,:,:,:)
2302 integer,
intent(in) :: now_step
2303 integer,
intent(in) :: update_step
2306 integer :: i, j, k, iq
2309 real(RP) :: real_nstep
2310 real(RP) :: half_nstep
2313 real_nstep =
real( now_step, kind=
rp )
2314 half_nstep =
real( UPDATE_NSTEP, kind=RP ) * 0.5_rp
2317 if( ( real_nstep - eps ) < half_nstep )
then 2321 else if( ( real_nstep - 1.0_rp + eps ) > half_nstep )
then 2333 bnd_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_idx)
2334 bnd_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_idx)
2335 bnd_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_idx)
2336 bnd_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_idx)
2337 bnd_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_idx)
2339 bnd_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_idx)
2346 end subroutine get_boundary_nearest_neighbor
2350 subroutine get_boundary_lerp_initpoint( &
2362 real(RP),
intent(out) :: bnd_DENS(:,:,:)
2363 real(RP),
intent(out) :: bnd_VELZ(:,:,:)
2364 real(RP),
intent(out) :: bnd_VELX(:,:,:)
2365 real(RP),
intent(out) :: bnd_VELY(:,:,:)
2366 real(RP),
intent(out) :: bnd_POTT(:,:,:)
2367 real(RP),
intent(out) :: bnd_QTRC(:,:,:,:)
2368 integer,
intent(in) :: now_step
2369 integer,
intent(in) :: update_step
2372 integer :: i, j, k, iq
2377 fact =
REAL(now_step, kind=RP) / update_step
2386 bnd_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_now) * ( 1.0_rp-fact ) &
2387 + atmos_boundary_ref_dens(k,i,j,ref_new) * fact
2388 bnd_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_now) * ( 1.0_rp-fact ) &
2389 + atmos_boundary_ref_velz(k,i,j,ref_new) * fact
2390 bnd_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_now) * ( 1.0_rp-fact) &
2391 + atmos_boundary_ref_velx(k,i,j,ref_new) * fact
2392 bnd_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_now) * ( 1.0_rp-fact) &
2393 + atmos_boundary_ref_vely(k,i,j,ref_new) * fact
2394 bnd_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_now) * ( 1.0_rp-fact ) &
2395 + atmos_boundary_ref_pott(k,i,j,ref_new) * fact
2397 bnd_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now) * ( 1.0_rp-fact ) &
2398 + atmos_boundary_ref_qtrc(k,i,j,iq,ref_new) * fact
2405 end subroutine get_boundary_lerp_initpoint
2409 subroutine get_boundary_lerp_midpoint( &
2423 real(RP) :: EPS = 1.0e-4_rp
2426 real(RP),
intent(out) :: bnd_DENS(:,:,:)
2427 real(RP),
intent(out) :: bnd_VELZ(:,:,:)
2428 real(RP),
intent(out) :: bnd_VELX(:,:,:)
2429 real(RP),
intent(out) :: bnd_VELY(:,:,:)
2430 real(RP),
intent(out) :: bnd_POTT(:,:,:)
2431 real(RP),
intent(out) :: bnd_QTRC(:,:,:,:)
2432 integer,
intent(in) :: now_step
2433 integer,
intent(in) :: update_step
2436 integer :: i, j, k, iq
2438 real(RP) :: real_nstep
2439 real(RP) :: half_nstep
2443 real_nstep =
real( now_step, kind=
rp )
2444 half_nstep =
real( UPDATE_NSTEP, kind=RP ) * 0.5_rp
2447 if( ( real_nstep - eps ) < half_nstep )
then 2449 t1 =
time_dtsec / atmos_boundary_update_dt * ( real_nstep + half_nstep - 0.5_rp )
2454 bnd_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_now) * t1 &
2455 - atmos_boundary_ref_dens(k,i,j,ref_old) * ( t1 - 1.0_rp )
2456 bnd_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_now) * t1 &
2457 - atmos_boundary_ref_velz(k,i,j,ref_old) * ( t1 - 1.0_rp )
2458 bnd_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_now) * t1 &
2459 - atmos_boundary_ref_velx(k,i,j,ref_old) * ( t1 - 1.0_rp )
2460 bnd_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_now) * t1 &
2461 - atmos_boundary_ref_vely(k,i,j,ref_old) * ( t1 - 1.0_rp )
2462 bnd_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_now) * t1 &
2463 - atmos_boundary_ref_pott(k,i,j,ref_old) * ( t1 - 1.0_rp )
2465 bnd_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now) * t1 &
2466 - atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) * ( t1 - 1.0_rp )
2473 else if( ( real_nstep - 1.0_rp + eps ) > half_nstep )
then 2475 t1 =
time_dtsec / atmos_boundary_update_dt * ( real_nstep - half_nstep - 0.5_rp )
2480 bnd_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_new) * t1 &
2481 - atmos_boundary_ref_dens(k,i,j,ref_now) * ( t1 - 1.0_rp )
2482 bnd_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_new) * t1 &
2483 - atmos_boundary_ref_velz(k,i,j,ref_now) * ( t1 - 1.0_rp )
2484 bnd_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_new) * t1 &
2485 - atmos_boundary_ref_velx(k,i,j,ref_now) * ( t1 - 1.0_rp )
2486 bnd_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_new) * t1 &
2487 - atmos_boundary_ref_vely(k,i,j,ref_now) * ( t1 - 1.0_rp )
2488 bnd_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_new) * t1 &
2489 - atmos_boundary_ref_pott(k,i,j,ref_now) * ( t1 - 1.0_rp )
2491 bnd_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_new) * t1 &
2492 - atmos_boundary_ref_qtrc(k,i,j,iq,ref_now) * ( t1 - 1.0_rp )
2501 t1 =
time_dtsec / atmos_boundary_update_dt * ( real_nstep + half_nstep - 1.0_rp )
2502 t2 =
time_dtsec / atmos_boundary_update_dt * ( real_nstep - half_nstep )
2507 bnd_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_new) * t2 * 0.25_rp &
2508 + atmos_boundary_ref_dens(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2509 - atmos_boundary_ref_dens(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp
2510 bnd_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_new) * t2 * 0.25_rp &
2511 + atmos_boundary_ref_velz(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2512 - atmos_boundary_ref_velz(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp
2513 bnd_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_new) * t2 * 0.25_rp &
2514 + atmos_boundary_ref_velx(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2515 - atmos_boundary_ref_velx(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp
2516 bnd_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_new) * t2 * 0.25_rp &
2517 + atmos_boundary_ref_vely(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2518 - atmos_boundary_ref_vely(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp
2519 bnd_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_new) * t2 * 0.25_rp &
2520 + atmos_boundary_ref_pott(k,i,j,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2521 - atmos_boundary_ref_pott(k,i,j,ref_old) * ( t1 - 1.0_rp ) * 0.25_rp
2523 bnd_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_new) * t2 * 0.25_rp &
2524 + atmos_boundary_ref_qtrc(k,i,j,iq,ref_now) * ( t1 - t2 + 3.0_rp ) * 0.25_rp &
2525 - atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) * ( t1 - 1.0_rp )
2534 end subroutine get_boundary_lerp_midpoint
2553 subroutine history_bnd( &
2554 ATMOS_BOUNDARY_DENS, &
2555 ATMOS_BOUNDARY_VELZ, &
2556 ATMOS_BOUNDARY_VELX, &
2557 ATMOS_BOUNDARY_VELY, &
2558 ATMOS_BOUNDARY_POTT, &
2559 ATMOS_BOUNDARY_QTRC )
2565 real(RP),
intent(in) :: ATMOS_BOUNDARY_DENS(
ka,
ia,
ja)
2566 real(RP),
intent(in) :: ATMOS_BOUNDARY_VELZ(
ka,
ia,
ja)
2567 real(RP),
intent(in) :: ATMOS_BOUNDARY_VELX(
ka,
ia,
ja)
2568 real(RP),
intent(in) :: ATMOS_BOUNDARY_VELY(
ka,
ia,
ja)
2569 real(RP),
intent(in) :: ATMOS_BOUNDARY_POTT(
ka,
ia,
ja)
2570 real(RP),
intent(in) :: ATMOS_BOUNDARY_QTRC(
ka,
ia,
ja,
bnd_qa)
2574 call file_history_in( atmos_boundary_dens(:,:,:),
'DENS_BND',
'Boundary Density',
'kg/m3' )
2575 call file_history_in( atmos_boundary_velz(:,:,:),
'VELZ_BND',
'Boundary velocity z-direction',
'm/s', dim_type=
'ZHXY' )
2576 call file_history_in( atmos_boundary_velx(:,:,:),
'VELX_BND',
'Boundary velocity x-direction',
'm/s', dim_type=
'ZXHY' )
2577 call file_history_in( atmos_boundary_vely(:,:,:),
'VELY_BND',
'Boundary velocity y-direction',
'm/s', dim_type=
'ZXYH' )
2578 call file_history_in( atmos_boundary_pott(:,:,:),
'POTT_BND',
'Boundary potential temperature',
'K' )
2580 iqa =
qs_mp + iq - 1
2581 call file_history_in( atmos_boundary_qtrc(:,:,:,iq), trim(
tracer_name(iqa))//
'_BND', &
2586 end subroutine history_bnd
subroutine, public comm_cartesc_nest_nestdown(HANDLE, BND_QA, DENS_send, MOMZ_send, MOMX_send, MOMY_send, RHOT_send, QTRC_send, DENS_recv, VELZ_recv, VELX_recv, VELY_recv, POTT_recv, QTRC_recv)
Boundary data transfer from parent to daughter: nestdown.
real(rp), dimension(:,:,:), allocatable, target, public momz
integer, dimension(2), public daughter_ia
daughter max number in x-direction (with halo)
real(dp) function, public calendar_combine_daysec(absday, abssec)
Combine day and second.
integer, dimension(2), public daughter_ja
daughter max number in y-direction (with halo)
subroutine, public atmos_boundary_driver_update
Update boundary value with a constant time boundary.
logical, public online_iam_parent
a flag to say "I am a parent"
real(rp), dimension(:,:,:), allocatable, target, public rhot
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_vely
subroutine, public calendar_date2char(chardate, ymdhms, subsec)
Convert from gregorian date to absolute day/second.
subroutine, public atmos_boundary_driver_set
set
integer, public time_nstep
total steps [number]
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_dens
integer, dimension(2), public daughter_ka
daughter max number in z-direction (with halo)
integer, public ia
of whole cells: x, local, with HALO
module Atmosphere / Physics Cloud Microphysics
logical, public atmos_boundary_update_flag
subroutine, public atmos_boundary_driver_setup
Setup.
module atmosphere / reference state
integer, dimension(2), public parent_nstep
parent step [number]
module ATMOSPHERIC Variables
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfz
center buffer factor (0-1): z
real(rp), dimension(:,:,:), allocatable, target, public momx
subroutine, public atmos_boundary_driver_finalize
Finalize boundary value.
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_pott
integer, public ja
of whole cells: y, local, with HALO
integer, public io_fid_conf
Config file ID.
logical, public prc_has_s
subroutine update_ref_index
Update indices of array of boundary references.
character(len=h_short), dimension(qa_max), public tracer_name
logical, public prc_has_n
logical, public prc_has_e
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velz
real(rp), public const_undef
character(len=h_short), dimension(qa_max), public tracer_unit
integer, public comm_cartesc_nest_bnd_qa
number of tracer treated in nesting system
real(rp), dimension(0-1), allocatable, public dens
integer, public is
start point of inner domain: x, local
integer, public ie
end point of inner domain: x, local
integer, dimension(2), public parent_ia
parent max number in x-direction (with halo)
subroutine, public comm_cartesc_nest_recv_cancel(HANDLE)
Sub-command for data transfer from parent to daughter: nestdown.
real(rp), public atmos_boundary_smoother_fact
module atmosphere / hydrometeor
subroutine, public atmos_phy_mp_driver_qhyd2qtrc(KA, KS, KE, IA, IS, IE, JA, JS, JE, QV, QHYD, QTRC, QNUM)
real(dp), public time_dtsec
time interval of model [sec]
logical, public online_boundary_diagqhyd
module atmosphere / grid / cartesC index
integer, public ke
end point of inner domain: z, local
logical, public online_iam_daughter
a flag to say "I am a daughter"
real(rp), dimension(:,:,:), allocatable, public atmos_refstate_dens
refernce density [kg/m3]
subroutine, public comm_cartesc_nest_recvwait_issue(HANDLE, BND_QA)
Sub-command for data transfer from parent to daughter: nestdown.
module ATMOSPHERE / Boundary treatment
integer, public je
end point of inner domain: y, local
real(rp), dimension(:,:,:,:), allocatable, public atmos_boundary_alpha_qtrc
logical, public online_boundary_use_qhyd
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_velx
module atmosphere / grid / cartesC
integer, public ks
start point of inner domain: z, local
integer, dimension(2), public parent_ja
parent max number in y-direction (with halo)
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfx
center buffer factor (0-1): x
logical, public use_nesting
subroutine, public prc_abort
Abort Process.
real(rp), dimension(:,:,:), allocatable, pointer, target, public qv
subroutine, public comm_cartesc_nest_test(HANDLE)
[check communication status] Inter-communication
real(rp), dimension(0-1), allocatable, public qtrc
module Communication CartesianC nesting
integer, public js
start point of inner domain: y, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfx
face buffer factor (0-1): x
real(rp), dimension(:,:,:), allocatable, target, public momy
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfy
center buffer factor (0-1): y
module Atmosphere / Physics Chemistry
subroutine atmos_boundary_set_file
Set boundary value for real case experiment.
real(rp), public const_eps
small number
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfz
face buffer factor (0-1): z
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfy
face buffer factor (0-1): y
real(dp), dimension(2), public parent_dtsec
parent DT [sec]
integer, dimension(2), public parent_ka
parent max number in z-direction (with halo)
integer, public ka
of whole cells: z, local, with HALO
real(rp), public const_pi
pi
integer, dimension(6), public time_nowdate
current time [YYYY MM DD HH MM SS]
real(rp), dimension(:,:,:,:), allocatable, target, public qe
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_velz
subroutine, public file_cartesc_flush(fid)
Flush all pending requests to a netCDF file (PnetCDF only)
integer, parameter, public n_hyd
module atmosphere / physics / cloud microphysics
integer, parameter, public rp
subroutine, public file_cartesc_open(basename, fid, aggregate)
open a netCDF file for read
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_pott
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_dens
subroutine, public calendar_date2daysec(absday, abssec, ymdhms, subsec, offset_year)
Convert from gregorian date to absolute day/second.
subroutine, public file_cartesc_close(fid)
Close a netCDF file.
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_vely
real(rp), dimension(:,:,:,:), allocatable, public atmos_boundary_qtrc
subroutine atmos_boundary_set_online
Set boundary value for real case experiment [online daughter].
logical, public prc_has_w
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velx
logical, public online_use_velz