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 boundary. 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_INTERP_TYPE character(len=H_LONG) 'lerp_initpoint' type of boundary interporation

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 199 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().

199  use scale_process, only: &
201  use scale_comm, only: &
203  use scale_const, only: &
205  use scale_time, only: &
206  dt => time_dtsec
207  use scale_grid_nest, only: &
208  use_nesting, &
209  offline, &
212  implicit none
213 
214  namelist / param_atmos_boundary / &
215  atmos_boundary_type, &
216  atmos_boundary_in_basename, &
217  atmos_boundary_out_basename, &
218  atmos_boundary_out_title, &
219  atmos_boundary_use_velz, &
220  atmos_boundary_use_velx, &
221  atmos_boundary_use_vely, &
222  atmos_boundary_use_pott, &
223  atmos_boundary_use_dens, &
224  atmos_boundary_use_qv, &
225  atmos_boundary_use_qhyd, &
226  atmos_boundary_value_velz, &
227  atmos_boundary_value_velx, &
228  atmos_boundary_value_vely, &
229  atmos_boundary_value_pott, &
230  atmos_boundary_value_qtrc, &
231  atmos_boundary_alphafact_dens, &
232  atmos_boundary_alphafact_velz, &
233  atmos_boundary_alphafact_velx, &
234  atmos_boundary_alphafact_vely, &
235  atmos_boundary_alphafact_pott, &
236  atmos_boundary_alphafact_qtrc, &
237  atmos_boundary_smoother_fact, &
238  atmos_boundary_fracz, &
239  atmos_boundary_fracx, &
240  atmos_boundary_fracy, &
241  atmos_boundary_tauz, &
242  atmos_boundary_taux, &
243  atmos_boundary_tauy, &
244  atmos_boundary_update_dt, &
245  atmos_boundary_start_date, &
246  atmos_boundary_linear_v, &
247  atmos_boundary_linear_h, &
248  atmos_boundary_exp_h, &
249  atmos_boundary_interp_type
250 
251  integer :: ierr
252  !---------------------------------------------------------------------------
253 
254  if( io_l ) write(io_fid_log,*)
255  if( io_l ) write(io_fid_log,*) '+++ Module[Boundary]/Categ[ATMOS]'
256 
257  atmos_boundary_tauz = dt * 10.0_rp
258  atmos_boundary_taux = dt * 10.0_rp
259  atmos_boundary_tauy = dt * 10.0_rp
260 
261  !--- read namelist
262  rewind(io_fid_conf)
263  read(io_fid_conf,nml=param_atmos_boundary,iostat=ierr)
264  if( ierr < 0 ) then !--- missing
265  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
266  elseif( ierr > 0 ) then !--- fatal error
267  write(*,*) 'xxx Not appropriate names in namelist PARAM_ATMOS_BOUNDARY. Check!'
268  call prc_mpistop
269  endif
270  if( io_lnml ) write(io_fid_log,nml=param_atmos_boundary)
271 
272  ! setting switches
273  if( .NOT. use_nesting ) then
274  atmos_boundary_online = .false.
275  else
276  if( offline ) then
277  atmos_boundary_online = .false.
278  else
279  atmos_boundary_online = .true.
280  endif
281  endif
282  do_parent_process = .false.
283  do_daughter_process = .false.
284  atmos_boundary_online_master = .false.
285  if ( atmos_boundary_online ) then
286  if ( online_iam_parent ) then
287  do_parent_process = .true.
288  if ( .NOT. online_iam_daughter ) then
289  atmos_boundary_online_master = .true.
290  endif
291  endif
292  if ( online_iam_daughter ) then
293  do_daughter_process = .true.
294  endif
295  endif
296 
297  if( atmos_boundary_use_qhyd ) then
298  bnd_qa = qa
299  else
300  bnd_qa = i_qv
301  end if
302 
303  allocate( atmos_boundary_dens(ka,ia,ja) )
304  allocate( atmos_boundary_velz(ka,ia,ja) )
305  allocate( atmos_boundary_velx(ka,ia,ja) )
306  allocate( atmos_boundary_vely(ka,ia,ja) )
307  allocate( atmos_boundary_pott(ka,ia,ja) )
308  allocate( atmos_boundary_qtrc(ka,ia,ja,bnd_qa) )
315 
316  allocate( atmos_boundary_alpha_dens(ka,ia,ja) )
317  allocate( atmos_boundary_alpha_velz(ka,ia,ja) )
318  allocate( atmos_boundary_alpha_velx(ka,ia,ja) )
319  allocate( atmos_boundary_alpha_vely(ka,ia,ja) )
320  allocate( atmos_boundary_alpha_pott(ka,ia,ja) )
321  allocate( atmos_boundary_alpha_qtrc(ka,ia,ja,bnd_qa) )
322  atmos_boundary_alpha_dens(:,:,:) = 0.0_rp
323  atmos_boundary_alpha_velz(:,:,:) = 0.0_rp
324  atmos_boundary_alpha_velx(:,:,:) = 0.0_rp
325  atmos_boundary_alpha_vely(:,:,:) = 0.0_rp
326  atmos_boundary_alpha_pott(:,:,:) = 0.0_rp
327  atmos_boundary_alpha_qtrc(:,:,:,:) = 0.0_rp
328 
329  if ( atmos_boundary_type == 'REAL' .OR. do_daughter_process ) then
330  l_bnd = .true.
331  else
332  l_bnd = .false.
333  end if
334 
335  if ( l_bnd ) then
336 
337  select case(atmos_boundary_interp_type)
338  case ('same_parent')
339  get_boundary => get_boundary_same_parent
340  case ('nearest_neighbor')
341  get_boundary => get_boundary_nearest_neighbor
342  case ('lerp_initpoint')
343  get_boundary => get_boundary_lerp_initpoint
344  case ('lerp_midpoint')
345  get_boundary => get_boundary_lerp_midpoint
346  case default
347  write(*,*) 'xxx Wrong parameter in ATMOS_BOUNDARY_interp_TYPE. Check!'
348  call prc_mpistop
349  end select
350 
351  comm_fill_bnd = .false.
352 
353  allocate( atmos_boundary_ref_dens(ka,ia,ja,ref_size) )
354  allocate( atmos_boundary_ref_velz(ka,ia,ja,ref_size) )
355  allocate( atmos_boundary_ref_velx(ka,ia,ja,ref_size) )
356  allocate( atmos_boundary_ref_vely(ka,ia,ja,ref_size) )
357  allocate( atmos_boundary_ref_pott(ka,ia,ja,ref_size) )
358  allocate( atmos_boundary_ref_qtrc(ka,ia,ja,bnd_qa,ref_size) )
359  atmos_boundary_ref_dens(:,:,:,:) = const_undef
360  atmos_boundary_ref_velz(:,:,:,:) = const_undef
361  atmos_boundary_ref_velx(:,:,:,:) = const_undef
362  atmos_boundary_ref_vely(:,:,:,:) = const_undef
363  atmos_boundary_ref_pott(:,:,:,:) = const_undef
364  atmos_boundary_ref_qtrc(:,:,:,:,:) = const_undef
365 
366  ! initialize boundary value (reading file or waiting parent domain)
367  if ( do_daughter_process ) then
368  call atmos_boundary_initialize_online
369  else
370  if ( atmos_boundary_in_basename /= '' ) then
371  call atmos_boundary_initialize_file
372  else
373  write(*,*) 'xxx You need specify ATMOS_BOUNDARY_IN_BASENAME'
374  call prc_mpistop
375  endif
376  endif
377 
378  call atmos_boundary_setalpha
379 
380  atmos_boundary_update_flag = .true.
381 
382  elseif ( atmos_boundary_type == 'CONST' ) then
383 
384  call atmos_boundary_generate
385 
386  call atmos_boundary_setalpha
387 
388  atmos_boundary_update_flag = .false.
389 
390  elseif ( atmos_boundary_type == 'INIT' ) then
391 
392  call atmos_boundary_setalpha
393 
394  atmos_boundary_update_flag = .false.
395 
396  elseif ( atmos_boundary_type == 'FILE' ) then
397 
398  if ( atmos_boundary_in_basename /= '' ) then
399  call atmos_boundary_read
400  else
401  write(*,*) 'xxx You need specify ATMOS_BOUNDARY_IN_BASENAME'
402  call prc_mpistop
403  endif
404 
405  atmos_boundary_update_flag = .false.
406 
407  else
408  write(*,*) 'xxx unsupported ATMOS_BOUNDARY_TYPE. Check!', trim(atmos_boundary_type)
409  call prc_mpistop
410  endif
411 
412  if ( use_nesting ) atmos_boundary_update_flag = .true.
413 
414  !----- report data -----
415  if( io_l ) write(io_fid_log,*)
416  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary parameters'
417  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary type : ', atmos_boundary_type
418  if( io_l ) write(io_fid_log,*)
419  if( io_l ) write(io_fid_log,*) '*** is VELZ used in atmospheric boundary? : ', atmos_boundary_use_velz
420  if( io_l ) write(io_fid_log,*) '*** is VELX used in atmospheric boundary? : ', atmos_boundary_use_velx
421  if( io_l ) write(io_fid_log,*) '*** is VELY used in atmospheric boundary? : ', atmos_boundary_use_vely
422  if( io_l ) write(io_fid_log,*) '*** is POTT used in atmospheric boundary? : ', atmos_boundary_use_pott
423  if( io_l ) write(io_fid_log,*) '*** is DENS used in atmospheric boundary? : ', atmos_boundary_use_dens
424  if( io_l ) write(io_fid_log,*) '*** is QV used in atmospheric boundary? : ', atmos_boundary_use_qv
425  if( io_l ) write(io_fid_log,*) '*** is QHYD used in atmospheric boundary? : ', atmos_boundary_use_qhyd
426  if( io_l ) write(io_fid_log,*)
427  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary VELZ values : ', atmos_boundary_value_velz
428  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary VELX values : ', atmos_boundary_value_velx
429  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary VELY values : ', atmos_boundary_value_vely
430  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary POTT values : ', atmos_boundary_value_pott
431  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary QTRC values : ', atmos_boundary_value_qtrc
432  if( io_l ) write(io_fid_log,*)
433  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary smoother factor : ', atmos_boundary_smoother_fact
434  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary z-fraction : ', atmos_boundary_fracz
435  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary x-fraction : ', atmos_boundary_fracx
436  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary y-fraction : ', atmos_boundary_fracy
437  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary z-relaxation time : ', atmos_boundary_tauz
438  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary x-relaxation time : ', atmos_boundary_taux
439  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary y-relaxation time : ', atmos_boundary_tauy
440  if( io_l ) write(io_fid_log,*)
441  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary update dt : ', atmos_boundary_update_dt
442  if( io_l ) write(io_fid_log,*) '*** atmospheric boundary start date : ', atmos_boundary_start_date(:)
443  if( io_l ) write(io_fid_log,*)
444  if( io_l ) write(io_fid_log,*) '*** linear profile in vertically relax region : ', atmos_boundary_linear_v
445  if( io_l ) write(io_fid_log,*) '*** linear profile in horizontally relax region : ', atmos_boundary_linear_h
446  if( io_l ) write(io_fid_log,*) '*** non-linear factor in horizontally relax region : ', atmos_boundary_exp_h
447  if( io_l ) write(io_fid_log,*)
448  if( io_l ) write(io_fid_log,*) '*** online nesting for lateral boundary : ', atmos_boundary_online
449 
450  if( io_l ) write(io_fid_log,*) '*** does lateral boundary exist in this domain? : ', l_bnd
451  if ( l_bnd ) then
452  if( io_l ) write(io_fid_log,*) '*** lateral boundary interporation type : ', atmos_boundary_interp_type
453  endif
454 
455  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 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 online_iam_parent
a flag to say "I am a parent"
real(rp), dimension(:,:,:), allocatable, public atmos_boundary_pott
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 467 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().

