SCALE-RM
Functions/Subroutines
scale_atmos_diagnostic Module Reference

module atmosphere / diagnostic More...

Functions/Subroutines

subroutine, public atmos_diagnostic_get_therm_rhot (KA, KS, KE, IA, IS, IE, JA, JS, JE, DENS, RHOT, Rtot, CVtot, CPtot, POTT, TEMP, PRES, EXNER)
 ATMOS_DIAGNOSTIC_get_therm_rhot potential temperature, temperature, pressure. More...
 
subroutine, public atmos_diagnostic_get_therm_rhoe (KA, KS, KE, IA, IS, IE, JA, JS, JE, DENS, RHOE, Rtot, CPtot, CVtot, TEMP, POTT, PRES, EXNER)
 ATMOS_DIAGNOSTIC_get_therm_rhoe potential temperature, temperature, pressure. More...
 
subroutine, public atmos_diagnostic_get_phyd (KA, KS, KE, IA, IS, IE, JA, JS, JE, DENS, PRES, CZ, FZ, PHYD, PHYDH)
 ATMOS_DIAGNOSTIC_get_phyd hydrostatic pressure. More...
 
subroutine, public atmos_diagnostic_get_n2 (KA, KS, KE, IA, IS, IE, JA, JS, JE, POTT, Rtot, CZ, FZ, F2H, N2)
 ATMOS_DIAGNOSTIC_get_n2 N^2. More...
 
subroutine, public atmos_diagnostic_get_potv (KA, KS, KE, IA, IS, IE, JA, JS, JE, POTT, Rtot, POTV)
 ATMOS_DIAGNOSTIC_get_potv virtual potential temperature. More...
 
subroutine, public atmos_diagnostic_get_teml (KA, KS, KE, IA, IS, IE, JA, JS, JE, TEMP, LHV, LHS, QC, QI, CPtot, TEML)
 ATMOS_DIAGNOSTIC_get_teml liqued water temperature. More...
 

Detailed Description

module atmosphere / diagnostic

Description
Calculate diagnostic variables
Author
Team SCALE

Function/Subroutine Documentation

◆ atmos_diagnostic_get_therm_rhot()

subroutine, public scale_atmos_diagnostic::atmos_diagnostic_get_therm_rhot ( integer, intent(in)  KA,
integer, intent(in)  KS,
integer, intent(in)  KE,
integer, intent(in)  IA,
integer, intent(in)  IS,
integer, intent(in)  IE,
integer, intent(in)  JA,
integer, intent(in)  JS,
integer, intent(in)  JE,
real(rp), dimension (ka,ia,ja), intent(in)  DENS,
real(rp), dimension (ka,ia,ja), intent(in)  RHOT,
real(rp), dimension (ka,ia,ja), intent(in)  Rtot,
real(rp), dimension(ka,ia,ja), intent(in)  CVtot,
real(rp), dimension(ka,ia,ja), intent(in)  CPtot,
real(rp), dimension (ka,ia,ja), intent(out)  POTT,
real(rp), dimension (ka,ia,ja), intent(out)  TEMP,
real(rp), dimension (ka,ia,ja), intent(out)  PRES,
real(rp), dimension(ka,ia,ja), intent(out)  EXNER 
)

ATMOS_DIAGNOSTIC_get_therm_rhot potential temperature, temperature, pressure.

Definition at line 59 of file scale_atmos_diagnostic.F90.

