SCALE-RM
mod_user.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
13 !-------------------------------------------------------------------------------
14 module mod_user
15  !-----------------------------------------------------------------------------
16  !
17  !++ used modules
18  !
19  use scale_precision
20  use scale_stdio
21  use scale_prof
23  use scale_tracer
24  !-----------------------------------------------------------------------------
25  implicit none
26  private
27  !-----------------------------------------------------------------------------
28  !
29  !++ Public procedure
30  !
31  public :: user_config
32  public :: user_setup
33  public :: user_resume0
34  public :: user_resume
35  public :: user_step
36 
37  !-----------------------------------------------------------------------------
38  !
39  !++ Public parameters & variables
40  !
41  !-----------------------------------------------------------------------------
42  !
43  !++ Private procedure
44  !
45  !-----------------------------------------------------------------------------
46  !
47  !++ Private parameters & variables
48  !
49  logical, private :: USER_do = .false.
50 
51  !-----------------------------------------------------------------------------
52 contains
53  !-----------------------------------------------------------------------------
55  subroutine user_config
56  use scale_tracer, only: &
58  implicit none
59 
60  ! if you want to add tracers, call the TRACER_regist subroutine.
61  ! e.g.,
62 ! integer, parameter :: NQ = 1
63 ! integer :: QS
64 ! character(len=H_SHORT) :: NAME(NQ)
65 ! character(len=H_MID) :: DESC(NQ)
66 ! character(len=H_SHORT) :: UNIT(NQ)
67 !
68 ! data NAME (/ 'name' /)
69 ! data DESC (/ 'tracer name' /)
70 ! data UNIT (/ 'kg/kg' /)
71  !---------------------------------------------------------------------------
72 
73 ! call TRACER_regist( QS, & ! [OUT]
74 ! NQ, & ! [IN]
75 ! NAME, & ! [IN]
76 ! DESC, & ! [IN]
77 ! UNIT ) ! [IN]
78 
79  return
80  end subroutine user_config
81 
82  !-----------------------------------------------------------------------------
84  subroutine user_setup
85  use scale_process, only: &
87  implicit none
88 
89  namelist / param_user / &
90  user_do
91 
92  integer :: ierr
93  !---------------------------------------------------------------------------
94 
95  if( io_l ) write(io_fid_log,*)
96  if( io_l ) write(io_fid_log,*) '++++++ Module[DRIVER] / Categ[USER] / Origin[SCALE-RM]'
97 
98  !--- read namelist
99  rewind(io_fid_conf)
100  read(io_fid_conf,nml=param_user,iostat=ierr)
101  if( ierr < 0 ) then !--- missing
102  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
103  elseif( ierr > 0 ) then !--- fatal error
104  write(*,*) 'xxx Not appropriate names in namelist PARAM_USER. Check!'
105  call prc_mpistop
106  endif
107  if( io_nml ) write(io_fid_nml,nml=param_user)
108 
109  if( io_l ) write(io_fid_log,*)
110  if( io_l ) write(io_fid_log,*) '*** This module is dummy.'
111 
112  return
113  end subroutine user_setup
114 
115  !-----------------------------------------------------------------------------
117  subroutine user_resume0
118  implicit none
119  !---------------------------------------------------------------------------
120 
121  ! If you need, calculate first step and put diagnostic value to history buffer.
122  ! USER_resume0 calls before setup of Atmos/Ocean/Land/Urban submodels.
123  ! All variables are set before surface coupling.
124 
125  !call USER_step
126 
127  return
128  end subroutine user_resume0
129 
130  !-----------------------------------------------------------------------------
132  subroutine user_resume
133  implicit none
134  !---------------------------------------------------------------------------
135 
136  ! If you need, calculate first step and put diagnostic value to history buffer.
137  ! USER_resume calls after setup of Atmos/Ocean/Land/Urban submodels.
138  ! All variables are set after surface coupling.
139 
140  !call USER_step
141 
142  return
143  end subroutine user_resume
144 
145  !-----------------------------------------------------------------------------
147  subroutine user_step
148  use scale_process, only: &
150  implicit none
151  !---------------------------------------------------------------------------
152 
153  if ( user_do ) then
154  call prc_mpistop
155  endif
156 
157  return
158  end subroutine user_step
159 
160 end module mod_user
subroutine, public prc_mpistop
Abort MPI.
subroutine, public user_step
User step.
Definition: mod_user.f90:148
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:61
module USER
Definition: mod_user.f90:14
module STDIO
Definition: scale_stdio.F90:12
module grid index
logical, public io_nml
output log or not? (for namelist, this process)
Definition: scale_stdio.F90:62
module TRACER
module PROCESS
module profiler
Definition: scale_prof.F90:10
subroutine, public user_resume
Resuming operation.
Definition: mod_user.f90:133
subroutine, public user_config
Config before setup of other components.
Definition: mod_user.f90:56
module PRECISION
integer, public io_fid_conf
Config file ID.
Definition: scale_stdio.F90:55
subroutine, public tracer_regist(QS, NQ, NAME, DESC, UNIT, CV, CP, R, ADVC, MASS)
Regist tracer.
subroutine, public user_setup
Setup before setup of other components.
Definition: mod_user.f90:85
subroutine, public user_resume0
Resuming operation, before calculating tendency.
Definition: mod_user.f90:118
integer, public io_fid_log
Log file ID.
Definition: scale_stdio.F90:56
integer, public io_fid_nml
Log file ID (only for output namelist)
Definition: scale_stdio.F90:57