467  implicit none
468 
469  real(RP), intent(in) :: dens(ka,ia,ja)
470  real(RP), intent(in) :: momz(ka,ia,ja)
471  real(RP), intent(in) :: momx(ka,ia,ja)
472  real(RP), intent(in) :: momy(ka,ia,ja)
473  real(RP), intent(in) :: rhot(ka,ia,ja)
474  real(RP), intent(in) :: qtrc(ka,ia,ja,qa)
475 
476 
477  call atmos_boundary_firstsend( &
478  dens, momz, momx, momy, rhot, qtrc )
479 
480  if ( l_bnd ) then
481 
482  ! initialize boundary value (reading file or waiting parent domain)
483  if ( do_daughter_process ) then
484  call atmos_boundary_resume_online
485  else
486  if ( atmos_boundary_in_basename /= '' ) then
487  call atmos_boundary_resume_file
488  endif
489  endif
490 
491  elseif ( atmos_boundary_type == 'INIT' ) then
492 
493  call atmos_boundary_setinitval( dens, & ! [IN]
494  momz, & ! [IN]
495  momx, & ! [IN]
496  momy, & ! [IN]
497  rhot, & ! [IN]
498  qtrc ) ! [IN]
499  endif
500 
501  if( atmos_boundary_out_basename /= '' ) then
502  call atmos_boundary_write
503  endif
504 
505  if ( atmos_boundary_update_flag ) then
506 
507  call history_bnd( &
514  end if
515 
516  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 1263 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().

1263  use gtool_file, only: &
1264  fileread
1265  use scale_process, only: &
1266  prc_mpistop
1267  use scale_time, only: &
1268  time_nowdate, &
1269  time_dtsec
1270  use scale_calendar, only: &
1273  implicit none
1274 
1275  real(RP) :: bnd_dens(ka,ia,ja) ! damping coefficient for DENS [0-1]
1276  real(RP) :: bnd_velz(ka,ia,ja) ! damping coefficient for VELZ [0-1]
1277  real(RP) :: bnd_velx(ka,ia,ja) ! damping coefficient for VELX [0-1]
1278  real(RP) :: bnd_vely(ka,ia,ja) ! damping coefficient for VELY [0-1]
1279  real(RP) :: bnd_pott(ka,ia,ja) ! damping coefficient for POTT [0-1]
1280  real(RP) :: bnd_qtrc(ka,ia,ja,bnd_qa) ! damping coefficient for QTRC [0-1]
1281 
1282  integer :: run_time_startdate(6)
1283  integer :: run_time_startday
1284  real(DP) :: run_time_startsec
1285  real(DP) :: run_time_startms
1286  integer :: run_time_offset_year
1287  real(DP) :: run_time_nowdaysec
1288 
1289  real(DP) :: boundary_diff_daysec
1290  real(RP) :: boundary_inc_offset
1291  integer :: fillgaps_steps
1292 
1293  character(len=H_LONG) :: bname
1294 
1295  integer :: i, j, k, iq, n
1296  !---------------------------------------------------------------------------
1297 
1298  bname = atmos_boundary_in_basename
1299 
1300  if ( atmos_boundary_update_dt <= 0.0_dp ) then
1301  write(*,*) 'xxx You need specify ATMOS_BOUNDARY_UPDATE_DT as larger than 0.0'
1302  call prc_mpistop
1303  endif
1304  update_nstep = nint( atmos_boundary_update_dt / time_dtsec )
1305  if ( abs(update_nstep * time_dtsec - atmos_boundary_update_dt) > 1e-10_dp ) then
1306  write(*,*) 'xxx ATMOS_BOUNDARY_UPDATE_DT is not multiple of DT'
1307  call prc_mpistop
1308  end if
1309 
1310  !--- recalculate time of the run [no offset]
1311  run_time_startdate(:) = time_nowdate(:)
1312  run_time_startms = 0.0_dp
1313  run_time_offset_year = 0
1314 
1315  call calendar_date2daysec( run_time_startday, & ! [OUT]
1316  run_time_startsec, & ! [OUT]
1317  run_time_startdate(:), & ! [IN]
1318  run_time_startms, & ! [IN]
1319  run_time_offset_year ) ! [IN]
1320 
1321  run_time_nowdaysec = calendar_combine_daysec( run_time_startday, run_time_startsec )
1322 
1323  boundary_diff_daysec = run_time_nowdaysec - boundary_time_initdaysec
1324  boundary_timestep = 1 + int( boundary_diff_daysec / atmos_boundary_update_dt )
1325  boundary_inc_offset = mod( boundary_diff_daysec, atmos_boundary_update_dt )
1326  fillgaps_steps = int( boundary_inc_offset / time_dtsec )
1327 
1328  if( io_l ) write(io_fid_log,*) '+++ BOUNDARY TIMESTEP NUMBER FOR INIT:', boundary_timestep
1329  if( io_l ) write(io_fid_log,*) '+++ BOUNDARY OFFSET:', boundary_inc_offset
1330  if( io_l ) write(io_fid_log,*) '+++ BOUNDARY FILLGAPS STEPS:', fillgaps_steps
1331 
1332  ! read boundary data from input file
1333  call atmos_boundary_update_file( ref_now )
1334 
1335  boundary_timestep = boundary_timestep + 1
1336  call atmos_boundary_update_file( ref_new )
1337 
1338  ! copy now to old
1339  do j = 1, ja
1340  do i = 1, ia
1341  do k = 1, ka
1342  atmos_boundary_ref_dens(k,i,j,ref_old) = atmos_boundary_ref_dens(k,i,j,ref_now)
1343  atmos_boundary_ref_velx(k,i,j,ref_old) = atmos_boundary_ref_velx(k,i,j,ref_now)
1344  atmos_boundary_ref_vely(k,i,j,ref_old) = atmos_boundary_ref_vely(k,i,j,ref_now)
1345  atmos_boundary_ref_pott(k,i,j,ref_old) = atmos_boundary_ref_pott(k,i,j,ref_now)
1346  do iq = 1, bnd_qa
1347  atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now)
1348  end do
1349  end do
1350  end do
1351  end do
1352 
1353  ! set boundary data
1354  do j = 1, ja
1355  do i = 1, ia
1356  do k = 1, ka
1357  atmos_boundary_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_now)
1358  atmos_boundary_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_now)
1359  atmos_boundary_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_now)
1360  atmos_boundary_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_now)
1361  do iq = 1, bnd_qa
1362  atmos_boundary_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now)
1363  end do
1364  end do
1365  end do
1366  end do
1367 
1368  if ( atmos_boundary_use_velz ) then
1369  do j = 1, ja
1370  do i = 1, ia
1371  do k = 1, ka
1372  atmos_boundary_velz(k,i,j) = atmos_boundary_value_velz
1373  end do
1374  end do
1375  end do
1376  end if
1377 
1378  now_step = fillgaps_steps
1379 
1380  ! get time boundary
1381  call get_boundary( bnd_dens(:,:,:), & ! [OUT]
1382  bnd_velz(:,:,:), & ! [OUT]
1383  bnd_velx(:,:,:), & ! [OUT]
1384  bnd_vely(:,:,:), & ! [OUT]
1385  bnd_pott(:,:,:), & ! [OUT]
1386  bnd_qtrc(:,:,:,:), & ! [OUT]
1387  now_step, & ! [IN]
1388  update_nstep ) ! [IN]
1389 
1390  ! fill in gaps of the offset
1391  do j = 1, ja
1392  do i = 1, ia
1393  do k = 1, ka
1394  atmos_boundary_dens(k,i,j) = bnd_dens(k,i,j)
1395  atmos_boundary_velx(k,i,j) = bnd_velx(k,i,j)
1396  atmos_boundary_vely(k,i,j) = bnd_vely(k,i,j)
1397  atmos_boundary_pott(k,i,j) = bnd_pott(k,i,j)
1398  do iq = 1, bnd_qa
1399  atmos_boundary_qtrc(k,i,j,iq) = bnd_qtrc(k,i,j,iq)
1400  end do
1401  end do
1402  end do
1403  end do
1404 
1405  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.
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
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 1440 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().