59  use scale_atmos_thermodyn, only: &
60  thermodyn_rhot2temp_pres => atmos_thermodyn_rhot2temp_pres
61  integer, intent(in) :: KA, KS, KE
62  integer, intent(in) :: IA, IS, IE
63  integer, intent(in) :: JA, JS, JE
64 
65  real(RP), intent(in) :: DENS (KA,IA,JA)
66  real(RP), intent(in) :: RHOT (KA,IA,JA)
67  real(RP), intent(in) :: Rtot (KA,IA,JA)
68  real(RP), intent(in) :: CVtot(KA,IA,JA)
69  real(RP), intent(in) :: CPtot(KA,IA,JA)
70 
71  real(RP), intent(out) :: POTT (KA,IA,JA)
72  real(RP), intent(out) :: TEMP (KA,IA,JA)
73  real(RP), intent(out) :: PRES (KA,IA,JA)
74  real(RP), intent(out) :: EXNER(KA,IA,JA)
75 
76  integer :: k, i, j
77  !---------------------------------------------------------------------------
78 
79  !$acc data copyin(DENS, RHOT, Rtot, CVtot, CPtot) copyout(POTT, TEMP, PRES, EXNER)
80 
81  call thermodyn_rhot2temp_pres( ka, ks, ke, ia, is, ie, ja, js, je, &
82  dens(:,:,:), rhot(:,:,:), & ! (in)
83  rtot(:,:,:), cvtot(:,:,:), cptot(:,:,:), & ! (in)
84  temp(:,:,:), pres(:,:,:) ) ! (out)
85 
86 
87 !OCL XFILL
88  !$omp parallel do default(none) OMP_SCHEDULE_ collapse(2) &
89  !$omp private(i,j,k) &
90  !$omp shared(POTT,EXNER,RHOT,DENS,TEMP) &
91  !$omp shared(KS,KE,IS,IE,JS,JE)
92  !$acc kernels
93  do j = js, je
94  do i = is, ie
95  do k = ks, ke
96  pott(k,i,j) = rhot(k,i,j) / dens(k,i,j)
97  exner(k,i,j) = temp(k,i,j) / pott(k,i,j)
98  enddo
99  enddo
100  enddo
101  !$acc end kernels
102 
103  !$acc end data
104 
105  return

Referenced by mod_atmos_vars::atmos_vars_calc_diagnostics().

Here is the caller graph for this function:

◆ atmos_diagnostic_get_therm_rhoe()

subroutine, public scale_atmos_diagnostic::atmos_diagnostic_get_therm_rhoe ( integer, intent(in)  KA,
integer, intent(in)  KS,
integer, intent(in)  KE,
integer, intent(in)  IA,
integer, intent(in)  IS,
integer, intent(in)  IE,
integer, intent(in)  JA,
integer, intent(in)  JS,
integer, intent(in)  JE,
real(rp), dimension (ka,ia,ja), intent(in)  DENS,
real(rp), dimension (ka,ia,ja), intent(in)  RHOE,
real(rp), dimension (ka,ia,ja), intent(in)  Rtot,
real(rp), dimension(ka,ia,ja), intent(in)  CPtot,
real(rp), dimension(ka,ia,ja), intent(in)  CVtot,
real(rp), dimension (ka,ia,ja), intent(out)  TEMP,
real(rp), dimension (ka,ia,ja), intent(out)  POTT,
real(rp), dimension (ka,ia,ja), intent(out)  PRES,
real(rp), dimension(ka,ia,ja), intent(out)  EXNER 
)

ATMOS_DIAGNOSTIC_get_therm_rhoe potential temperature, temperature, pressure.

Definition at line 116 of file scale_atmos_diagnostic.F90.

116  use scale_const, only: &
117  pre00 => const_pre00
118  implicit none
119  integer, intent(in) :: KA, KS, KE
120  integer, intent(in) :: IA, IS, IE
121  integer, intent(in) :: JA, JS, JE
122 
123  real(RP), intent(in) :: DENS (KA,IA,JA)
124  real(RP), intent(in) :: RHOE (KA,IA,JA)
125  real(RP), intent(in) :: Rtot (KA,IA,JA)
126  real(RP), intent(in) :: CPtot(KA,IA,JA)
127  real(RP), intent(in) :: CVtot(KA,IA,JA)
128 
129  real(RP), intent(out) :: POTT (KA,IA,JA)
130  real(RP), intent(out) :: TEMP (KA,IA,JA)
131  real(RP), intent(out) :: PRES (KA,IA,JA)
132  real(RP), intent(out) :: EXNER(KA,IA,JA)
133 
134  integer :: i, j, k
135 
136  !$omp parallel do
137  !$acc kernels
138  do j = js, je
139  do i = is, ie
140  do k = ks, ke
141  temp(k,i,j) = rhoe(k,i,j) / ( cvtot(k,i,j) * dens(k,i,j) )
142  pres(k,i,j) = dens(k,i,j) * rtot(k,i,j) * temp(k,i,j)
143  exner(k,i,j) = ( pres(k,i,j) / pre00 )**( rtot(k,i,j) / cptot(k,i,j) )
144  pott(k,i,j) = temp(k,i,j) / exner(k,i,j)
145  end do
146  end do
147  end do
148  !$acc end kernels
149 
150  return

References scale_const::const_pre00.

