SCALE-RM
Data Types | Functions/Subroutines | Variables
scale_atmos_boundary Module Reference

module ATMOSPHERE / Boundary treatment More...

Functions/Subroutines

subroutine, public atmos_boundary_setup
 Setup. More...
 
subroutine, public atmos_boundary_resume (DENS, MOMZ, MOMX, MOMY, RHOT, QTRC)
 Resume. More...
 
subroutine atmos_boundary_resume_file
 Resume boundary value for real case experiment. More...
 
subroutine atmos_boundary_resume_online
 Resume boundary value for real case experiment [online daughter]. More...
 
subroutine, public atmos_boundary_firstsend (DENS, MOMZ, MOMX, MOMY, RHOT, QTRC)
 First send boundary value. More...
 
subroutine, public atmos_boundary_finalize
 Finalize boundary value. More...
 
subroutine, public atmos_boundary_update (DENS, MOMZ, MOMX, MOMY, RHOT, QTRC)
 Update boundary value with a constant time increment. More...
 
subroutine update_ref_index
 Update indices of array of boundary references. More...
 

Variables

integer, public bnd_qa
 
integer, public of
 
integer, public tracer
 
integer, public at
 
integer, public boundary
 
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_dens
 
real(rp), allocatable, public reference
 
real(rp), dimension(with halo), allocatable, public dens
 
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velz
 
real(rp), dimension(with halo), allocatable, public velz
 
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velx
 
real(rp), dimension(with halo), allocatable, public velx
 
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_vely
 
real(rp), dimension(with halo), allocatable, public vely
 
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_pott
 
real(rp), dimension(with halo), allocatable, public pott
 
real(rp), dimension(:,:,:,:), allocatable, public atmos_boundary_qtrc
 
real(rp), dimension(with halo), allocatable, public qtrc
 
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_dens
 
real(rp), allocatable, public damping
 
real(rp), allocatable, public coefficient
 
real(rp), allocatable, public for
 
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_velz
 
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_velx
 
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_vely
 
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_pott
 
real(rp), dimension(:,:,:,:), allocatable, public atmos_boundary_alpha_qtrc
 
real(rp), public atmos_boundary_smoother_fact = 0.2_RP
 
logical, public atmos_boundary_update_flag = .false.
 
logical, public switch
 
logical, public real
 
logical, public case
 

Detailed Description

module ATMOSPHERE / Boundary treatment

Description
Boundary treatment of model domain Additional forcing, Sponge layer, rayleigh dumping
Author
Team SCALE
History
  • 2011-12-07 (Y.Miyamoto) [new]
  • 2011-12-11 (H.Yashiro) [mod] integrate to SCALE-LES ver.3
  • 2012-03-23 (H.Yashiro) [mod] Explicit index parameter inclusion
  • 2014-05-18 (R.Yoshida) [add] boudary read/update for real case
  • 2014-09-05 (R.Yoshida) [add] boudary update by online communicate
NAMELIST
  • PARAM_ATMOS_BOUNDARY
    nametypedefault valuecomment
    ATMOS_BOUNDARY_TYPE character(len=H_LONG) 'NONE'
    ATMOS_BOUNDARY_IN_BASENAME character(len=H_LONG) ''
    ATMOS_BOUNDARY_OUT_BASENAME character(len=H_LONG) ''
    ATMOS_BOUNDARY_OUT_TITLE character(len=H_MID) 'SCALE-RM BOUNDARY CONDITION' title of the output file
    ATMOS_BOUNDARY_USE_VELZ logical .false. read from file?
    ATMOS_BOUNDARY_USE_VELX logical .false. read from file?
    ATMOS_BOUNDARY_USE_VELY logical .false. read from file?
    ATMOS_BOUNDARY_USE_POTT logical .false. read from file?
    ATMOS_BOUNDARY_USE_DENS logical .false. read from file?
    ATMOS_BOUNDARY_USE_QV logical .false. read from file?
    ATMOS_BOUNDARY_USE_QHYD logical .false. read from file?
    ATMOS_BOUNDARY_VALUE_VELZ real(RP) 0.0_RP velocity w at boundary, 0 [m/s]
    ATMOS_BOUNDARY_VALUE_VELX real(RP) 0.0_RP velocity u at boundary, 0 [m/s]
    ATMOS_BOUNDARY_VALUE_VELY real(RP) 0.0_RP velocity v at boundary, 0 [m/s]
    ATMOS_BOUNDARY_VALUE_POTT real(RP) 300.0_RP potential temp. at boundary, 300 [K]
    ATMOS_BOUNDARY_VALUE_QTRC real(RP) 0.0_RP tracer at boundary, 0 [kg/kg]
    ATMOS_BOUNDARY_ALPHAFACT_DENS real(RP) 1.0_RP alpha factor again default
    ATMOS_BOUNDARY_ALPHAFACT_VELZ real(RP) 1.0_RP alpha factor again default
    ATMOS_BOUNDARY_ALPHAFACT_VELX real(RP) 1.0_RP alpha factor again default
    ATMOS_BOUNDARY_ALPHAFACT_VELY real(RP) 1.0_RP alpha factor again default
    ATMOS_BOUNDARY_ALPHAFACT_POTT real(RP) 1.0_RP alpha factor again default
    ATMOS_BOUNDARY_ALPHAFACT_QTRC real(RP) 1.0_RP alpha factor again default
    ATMOS_BOUNDARY_SMOOTHER_FACT real(RP) 0.2_RP fact for smoother to damping
    ATMOS_BOUNDARY_FRACZ real(RP) 1.0_RP fraction of boundary region for dumping (z) [0-1]
    ATMOS_BOUNDARY_FRACX real(RP) 1.0_RP fraction of boundary region for dumping (x) [0-1]
    ATMOS_BOUNDARY_FRACY real(RP) 1.0_RP fraction of boundary region for dumping (y) [0-1]
    ATMOS_BOUNDARY_TAUZ real(RP) maximum value for damping tau (z) [s]
    ATMOS_BOUNDARY_TAUX real(RP) maximum value for damping tau (x) [s]
    ATMOS_BOUNDARY_TAUY real(RP) maximum value for damping tau (y) [s]
    ATMOS_BOUNDARY_UPDATE_DT real(DP) 0.0_DP inteval time of boudary data update [s]
    ATMOS_BOUNDARY_START_DATE integer (/ -9999, 0, 0, 0, 0, 0 /) boundary initial date
    ATMOS_BOUNDARY_LINEAR_V logical .false. linear or non-linear profile of relax region
    ATMOS_BOUNDARY_LINEAR_H logical .true. linear or non-linear profile of relax region
    ATMOS_BOUNDARY_EXP_H real(RP) 2.0_RP factor of non-linear profile of relax region
    ATMOS_BOUNDARY_INCREMENT_TYPE character(len=H_LONG) 'lerp_initpoint' type of boundary increment

History Output
namedescriptionunitvariable
DENS_BND Boundary Density kg/m3 ATMOS_BOUNDARY_DENS
POTT_BND Boundary potential temperature K ATMOS_BOUNDARY_POTT
VELX_BND Boundary velocity x-direction m/s ATMOS_BOUNDARY_VELX
VELY_BND Boundary velocity y-direction m/s ATMOS_BOUNDARY_VELY
VELZ_BND Boundary velocity z-direction m/s ATMOS_BOUNDARY_VELZ
trim(AQ_NAME(iq))//'_BND' 'Boundary '//trim(AQ_NAME(iq)) kg/kg ATMOS_BOUNDARY_QTRC

