SCALE-RM
scale_tracer.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
14 !-------------------------------------------------------------------------------
16  !-----------------------------------------------------------------------------
17  !
18  !++ used modules
19  !
20  use scale_precision
21  use scale_stdio
22  !-----------------------------------------------------------------------------
23  implicit none
24  private
25  !-----------------------------------------------------------------------------
26  !
27  !++ Public procedure
28  !
29  public :: tracer_regist
30 
31  !-----------------------------------------------------------------------------
32  !
33  !++ Public parameters & variables
34  !
35  integer, public :: qa = 0
36 
37  integer, private, parameter :: qa_max = 1024
38 
39  real(RP), public :: tracer_cp (qa_max)
40  real(RP), public :: tracer_cv (qa_max)
41  real(RP), public :: tracer_r (qa_max)
42  real(RP), public :: tracer_mass(qa_max)
43  logical, public :: tracer_advc(qa_max)
44  character(len=H_SHORT), public :: tracer_name(qa_max)
45  character(len=H_MID), public :: tracer_desc(qa_max)
46  character(len=H_SHORT), public :: tracer_unit(qa_max)
47 
48  !-----------------------------------------------------------------------------
49  !
50  !++ Private procedure
51  !
52  !-----------------------------------------------------------------------------
53  !
54  !++ Private parameters & variables
55  !
56  !-----------------------------------------------------------------------------
57 contains
58  !-----------------------------------------------------------------------------
60  subroutine tracer_regist( &
61  QS, &
62  NQ, NAME, DESC, UNIT, &
63  CV, CP, R, ADVC, MASS )
64  use scale_process, only: &
66  implicit none
67 
68  integer, intent(out) :: qs
69  integer, intent(in) :: nq
70  character(len=*), intent(in) :: name(nq)
71  character(len=*), intent(in) :: desc(nq)
72  character(len=*), intent(in) :: unit(nq)
73  real(RP), intent(in), optional :: cv (nq)
74  real(RP), intent(in), optional :: cp (nq)
75  real(RP), intent(in), optional :: r (nq)
76  logical, intent(in), optional :: advc(nq)
77  logical, intent(in), optional :: mass(nq)
78 
79  real(RP) :: cv_ (nq)
80  real(RP) :: cp_ (nq)
81  real(RP) :: r_ (nq)
82  logical :: advc_(nq)
83  logical :: mass_(nq)
84 
85  character(len=24) :: name_trim
86 
87  integer :: n
88  !---------------------------------------------------------------------------
89 
90  if ( qa + nq > qa_max ) then
91  write(*,*) 'xxx total number of tracer must be less or equal to ', qa_max
92  call prc_mpistop
93  end if
94 
95  if ( present(cv) ) then
96  cv_(:) = cv(:)
97  else
98  cv_(:) = 0.0_rp
99  end if
100 
101  if ( present(cp) ) then
102  cp_(:) = cp(:)
103  else
104  cp_(:) = 0.0_rp
105  end if
106 
107  if ( present(r) ) then
108  r_(:) = r(:)
109  else
110  r_(:) = 0.0_rp
111  end if
112 
113  if ( present(advc) ) then
114  advc_(:) = advc(:)
115  else
116  advc_(:) = .true.
117  end if
118 
119  if ( present(mass) ) then
120  mass_(:) = mass(:)
121  else
122  mass_(:) = .false.
123  end if
124 
125  if( io_l ) write(io_fid_log,*)
126  do n = 1, nq
127 
128  name_trim = trim(name(n))
129 
130  if( io_l ) write(io_fid_log,'(1x,A,I3,A,A,A,F6.1,A,F6.1,A,L1,A,L1)') &
131  '] Register tracer : No.', qa+n, &
132  ', NAME = ', name_trim, &
133  ', CV = ', cv_(n), &
134  ', CP = ', cp_(n), &
135  ', ADVC = ', advc_(n), &
136  ', MASS = ', mass_(n)
137 
138  tracer_name(qa+n) = name(n)
139  tracer_desc(qa+n) = desc(n)
140  tracer_unit(qa+n) = unit(n)
141  tracer_cv(qa+n) = cv_(n)
142  tracer_cp(qa+n) = cp_(n)
143  tracer_r(qa+n) = r_(n)
144  tracer_advc(qa+n) = advc_(n)
145 
146  if ( mass_(n) ) then
147  tracer_mass(qa+n) = 1.0_rp
148  else
149  tracer_mass(qa+n) = 0.0_rp
150  end if
151  end do
152 
153  qs = qa + 1
154  qa = qa + nq
155 
156  return
157  end subroutine tracer_regist
158 
159 end module scale_tracer
subroutine, public prc_mpistop
Abort MPI.
real(rp), dimension(qa_max), public tracer_r
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:61
module STDIO
Definition: scale_stdio.F90:12
integer, public qa
logical, dimension(qa_max), public tracer_advc
character(len=h_short), dimension(qa_max), public tracer_name
real(rp), dimension(qa_max), public tracer_cv
character(len=h_short), dimension(qa_max), public tracer_unit
real(rp), dimension(qa_max), public tracer_cp
module TRACER
module PROCESS
module PRECISION
character(len=h_mid), dimension(qa_max), public tracer_desc
subroutine, public tracer_regist(QS, NQ, NAME, DESC, UNIT, CV, CP, R, ADVC, MASS)
Regist tracer.
integer, public io_fid_log
Log file ID.
Definition: scale_stdio.F90:56
real(rp), dimension(qa_max), public tracer_mass