SCALE-RM
Functions/Subroutines | Variables
mod_atmos_dyn_vars Module Reference

module Atmosphere / Dynamics More...

Functions/Subroutines

subroutine, public atmos_dyn_vars_setup
 Setup. More...
 
subroutine, public atmos_dyn_vars_fillhalo
 HALO Communication. More...
 
subroutine, public atmos_dyn_vars_restart_open
 Open restart file for read. More...
 
subroutine, public atmos_dyn_vars_restart_read
 Read restart. More...
 
subroutine, public atmos_dyn_vars_restart_create
 Create restart file. More...
 
subroutine, public atmos_dyn_vars_restart_enddef
 Exit netCDF define mode. More...
 
subroutine, public atmos_dyn_vars_restart_close
 Close restart file. More...
 
subroutine, public atmos_dyn_vars_restart_def_var
 Define variables in restart file. More...
 
subroutine, public atmos_dyn_vars_restart_write
 Write variables to restart file. More...
 

Variables

logical, public atmos_dyn_restart_output = .false.
 output restart file? More...
 
character(len=h_long), public atmos_dyn_restart_in_basename = ''
 Basename of the input file. More...
 
logical, public atmos_dyn_restart_in_postfix_timelabel = .false.
 Add timelabel to the basename of input file? More...
 
character(len=h_long), public atmos_dyn_restart_out_basename = ''
 Basename of the output file. More...
 
logical, public atmos_dyn_restart_out_postfix_timelabel = .true.
 Add timelabel to the basename of output file? More...
 
character(len=h_mid), public atmos_dyn_restart_out_title = 'ATMOS_DYN restart'
 title of the output file More...
 
character(len=h_short), public atmos_dyn_restart_out_dtype = 'DEFAULT'
 REAL4 or REAL8. More...
 
real(rp), dimension(:,:,:,:), allocatable, public prog
 

Detailed Description

module Atmosphere / Dynamics

Description
Container for mod_atmos_dyn
Author
Team SCALE
History
  • 2014-05-04 (H.Yashiro) [new]
NAMELIST
  • PARAM_ATMOS_DYN_VARS
    nametypedefault valuecomment
    ATMOS_DYN_RESTART_IN_BASENAME character(len=H_LONG) '' Basename of the input file
    ATMOS_DYN_RESTART_IN_POSTFIX_TIMELABEL logical .false. Add timelabel to the basename of input file?
    ATMOS_DYN_RESTART_OUTPUT logical .false. output restart file?
    ATMOS_DYN_RESTART_OUT_BASENAME character(len=H_LONG) '' Basename of the output file
    ATMOS_DYN_RESTART_OUT_POSTFIX_TIMELABEL logical .true. Add timelabel to the basename of output file?
    ATMOS_DYN_RESTART_OUT_TITLE character(len=H_MID) 'ATMOS_DYN restart' title of the output file
    ATMOS_DYN_RESTART_OUT_DTYPE character(len=H_SHORT) 'DEFAULT' REAL4 or REAL8

History Output
No history output

Function/Subroutine Documentation

◆ atmos_dyn_vars_setup()

subroutine, public mod_atmos_dyn_vars::atmos_dyn_vars_setup ( )

Setup.

Definition at line 79 of file mod_atmos_dyn_vars.f90.

References atmos_dyn_restart_in_basename, atmos_dyn_restart_in_postfix_timelabel, atmos_dyn_restart_out_basename, atmos_dyn_restart_out_dtype, atmos_dyn_restart_out_postfix_timelabel, atmos_dyn_restart_out_title, atmos_dyn_restart_output, scale_atmos_dyn_tstep_short::atmos_dyn_tstep_short_regist(), mod_atmos_admin::atmos_dyn_type, scale_const::const_undef, scale_grid_index::ia, scale_stdio::io_fid_conf, scale_stdio::io_fid_log, scale_stdio::io_fid_nml, scale_stdio::io_l, scale_stdio::io_nml, scale_grid_index::ja, scale_grid_index::ka, scale_process::prc_mpistop(), prog, and scale_index::va.