Function/Subroutine Documentation

◆ atmos_boundary_setup()

subroutine, public scale_atmos_boundary::atmos_boundary_setup ( )

Setup.

Definition at line 195 of file scale_atmos_sub_boundary.F90.

References atmos_boundary_alpha_dens, atmos_boundary_alpha_pott, atmos_boundary_alpha_qtrc, atmos_boundary_alpha_velx, atmos_boundary_alpha_vely, atmos_boundary_alpha_velz, atmos_boundary_dens, atmos_boundary_pott, atmos_boundary_qtrc, atmos_boundary_smoother_fact, atmos_boundary_update_flag, atmos_boundary_velx, atmos_boundary_vely, atmos_boundary_velz, bnd_qa, scale_comm::comm_fill_bnd, scale_const::const_undef, scale_tracer::i_qv, scale_grid_index::ia, scale_stdio::io_fid_conf, scale_stdio::io_fid_log, scale_stdio::io_l, scale_stdio::io_lnml, scale_grid_index::ja, scale_grid_index::ka, scale_grid_nest::offline, scale_grid_nest::online_iam_daughter, scale_grid_nest::online_iam_parent, scale_process::prc_mpistop(), scale_tracer::qa, scale_time::time_dtsec, and scale_grid_nest::use_nesting.

Referenced by mod_atmos_driver::atmos_driver_setup().

195  use scale_process, only: &
197  use scale_comm, only: &
199  use scale_const, only: &
201  use scale_time, only: &
202  dt => time_dtsec
203  use scale_grid_nest, only: &
204  use_nesting, &
205  offline, &
208  implicit none
209 
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, &
233  atmos_boundary_smoother_fact, &
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
246 
247  integer :: ierr
248  !---------------------------------------------------------------------------
249 
250  if( io_l ) write(io_fid_log,*)
251  if( io_l ) write(io_fid_log,*) '+++ Module[Boundary]/Categ[ATMOS]'
252 
253  atmos_boundary_tauz = dt * 10.0_rp
254  atmos_boundary_taux = dt * 10.0_rp
255  atmos_boundary_tauy = dt * 10.0_rp
256 
257  !--- read namelist
258  rewind(io_fid_conf)
259  read(io_fid_conf,nml=param_atmos_boundary,iostat=ierr)
260  if( ierr < 0 ) then !--- missing
261  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
262  elseif( ierr > 0 ) then !--- fatal error
263  write(*,*) 'xxx Not appropriate names in namelist PARAM_ATMOS_BOUNDARY. Check!'
264  call prc_mpistop
265  endif
266  if( io_lnml ) write(io_fid_log,nml=param_atmos_boundary)
267 
268  ! setting switches
269  if( .NOT. use_nesting ) then
270  atmos_boundary_online = .false.
271  else
272  if( offline ) then
273  atmos_boundary_online = .false.
274  else
275  atmos_boundary_online = .true.
276  endif
277  endif
278  do_parent_process = .false.
279  do_daughter_process = .false.
280  atmos_boundary_online_master = .false.
281  if ( atmos_boundary_online ) then
282  if ( online_iam_parent ) then
283  do_parent_process = .true.
284  if ( .NOT. online_iam_daughter ) then
285  atmos_boundary_online_master = .true.
286  endif
287  endif
288  if ( online_iam_daughter ) then
289  do_daughter_process = .true.
290  endif
291  endif
292 
293  if( atmos_boundary_use_qhyd ) then
294  bnd_qa = qa
295  else
296  bnd_qa = i_qv
297  end if
298 
299  allocate( atmos_boundary_dens(ka,ia,ja) )
300  allocate( atmos_boundary_velz(ka,ia,ja) )
301  allocate( atmos_boundary_velx(ka,ia,ja) )
302  allocate( atmos_boundary_vely(ka,ia,ja) )
303  allocate( atmos_boundary_pott(ka,ia,ja) )
304  allocate( atmos_boundary_qtrc(ka,ia,ja,bnd_qa) )
311 
312  allocate( atmos_boundary_alpha_dens(ka,ia,ja) )
313  allocate( atmos_boundary_alpha_velz(ka,ia,ja) )
314  allocate( atmos_boundary_alpha_velx(ka,ia,ja) )
315  allocate( atmos_boundary_alpha_vely(ka,ia,ja) )
316  allocate( atmos_boundary_alpha_pott(ka,ia,ja) )
317  allocate( atmos_boundary_alpha_qtrc(ka,ia,ja,bnd_qa) )
318  atmos_boundary_alpha_dens(:,:,:) = 0.0_rp
319  atmos_boundary_alpha_velz(:,:,:) = 0.0_rp
320  atmos_boundary_alpha_velx(:,:,:) = 0.0_rp
321  atmos_boundary_alpha_vely(:,:,:) = 0.0_rp
322  atmos_boundary_alpha_pott(:,:,:) = 0.0_rp
323  atmos_boundary_alpha_qtrc(:,:,:,:) = 0.0_rp
324 
325  if ( atmos_boundary_type == 'REAL' .OR. do_daughter_process ) then
326  l_bnd = .true.
327  else
328  l_bnd = .false.
329  end if
330 
331  if ( l_bnd ) then
332 
333  select case(atmos_boundary_increment_type)
334  case ('same_parent')
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
342  case default
343  write(*,*) 'xxx Wrong parameter in ATMOS_BOUNDARY_increment_TYPE. Check!'
344  call prc_mpistop
345  end select
346 
347  comm_fill_bnd = .false.
348 
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) )
355  atmos_boundary_ref_dens(:,:,:,:) = const_undef
356  atmos_boundary_ref_velz(:,:,:,:) = const_undef
357  atmos_boundary_ref_velx(:,:,:,:) = const_undef
358  atmos_boundary_ref_vely(:,:,:,:) = const_undef
359  atmos_boundary_ref_pott(:,:,:,:) = const_undef
360  atmos_boundary_ref_qtrc(:,:,:,:,:) = const_undef
361 
362  ! initialize boundary value (reading file or waiting parent domain)
363  if ( do_daughter_process ) then
364  call atmos_boundary_initialize_online
365  else
366  if ( atmos_boundary_in_basename /= '' ) then
367  call atmos_boundary_initialize_file
368  else
369  write(*,*) 'xxx You need specify ATMOS_BOUNDARY_IN_BASENAME'
370  call prc_mpistop
371  endif
372  endif
373 
374  call atmos_boundary_setalpha
375 
376  atmos_boundary_update_flag = .true.
377 
378  elseif ( atmos_boundary_type == 'CONST' ) then
379 
380  call atmos_boundary_generate
381 
382  call atmos_boundary_setalpha
383 
384  atmos_boundary_update_flag = .false.
385 
386  elseif ( atmos_boundary_type == 'INIT' ) then
387 
388  call atmos_boundary_setalpha
389 
390  atmos_boundary_update_flag = .false.
391 
392  elseif ( atmos_boundary_type == 'FILE' ) then
393 
394  if ( atmos_boundary_in_basename /= '' ) then
395  call atmos_boundary_read
396  else
397  write(*,*) 'xxx You need specify ATMOS_BOUNDARY_IN_BASENAME'
398  call prc_mpistop
399  endif
400 
401  atmos_boundary_update_flag = .false.
402 
403  else
404  write(*,*) 'xxx unsupported ATMOS_BOUNDARY_TYPE. Check!', trim(atmos_boundary_type)
405  call prc_mpistop
406  endif
407 
408  if ( use_nesting ) atmos_boundary_update_flag = .true.
409 
410  !----- report data -----
411  if( io_l ) write(io_fid_log,*)
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
414  if( io_l ) write(io_fid_log,*)
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
422  if( io_l ) write(io_fid_log,*)
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
428  if( io_l ) write(io_fid_log,*)
429  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary smoother factor : ', atmos_boundary_smoother_fact
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
436  if( io_l ) write(io_fid_log,*)
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(:)
439  if( io_l ) write(io_fid_log,*)
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
443  if( io_l ) write(io_fid_log,*)
444  if( io_l ) write(io_fid_log,*) '*** online nesting for lateral boundary : ', atmos_boundary_online
445 
446  if( io_l ) write(io_fid_log,*) '*** does lateral boundary exist in this domain? : ', l_bnd
447  if ( l_bnd ) then
448  if( io_l ) write(io_fid_log,*) '*** lateral boundary increment type : ', atmos_boundary_increment_type
449  endif
450 
451  return
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velx
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velz
subroutine, public prc_mpistop
Abort MPI.
module GRID (nesting system)
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:59
logical, public online_iam_daughter
a flag to say "I am a daughter"
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_pott
logical, public offline
real(rp), public const_undef
Definition: scale_const.F90:43
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_velz
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_vely
real(rp), dimension(:,:,:,:), allocatable, public atmos_boundary_qtrc
real(dp), public time_dtsec
time interval of model [sec]
Definition: scale_time.F90:36
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_vely
module COMMUNICATION
Definition: scale_comm.F90:23
module TIME
Definition: scale_time.F90:15
module PROCESS
logical, public comm_fill_bnd
switch whether fill boundary data
Definition: scale_comm.F90:119
module CONSTANT
Definition: scale_const.F90:14
logical, public use_nesting
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_dens
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_dens
logical, public io_lnml
output log or not? (for namelist, this process)
Definition: scale_stdio.F90:60
logical, public online_iam_parent
a flag to say "I am a parent"
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_pott
integer, public io_fid_conf
Config file ID.
Definition: scale_stdio.F90:55
integer, public io_fid_log
Log file ID.
Definition: scale_stdio.F90:56
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_velx
real(rp), dimension(:,:,:,:), allocatable, public atmos_boundary_alpha_qtrc
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_boundary_resume()