◆ atmos_diagnostic_get_phyd()

subroutine, public scale_atmos_diagnostic::atmos_diagnostic_get_phyd ( integer, intent(in)  KA,
integer, intent(in)  KS,
integer, intent(in)  KE,
integer, intent(in)  IA,
integer, intent(in)  IS,
integer, intent(in)  IE,
integer, intent(in)  JA,
integer, intent(in)  JS,
integer, intent(in)  JE,
real(rp), dimension ( ka,ia,ja), intent(in)  DENS,
real(rp), dimension ( ka,ia,ja), intent(in)  PRES,
real(rp), dimension ( ka,ia,ja), intent(in)  CZ,
real(rp), dimension (0:ka,ia,ja), intent(in)  FZ,
real(rp), dimension ( ka,ia,ja), intent(out)  PHYD,
real(rp), dimension(0:ka,ia,ja), intent(out)  PHYDH 
)

ATMOS_DIAGNOSTIC_get_phyd hydrostatic pressure.

Definition at line 165 of file scale_atmos_diagnostic.F90.

165  use scale_const, only: &
166  eps => const_eps, &
167  grav => const_grav
168  implicit none
169 
170  integer, intent(in) :: KA, KS, KE
171  integer, intent(in) :: IA, IS, IE
172  integer, intent(in) :: JA, JS, JE
173  real(RP), intent(in) :: DENS ( KA,IA,JA)
174  real(RP), intent(in) :: PRES ( KA,IA,JA)
175  real(RP), intent(in) :: CZ ( KA,IA,JA)
176  real(RP), intent(in) :: FZ (0:KA,IA,JA)
177  real(RP), intent(out) :: PHYD ( KA,IA,JA)
178  real(RP), intent(out) :: PHYDH(0:KA,IA,JA)
179 
180  real(RP) :: diff
181 
182  integer :: k, i, j
183  !---------------------------------------------------------------------------
184 
185  !$omp parallel do default(none) OMP_SCHEDULE_ &
186  !$omp private(i,j,k) &
187  !$omp private(diff) &
188  !$omp shared(PHYD,PHYDH,DENS,PRES,CZ,FZ,GRAV,EPS) &
189  !$omp shared(KS,KE,IS,IE,JS,JE)
190  !$acc kernels copyin(DENS, CZ, FZ) copyout(PHYD, PHYDH)
191  do j = js, je
192  do i = is, ie
193  phydh(ke,i,j) = pres(ke,i,j) - dens(ke,i,j) * grav * ( fz(ke,i,j) - cz(ke,i,j) )
194  do k = ke-1, ks-1, -1
195  phydh(k,i,j) = phydh(k+1,i,j) + dens(k+1,i,j) * grav * ( fz(k+1,i,j) - fz(k,i,j) )
196  end do
197  phyd(ke,i,j) = pres(ke,i,j)
198  do k = ke-1, ks, -1
199  phyd(k,i,j) = phyd(k+1,i,j) + ( dens(k+1,i,j) + dens(k,i,j) ) * grav * ( cz(k+1,i,j) - cz(k,i,j) ) * 0.5_rp
200  end do
201  diff = 0.0_rp
202  do k = ks, ke-1
203  diff = diff + ( pres(k,i,j) - phyd(k,i,j) ) * ( fz(k,i,j) - fz(k-1,i,j) )
204  end do
205  diff = diff / ( fz(ke,i,j) - fz(ks-1,i,j) )
206  diff = max( diff, eps - phydh(ke,i,j) )
207  do k = ks-1, ke
208  phydh(k,i,j) = phydh(k,i,j) + diff
209  end do
210  do k = ks, ke
211  phyd(k,i,j) = phyd(k,i,j) + diff
212  end do
213  enddo
214  enddo
215  !$acc end kernels
216 
217  return

References scale_const::const_eps, and scale_const::const_grav.

Referenced by mod_atmos_vars::atmos_vars_calc_diagnostics().

Here is the caller graph for this function:

◆ atmos_diagnostic_get_n2()