Referenced by mod_atmos_vars::atmos_vars_setup().

79  use scale_process, only: &
81  use scale_const, only: &
82  undef => const_undef
83  use mod_atmos_admin, only: &
85  use scale_atmos_dyn_tstep_short, only: &
87  implicit none
88 
89  namelist / param_atmos_dyn_vars / &
90  atmos_dyn_restart_in_basename, &
91  atmos_dyn_restart_in_postfix_timelabel, &
92  atmos_dyn_restart_output, &
93  atmos_dyn_restart_out_basename, &
94  atmos_dyn_restart_out_postfix_timelabel, &
95  atmos_dyn_restart_out_title, &
96  atmos_dyn_restart_out_dtype
97 
98  integer :: ierr
99  integer :: iv
100  !---------------------------------------------------------------------------
101 
102  if( io_l ) write(io_fid_log,*)
103  if( io_l ) write(io_fid_log,*) '++++++ Module[VARS] / Categ[ATMOS DYN] / Origin[SCALE-RM]'
104 
105  !--- read namelist
106  rewind(io_fid_conf)
107  read(io_fid_conf,nml=param_atmos_dyn_vars,iostat=ierr)
108  if( ierr < 0 ) then !--- missing
109  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
110  elseif( ierr > 0 ) then !--- fatal error
111  write(*,*) 'xxx Not appropriate names in namelist PARAM_ATMOS_DYN_VARS. Check!'
112  call prc_mpistop
113  endif
114  if( io_nml ) write(io_fid_nml,nml=param_atmos_dyn_vars)
115 
117  va, & ! [OUT]
118  var_name, & ! [OUT]
119  var_desc, & ! [OUT]
120  var_unit ) ! [OUT]
121 
122  if ( va > 0 ) then ! additional prognostic variables
123 
124  if ( va > vmax ) then
125  write(*,*) 'xxx number of the prognostic variables is exceed the limit', va, ' > ', vmax
126  call prc_mpistop
127  endif
128  allocate( prog(ka,ia,ja,va) )
129  prog(:,:,:,:) = undef
130 
131  if( io_l ) write(io_fid_log,*)
132  if( io_l ) write(io_fid_log,*) '*** [ATMOS_DYN] prognostic/diagnostic variables'
133  if( io_l ) write(io_fid_log,'(1x,A,A24,A,A48,A,A12,A)') &
134  '*** |', 'VARNAME ','|', &
135  'DESCRIPTION ', '[', 'UNIT ', ']'
136  do iv = 1, va
137  if( io_l ) write(io_fid_log,'(1x,A,I3,A,A24,A,A48,A,A12,A)') &
138  '*** NO.',iv,'|',var_name(iv),'|',var_desc(iv),'[',var_unit(iv),']'
139  enddo
140 
141  if( io_l ) write(io_fid_log,*)
142  if ( atmos_dyn_restart_in_basename /= '' ) then
143  if( io_l ) write(io_fid_log,*) '*** Restart input? : YES, file = ', trim(atmos_dyn_restart_in_basename)
144  if( io_l ) write(io_fid_log,*) '*** Add timelabel? : ', atmos_dyn_restart_in_postfix_timelabel
145  else
146  if( io_l ) write(io_fid_log,*) '*** Restart input? : NO'
147  endif
148  if ( atmos_dyn_restart_output &
149  .AND. atmos_dyn_restart_out_basename /= '' ) then
150  if( io_l ) write(io_fid_log,*) '*** Restart output? : YES, file = ', trim(atmos_dyn_restart_out_basename)
151  if( io_l ) write(io_fid_log,*) '*** Add timelabel? : ', atmos_dyn_restart_out_postfix_timelabel
152  else
153  if( io_l ) write(io_fid_log,*) '*** Restart output? : NO'
154  atmos_dyn_restart_output = .false.
155  endif
156 
157  else ! no additional prognostic variables
158 
159  allocate( prog(ka,ia,ja,1) ) ! for safety
160  prog(:,:,:,:) = undef
161  atmos_dyn_restart_output = .false.
162 
163  endif
164 
165  return
module ATMOS admin
subroutine, public prc_mpistop
Abort MPI.
module Atmosphere / Dynamical scheme
real(rp), public const_undef
Definition: scale_const.F90:43
module PROCESS
subroutine, public atmos_dyn_tstep_short_regist(ATMOS_DYN_TYPE, VA_out, VAR_NAME, VAR_DESC, VAR_UNIT)
Register.
real(rp), dimension(:,:,:,:), allocatable, public prog
module CONSTANT
Definition: scale_const.F90:14
character(len=h_short), public atmos_dyn_type
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_dyn_vars_fillhalo()