subroutine, public scale_atmos_boundary::atmos_boundary_resume ( real(rp), dimension(ka,ia,ja), intent(in)  DENS,
real(rp), dimension(ka,ia,ja), intent(in)  MOMZ,
real(rp), dimension(ka,ia,ja), intent(in)  MOMX,
real(rp), dimension(ka,ia,ja), intent(in)  MOMY,
real(rp), dimension(ka,ia,ja), intent(in)  RHOT,
real(rp), dimension(ka,ia,ja,qa), intent(in)  QTRC 
)

Resume.

Definition at line 463 of file scale_atmos_sub_boundary.F90.

References scale_tracer::aq_name, scale_tracer::aq_unit, atmos_boundary_alpha_dens, atmos_boundary_alpha_pott, atmos_boundary_alpha_qtrc, atmos_boundary_alpha_velx, atmos_boundary_alpha_vely, atmos_boundary_alpha_velz, atmos_boundary_dens, atmos_boundary_firstsend(), atmos_boundary_pott, atmos_boundary_qtrc, atmos_boundary_resume_file(), atmos_boundary_resume_online(), atmos_boundary_update_flag, atmos_boundary_velx, atmos_boundary_vely, atmos_boundary_velz, scale_atmos_refstate::atmos_refstate_dens, bnd_qa, scale_calendar::calendar_combine_daysec(), scale_calendar::calendar_date2char(), scale_calendar::calendar_date2daysec(), scale_const::const_eps, scale_const::const_pi, scale_grid::grid_cbfx, scale_grid::grid_cbfy, scale_grid::grid_cbfz, scale_grid::grid_fbfx, scale_grid::grid_fbfy, scale_grid::grid_fbfz, scale_grid_index::ia, scale_grid_index::ieb, scale_stdio::io_fid_log, scale_stdio::io_l, scale_grid_index::isb, scale_grid_index::ja, scale_grid_index::jeb, scale_grid_index::jsb, scale_grid_index::ka, scale_grid_index::ke, scale_grid_index::ks, scale_grid_nest::online_use_velz, scale_process::prc_mpistop(), scale_process::prc_myrank, and scale_time::time_nowdate.

Referenced by mod_atmos_driver::atmos_driver_resume1().