subroutine, public scale_atmos_diagnostic::atmos_diagnostic_get_n2 ( integer, intent(in)  KA,
integer, intent(in)  KS,
integer, intent(in)  KE,
integer, intent(in)  IA,
integer, intent(in)  IS,
integer, intent(in)  IE,
integer, intent(in)  JA,
integer, intent(in)  JS,
integer, intent(in)  JE,
real(rp), dimension(ka,ia,ja), intent(in)  POTT,
real(rp), dimension(ka,ia,ja), intent(in)  Rtot,
real(rp), dimension ( ka,ia,ja), intent(in)  CZ,
real(rp), dimension (0:ka,ia,ja), intent(in)  FZ,
real(rp), dimension(ka,2,ia,ja), intent(in)  F2H,
real(rp), dimension (ka,ia,ja), intent(out)  N2 
)

ATMOS_DIAGNOSTIC_get_n2 N^2.

Definition at line 231 of file scale_atmos_diagnostic.F90.

231  use scale_const, only: &
232  grav => const_grav
233  integer, intent(in) :: KA, KS, KE
234  integer, intent(in) :: IA, IS, IE
235  integer, intent(in) :: JA, JS, JE
236 
237  real(RP), intent(in) :: POTT(KA,IA,JA)
238  real(RP), intent(in) :: Rtot(KA,IA,JA)
239 
240  real(RP), intent(in) :: CZ ( KA,IA,JA)
241  real(RP), intent(in) :: FZ (0:KA,IA,JA)
242  real(RP), intent(in) :: F2H(KA,2,IA,JA)
243 
244  real(RP), intent(out) :: N2 (KA,IA,JA)
245 
246  real(RP) :: RPT(KA)
247  real(RP) :: RPT_h(KA)
248 
249  integer :: k, i, j
250  !---------------------------------------------------------------------------
251 
252  !$omp parallel do default(none) OMP_SCHEDULE_ collapse(2) &
253  !$omp private(i,j,k) &
254  !$omp private(RPT,RPT_h) &
255  !$omp shared(N2,POTT,Rtot,CZ,FZ,F2H,GRAV) &
256  !$omp shared(KS,KE,IS,IE,JS,JE)
257  !$acc kernels
258  !$acc loop private(RPT,RPT_h)
259  do j = js, je
260  !$acc loop private(RPT,RPT_h)
261  do i = is, ie
262  do k = ks, ke
263  rpt(k) = rtot(k,i,j) * pott(k,i,j)
264  end do
265 
266  do k = ks, ke-1
267  rpt_h(k) = f2h(k,1,i,j) * rpt(k+1) + f2h(k,2,i,j) * rpt(k)
268  end do
269 
270  n2(ks,i,j) = grav * ( rpt_h(ks) - rpt(ks) ) / ( ( fz(ks,i,j) - cz(ks,i,j) ) * rpt(ks) )
271  do k = ks+1,ke-1
272  n2(k,i,j) = grav * ( rpt_h(k) - rpt_h(k-1) ) / ( ( fz(k,i,j) - fz(k-1,i,j) ) * rpt(k) )
273  end do
274  n2(ke,i,j) = grav * ( rpt(ke) - rpt_h(ke-1) ) / ( ( cz(ke,i,j) - fz(ke-1,i,j) ) * rpt(ke) )
275  end do
276  end do
277  !$acc end kernels
278 
279  return

References scale_const::const_grav.

Referenced by mod_atmos_vars::atmos_vars_get_diagnostic_3d().

Here is the caller graph for this function:

◆ atmos_diagnostic_get_potv()

subroutine, public scale_atmos_diagnostic::atmos_diagnostic_get_potv ( integer, intent(in)  KA,
integer, intent(in)  KS,
integer, intent(in)  KE,
integer, intent(in)  IA,
integer, intent(in)  IS,
integer, intent(in)  IE,
integer, intent(in)  JA,
integer, intent(in)  JS,
integer, intent(in)  JE,
real(rp), dimension(ka,ia,ja), intent(in)  POTT,
real(rp), dimension(ka,ia,ja), intent(in)  Rtot,
real(rp), dimension(ka,ia,ja), intent(out)  POTV 
)

ATMOS_DIAGNOSTIC_get_potv virtual potential temperature.

Definition at line 293 of file scale_atmos_diagnostic.F90.