subroutine, public mod_atmos_dyn_vars::atmos_dyn_vars_fillhalo ( )

HALO Communication.

Definition at line 171 of file mod_atmos_dyn_vars.f90.

References scale_grid_index::ie, scale_grid_index::is, scale_grid_index::je, scale_grid_index::js, scale_grid_index::ka, scale_grid_index::ke, scale_grid_index::ks, prog, and scale_index::va.

Referenced by atmos_dyn_vars_restart_read(), and atmos_dyn_vars_restart_write().

171  use scale_comm, only: &
172  comm_vars8, &
173  comm_wait
174  implicit none
175 
176  integer :: i, j, iv
177  !---------------------------------------------------------------------------
178 
179  do iv = 1, va
180  do j = js, je
181  do i = is, ie
182  prog( 1:ks-1,i,j,iv) = prog(ks,i,j,iv)
183  prog(ke+1:ka, i,j,iv) = prog(ke,i,j,iv)
184  enddo
185  enddo
186 
187  call comm_vars8( prog(:,:,:,iv), iv )
188  enddo
189 
190  do iv = 1, va
191  call comm_wait ( prog(:,:,:,iv), iv )
192  enddo
193 
194  return
module COMMUNICATION
Definition: scale_comm.F90:23
real(rp), dimension(:,:,:,:), allocatable, public prog
Here is the caller graph for this function:

◆ atmos_dyn_vars_restart_open()

subroutine, public mod_atmos_dyn_vars::atmos_dyn_vars_restart_open ( )

Open restart file for read.

Definition at line 200 of file mod_atmos_dyn_vars.f90.

References atmos_dyn_restart_in_basename, atmos_dyn_restart_in_postfix_timelabel, scale_fileio::fileio_open(), scale_stdio::io_fid_log, scale_stdio::io_l, and scale_time::time_gettimelabel().

Referenced by mod_atmos_vars::atmos_vars_restart_open().

200  use scale_time, only: &
202  use scale_fileio, only: &
204  implicit none
205 
206  character(len=19) :: timelabel
207  character(len=H_LONG) :: basename
208  !---------------------------------------------------------------------------
209 
210  if( io_l ) write(io_fid_log,*)
211  if( io_l ) write(io_fid_log,*) '*** Open restart file (ATMOS_DYN) ***'
212 
213  if ( atmos_dyn_restart_in_basename /= '' ) then
214 
215  if ( atmos_dyn_restart_in_postfix_timelabel ) then
216  call time_gettimelabel( timelabel )
217  basename = trim(atmos_dyn_restart_in_basename)//'_'//trim(timelabel)
218  else
219  basename = trim(atmos_dyn_restart_in_basename)
220  endif
221 
222  if( io_l ) write(io_fid_log,*) '*** basename: ', trim(basename)
223 
224  call fileio_open( restart_fid, basename )
225  else
226  if( io_l ) write(io_fid_log,*) '*** restart file for ATMOS_DYN is not specified.'
227  endif
228 
229  return
module FILE I/O (netcdf)
subroutine, public time_gettimelabel(timelabel)
generate time label
Definition: scale_time.F90:90
module TIME
Definition: scale_time.F90:15
subroutine, public fileio_open(fid, basename)
open a netCDF file for read
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_dyn_vars_restart_read()

subroutine, public mod_atmos_dyn_vars::atmos_dyn_vars_restart_read ( )

Read restart.

Definition at line 235 of file mod_atmos_dyn_vars.f90.