463  implicit none
464 
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)
471 
472 
473  call atmos_boundary_firstsend( &
474  dens, momz, momx, momy, rhot, qtrc )
475 
476  if ( l_bnd ) then
477 
478  ! initialize boundary value (reading file or waiting parent domain)
479  if ( do_daughter_process ) then
480  call atmos_boundary_resume_online
481  else
482  if ( atmos_boundary_in_basename /= '' ) then
483  call atmos_boundary_resume_file
484  endif
485  endif
486 
487  elseif ( atmos_boundary_type == 'INIT' ) then
488 
489  call atmos_boundary_setinitval( dens, & ! [IN]
490  momz, & ! [IN]
491  momx, & ! [IN]
492  momy, & ! [IN]
493  rhot, & ! [IN]
494  qtrc ) ! [IN]
495  endif
496 
497  if( atmos_boundary_out_basename /= '' ) then
498  call atmos_boundary_write
499  endif
500 
501  if ( atmos_boundary_update_flag ) then
502 
503  call history_bnd( &
510  end if
511 
512  return
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velx
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velz
real(rp), dimension(:,:,:,:), allocatable, public atmos_boundary_qtrc
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_vely
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_dens
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_pott
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_boundary_resume_file()

subroutine scale_atmos_boundary::atmos_boundary_resume_file ( )

Resume boundary value for real case experiment.

Definition at line 1259 of file scale_atmos_sub_boundary.F90.

References atmos_boundary_dens, atmos_boundary_pott, atmos_boundary_qtrc, atmos_boundary_velx, atmos_boundary_vely, atmos_boundary_velz, bnd_qa, scale_calendar::calendar_combine_daysec(), scale_calendar::calendar_date2daysec(), scale_grid_index::ia, scale_stdio::io_fid_log, scale_stdio::io_l, scale_grid_index::ja, scale_grid_index::ka, scale_grid_nest::nest_bnd_qa, scale_grid_nest::nest_comm_recvwait_issue(), scale_grid_nest::online_use_velz, scale_grid_nest::parent_dtsec, scale_process::prc_mpistop(), scale_time::time_dtsec, and scale_time::time_nowdate.

Referenced by atmos_boundary_resume().

1259  use gtool_file, only: &
1260  fileread
1261  use scale_process, only: &
1262  prc_mpistop
1263  use scale_time, only: &
1264  time_nowdate, &
1265  time_dtsec
1266  use scale_calendar, only: &
1269  implicit none
1270 
1271  real(RP) :: inc_dens(ka,ia,ja) ! damping coefficient for DENS [0-1]
1272  real(RP) :: inc_velz(ka,ia,ja) ! damping coefficient for VELZ [0-1]
1273  real(RP) :: inc_velx(ka,ia,ja) ! damping coefficient for VELX [0-1]
1274  real(RP) :: inc_vely(ka,ia,ja) ! damping coefficient for VELY [0-1]
1275  real(RP) :: inc_pott(ka,ia,ja) ! damping coefficient for POTT [0-1]
1276  real(RP) :: inc_qtrc(ka,ia,ja,bnd_qa) ! damping coefficient for QTRC [0-1]
1277 
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
1284 
1285  real(DP) :: boundary_diff_daysec
1286  real(RP) :: boundary_inc_offset
1287  integer :: fillgaps_steps
1288 
1289  character(len=H_LONG) :: bname
1290 
1291  integer :: i, j, k, iq, n
1292  !---------------------------------------------------------------------------
1293 
1294  bname = atmos_boundary_in_basename
1295 
1296  !--- recalculate time of the run [no offset]
1297  run_time_startdate(:) = time_nowdate(:)
1298  run_time_startms = 0.0_dp
1299  run_time_offset_year = 0
1300 
1301  call calendar_date2daysec( run_time_startday, & ! [OUT]
1302  run_time_startsec, & ! [OUT]
1303  run_time_startdate(:), & ! [IN]
1304  run_time_startms, & ! [IN]
1305  run_time_offset_year ) ! [IN]
1306 
1307  run_time_nowdaysec = calendar_combine_daysec( run_time_startday, run_time_startsec )
1308 
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 )
1313 
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
1317 
1318  ! read boundary data from input file
1319  call atmos_boundary_update_file( ref_now )
1320 
1321  boundary_timestep = boundary_timestep + 1
1322  call atmos_boundary_update_file( ref_new )
1323 
1324  ! copy now to old
1325  do j = 1, ja
1326  do i = 1, ia
1327  do k = 1, ka
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)
1332  do iq = 1, bnd_qa
1333  atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now)
1334  end do
1335  end do
1336  end do
1337  end do
1338 
1339  ! set boundary data
1340  do j = 1, ja
1341  do i = 1, ia
1342  do k = 1, ka
1343  atmos_boundary_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_now)
1344  atmos_boundary_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_now)
1345  atmos_boundary_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_now)
1346  atmos_boundary_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_now)
1347  do iq = 1, bnd_qa
1348  atmos_boundary_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now)
1349  end do
1350  end do
1351  end do
1352  end do
1353 
1354  if ( atmos_boundary_use_velz ) then
1355  do j = 1, ja
1356  do i = 1, ia
1357  do k = 1, ka
1358  atmos_boundary_velz(k,i,j) = atmos_boundary_value_velz
1359  end do
1360  end do
1361  end do
1362  end if
1363 
1364  now_step = fillgaps_steps
1365 
1366  ! get time increment
1367  call get_increment( inc_dens(:,:,:), & ! [OUT]
1368  inc_velz(:,:,:), & ! [OUT]
1369  inc_velx(:,:,:), & ! [OUT]
1370  inc_vely(:,:,:), & ! [OUT]
1371  inc_pott(:,:,:), & ! [OUT]
1372  inc_qtrc(:,:,:,:) ) ! [OUT]
1373 
1374  ! fill in gaps of the offset
1375  do j = 1, ja
1376  do i = 1, ia
1377  do k = 1, ka
1378  do n = 1, fillgaps_steps
1379  atmos_boundary_dens(k,i,j) = atmos_boundary_dens(k,i,j) + inc_dens(k,i,j)
1380  atmos_boundary_velx(k,i,j) = atmos_boundary_velx(k,i,j) + inc_velx(k,i,j)
1381  atmos_boundary_vely(k,i,j) = atmos_boundary_vely(k,i,j) + inc_vely(k,i,j)
1382  atmos_boundary_pott(k,i,j) = atmos_boundary_pott(k,i,j) + inc_pott(k,i,j)
1383  do iq = 1, bnd_qa
1384  atmos_boundary_qtrc(k,i,j,iq) = atmos_boundary_qtrc(k,i,j,iq) + inc_qtrc(k,i,j,iq)
1385  end do
1386  end do
1387  end do
1388  end do
1389  end do
1390 
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'
1393  call prc_mpistop
1394  endif
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'
1398  call prc_mpistop
1399  end if
1400 
1401  return
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velx
module GTOOL_FILE
Definition: gtool_file.f90:17
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velz
subroutine, public prc_mpistop
Abort MPI.
real(dp) function, public calendar_combine_daysec(absday, abssec)
Combine day and second.
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:59
real(rp), dimension(:,:,:,:), allocatable, public atmos_boundary_qtrc
real(dp), public time_dtsec
time interval of model [sec]
Definition: scale_time.F90:36
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_vely
module TIME
Definition: scale_time.F90:15
module PROCESS
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_dens
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_pott
module CALENDAR
integer, dimension(6), public time_nowdate
current time [YYYY MM DD HH MM SS]
Definition: scale_time.F90:65
integer, public io_fid_log
Log file ID.
Definition: scale_stdio.F90:56
subroutine, public calendar_date2daysec(absday, abssec, ymdhms, subsec, offset_year)
Convert from gregorian date to absolute day/second.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_boundary_resume_online()

subroutine scale_atmos_boundary::atmos_boundary_resume_online ( )

Resume boundary value for real case experiment [online daughter].

Definition at line 1436 of file scale_atmos_sub_boundary.F90.

References atmos_boundary_dens, atmos_boundary_pott, atmos_boundary_qtrc, atmos_boundary_velx, atmos_boundary_vely, atmos_boundary_velz, bnd_qa, scale_grid_index::ia, scale_stdio::io_fid_log, scale_stdio::io_l, scale_grid_index::ja, scale_grid_index::ka, scale_grid_nest::nest_comm_recvwait_issue(), scale_grid_nest::online_use_velz, scale_grid_nest::parent_nstep, scale_process::prc_mpistop(), scale_time::time_dtsec, and scale_time::time_nstep.

Referenced by atmos_boundary_resume().

