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_read
 Read restart. More...
 
subroutine, public atmos_dyn_vars_restart_write
 Write 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_var
 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 restart file More...
 
character(len=h_long), public atmos_dyn_restart_out_basename = ''
 basename of the 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_mid), 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 restart 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_TITLE character(len=H_MID) 'ATMOS_DYN restart' title of the output file
    ATMOS_DYN_RESTART_OUT_DTYPE character(len=H_MID) '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 77 of file mod_atmos_dyn_vars.f90.

References atmos_dyn_restart_in_basename, atmos_dyn_restart_out_basename, atmos_dyn_restart_out_dtype, 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_l, scale_stdio::io_lnml, 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().

77  use scale_process, only: &
79  use scale_const, only: &
80  undef => const_undef
81  use mod_atmos_admin, only: &
83  use scale_atmos_dyn_tstep_short, only: &
85  implicit none
86 
87  namelist / param_atmos_dyn_vars / &
88  atmos_dyn_restart_in_basename, &
89  atmos_dyn_restart_output, &
90  atmos_dyn_restart_out_basename, &
91  atmos_dyn_restart_out_title, &
92  atmos_dyn_restart_out_dtype
93 
94  integer :: ierr
95  integer :: iv
96  !---------------------------------------------------------------------------
97 
98  if( io_l ) write(io_fid_log,*)
99  if( io_l ) write(io_fid_log,*) '++++++ Module[VARS] / Categ[ATMOS DYN] / Origin[SCALE-RM]'
100 
101  !--- read namelist
102  rewind(io_fid_conf)
103  read(io_fid_conf,nml=param_atmos_dyn_vars,iostat=ierr)
104  if( ierr < 0 ) then !--- missing
105  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
106  elseif( ierr > 0 ) then !--- fatal error
107  write(*,*) 'xxx Not appropriate names in namelist PARAM_ATMOS_DYN_VARS. Check!'
108  call prc_mpistop
109  endif
110  if( io_lnml ) write(io_fid_log,nml=param_atmos_dyn_vars)
111 
113  va, & ! [OUT]
114  var_name, & ! [OUT]
115  var_desc, & ! [OUT]
116  var_unit ) ! [OUT]
117 
118  if ( va > 0 ) then ! additional prognostic variables
119 
120  if ( va > vmax ) then
121  write(*,*) 'xxx number of the prognostic variables is exceed the limit', va, ' > ', vmax
122  call prc_mpistop
123  endif
124  allocate( prog(ka,ia,ja,va) )
125  prog(:,:,:,:) = undef
126 
127  if( io_l ) write(io_fid_log,*)
128  if( io_l ) write(io_fid_log,*) '*** [ATMOS_DYN] prognostic/diagnostic variables'
129  if( io_l ) write(io_fid_log,'(1x,A,A15,A,A32,3(A))') &
130  '*** |','VARNAME ','|', 'DESCRIPTION ','[', 'UNIT ',']'
131  do iv = 1, va
132  if( io_l ) write(io_fid_log,'(1x,A,i3,A,A15,A,A32,3(A))') &
133  '*** NO.',iv,'|',var_name(iv),'|',var_desc(iv),'[',var_unit(iv),']'
134  enddo
135 
136  if( io_l ) write(io_fid_log,*)
137 
138  if ( atmos_dyn_restart_in_basename /= '' ) then
139  if( io_l ) write(io_fid_log,*) '*** Restart input? : ', trim(atmos_dyn_restart_in_basename)
140  else
141  if( io_l ) write(io_fid_log,*) '*** Restart input? : NO'
142  endif
143 
144  if ( atmos_dyn_restart_output &
145  .AND. atmos_dyn_restart_out_basename /= '' ) then
146  if( io_l ) write(io_fid_log,*) '*** Restart output? : ', trim(atmos_dyn_restart_out_basename)
147  else
148  if( io_l ) write(io_fid_log,*) '*** Restart output? : NO'
149  atmos_dyn_restart_output = .false.
150  endif
151 
152  else ! no additional prognostic variables
153 
154  allocate( prog(ka,ia,ja,1) ) ! for safety
155  prog(:,:,:,:) = undef
156  atmos_dyn_restart_output = .false.
157 
158  endif
159 
160  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 166 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().