References atmos_dyn_vars_fillhalo(), scale_fileio::fileio_flush(), scale_grid_index::ia, scale_stdio::io_aggregate, scale_stdio::io_fid_log, scale_stdio::io_l, scale_grid_index::ja, scale_grid_index::ka, scale_grid_index::ke, scale_grid_index::ks, prog, scale_rm_statistics::statistics_checktotal, and scale_index::va.

Referenced by mod_atmos_vars::atmos_vars_restart_read().

235  use scale_rm_statistics, only: &
237  stat_total
238  use scale_fileio, only: &
239  fileio_read, &
241  implicit none
242 
243  real(RP) :: total
244  integer :: i, j, iv
245  !---------------------------------------------------------------------------
246 
247  if ( restart_fid /= -1 ) then
248  if( io_l ) write(io_fid_log,*)
249  if( io_l ) write(io_fid_log,*) '*** Read from restart file (ATMOS_DYN) ***'
250 
251  do iv = 1, va
252  call fileio_read( prog(:,:,:,iv), & ! [OUT]
253  restart_fid, var_name(iv), 'ZXY', step=1 ) ! [IN]
254  enddo
255 
256  if ( io_aggregate ) then
257  call fileio_flush( restart_fid )
258  ! X/Y halos have been read from file
259 
260  ! fill K halos
261  do iv = 1, va
262  do j = 1, ja
263  do i = 1, ia
264  prog( 1:ks-1,i,j,iv) = prog(ks,i,j,iv)
265  prog(ke+1:ka, i,j,iv) = prog(ke,i,j,iv)
266  enddo
267  enddo
268  enddo
269  else
270  call atmos_dyn_vars_fillhalo
271  end if
272 
273  if ( statistics_checktotal ) then
274  do iv = 1, va
275  call stat_total( total, prog(:,:,:,iv), var_name(iv) )
276  enddo
277  endif
278  else
279  if( io_l ) write(io_fid_log,*) '*** invalid restart file ID for ATMOS_DYN.'
280  endif
281 
282  return
logical, public statistics_checktotal
calc&report variable totals to logfile?
subroutine, public fileio_flush(fid)
Flush all pending requests to a netCDF file (PnetCDF only)
module FILE I/O (netcdf)
module Statistics
real(rp), dimension(:,:,:,:), allocatable, public prog
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_dyn_vars_restart_create()

subroutine, public mod_atmos_dyn_vars::atmos_dyn_vars_restart_create ( )

Create restart file.

Definition at line 287 of file mod_atmos_dyn_vars.f90.

References atmos_dyn_restart_out_basename, atmos_dyn_restart_out_dtype, atmos_dyn_restart_out_postfix_timelabel, atmos_dyn_restart_out_title, scale_fileio::fileio_create(), scale_stdio::io_fid_log, scale_stdio::io_l, and scale_time::time_gettimelabel().

Referenced by mod_atmos_vars::atmos_vars_restart_create().

287  use scale_time, only: &
289  use scale_fileio, only: &
291  implicit none
292 
293  character(len=19) :: timelabel
294  character(len=H_LONG) :: basename
295  !---------------------------------------------------------------------------
296 
297  if ( atmos_dyn_restart_out_basename /= '' ) then
298 
299  if( io_l ) write(io_fid_log,*)
300  if( io_l ) write(io_fid_log,*) '*** Create restart file (ATMOS_DYN) ***'
301 
302  if ( atmos_dyn_restart_out_postfix_timelabel ) then
303  call time_gettimelabel( timelabel )
304  basename = trim(atmos_dyn_restart_out_basename)//'_'//trim(timelabel)
305  else
306  basename = trim(atmos_dyn_restart_out_basename)
307  endif
308 
309  if( io_l ) write(io_fid_log,*) '*** basename: ', trim(basename)
310 
311  call fileio_create( restart_fid, & ! [OUT]
312  basename, atmos_dyn_restart_out_title, atmos_dyn_restart_out_dtype ) ! [IN]
313 
314  endif
315 
316  return
module FILE I/O (netcdf)
subroutine, public time_gettimelabel(timelabel)
generate time label
Definition: scale_time.F90:90
subroutine, public fileio_create(fid, basename, title, datatype, date, subsec, append, nozcoord)
Create/open a netCDF file.
module TIME
Definition: scale_time.F90:15
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_dyn_vars_restart_enddef()