293  use scale_const, only: &
294  rdry => const_rdry
295  integer, intent(in) :: KA, KS, KE
296  integer, intent(in) :: IA, IS, IE
297  integer, intent(in) :: JA, JS, JE
298 
299  real(RP), intent(in) :: POTT(KA,IA,JA)
300  real(RP), intent(in) :: Rtot(KA,IA,JA)
301 
302  real(RP), intent(out) :: POTV(KA,IA,JA)
303 
304  integer :: k, i, j
305  !---------------------------------------------------------------------------
306 
307 !OCL XFILL
308  !$omp parallel do default(none) OMP_SCHEDULE_ collapse(2) &
309  !$omp private(i,j,k) &
310  !$omp shared(POTV,POTT,Rtot,Rdry) &
311  !$omp shared(KS,KE,IS,IE,JS,JE)
312  !$acc kernels
313  do j = js, je
314  do i = is, ie
315  do k = ks, ke
316  potv(k,i,j) = pott(k,i,j) * rtot(k,i,j) / rdry
317  end do
318  end do
319  end do
320  !$acc end kernels
321 
322  return

References scale_const::const_rdry.

Referenced by mod_atmos_vars::atmos_vars_get_diagnostic_3d().

Here is the caller graph for this function:

◆ atmos_diagnostic_get_teml()

subroutine, public scale_atmos_diagnostic::atmos_diagnostic_get_teml ( integer, intent(in)  KA,
integer, intent(in)  KS,
integer, intent(in)  KE,
integer, intent(in)  IA,
integer, intent(in)  IS,
integer, intent(in)  IE,
integer, intent(in)  JA,
integer, intent(in)  JS,
integer, intent(in)  JE,
real(rp), dimension (ka,ia,ja), intent(in)  TEMP,
real(rp), dimension (ka,ia,ja), intent(in)  LHV,
real(rp), dimension (ka,ia,ja), intent(in)  LHS,
real(rp), dimension (ka,ia,ja), intent(in)  QC,
real(rp), dimension (ka,ia,ja), intent(in)  QI,
real(rp), dimension(ka,ia,ja), intent(in)  CPtot,
real(rp), dimension(ka,ia,ja), intent(out)  TEML 
)

ATMOS_DIAGNOSTIC_get_teml liqued water temperature.

Definition at line 338 of file scale_atmos_diagnostic.F90.

338  integer, intent(in) :: KA, KS, KE
339  integer, intent(in) :: IA, IS, IE
340  integer, intent(in) :: JA, JS, JE
341 
342  real(RP), intent(in) :: TEMP (KA,IA,JA)
343  real(RP), intent(in) :: LHV (KA,IA,JA)
344  real(RP), intent(in) :: LHS (KA,IA,JA)
345  real(RP), intent(in) :: QC (KA,IA,JA)
346  real(RP), intent(in) :: QI (KA,IA,JA)
347  real(RP), intent(in) :: CPtot(KA,IA,JA)
348 
349  real(RP), intent(out) :: TEML(KA,IA,JA)
350 
351  integer :: k, i, j
352  !---------------------------------------------------------------------------
353 
354 !OCL XFILL
355  !$omp parallel do default(none) OMP_SCHEDULE_ collapse(2) &
356  !$omp private(i,j,k) &
357  !$omp shared(TEML,TEMP,LHV,LHS,QC,QI,CPtot) &
358  !$omp shared(KS,KE,IS,IE,JS,JE)
359  !$acc kernels
360  do j = js, je
361  do i = is, ie
362  do k = ks, ke
363  teml(k,i,j) = temp(k,i,j) &
364  - ( lhv(k,i,j) * qc(k,i,j) + lhs(k,i,j) * qi(k,i,j) ) / cptot(k,i,j)
365  end do
366  end do
367  end do
368  !$acc end kernels
369 
370  return

Referenced by mod_atmos_vars::atmos_vars_get_diagnostic_3d().

Here is the caller graph for this function:
scale_const::const_grav
real(rp), public const_grav
standard acceleration of gravity [m/s2]
Definition: scale_const.F90:49
scale_const::const_eps
real(rp), public const_eps
small number
Definition: scale_const.F90:35
scale_const
module CONSTANT
Definition: scale_const.F90:11
scale_atmos_grid_cartesc_index::ia
integer, public ia
Definition: scale_atmos_grid_cartesC_index.F90:48
scale_atmos_grid_cartesc_index::ja
integer, public ja
Definition: scale_atmos_grid_cartesC_index.F90:49
scale_atmos_thermodyn
module atmosphere / thermodyn
Definition: scale_atmos_thermodyn.F90:11
scale_const::const_rdry
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
Definition: scale_const.F90:59
scale_const::const_pre00
real(rp), public const_pre00
pressure reference [Pa]
Definition: scale_const.F90:97