1436  use scale_process, only: &
1437  prc_mpistop
1438  use scale_time, only: &
1439  time_dtsec, &
1440  time_nstep
1441  use scale_grid_nest, only: &
1443  online_use_velz, &
1444  parent_nstep
1445  implicit none
1446 
1447  ! parameters
1448  integer, parameter :: handle = 2
1449 
1450  ! works
1451  integer :: i, j, k, iq
1452  !---------------------------------------------------------------------------
1453 
1454  ! import data from parent domain
1455  boundary_timestep = 1
1456  if( io_l ) write(io_fid_log,*) '+++ BOUNDARY TIMESTEP NUMBER FOR INIT:', boundary_timestep
1457 
1458  call atmos_boundary_update_online_daughter( ref_now )
1459 
1460  boundary_timestep = boundary_timestep + 1
1461  if( io_l ) write(io_fid_log,*) '+++ BOUNDARY TIMESTEP NUMBER FOR INIT:', boundary_timestep
1462 
1463  call atmos_boundary_update_online_daughter( ref_new )
1464 
1465  ! copy now to old
1466  do j = 1, ja
1467  do i = 1, ia
1468  do k = 1, ka
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)
1473  do iq = 1, bnd_qa
1474  atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now)
1475  end do
1476  end do
1477  end do
1478  end do
1479 
1480  ! set boundary data
1481  do j = 1, ja
1482  do i = 1, ia
1483  do k = 1, ka
1484  atmos_boundary_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_now)
1485  atmos_boundary_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_now)
1486  atmos_boundary_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_now)
1487  atmos_boundary_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_now)
1488  do iq = 1, bnd_qa
1489  atmos_boundary_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now)
1490  end do
1491  end do
1492  end do
1493  end do
1494 
1495  if ( online_use_velz ) then
1496  do j = 1, ja
1497  do i = 1, ia
1498  do k = 1, ka
1499  atmos_boundary_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_now)
1500  end do
1501  end do
1502  end do
1503  else if ( atmos_boundary_use_velz ) then
1504  do j = 1, ja
1505  do i = 1, ia
1506  do k = 1, ka
1507  atmos_boundary_velz(k,i,j) = atmos_boundary_value_velz
1508  end do
1509  end do
1510  end do
1511  end if
1512 
1513  update_nstep = nint( atmos_boundary_update_dt / time_dtsec )
1514  if ( update_nstep * parent_nstep(handle) /= time_nstep ) then
1515  write(*,*) 'xxx NSTEP is not multiple of PARENT_NSTEP'
1516  call prc_mpistop
1517  end if
1518 
1519  now_step = 0 ! should be set as zero in initialize process
1520 
1521  return
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velx
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velz
subroutine, public prc_mpistop
Abort MPI.
module GRID (nesting system)
integer, public time_nstep
total steps [number]
Definition: scale_time.F90:71
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:59
integer, dimension(2), public parent_nstep
parent step [number]
real(rp), dimension(:,:,:,:), allocatable, public atmos_boundary_qtrc
real(dp), public time_dtsec
time interval of model [sec]
Definition: scale_time.F90:36
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_vely
module TIME
Definition: scale_time.F90:15
module PROCESS
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_dens
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_pott
logical, public online_use_velz
integer, public io_fid_log
Log file ID.
Definition: scale_stdio.F90:56
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_boundary_firstsend()

subroutine, public scale_atmos_boundary::atmos_boundary_firstsend ( real(rp), dimension(ka,ia,ja), intent(in)  DENS,
real(rp), dimension(ka,ia,ja), intent(in)  MOMZ,
real(rp), dimension(ka,ia,ja), intent(in)  MOMX,
real(rp), dimension(ka,ia,ja), intent(in)  MOMY,
real(rp), dimension(ka,ia,ja), intent(in)  RHOT,
real(rp), dimension(ka,ia,ja,qa), intent(in)  QTRC 
)

First send boundary value.

Definition at line 1528 of file scale_atmos_sub_boundary.F90.

Referenced by atmos_boundary_resume().

1528  implicit none
1529 
1530  ! arguments
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)
1537  !---------------------------------------------------------------------------
1538 
1539  ! send data at the first time
1540  if ( do_parent_process ) then !online [parent]
1541  ! issue send
1542  call atmos_boundary_send( dens, momz, momx, momy, rhot, qtrc )
1543  endif
1544 
1545  return
Here is the caller graph for this function:

◆ atmos_boundary_finalize()

subroutine, public scale_atmos_boundary::atmos_boundary_finalize ( )

Finalize boundary value.

Definition at line 1551 of file scale_atmos_sub_boundary.F90.

References scale_grid_nest::nest_bnd_qa, scale_grid_nest::nest_comm_recv_cancel(), and scale_grid_nest::nest_comm_recvwait_issue().

Referenced by mod_atmos_driver::atmos_driver_finalize().

1551  use scale_grid_nest, only: &
1554  nestqa => nest_bnd_qa
1555  implicit none
1556 
1557  ! works
1558  integer :: handle
1559  !---------------------------------------------------------------------------
1560 
1561  if ( do_parent_process ) then !online [parent]
1562  handle = 1
1563  call nest_comm_recvwait_issue( handle, nestqa )
1564  endif
1565 
1566  if ( do_daughter_process ) then !online [daughter]
1567  handle = 2
1568  call nest_comm_recv_cancel( handle )
1569  endif
1570 
1571  return
module GRID (nesting system)
integer, public nest_bnd_qa
number of tracer treated in nesting system
subroutine, public nest_comm_recv_cancel(HANDLE)
Sub-command for data transfer from parent to daughter: nestdown.
subroutine, public nest_comm_recvwait_issue(HANDLE, BND_QA)
Sub-command for data transfer from parent to daughter: nestdown.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_boundary_update()

subroutine, public scale_atmos_boundary::atmos_boundary_update ( real(rp), dimension(ka,ia,ja), intent(inout)  DENS,
real(rp), dimension(ka,ia,ja), intent(inout)  MOMZ,
real(rp), dimension(ka,ia,ja), intent(inout)  MOMX,
real(rp), dimension(ka,ia,ja), intent(inout)  MOMY,
real(rp), dimension(ka,ia,ja), intent(inout)  RHOT,
real(rp), dimension(ka,ia,ja,qa), intent(inout)  QTRC 
)

Update boundary value with a constant time increment.

Definition at line 1578 of file scale_atmos_sub_boundary.F90.

References scale_tracer::aq_name, atmos_boundary_dens, atmos_boundary_pott, atmos_boundary_qtrc, atmos_boundary_velx, atmos_boundary_vely, atmos_boundary_velz, bnd_qa, scale_grid_nest::daughter_ia, scale_grid_nest::daughter_ja, scale_grid_nest::daughter_ka, scale_grid_index::ia, scale_grid_index::ie, scale_grid_index::ieb, scale_stdio::io_fid_log, scale_stdio::io_l, scale_grid_index::is, scale_grid_index::isb, scale_grid_index::ja, scale_grid_index::je, scale_grid_index::jeb, scale_grid_index::js, scale_grid_index::jsb, scale_grid_index::ka, scale_grid_index::ke, scale_grid_index::ks, scale_grid_nest::nest_bnd_qa, scale_grid_nest::nest_comm_nestdown(), scale_grid_nest::nest_comm_recvwait_issue(), scale_grid_nest::nest_comm_test(), scale_grid_nest::online_use_velz, scale_grid_nest::parent_ia, scale_grid_nest::parent_ja, scale_grid_nest::parent_ka, scale_rm_process::prc_has_e, scale_rm_process::prc_has_n, scale_rm_process::prc_has_s, scale_rm_process::prc_has_w, scale_process::prc_mpistop(), scale_process::prc_myrank, scale_tracer::qa, scale_time::time_dtsec, and update_ref_index().

Referenced by mod_atmos_driver::atmos_driver().