subroutine, public mod_atmos_dyn_vars::atmos_dyn_vars_restart_enddef ( )

Exit netCDF define mode.

Definition at line 322 of file mod_atmos_dyn_vars.f90.

References scale_fileio::fileio_enddef().

Referenced by mod_atmos_vars::atmos_vars_restart_enddef().

322  use scale_fileio, only: &
324  implicit none
325 
326  if ( restart_fid /= -1 ) then
327  call fileio_enddef( restart_fid ) ! [IN]
328  endif
329 
330  return
module FILE I/O (netcdf)
subroutine, public fileio_enddef(fid)
Exit netCDF file define mode.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_dyn_vars_restart_close()

subroutine, public mod_atmos_dyn_vars::atmos_dyn_vars_restart_close ( )

Close restart file.

Definition at line 336 of file mod_atmos_dyn_vars.f90.

References scale_fileio::fileio_close(), scale_stdio::io_fid_log, and scale_stdio::io_l.

Referenced by mod_atmos_vars::atmos_vars_restart_close().

336  use scale_fileio, only: &
338  implicit none
339  !---------------------------------------------------------------------------
340 
341  if ( restart_fid /= -1 ) then
342  if( io_l ) write(io_fid_log,*)
343  if( io_l ) write(io_fid_log,*) '*** Close restart file (ATMOS_DYN) ***'
344 
345  call fileio_close( restart_fid ) ! [IN]
346 
347  restart_fid = -1
348  endif
349 
350  return
module FILE I/O (netcdf)
subroutine, public fileio_close(fid)
Close a netCDF file.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_dyn_vars_restart_def_var()

subroutine, public mod_atmos_dyn_vars::atmos_dyn_vars_restart_def_var ( )

Define variables in restart file.

Definition at line 356 of file mod_atmos_dyn_vars.f90.

References atmos_dyn_restart_out_dtype, scale_fileio::fileio_def_var(), and scale_index::va.

Referenced by mod_atmos_vars::atmos_vars_restart_def_var().

356  use scale_fileio, only: &
358  implicit none
359 
360  integer iv
361  !---------------------------------------------------------------------------
362 
363  if ( restart_fid /= -1 ) then
364 
365  do iv = 1, va
366  call fileio_def_var( restart_fid, var_id(iv), var_name(iv), var_desc(iv), &
367  var_unit(iv), 'ZXY', atmos_dyn_restart_out_dtype ) ! [IN]
368  enddo
369 
370  endif
371 
372  return
module FILE I/O (netcdf)
subroutine, public fileio_def_var(fid, vid, varname, desc, unit, axistype, datatype, timeintv, nsteps)
Define a variable to file.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_dyn_vars_restart_write()

subroutine, public mod_atmos_dyn_vars::atmos_dyn_vars_restart_write ( )

Write variables to restart file.

Definition at line 378 of file mod_atmos_dyn_vars.f90.

References atmos_dyn_vars_fillhalo(), prog, scale_rm_statistics::statistics_checktotal, and scale_index::va.

Referenced by mod_atmos_vars::atmos_vars_restart_write().

378  use scale_rm_statistics, only: &
380  stat_total
381  use scale_fileio, only: &
382  fileio_write_var
383  implicit none
384 
385  real(RP) :: total
386  integer :: iv
387  !---------------------------------------------------------------------------
388 
389  if ( restart_fid /= -1 ) then
390 
391  call atmos_dyn_vars_fillhalo
392 
393  if ( statistics_checktotal ) then
394  do iv = 1, va
395  call stat_total( total, prog(:,:,:,iv), var_name(iv) )
396  enddo
397  endif
398 
399  do iv = 1, va
400  call fileio_write_var( restart_fid, var_id(iv), prog(:,:,:,iv), var_name(iv), 'ZXY' ) ! [IN]
401  enddo
402 
403  endif
404 
405  return
logical, public statistics_checktotal
calc&report variable totals to logfile?
module FILE I/O (netcdf)
module Statistics
real(rp), dimension(:,:,:,:), allocatable, public prog
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ atmos_dyn_restart_output