166  use scale_comm, only: &
167  comm_vars8, &
168  comm_wait
169  implicit none
170 
171  integer :: i, j, iv
172  !---------------------------------------------------------------------------
173 
174  do iv = 1, va
175  do j = js, je
176  do i = is, ie
177  prog( 1:ks-1,i,j,iv) = prog(ks,i,j,iv)
178  prog(ke+1:ka, i,j,iv) = prog(ke,i,j,iv)
179  enddo
180  enddo
181 
182  call comm_vars8( prog(:,:,:,iv), iv )
183  enddo
184 
185  do iv = 1, va
186  call comm_wait ( prog(:,:,:,iv), iv )
187  enddo
188 
189  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_read()

subroutine, public mod_atmos_dyn_vars::atmos_dyn_vars_restart_read ( )

Read restart.

Definition at line 195 of file mod_atmos_dyn_vars.f90.

References atmos_dyn_restart_in_basename, atmos_dyn_vars_fillhalo(), scale_stdio::io_fid_log, scale_stdio::io_l, prog, and scale_index::va.

Referenced by mod_atmos_vars::atmos_vars_restart_read().

195  use scale_fileio, only: &
196  fileio_read
197  use scale_rm_statistics, only: &
198  stat_total
199  implicit none
200 
201  real(RP) :: total
202  integer :: iv
203  !---------------------------------------------------------------------------
204 
205  if( io_l ) write(io_fid_log,*)
206  if( io_l ) write(io_fid_log,*) '*** Input restart file (ATMOS_DYN) ***'
207 
208  if ( atmos_dyn_restart_in_basename /= '' ) then
209  if( io_l ) write(io_fid_log,*) '*** basename: ', trim(atmos_dyn_restart_in_basename)
210 
211  do iv = 1, va
212  call fileio_read( prog(:,:,:,iv), & ! [OUT]
213  atmos_dyn_restart_in_basename, var_name(iv), 'ZXY', step=1 ) ! [IN]
214 
215  enddo
216 
217  call atmos_dyn_vars_fillhalo
218 
219  do iv = 1, va
220  call stat_total( total, prog(:,:,:,iv), var_name(iv) )
221  enddo
222  else
223  if( io_l ) write(io_fid_log,*) '*** restart file for ATMOS_DYN is not specified.'
224  endif
225 
226  return
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_write()

subroutine, public mod_atmos_dyn_vars::atmos_dyn_vars_restart_write ( )

Write restart.

Definition at line 232 of file mod_atmos_dyn_vars.f90.

References atmos_dyn_restart_out_basename, atmos_dyn_restart_out_dtype, atmos_dyn_restart_out_title, scale_stdio::io_fid_log, scale_stdio::io_l, prog, scale_time::time_gettimelabel(), and scale_index::va.

Referenced by mod_atmos_vars::atmos_vars_restart_write().

232  use scale_time, only: &
234  use scale_fileio, only: &
235  fileio_write
236  implicit none
237 
238  character(len=20) :: timelabel
239  character(len=H_LONG) :: basename
240  integer :: iv
241  !---------------------------------------------------------------------------
242 
243  if ( atmos_dyn_restart_out_basename /= '' ) then
244 
245  call time_gettimelabel( timelabel )
246  write(basename,'(A,A,A)') trim(atmos_dyn_restart_out_basename), '_', trim(timelabel)
247 
248  if( io_l ) write(io_fid_log,*)
249  if( io_l ) write(io_fid_log,*) '*** Output restart file (ATMOS_DYN) ***'
250  if( io_l ) write(io_fid_log,*) '*** basename: ', trim(basename)
251 
252  do iv = 1, va
253  call fileio_write( prog(:,:,:,iv), basename, atmos_dyn_restart_out_title, & ! [IN]
254  var_name(iv), var_desc(iv), var_unit(iv), 'ZXY', atmos_dyn_restart_out_dtype ) ! [IN]
255  enddo
256 
257  endif
258 
259  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
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 265 of file mod_atmos_dyn_vars.f90.