1440  use scale_process, only: &
1441  prc_mpistop
1442  use scale_time, only: &
1443  time_dtsec, &
1444  time_nstep
1445  use scale_grid_nest, only: &
1447  online_use_velz, &
1448  parent_nstep
1449  implicit none
1450 
1451  ! parameters
1452  integer, parameter :: handle = 2
1453 
1454  ! works
1455  integer :: i, j, k, iq
1456  !---------------------------------------------------------------------------
1457 
1458  ! import data from parent domain
1459  boundary_timestep = 1
1460  if( io_l ) write(io_fid_log,*) '+++ BOUNDARY TIMESTEP NUMBER FOR INIT:', boundary_timestep
1461 
1462  call atmos_boundary_update_online_daughter( ref_now )
1463 
1464  boundary_timestep = boundary_timestep + 1
1465  if( io_l ) write(io_fid_log,*) '+++ BOUNDARY TIMESTEP NUMBER FOR INIT:', boundary_timestep
1466 
1467  call atmos_boundary_update_online_daughter( ref_new )
1468 
1469  ! copy now to old
1470  do j = 1, ja
1471  do i = 1, ia
1472  do k = 1, ka
1473  atmos_boundary_ref_dens(k,i,j,ref_old) = atmos_boundary_ref_dens(k,i,j,ref_now)
1474  atmos_boundary_ref_velx(k,i,j,ref_old) = atmos_boundary_ref_velx(k,i,j,ref_now)
1475  atmos_boundary_ref_vely(k,i,j,ref_old) = atmos_boundary_ref_vely(k,i,j,ref_now)
1476  atmos_boundary_ref_pott(k,i,j,ref_old) = atmos_boundary_ref_pott(k,i,j,ref_now)
1477  do iq = 1, bnd_qa
1478  atmos_boundary_ref_qtrc(k,i,j,iq,ref_old) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now)
1479  end do
1480  end do
1481  end do
1482  end do
1483 
1484  ! set boundary data
1485  do j = 1, ja
1486  do i = 1, ia
1487  do k = 1, ka
1488  atmos_boundary_dens(k,i,j) = atmos_boundary_ref_dens(k,i,j,ref_now)
1489  atmos_boundary_velx(k,i,j) = atmos_boundary_ref_velx(k,i,j,ref_now)
1490  atmos_boundary_vely(k,i,j) = atmos_boundary_ref_vely(k,i,j,ref_now)
1491  atmos_boundary_pott(k,i,j) = atmos_boundary_ref_pott(k,i,j,ref_now)
1492  do iq = 1, bnd_qa
1493  atmos_boundary_qtrc(k,i,j,iq) = atmos_boundary_ref_qtrc(k,i,j,iq,ref_now)
1494  end do
1495  end do
1496  end do
1497  end do
1498 
1499  if ( online_use_velz ) then
1500  do j = 1, ja
1501  do i = 1, ia
1502  do k = 1, ka
1503  atmos_boundary_velz(k,i,j) = atmos_boundary_ref_velz(k,i,j,ref_now)
1504  end do
1505  end do
1506  end do
1507  else if ( atmos_boundary_use_velz ) then
1508  do j = 1, ja
1509  do i = 1, ia
1510  do k = 1, ka
1511  atmos_boundary_velz(k,i,j) = atmos_boundary_value_velz
1512  end do
1513  end do
1514  end do
1515  end if
1516 
1517  update_nstep = nint( atmos_boundary_update_dt / time_dtsec )
1518  if ( update_nstep * parent_nstep(handle) /= time_nstep ) then
1519  write(*,*) 'xxx NSTEP is not multiple of PARENT_NSTEP'
1520  call prc_mpistop
1521  end if
1522 
1523  now_step = 0 ! should be set as zero in initialize process
1524 
1525  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
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
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 1532 of file scale_atmos_sub_boundary.F90.