logical, public mod_atmos_dyn_vars::atmos_dyn_restart_output = .false.

output restart file?

Definition at line 47 of file mod_atmos_dyn_vars.f90.

Referenced by mod_admin_restart::admin_restart_setup(), and atmos_dyn_vars_setup().

47  logical, public :: ATMOS_DYN_RESTART_OUTPUT = .false.

◆ atmos_dyn_restart_in_basename

character(len=h_long), public mod_atmos_dyn_vars::atmos_dyn_restart_in_basename = ''

Basename of the input file.

Definition at line 49 of file mod_atmos_dyn_vars.f90.

Referenced by mod_admin_restart::admin_restart_setup(), atmos_dyn_vars_restart_open(), and atmos_dyn_vars_setup().

49  character(len=H_LONG), public :: ATMOS_DYN_RESTART_IN_BASENAME = ''

◆ atmos_dyn_restart_in_postfix_timelabel

logical, public mod_atmos_dyn_vars::atmos_dyn_restart_in_postfix_timelabel = .false.

Add timelabel to the basename of input file?

Definition at line 50 of file mod_atmos_dyn_vars.f90.

Referenced by mod_admin_restart::admin_restart_setup(), atmos_dyn_vars_restart_open(), and atmos_dyn_vars_setup().

50  logical, public :: ATMOS_DYN_RESTART_IN_POSTFIX_TIMELABEL = .false.

◆ atmos_dyn_restart_out_basename

character(len=h_long), public mod_atmos_dyn_vars::atmos_dyn_restart_out_basename = ''

Basename of the output file.

Definition at line 51 of file mod_atmos_dyn_vars.f90.

Referenced by mod_admin_restart::admin_restart_setup(), atmos_dyn_vars_restart_create(), and atmos_dyn_vars_setup().

51  character(len=H_LONG), public :: ATMOS_DYN_RESTART_OUT_BASENAME = ''

◆ atmos_dyn_restart_out_postfix_timelabel

logical, public mod_atmos_dyn_vars::atmos_dyn_restart_out_postfix_timelabel = .true.

Add timelabel to the basename of output file?

Definition at line 52 of file mod_atmos_dyn_vars.f90.

Referenced by mod_admin_restart::admin_restart_setup(), atmos_dyn_vars_restart_create(), and atmos_dyn_vars_setup().

52  logical, public :: ATMOS_DYN_RESTART_OUT_POSTFIX_TIMELABEL = .true.

◆ atmos_dyn_restart_out_title

character(len=h_mid), public mod_atmos_dyn_vars::atmos_dyn_restart_out_title = 'ATMOS_DYN restart'

title of the output file

Definition at line 53 of file mod_atmos_dyn_vars.f90.

Referenced by mod_admin_restart::admin_restart_setup(), atmos_dyn_vars_restart_create(), and atmos_dyn_vars_setup().

53  character(len=H_MID), public :: ATMOS_DYN_RESTART_OUT_TITLE = 'ATMOS_DYN restart'

◆ atmos_dyn_restart_out_dtype

character(len=h_short), public mod_atmos_dyn_vars::atmos_dyn_restart_out_dtype = 'DEFAULT'

REAL4 or REAL8.

Definition at line 54 of file mod_atmos_dyn_vars.f90.

Referenced by mod_admin_restart::admin_restart_setup(), atmos_dyn_vars_restart_create(), atmos_dyn_vars_restart_def_var(), and atmos_dyn_vars_setup().

54  character(len=H_SHORT), public :: ATMOS_DYN_RESTART_OUT_DTYPE = 'DEFAULT'

◆ prog

real(rp), dimension(:,:,:,:), allocatable, public mod_atmos_dyn_vars::prog