1578  use scale_process, only: &
1579  prc_mpistop
1580  use scale_rm_process, only: &
1581  prc_has_w, &
1582  prc_has_e, &
1583  prc_has_s, &
1584  prc_has_n
1585  use scale_grid_nest, only: &
1586  online_use_velz, &
1588  implicit none
1589 
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)
1596 
1597  real(RP) :: inc_dens(ka,ia,ja) ! damping coefficient for DENS [0-1]
1598  real(RP) :: inc_velz(ka,ia,ja) ! damping coefficient for VELZ [0-1]
1599  real(RP) :: inc_velx(ka,ia,ja) ! damping coefficient for VELX [0-1]
1600  real(RP) :: inc_vely(ka,ia,ja) ! damping coefficient for VELY [0-1]
1601  real(RP) :: inc_pott(ka,ia,ja) ! damping coefficient for POTT [0-1]
1602  real(RP) :: inc_qtrc(ka,ia,ja,bnd_qa) ! damping coefficient for QTRC [0-1]
1603 
1604  integer :: handle
1605  integer :: i, j, k, iq
1606  !---------------------------------------------------------------------------
1607 
1608  if ( do_parent_process ) then !online [parent]
1609  ! should be called every time step
1610  call atmos_boundary_update_online_parent( dens,momz,momx,momy,rhot,qtrc )
1611  endif
1612 
1613  if ( l_bnd ) then
1614  ! update referce vars
1615  if ( now_step >= update_nstep ) then
1616  now_step = 0
1617  boundary_timestep = boundary_timestep + 1
1618 
1619  call update_ref_index
1620 
1621  if ( do_daughter_process ) then !online [daughter]
1622  call atmos_boundary_update_online_daughter( ref_new )
1623  else
1624  call atmos_boundary_update_file( ref_new )
1625  end if
1626  end if
1627 
1628  ! step increment
1629  now_step = now_step + 1
1630 
1631  ! get incremental coefficients
1632  call get_increment( inc_dens(:,:,:), & ! [OUT]
1633  inc_velz(:,:,:), & ! [OUT]
1634  inc_velx(:,:,:), & ! [OUT]
1635  inc_vely(:,:,:), & ! [OUT]
1636  inc_pott(:,:,:), & ! [OUT]
1637  inc_qtrc(:,:,:,:) ) ! [OUT]
1638 
1639  ! update boundary vars
1640  do j = 1, ja
1641  do i = 1, ia
1642  do k = 1, ka
1643  atmos_boundary_dens(k,i,j) = atmos_boundary_dens(k,i,j) + inc_dens(k,i,j)
1644  atmos_boundary_velx(k,i,j) = atmos_boundary_velx(k,i,j) + inc_velx(k,i,j)
1645  atmos_boundary_vely(k,i,j) = atmos_boundary_vely(k,i,j) + inc_vely(k,i,j)
1646  atmos_boundary_pott(k,i,j) = atmos_boundary_pott(k,i,j) + inc_pott(k,i,j)
1647  do iq = 1, bnd_qa
1648  atmos_boundary_qtrc(k,i,j,iq) = atmos_boundary_qtrc(k,i,j,iq) + inc_qtrc(k,i,j,iq)
1649  end do
1650  end do
1651  end do
1652  end do
1653  if ( online_use_velz ) then
1654  do j = 1, ja
1655  do i = 1, ia
1656  do k = 1, ka
1657  atmos_boundary_velz(k,i,j) = atmos_boundary_velz(k,i,j) + inc_velz(k,i,j)
1658  end do
1659  end do
1660  end do
1661  end if
1662 
1663  ! fill HALO in western region
1664  if ( .NOT. prc_has_w ) then
1665  do j = 1, ja
1666  do i = 1, is-1
1667  do k = 1, ka
1668  dens(k,i,j) = atmos_boundary_dens(k,i,j)
1669  momx(k,i,j) = atmos_boundary_velx(k,i,j) &
1670  * ( atmos_boundary_dens(k,i,j) + atmos_boundary_dens(k,i+1,j) ) * 0.5_rp
1671  rhot(k,i,j) = atmos_boundary_pott(k,i,j) * atmos_boundary_dens(k,i,j)
1672  do iq = 1, bnd_qa
1673  qtrc(k,i,j,iq) = atmos_boundary_qtrc(k,i,j,iq)
1674  end do
1675  do iq = bnd_qa+1, qa
1676  qtrc(k,i,j,iq) = qtrc(k,is,j,iq) &
1677  * ( 0.5_rp - sign(0.5_rp, atmos_boundary_velx(k,is-1,j)) )
1678  end do
1679  end do
1680  end do
1681  end do
1682  do j = 1, ja-1
1683  do i = 1, is-1
1684  do k = 1, ka
1685  momy(k,i,j) = atmos_boundary_vely(k,i,j) &
1686  * ( atmos_boundary_dens(k,i,j) + atmos_boundary_dens(k,i,j+1) ) * 0.5_rp
1687  end do
1688  end do
1689  end do
1690  do i = 1, is-1
1691  do k = 1, ka
1692  momy(k,i,ja) = atmos_boundary_vely(k,i,ja) &
1693  * atmos_boundary_dens(k,i,ja)
1694  end do
1695  end do
1696  if ( online_use_velz ) then
1697  do j = 1, ja
1698  do i = 1, is-1
1699  do k = ks, ke-1
1700  momz(k,i,j) = atmos_boundary_velz(k,i,j) &
1701  * ( atmos_boundary_dens(k,i,j) + atmos_boundary_dens(k+1,i,j) ) * 0.5_rp
1702  end do
1703  end do
1704  end do
1705  else
1706  do j = 1, ja
1707  do i = 1, is-1
1708  do k = ks, ke-1
1709  momz(k,i,j) = momz(k,is,j)
1710  end do
1711  end do
1712  end do
1713  end if
1714  end if
1715 
1716  ! fill HALO in eastern region
1717  if ( .NOT. prc_has_e ) then
1718  do j = 1, ja
1719  do i = ie+1, ia
1720  do k = 1, ka
1721  dens(k,i,j) = atmos_boundary_dens(k,i,j)
1722  rhot(k,i,j) = atmos_boundary_pott(k,i,j) * atmos_boundary_dens(k,i,j)
1723  do iq = 1, bnd_qa
1724  qtrc(k,i,j,iq) = atmos_boundary_qtrc(k,i,j,iq)
1725  end do
1726  do iq = bnd_qa+1, qa
1727  qtrc(k,i,j,iq) = qtrc(k,ie,j,iq) &
1728  * ( 0.5_rp + sign(0.5_rp, atmos_boundary_velx(k,ie,j)) )
1729  end do
1730  end do
1731  end do
1732  end do
1733  do j = 1, ja
1734  do i = ie, ia-1
1735  do k = 1, ka
1736  momx(k,i,j) = atmos_boundary_velx(k,i,j) &
1737  * ( atmos_boundary_dens(k,i,j) + atmos_boundary_dens(k,i+1,j) ) * 0.5_rp
1738  end do
1739  end do
1740  end do
1741  do j = 1, ja
1742  do k = 1, ka
1743  momx(k,ia,j) = atmos_boundary_velx(k,ia,j) * atmos_boundary_dens(k,ia,j)
1744  end do
1745  end do
1746  do j = 1, ja-1
1747  do i = ie+1, ia
1748  do k = 1, ka
1749  momy(k,i,j) = atmos_boundary_vely(k,i,j) &
1750  * ( atmos_boundary_dens(k,i,j) + atmos_boundary_dens(k,i,j+1) ) * 0.5_rp
1751  end do
1752  end do
1753  end do
1754  do i = ie+1, ia
1755  do k = 1, ka
1756  momy(k,i,ja) = atmos_boundary_vely(k,i,ja) &
1757  * atmos_boundary_dens(k,i,ja)
1758  end do
1759  end do
1760  if ( online_use_velz ) then
1761  do j = 1, ja
1762  do i = ie+1, ia
1763  do k = ks, ke-1
1764  momz(k,i,j) = atmos_boundary_velz(k,i,j) &
1765  * ( atmos_boundary_dens(k,i,j) + atmos_boundary_dens(k+1,i,j) ) * 0.5_rp
1766  end do
1767  end do
1768  end do
1769  else
1770  do j = 1, ja
1771  do i = ie+1, ia
1772  do k = ks, ke-1
1773  momz(k,i,j) = momz(k,ie,j)
1774  end do
1775  end do
1776  end do
1777  end if
1778  end if
1779 
1780  ! fill HALO in southern region
1781  if ( .NOT. prc_has_s ) then
1782  do j = 1, js-1
1783  do i = 1, ia
1784  do k = 1, ka
1785  dens(k,i,j) = atmos_boundary_dens(k,i,j)
1786  momy(k,i,j) = atmos_boundary_vely(k,i,j) &
1787  * ( atmos_boundary_dens(k,i,j) + atmos_boundary_dens(k,i,j+1) ) * 0.5_rp
1788  rhot(k,i,j) = atmos_boundary_pott(k,i,j) * atmos_boundary_dens(k,i,j)
1789  do iq = 1, bnd_qa
1790  qtrc(k,i,j,iq) = atmos_boundary_qtrc(k,i,j,iq)
1791  end do
1792  do iq = bnd_qa+1, qa
1793  qtrc(k,i,j,iq) = qtrc(k,i,js,iq) &
1794  * ( 0.5_rp - sign(0.5_rp, atmos_boundary_vely(k,i,js-1)) )
1795  end do
1796  end do
1797  end do
1798  end do
1799  do j = 1, js-1
1800  do i = 1, ia-1
1801  do k = 1, ka
1802  momx(k,i,j) = atmos_boundary_velx(k,i,j) &
1803  * ( atmos_boundary_dens(k,i,j) + atmos_boundary_dens(k,i+1,j) ) * 0.5_rp
1804  end do
1805  end do
1806  end do
1807  do j = 1, js-1
1808  do k = 1, ka
1809  momx(k,ia,j) = atmos_boundary_velx(k,ia,j) &
1810  * atmos_boundary_dens(k,ia,j)
1811  end do
1812  end do
1813  if ( online_use_velz ) then
1814  do j = 1, js-1
1815  do i = 1, ia
1816  do k = ks, ke-1
1817  momz(k,i,j) = atmos_boundary_velz(k,i,j) &
1818  * ( atmos_boundary_dens(k,i,j) + atmos_boundary_dens(k+1,i,j) ) * 0.5_rp
1819  end do
1820  end do
1821  end do
1822  else
1823  do j = 1, js-1
1824  do i = 1, ia
1825  do k = ks, ke-1
1826  momz(k,i,j) = momz(k,i,js)
1827  end do
1828  end do
1829  end do
1830  end if
1831  end if
1832 
1833  ! fill HALO in northern region
1834  if ( .NOT. prc_has_n ) then
1835  do j = je+1, ja
1836  do i = 1, ia
1837  do k = 1, ka
1838  dens(k,i,j) = atmos_boundary_dens(k,i,j)
1839  rhot(k,i,j) = atmos_boundary_pott(k,i,j) * atmos_boundary_dens(k,i,j)
1840  do iq = 1, bnd_qa
1841  qtrc(k,i,j,iq) = atmos_boundary_qtrc(k,i,j,iq)
1842  end do
1843  do iq = bnd_qa+1, qa
1844  qtrc(k,i,j,iq) = qtrc(k,i,je,iq) &
1845  * ( 0.5_rp + sign(0.5_rp, atmos_boundary_vely(k,i,je)) )
1846  end do
1847  end do
1848  end do
1849  end do
1850  do j = je, ja-1
1851  do i = 1, ia
1852  do k = 1, ka
1853  momy(k,i,j) = atmos_boundary_vely(k,i,j) &
1854  * ( atmos_boundary_dens(k,i,j) + atmos_boundary_dens(k,i,j+1) ) * 0.5_rp
1855  end do
1856  end do
1857  end do
1858  do i = 1, ia
1859  do k = 1, ka
1860  momy(k,i,ja) = atmos_boundary_vely(k,i,ja) * atmos_boundary_dens(k,i,ja)
1861  end do
1862  end do
1863  do j = je+1, ja
1864  do i = 1, ia-1
1865  do k = 1, ka
1866  momx(k,i,j) = atmos_boundary_velx(k,i,j) &
1867  * ( atmos_boundary_dens(k,i,j) + atmos_boundary_dens(k,i+1,j) ) * 0.5_rp
1868  end do
1869  end do
1870  end do
1871  do j = je+1, ja
1872  do k = 1, ka
1873  momx(k,ia,j) = atmos_boundary_velx(k,ia,j) &
1874  * atmos_boundary_dens(k,ia,j)
1875  end do
1876  end do
1877  if ( online_use_velz ) then
1878  do j = je+1, ja
1879  do i = 1, ia
1880  do k = ks, ke-1
1881  momz(k,i,j) = atmos_boundary_velz(k,i,j) &
1882  * ( atmos_boundary_dens(k,i,j) + atmos_boundary_dens(k+1,i,j) ) * 0.5_rp
1883  end do
1884  end do
1885  end do
1886  else
1887  do j = je+1, ja
1888  do i = 1, ia
1889  do k = ks, ke-1
1890  momz(k,i,j) = momz(k,i,je)
1891  end do
1892  end do
1893  end do
1894  end if
1895  end if
1896 
1897  elseif ( do_parent_process ) then
1898  ! do nothing
1899  else
1900  write(*,*) 'xxx [BUG] invalid path'
1901  call prc_mpistop
1902  end if
1903 
1904  call history_bnd( atmos_boundary_dens, &
1910 
1911  ! To be enable to do asynchronous communicaton
1912  if ( do_parent_process ) then !online [parent]
1913  handle = 1
1914  call nest_comm_test( handle )
1915  endif
1916  if ( do_daughter_process ) then !online [daughter]
1917  handle = 2
1918  call nest_comm_test( handle )
1919  endif
1920 
1921  return
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velx
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_velz
logical, public prc_has_n
subroutine, public prc_mpistop
Abort MPI.
module GRID (nesting system)
logical, public prc_has_e
logical, public prc_has_s
real(rp), dimension(:,:,:,:), allocatable, public atmos_boundary_qtrc
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_vely
module PROCESS
module RM PROCESS
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_dens
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_pott
logical, public online_use_velz
logical, public prc_has_w
subroutine, public nest_comm_test(HANDLE)
[check communication status] Inter-communication
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_ref_index()

subroutine scale_atmos_boundary::update_ref_index ( )

Update indices of array of boundary references.

Definition at line 2419 of file scale_atmos_sub_boundary.F90.

References scale_tracer::aq_name, and bnd_qa.

Referenced by atmos_boundary_update().

2419  implicit none
2420 
2421  ! works
2422  integer :: ref_tmp
2423  !---------------------------------------------------------------------------
2424 
2425  ref_tmp = ref_old
2426  ref_old = ref_now
2427  ref_now = ref_new
2428  ref_new = ref_tmp
2429 
2430  return
Here is the caller graph for this function:

Variable Documentation

◆ bnd_qa

integer, public scale_atmos_boundary::bnd_qa

◆ of

integer, public scale_atmos_boundary::of

Definition at line 51 of file scale_atmos_sub_boundary.F90.

◆ tracer

integer, public scale_atmos_boundary::tracer

Definition at line 51 of file scale_atmos_sub_boundary.F90.

◆ at

integer, public scale_atmos_boundary::at

Definition at line 51 of file scale_atmos_sub_boundary.F90.

◆ boundary

integer, public scale_atmos_boundary::boundary

Definition at line 51 of file scale_atmos_sub_boundary.F90.

◆ atmos_boundary_dens

real(rp), dimension(:,:,:), allocatable, public scale_atmos_boundary::atmos_boundary_dens

◆ reference

real(rp), allocatable, public scale_atmos_boundary::reference

Definition at line 53 of file scale_atmos_sub_boundary.F90.

◆ dens

real(rp), dimension (with halo), allocatable, public scale_atmos_boundary::dens

Definition at line 53 of file scale_atmos_sub_boundary.F90.

◆ atmos_boundary_velz

real(rp), dimension(:,:,:), allocatable, public scale_atmos_boundary::atmos_boundary_velz

◆ velz

real(rp), dimension (with halo), allocatable, public scale_atmos_boundary::velz

Definition at line 54 of file scale_atmos_sub_boundary.F90.

◆ atmos_boundary_velx

real(rp), dimension(:,:,:), allocatable, public scale_atmos_boundary::atmos_boundary_velx

◆ velx

real(rp), dimension (with halo), allocatable, public scale_atmos_boundary::velx

Definition at line 55 of file scale_atmos_sub_boundary.F90.

◆ atmos_boundary_vely

real(rp), dimension(:,:,:), allocatable, public scale_atmos_boundary::atmos_boundary_vely

◆ vely

real(rp), dimension (with halo), allocatable, public scale_atmos_boundary::vely

Definition at line 56 of file scale_atmos_sub_boundary.F90.

◆ atmos_boundary_pott

real(rp), dimension(:,:,:), allocatable, public scale_atmos_boundary::atmos_boundary_pott

◆ pott

real(rp), dimension (with halo), allocatable, public scale_atmos_boundary::pott

Definition at line 57 of file scale_atmos_sub_boundary.F90.

◆ atmos_boundary_qtrc

real(rp), dimension(:,:,:,:), allocatable, public scale_atmos_boundary::atmos_boundary_qtrc

◆ qtrc

real(rp), dimension (with halo), allocatable, public scale_atmos_boundary::qtrc

Definition at line 58 of file scale_atmos_sub_boundary.F90.

◆ atmos_boundary_alpha_dens

real(rp), dimension(:,:,:), allocatable, public scale_atmos_boundary::atmos_boundary_alpha_dens

Definition at line 60 of file scale_atmos_sub_boundary.F90.

Referenced by atmos_boundary_resume(), atmos_boundary_setup(), and mod_atmos_dyn_driver::atmos_dyn_driver().

60  real(RP), public, allocatable :: atmos_boundary_alpha_dens(:,:,:)
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_dens

◆ damping

real(rp), allocatable, public scale_atmos_boundary::damping

Definition at line 60 of file scale_atmos_sub_boundary.F90.

◆ coefficient

real(rp), allocatable, public scale_atmos_boundary::coefficient

Definition at line 60 of file scale_atmos_sub_boundary.F90.

◆ for

logical allocatable public scale_atmos_boundary::for

Definition at line 60 of file scale_atmos_sub_boundary.F90.

◆ atmos_boundary_alpha_velz

real(rp), dimension(:,:,:), allocatable, public scale_atmos_boundary::atmos_boundary_alpha_velz

Definition at line 61 of file scale_atmos_sub_boundary.F90.

Referenced by atmos_boundary_resume(), atmos_boundary_setup(), and mod_atmos_dyn_driver::atmos_dyn_driver().

61  real(RP), public, allocatable :: atmos_boundary_alpha_velz(:,:,:)
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_velz

◆ atmos_boundary_alpha_velx

real(rp), dimension(:,:,:), allocatable, public scale_atmos_boundary::atmos_boundary_alpha_velx

Definition at line 62 of file scale_atmos_sub_boundary.F90.

Referenced by atmos_boundary_resume(), atmos_boundary_setup(), and mod_atmos_dyn_driver::atmos_dyn_driver().

62  real(RP), public, allocatable :: atmos_boundary_alpha_velx(:,:,:)
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_velx

◆ atmos_boundary_alpha_vely

real(rp), dimension(:,:,:), allocatable, public scale_atmos_boundary::atmos_boundary_alpha_vely

Definition at line 63 of file scale_atmos_sub_boundary.F90.

Referenced by atmos_boundary_resume(), atmos_boundary_setup(), and mod_atmos_dyn_driver::atmos_dyn_driver().

63  real(RP), public, allocatable :: atmos_boundary_alpha_vely(:,:,:)
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_vely

◆ atmos_boundary_alpha_pott

real(rp), dimension(:,:,:), allocatable, public scale_atmos_boundary::atmos_boundary_alpha_pott

Definition at line 64 of file scale_atmos_sub_boundary.F90.

Referenced by atmos_boundary_resume(), atmos_boundary_setup(), and mod_atmos_dyn_driver::atmos_dyn_driver().

64  real(RP), public, allocatable :: atmos_boundary_alpha_pott(:,:,:)
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_alpha_pott

◆ atmos_boundary_alpha_qtrc

real(rp), dimension(:,:,:,:), allocatable, public scale_atmos_boundary::atmos_boundary_alpha_qtrc

Definition at line 65 of file scale_atmos_sub_boundary.F90.

Referenced by atmos_boundary_resume(), atmos_boundary_setup(), and mod_atmos_dyn_driver::atmos_dyn_driver().

65  real(RP), public, allocatable :: atmos_boundary_alpha_qtrc(:,:,:,:)
real(rp), dimension(:,:,:,:), allocatable, public atmos_boundary_alpha_qtrc

◆ atmos_boundary_smoother_fact

real(rp), public scale_atmos_boundary::atmos_boundary_smoother_fact = 0.2_RP

◆ atmos_boundary_update_flag

logical, public scale_atmos_boundary::atmos_boundary_update_flag = .false.

Definition at line 70 of file scale_atmos_sub_boundary.F90.

Referenced by atmos_boundary_resume(), atmos_boundary_setup(), mod_atmos_driver::atmos_driver(), and mod_atmos_driver::atmos_driver_finalize().

70  logical, public :: atmos_boundary_update_flag = .false.

◆ switch

logical, public scale_atmos_boundary::switch

Definition at line 70 of file scale_atmos_sub_boundary.F90.

◆ real

scale_atmos_boundary::real

Definition at line 70 of file scale_atmos_sub_boundary.F90.

◆ case

logical, public scale_atmos_boundary::case

Definition at line 70 of file scale_atmos_sub_boundary.F90.