Referenced by atmos_boundary_resume().

1532  implicit none
1533 
1534  ! arguments
1535  real(RP), intent(in) :: dens(ka,ia,ja)
1536  real(RP), intent(in) :: momz(ka,ia,ja)
1537  real(RP), intent(in) :: momx(ka,ia,ja)
1538  real(RP), intent(in) :: momy(ka,ia,ja)
1539  real(RP), intent(in) :: rhot(ka,ia,ja)
1540  real(RP), intent(in) :: qtrc(ka,ia,ja,qa)
1541  !---------------------------------------------------------------------------
1542 
1543  ! send data at the first time
1544  if ( do_parent_process ) then !online [parent]
1545  ! issue send
1546  call atmos_boundary_send( dens, momz, momx, momy, rhot, qtrc )
1547  endif
1548 
1549  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 1555 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().

1555  use scale_grid_nest, only: &
1558  nestqa => nest_bnd_qa
1559  implicit none
1560 
1561  ! works
1562  integer :: handle
1563  !---------------------------------------------------------------------------
1564 
1565  if ( do_parent_process ) then !online [parent]
1566  handle = 1
1567  call nest_comm_recvwait_issue( handle, nestqa )
1568  endif
1569 
1570  if ( do_daughter_process ) then !online [daughter]
1571  handle = 2
1572  call nest_comm_recv_cancel( handle )
1573  endif
1574 
1575  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 boundary.

Definition at line 1582 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().

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

References scale_tracer::aq_name, and bnd_qa.

Referenced by atmos_boundary_update().

2436  implicit none
2437 
2438  ! works
2439  integer :: ref_tmp
2440  !---------------------------------------------------------------------------
2441 
2442  ref_tmp = ref_old
2443  ref_old = ref_now
2444  ref_now = ref_new
2445  ref_new = ref_tmp
2446 
2447  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.