References atmos_dyn_restart_out_basename, atmos_dyn_restart_out_dtype, 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().

265  use scale_time, only: &
267  use scale_fileio, only: &
269  implicit none
270 
271  character(len=20) :: timelabel
272  character(len=H_LONG) :: basename
273  integer :: iv
274  !---------------------------------------------------------------------------
275 
276  if ( atmos_dyn_restart_out_basename /= '' ) then
277 
278  call time_gettimelabel( timelabel )
279  write(basename,'(A,A,A)') trim(atmos_dyn_restart_out_basename), '_', trim(timelabel)
280 
281  if( io_l ) write(io_fid_log,*)
282  if( io_l ) write(io_fid_log,*) '*** Output restart file (ATMOS_DYN) ***'
283  if( io_l ) write(io_fid_log,*) '*** basename: ', trim(basename)
284 
285  call fileio_create(restart_fid, basename, atmos_dyn_restart_out_title, &
286  atmos_dyn_restart_out_dtype ) ! [IN]
287  endif
288 
289  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 295 of file mod_atmos_dyn_vars.f90.

References scale_fileio::fileio_enddef().

Referenced by mod_atmos_vars::atmos_vars_restart_enddef().

295  use scale_fileio, only: &
297  implicit none
298 
299  if ( restart_fid .NE. -1 ) then
300  call fileio_enddef( restart_fid ) ! [IN]
301  endif
302 
303  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 309 of file mod_atmos_dyn_vars.f90.

References scale_fileio::fileio_close().

Referenced by mod_atmos_vars::atmos_vars_restart_close().

309  use scale_fileio, only: &
311  implicit none
312 
313  if ( restart_fid .NE. -1 ) then
314  call fileio_close( restart_fid ) ! [IN]
315  restart_fid = -1
316  endif
317 
318  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 324 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().

324  use scale_fileio, only: &
326  implicit none
327 
328  integer iv
329  !---------------------------------------------------------------------------
330 
331  if ( restart_fid .NE. -1 ) then
332 
333  do iv = 1, va
334  call fileio_def_var( restart_fid, var_id(iv), var_name(iv), var_desc(iv), &
335  var_unit(iv), 'ZXY', atmos_dyn_restart_out_dtype ) ! [IN]
336  enddo
337 
338  endif
339 
340  return
module FILE I/O (netcdf)
subroutine, public fileio_def_var(fid, vid, varname, desc, unit, axistype, datatype, timeintv)
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_var()

subroutine, public mod_atmos_dyn_vars::atmos_dyn_vars_restart_write_var ( )

Write variables to restart file.

Definition at line 346 of file mod_atmos_dyn_vars.f90.

References prog, and scale_index::va.

Referenced by mod_atmos_vars::atmos_vars_restart_write_var().

346  use scale_fileio, only: &
347  fileio_write_var
348  implicit none
349 
350  integer iv
351  !---------------------------------------------------------------------------
352 
353  if ( restart_fid .NE. -1 ) then
354 
355  do iv = 1, va
356  call fileio_write_var( restart_fid, var_id(iv), prog(:,:,:,iv), var_name(iv), 'ZXY' ) ! [IN]
357  enddo
358 
359  endif
360 
361  return
module FILE I/O (netcdf)
real(rp), dimension(:,:,:,:), allocatable, public prog
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 restart file

Definition at line 49 of file mod_atmos_dyn_vars.f90.

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

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

◆ 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 50 of file mod_atmos_dyn_vars.f90.

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

50  character(len=H_LONG), public :: atmos_dyn_restart_out_basename = ''

◆ 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 51 of file mod_atmos_dyn_vars.f90.

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

51  character(len=H_MID), public :: atmos_dyn_restart_out_title = 'ATMOS_DYN restart'

◆ atmos_dyn_restart_out_dtype

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

REAL4 or REAL8.

Definition at line 52 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(), atmos_dyn_vars_restart_write(), and atmos_dyn_vars_setup().

52  character(len=H_MID), public :: atmos_dyn_restart_out_dtype = 'DEFAULT'

◆ prog

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