SCALE-RM
scale_atmos_sub_hydrometeor.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
13 !-------------------------------------------------------------------------------
15  !-----------------------------------------------------------------------------
16  !
17  !++ used modules
18  !
19  use scale_precision
20  use scale_stdio
22  !-----------------------------------------------------------------------------
23  implicit none
24  private
25  !-----------------------------------------------------------------------------
26  !
27  !++ Public procedure
28  !
29  public :: atmos_hydrometeor_setup
30  public :: atmos_hydrometeor_regist
31  public :: atmos_hydrometeor_lhv
32  public :: atmos_hydrometeor_lhs
33  public :: atmos_hydrometeor_lhf
34  public :: atmos_hydrometeor_entr
36 
37  interface atmos_hydrometeor_lhv
38  module procedure atmos_hydrometeor_lhv_0d
39  module procedure atmos_hydrometeor_lhv_1d
40  module procedure atmos_hydrometeor_lhv_2d
41  module procedure atmos_hydrometeor_lhv_3d
42  end interface atmos_hydrometeor_lhv
43 
44  interface atmos_hydrometeor_lhs
45  module procedure atmos_hydrometeor_lhs_0d
46  module procedure atmos_hydrometeor_lhs_1d
47  module procedure atmos_hydrometeor_lhs_2d
48  module procedure atmos_hydrometeor_lhs_3d
49  end interface atmos_hydrometeor_lhs
50 
51  interface atmos_hydrometeor_lhf
52  module procedure atmos_hydrometeor_lhf_0d
53  module procedure atmos_hydrometeor_lhf_1d
54  module procedure atmos_hydrometeor_lhf_2d
55  module procedure atmos_hydrometeor_lhf_3d
56  end interface atmos_hydrometeor_lhf
57 
58  interface atmos_hydrometeor_entr
59  module procedure atmos_hydrometeor_entr_0d
60  module procedure atmos_hydrometeor_entr_2d
61  module procedure atmos_hydrometeor_entr_3d
62  end interface atmos_hydrometeor_entr
63 
64  !-----------------------------------------------------------------------------
65  !
66  !++ Public parameters & variables
67  !
68  integer, public :: i_qv = -1
69 
70  integer, public, parameter :: n_hyd = 6
71 
72  integer, public, parameter :: i_hc = 1
73  integer, public, parameter :: i_hr = 2
74  integer, public, parameter :: i_hi = 3
75  integer, public, parameter :: i_hs = 4
76  integer, public, parameter :: i_hg = 5
77  integer, public, parameter :: i_hh = 6
78 
79  integer, public :: i_qc = -1
80  integer, public :: i_qr = -1
81  integer, public :: i_qi = -1
82  integer, public :: i_qs = -1
83  integer, public :: i_qg = -1
84  integer, public :: i_qh = -1
85 
86  integer, public :: i_nc = -1
87  integer, public :: i_nr = -1
88  integer, public :: i_ni = -1
89  integer, public :: i_ns = -1
90  integer, public :: i_ng = -1
91  integer, public :: i_nh = -1
92 
93  ! hydrometeor (water + ice)
94  integer, public :: qhs = -1
95  integer, public :: qhe = -2
96  ! water
97  integer, public :: qls = -1
98  integer, public :: qle = -2
99  ! ice
100  integer, public :: qis = -1
101  integer, public :: qie = -2
102 
103  real(RP), public :: lhv
104  real(RP), public :: lhs
105  real(RP), public :: lhf
106 
107  !-----------------------------------------------------------------------------
108  !
109  !++ Private procedure
110  !
111  !-----------------------------------------------------------------------------
112  !
113  !++ Private parameters & variables
114  !
115  real(RP), private :: cv_vapor
116  real(RP), private :: cp_vapor
117  real(RP), private :: cv_water
118  real(RP), private :: cp_water
119  real(RP), private :: cv_ice
120  real(RP), private :: cp_ice
121 
122  real(RP), private :: thermodyn_emask = 1.0_rp
123 
124  !-----------------------------------------------------------------------------
125 contains
126  !-----------------------------------------------------------------------------
128  subroutine atmos_hydrometeor_setup
129  use scale_const, only: &
130  cpvap => const_cpvap, &
131  cvvap => const_cvvap, &
132  cl => const_cl, &
133  ci => const_ci, &
134  lhv00 => const_lhv00, &
135  lhs00 => const_lhs00, &
136  lhf00 => const_lhf00, &
137  lhv0 => const_lhv0, &
138  lhs0 => const_lhs0, &
139  lhf0 => const_lhf0, &
140  thermodyn_type => const_thermodyn_type
141  use scale_process, only: &
143  implicit none
144  !---------------------------------------------------------------------------
145 
146  if( io_l ) write(io_fid_log,*)
147  if( io_l ) write(io_fid_log,*) '++++++ Module[HYDEROMETER] / Categ[ATMOS SHARE] / Origin[SCALElib]'
148 
149  if ( thermodyn_type == 'EXACT' ) then
150 
151  cv_vapor = cvvap
152  cp_vapor = cpvap
153  cv_water = cl
154  cp_water = cv_water
155  cv_ice = ci
156  cp_ice = cv_ice
157 
158  lhv = lhv00
159  lhs = lhs00
160  lhf = lhf00
161  thermodyn_emask = 1.0_rp
162 
163  elseif( thermodyn_type == 'SIMPLE' ) then
164 
165  cv_vapor = cvvap
166  cp_vapor = cpvap
167  cv_water = cvvap
168  cp_water = cv_water
169  cv_ice = cvvap
170  cp_ice = cv_ice
171 
172  lhv = lhv0
173  lhs = lhs0
174  lhf = lhf0
175  thermodyn_emask = 0.0_rp
176 
177  else
178  write(*,*) 'xxx Not appropriate ATMOS_THERMODYN_ENERGY_TYPE. Check!', trim(thermodyn_type)
179  call prc_mpistop
180  endif
181 
182  return
183  end subroutine atmos_hydrometeor_setup
184 
185  !-----------------------------------------------------------------------------
187  subroutine atmos_hydrometeor_regist( &
188  Q0, &
189  NV, &
190  NL, &
191  NI, &
192  NAME, &
193  DESC, &
194  UNIT, &
195  ADVC )
196  use scale_process, only: &
198  use scale_tracer, only: &
200  use scale_const, only: &
201  rvap => const_rvap
202  implicit none
203 
204  integer, intent(out) :: q0
205  integer, intent(in) :: nv
206  integer, intent(in) :: nl
207  integer, intent(in) :: ni
208  character(len=*), intent(in) :: name(nv+nl+ni)
209  character(len=*), intent(in) :: desc(nv+nl+ni)
210  character(len=*), intent(in) :: unit(nv+nl+ni)
211 
212  logical, intent(in), optional :: advc(nv+nl+ni)
213 
214  real(RP) :: cv (nv+nl+ni)
215  real(RP) :: cp (nv+nl+ni)
216  real(RP) :: r (nv+nl+ni)
217  logical :: mass (nv+nl+ni)
218  logical :: advc_(nv+nl+ni)
219 
220  integer :: nq
221  integer :: n
222  !---------------------------------------------------------------------------
223 
224  if ( i_qv > 0 ) then
225  write(*,*) 'xxx tracer for hydrometeor is already registerd'
226  call prc_mpistop
227  endif
228 
229  if ( nv /= 1 ) then
230  write(*,*) 'xxx number of vapor must be 1 at this moment'
231  call prc_mpistop
232  endif
233 
234  nq = 0
235 
236  do n = 1, nv
237  nq = nq + 1
238  cv(nq) = cv_vapor
239  cp(nq) = cp_vapor
240  r(nq) = rvap
241  end do
242 
243  do n = 1, nl
244  nq = nq + 1
245  cv(nq) = cv_water
246  cp(nq) = cp_water
247  r(nq) = 0.0_rp
248  end do
249 
250  do n = 1, ni
251  nq = nq + 1
252  cv(nq) = cv_ice
253  cp(nq) = cp_ice
254  r(nq) = 0.0_rp
255  end do
256 
257  ! NQ = 1 + NL + NI, vapor + liqid + ice
258 
259  if ( present(advc) ) then
260  advc_(:) = advc(:)
261  else
262  advc_(:) = .true.
263  endif
264 
265  do n = 1, nq
266  mass(n) = .true.
267  end do
268 
269  call tracer_regist( q0, & ! [OUT]
270  nq, & ! [IN]
271  name, & ! [IN]
272  desc, & ! [IN]
273  unit, & ! [IN]
274  cv, cp, r, & ! [IN], optional
275  advc_, mass ) ! [IN], optional
276 
277  i_qv = q0
278 
279  if ( nq > 1 ) then
280  qhs = i_qv + 1
281  qhe = qhs + nl + ni - 1
282  endif
283 
284  if ( nl > 0 ) then
285  qls = i_qv + 1
286  qle = qls + nl - 1
287  endif
288 
289  if ( ni > 0 ) then
290  qis = qle + 1
291  qie = qis + ni - 1
292  endif
293 
294  return
295  end subroutine atmos_hydrometeor_regist
296 
297  !-----------------------------------------------------------------------------
298  subroutine atmos_hydrometeor_lhv_0d( &
299  lhv, &
300  temp )
301  use scale_const, only: &
302  tem00 => const_tem00, &
303  lhv0 => const_lhv0
304  implicit none
305 
306  real(RP), intent(out) :: lhv
307  real(RP), intent(in) :: temp
308  !---------------------------------------------------------------------------
309 
310  lhv = lhv0 + ( cp_vapor - cp_water ) * ( temp - tem00 ) * thermodyn_emask
311 
312  return
313  end subroutine atmos_hydrometeor_lhv_0d
314 
315  !-----------------------------------------------------------------------------
316  subroutine atmos_hydrometeor_lhv_1d( &
317  lhv, &
318  temp )
319  use scale_const, only: &
320  tem00 => const_tem00, &
321  lhv0 => const_lhv0
322  implicit none
323 
324  real(RP), intent(out) :: lhv (KA)
325  real(RP), intent(in) :: temp(KA)
326 
327  integer :: k
328  !---------------------------------------------------------------------------
329 
330  do k = ks, ke
331  lhv(k) = lhv0 + ( cp_vapor - cp_water ) * ( temp(k) - tem00 ) * thermodyn_emask
332  enddo
333 
334  return
335  end subroutine atmos_hydrometeor_lhv_1d
336 
337  !-----------------------------------------------------------------------------
338  subroutine atmos_hydrometeor_lhv_2d( &
339  lhv, &
340  temp )
341  use scale_const, only: &
342  tem00 => const_tem00, &
343  lhv0 => const_lhv0
344  implicit none
345 
346  real(RP), intent(out) :: lhv (IA,JA)
347  real(RP), intent(in) :: temp(IA,JA)
348 
349  integer :: i, j
350  !---------------------------------------------------------------------------
351 
352  do j = jsb, jeb
353  do i = isb, ieb
354  lhv(i,j) = lhv0 + ( cp_vapor - cp_water ) * ( temp(i,j) - tem00 ) * thermodyn_emask
355  enddo
356  enddo
357 
358  return
359  end subroutine atmos_hydrometeor_lhv_2d
360 
361  !-----------------------------------------------------------------------------
362  subroutine atmos_hydrometeor_lhv_3d( &
363  lhv, &
364  temp )
365  use scale_const, only: &
366  tem00 => const_tem00, &
367  lhv0 => const_lhv0
368  implicit none
369 
370  real(RP), intent(out) :: lhv (KA,IA,JA)
371  real(RP), intent(in) :: temp(KA,IA,JA)
372 
373  integer :: k, i, j
374  !---------------------------------------------------------------------------
375 
376  do j = jsb, jeb
377  do i = isb, ieb
378  do k = ks, ke
379  lhv(k,i,j) = lhv0 + ( cp_vapor - cp_water ) * ( temp(k,i,j) - tem00 ) * thermodyn_emask
380  enddo
381  enddo
382  enddo
383 
384  return
385  end subroutine atmos_hydrometeor_lhv_3d
386 
387  !-----------------------------------------------------------------------------
388  subroutine atmos_hydrometeor_lhs_0d( &
389  lhs, &
390  temp )
391  use scale_const, only: &
392  tem00 => const_tem00, &
393  lhs0 => const_lhs0
394  implicit none
395 
396  real(RP), intent(out) :: lhs
397  real(RP), intent(in) :: temp
398  !---------------------------------------------------------------------------
399 
400  lhs = lhs0 + ( cp_vapor - cp_ice ) * ( temp - tem00 ) * thermodyn_emask
401 
402  return
403  end subroutine atmos_hydrometeor_lhs_0d
404 
405  !-----------------------------------------------------------------------------
406  subroutine atmos_hydrometeor_lhs_1d( &
407  lhs, &
408  temp )
409  use scale_const, only: &
410  tem00 => const_tem00, &
411  lhs0 => const_lhs0
412  implicit none
413 
414  real(RP), intent(out) :: lhs (KA)
415  real(RP), intent(in) :: temp(KA)
416 
417  integer :: k
418  !---------------------------------------------------------------------------
419 
420  do k = ks, ke
421  lhs(k) = lhs0 + ( cp_vapor - cp_ice ) * ( temp(k) - tem00 ) * thermodyn_emask
422  enddo
423 
424  return
425  end subroutine atmos_hydrometeor_lhs_1d
426 
427  !-----------------------------------------------------------------------------
428  subroutine atmos_hydrometeor_lhs_2d( &
429  lhs, &
430  temp )
431  use scale_const, only: &
432  tem00 => const_tem00, &
433  lhs0 => const_lhs0
434  implicit none
435 
436  real(RP), intent(out) :: lhs (IA,JA)
437  real(RP), intent(in) :: temp(IA,JA)
438 
439  integer :: i, j
440  !---------------------------------------------------------------------------
441 
442  do j = jsb, jeb
443  do i = isb, ieb
444  lhs(i,j) = lhs0 + ( cp_vapor - cp_ice ) * ( temp(i,j) - tem00 ) * thermodyn_emask
445  enddo
446  enddo
447 
448  return
449  end subroutine atmos_hydrometeor_lhs_2d
450 
451  !-----------------------------------------------------------------------------
452  subroutine atmos_hydrometeor_lhs_3d( &
453  lhs, &
454  temp )
455  use scale_const, only: &
456  tem00 => const_tem00, &
457  lhs0 => const_lhs0
458  implicit none
459 
460  real(RP), intent(out) :: lhs (KA,IA,JA)
461  real(RP), intent(in) :: temp(KA,IA,JA)
462 
463  integer :: k, i, j
464  !---------------------------------------------------------------------------
465 
466  do j = jsb, jeb
467  do i = isb, ieb
468  do k = ks, ke
469  lhs(k,i,j) = lhs0 + ( cp_vapor - cp_ice ) * ( temp(k,i,j) - tem00 ) * thermodyn_emask
470  enddo
471  enddo
472  enddo
473 
474  return
475  end subroutine atmos_hydrometeor_lhs_3d
476 
477  !-----------------------------------------------------------------------------
478  subroutine atmos_hydrometeor_lhf_0d( &
479  lhf, &
480  temp )
481  use scale_const, only: &
482  tem00 => const_tem00, &
483  lhf0 => const_lhf0
484  implicit none
485 
486  real(RP), intent(out) :: lhf
487  real(RP), intent(in) :: temp
488  !---------------------------------------------------------------------------
489 
490  lhf = lhf0 + ( cp_water - cp_ice ) * ( temp - tem00 ) * thermodyn_emask
491 
492  return
493  end subroutine atmos_hydrometeor_lhf_0d
494 
495  !-----------------------------------------------------------------------------
496  subroutine atmos_hydrometeor_lhf_1d( &
497  lhf, &
498  temp )
499  use scale_const, only: &
500  tem00 => const_tem00, &
501  lhf0 => const_lhf0
502  implicit none
503 
504  real(RP), intent(out) :: lhf (KA)
505  real(RP), intent(in) :: temp(KA)
506 
507  integer :: k
508  !---------------------------------------------------------------------------
509 
510  do k = ks, ke
511  lhf(k) = lhf0 + ( cp_water - cp_ice ) * ( temp(k) - tem00 ) * thermodyn_emask
512  enddo
513 
514  return
515  end subroutine atmos_hydrometeor_lhf_1d
516 
517  !-----------------------------------------------------------------------------
518  subroutine atmos_hydrometeor_lhf_2d( &
519  lhf, &
520  temp )
521  use scale_const, only: &
522  tem00 => const_tem00, &
523  lhf0 => const_lhf0
524  implicit none
525 
526  real(RP), intent(out) :: lhf (IA,JA)
527  real(RP), intent(in) :: temp(IA,JA)
528 
529  integer :: i, j
530  !---------------------------------------------------------------------------
531 
532  do j = jsb, jeb
533  do i = isb, ieb
534  lhf(i,j) = lhf0 + ( cp_water - cp_ice ) * ( temp(i,j) - tem00 ) * thermodyn_emask
535  enddo
536  enddo
537 
538  return
539  end subroutine atmos_hydrometeor_lhf_2d
540 
541  !-----------------------------------------------------------------------------
542  subroutine atmos_hydrometeor_lhf_3d( &
543  lhf, &
544  temp )
545  use scale_const, only: &
546  tem00 => const_tem00, &
547  lhf0 => const_lhf0
548  implicit none
549 
550  real(RP), intent(out) :: lhf (KA,IA,JA)
551  real(RP), intent(in) :: temp(KA,IA,JA)
552 
553  integer :: k, i, j
554  !---------------------------------------------------------------------------
555 
556  do j = jsb, jeb
557  do i = isb, ieb
558  do k = ks, ke
559  lhf(k,i,j) = lhf0 + ( cp_water - cp_ice ) * ( temp(k,i,j) - tem00 ) * thermodyn_emask
560  enddo
561  enddo
562  enddo
563 
564  return
565  end subroutine atmos_hydrometeor_lhf_3d
566 
567  !-----------------------------------------------------------------------------
569  subroutine atmos_hydrometeor_entr_0d( &
570  entr, &
571  temp, &
572  pres, &
573  q, &
574  Rq )
575  use scale_const, only: &
576  eps => const_eps, &
577  pre00 => const_pre00, &
578  tem00 => const_tem00, &
579  rdry => const_rdry, &
580  cpdry => const_cpdry, &
581  rvap => const_rvap, &
582  lhv0 => const_lhv0, &
583  lhf0 => const_lhf0, &
584  psat0 => const_psat0
585  use scale_tracer, only: &
586  qa
587  implicit none
588 
589  real(RP), intent(out) :: entr
590  real(RP), intent(in) :: temp
591  real(RP), intent(in) :: pres
592  real(RP), intent(in) :: q(QA)
593  real(RP), intent(in) :: Rq(QA)
594 
595  real(RP) :: qdry, Rtot
596  real(RP) :: logT_T0, pres_dry, pres_vap
597 
598  integer :: iqw
599  !---------------------------------------------------------------------------
600 
601  logt_t0 = log( temp / tem00 )
602 
603  qdry = 1.0_rp
604  rtot = 0.0_rp
605  do iqw = 1, qa
606  qdry = qdry - q(iqw)
607  rtot = rtot + q(iqw) * rq(iqw)
608  enddo
609  rtot = rtot + rdry * qdry
610 
611  ! dry air + vapor
612  pres_dry = max( pres * qdry * rdry / rtot, eps )
613  entr = qdry * cpdry * logt_t0 &
614  - qdry * rdry * log( pres_dry / pre00 )
615 
616  if ( i_qv > 0 ) then
617  pres_vap = max( pres * q(i_qv) * rvap / rtot, eps )
618  entr = entr + q(i_qv) * cp_vapor * logt_t0 &
619  - q(i_qv) * rvap * log( pres_vap / psat0 ) &
620  + q(i_qv) * lhv0 / tem00
621  endif
622 
623  ! liquid water
624  if ( qls > 0 ) then
625  do iqw = qls, qle
626  entr = entr + q(iqw) * cp_water * logt_t0
627  enddo
628  endif
629 
630  ! ice
631  if ( qis > 0 ) then
632  do iqw = qis, qie
633  entr = entr + q(iqw) * cp_ice * logt_t0 &
634  - q(iqw) * lhf0 / tem00
635  enddo
636  endif
637 
638  return
639  end subroutine atmos_hydrometeor_entr_0d
640 
641  !-----------------------------------------------------------------------------
643  subroutine atmos_hydrometeor_entr_2d( &
644  entr, &
645  temp, &
646  pres, &
647  q, &
648  Rq )
649  use scale_const, only: &
650  eps => const_eps, &
651  pre00 => const_pre00, &
652  tem00 => const_tem00, &
653  cpdry => const_cpdry, &
654  rdry => const_rdry, &
655  rvap => const_rvap, &
656  lhv0 => const_lhv0, &
657  lhf0 => const_lhf0, &
658  psat0 => const_psat0
659  use scale_tracer, only: &
660  qa
661  implicit none
662 
663  real(RP), intent(out) :: entr(IA,JA)
664  real(RP), intent(in) :: temp(IA,JA)
665  real(RP), intent(in) :: pres(IA,JA)
666  real(RP), intent(in) :: q (IA,JA,QA)
667  real(RP), intent(in) :: Rq (QA)
668 
669  real(RP) :: qdry, Rtot
670  real(RP) :: logT_T0, pres_dry, pres_vap
671 
672  integer :: i, j, iqw
673  !---------------------------------------------------------------------------
674 
675  ! dry air + vapor
676  do j = jsb, jeb
677  do i = isb, ieb
678 
679  logt_t0 = log( temp(i,j) / tem00 )
680 
681  qdry = 1.0_rp
682  rtot = 0.0_rp
683  do iqw = 1, qa
684  qdry = qdry - q(i,j,iqw)
685  rtot = rtot + q(i,j,iqw) * rq(iqw)
686  enddo
687  rtot = rtot + rdry * qdry
688 
689  ! dry air + vapor
690  pres_dry = max( pres(i,j) * qdry * rdry / rtot, eps )
691  entr(i,j) = qdry * cpdry * logt_t0 &
692  - qdry * rdry * log( pres_dry / pre00 )
693 
694  if ( i_qv > 0 ) then
695  pres_vap = max( pres(i,j) * q(i,j,i_qv) * rvap / rtot, eps )
696  entr(i,j) = entr(i,j) + q(i,j,i_qv) * cp_vapor * logt_t0 &
697  - q(i,j,i_qv) * rvap * log( pres_vap / psat0 ) &
698  + q(i,j,i_qv) * lhv0 / tem00
699  endif
700 
701  ! liquid water
702  if ( qls > 0 ) then
703  do iqw = qls, qle
704  entr(i,j) = entr(i,j) + q(i,j,iqw) * cp_water * logt_t0
705  enddo
706  endif
707 
708  ! ice
709  if ( qis > 0 ) then
710  do iqw = qis, qie
711  entr(i,j) = entr(i,j) + q(i,j,iqw) * cp_ice * logt_t0 &
712  - q(i,j,iqw) * lhf0 / tem00
713  enddo
714  endif
715 
716  enddo
717  enddo
718 
719  return
720  end subroutine atmos_hydrometeor_entr_2d
721 
722  !-----------------------------------------------------------------------------
724  subroutine atmos_hydrometeor_entr_3d( &
725  entr, &
726  temp, &
727  pres, &
728  q, &
729  Rq )
730  use scale_const, only: &
731  eps => const_eps, &
732  pre00 => const_pre00, &
733  tem00 => const_tem00, &
734  cpdry => const_cpdry, &
735  rdry => const_rdry, &
736  rvap => const_rvap, &
737  lhv0 => const_lhv0, &
738  lhf0 => const_lhf0, &
739  psat0 => const_psat0
740  use scale_tracer, only: &
741  qa
742  implicit none
743 
744  real(RP), intent(out) :: entr(KA,IA,JA)
745  real(RP), intent(in) :: temp(KA,IA,JA)
746  real(RP), intent(in) :: pres(KA,IA,JA)
747  real(RP), intent(in) :: q (KA,IA,JA,QA)
748  real(RP), intent(in) :: Rq (QA)
749 
750  real(RP) :: qdry, Rtot
751  real(RP) :: logT_T0, pres_dry, pres_vap
752 
753  integer :: k, i, j, iqw
754  !---------------------------------------------------------------------------
755 
756  ! dry air + vapor
757  do j = jsb, jeb
758  do i = isb, ieb
759  do k = ks, ke
760 
761  logt_t0 = log( temp(k,i,j) / tem00 )
762 
763  qdry = 1.0_rp
764  rtot = 0.0_rp
765  do iqw = 1, qa
766  qdry = qdry - q(k,i,j,iqw)
767  rtot = rtot + q(k,i,j,iqw) * rq(iqw)
768  enddo
769  rtot = rtot + rdry * qdry
770 
771  ! dry air + vapor
772  pres_dry = max( pres(k,i,j) * qdry * rdry / rtot, eps )
773  entr(k,i,j) = qdry * cpdry * logt_t0 &
774  - qdry * rdry * log( pres_dry / pre00 )
775 
776  if ( i_qv > 0 ) then
777  pres_vap = max( pres(k,i,j) * q(k,i,j,i_qv) * rvap / rtot, eps )
778  entr(k,i,j) = entr(k,i,j) + q(k,i,j,i_qv) * cp_vapor * logt_t0 &
779  - q(k,i,j,i_qv) * rvap * log( pres_vap / psat0 ) &
780  + q(k,i,j,i_qv) * lhv0 / tem00
781  endif
782 
783  ! liquid water
784  if ( qls > 0 ) then
785  do iqw = qls, qle
786  entr(k,i,j) = entr(k,i,j) + q(k,i,j,iqw) * cp_water * logt_t0
787  enddo
788  endif
789 
790  ! ice
791  if ( qis > 0 ) then
792  do iqw = qis, qie
793  entr(k,i,j) = entr(k,i,j) + q(k,i,j,iqw) * cp_ice * logt_t0 &
794  - q(k,i,j,iqw) * lhf0 / tem00
795  enddo
796  endif
797 
798  enddo
799  enddo
800  enddo
801 
802  return
803  end subroutine atmos_hydrometeor_entr_3d
804 
805  !-----------------------------------------------------------------------------
807  QTRC )
808  use scale_const, only: &
809  pi => const_pi
810  implicit none
811 
812  real(RP), intent(inout) :: qtrc(:,:,:,:)
813 
814  real(RP), parameter :: dc = 20.e-6_rp ! typical particle diameter for cloud [m]
815  real(RP), parameter :: dr = 200.e-6_rp ! typical particle diameter for rain [m]
816  real(RP), parameter :: di = 80.e-6_rp ! typical particle diameter for ice [m]
817  real(RP), parameter :: ds = 80.e-6_rp ! typical particle diameter for snow [m]
818  real(RP), parameter :: dg = 200.e-6_rp ! typical particle diameter for grapel [m]
819  real(RP), parameter :: rhow = 1000.0_rp ! typical density for warm particles [kg/m3]
820  real(RP), parameter :: rhof = 100.0_rp ! typical density for frozen particles [kg/m3]
821  real(RP), parameter :: rhog = 400.0_rp ! typical density for grapel particles [kg/m3]
822  real(RP), parameter :: b = 3.0_rp ! assume spherical form
823 
824  real(RP) :: piov6
825  !---------------------------------------------------------------------------
826 
827  piov6 = pi / 6.0_rp
828 
829  if ( i_nc > 0 ) qtrc(:,:,:,i_nc) = qtrc(:,:,:,i_qc) / ( (piov6*rhow) * dc**b )
830  if ( i_nr > 0 ) qtrc(:,:,:,i_nr) = qtrc(:,:,:,i_qr) / ( (piov6*rhow) * dr**b )
831  if ( i_ni > 0 ) qtrc(:,:,:,i_ni) = qtrc(:,:,:,i_qi) / ( (piov6*rhof) * di**b )
832  if ( i_ns > 0 ) qtrc(:,:,:,i_ns) = qtrc(:,:,:,i_qs) / ( (piov6*rhof) * ds**b )
833  if ( i_ng > 0 ) qtrc(:,:,:,i_ng) = qtrc(:,:,:,i_qg) / ( (piov6*rhog) * dg**b )
834 
835  return
837 
838 end module scale_atmos_hydrometeor
subroutine atmos_hydrometeor_lhv_3d(lhv, temp)
subroutine atmos_hydrometeor_lhv_2d(lhv, temp)
subroutine atmos_hydrometeor_lhs_1d(lhs, temp)
real(rp), parameter, public const_psat0
saturate pressure of water vapor at 0C [Pa]
Definition: scale_const.F90:83
real(rp), public const_cpdry
specific heat (dry air,constant pressure) [J/kg/K]
Definition: scale_const.F90:58
subroutine atmos_hydrometeor_lhs_2d(lhs, temp)
subroutine, public prc_mpistop
Abort MPI.
integer, public jeb
real(rp), parameter, public const_ci
specific heat (ice) [J/kg/K]
Definition: scale_const.F90:69
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:61
integer, parameter, public i_hs
snow
subroutine atmos_hydrometeor_entr_3d(entr, temp, pres, q, Rq)
calc temp, pres, q -> entropy (3D)
real(rp), parameter, public const_cl
specific heat (liquid water) [J/kg/K]
Definition: scale_const.F90:68
integer, parameter, public i_hr
liquid water rain
subroutine atmos_hydrometeor_lhv_0d(lhv, temp)
subroutine atmos_hydrometeor_lhf_2d(lhf, temp)
integer, parameter, public i_hi
ice water cloud
module STDIO
Definition: scale_stdio.F90:12
integer, public ke
end point of inner domain: z, local
real(rp), parameter, public const_tem00
temperature reference (0C) [K]
Definition: scale_const.F90:92
integer, public qa
subroutine atmos_hydrometeor_entr_0d(entr, temp, pres, q, Rq)
calc temp, pres, q -> entropy (0D)
real(rp), public const_cvvap
specific heat (water vapor, constant volume) [J/kg/K]
Definition: scale_const.F90:67
integer, parameter, public i_hh
hail
subroutine, public atmos_hydrometeor_diagnose_number_concentration(QTRC)
subroutine atmos_hydrometeor_entr_2d(entr, temp, pres, q, Rq)
calc temp, pres, q -> entropy (2D)
real(rp), public const_lhf0
latent heat of fusion at 0C [J/kg]
Definition: scale_const.F90:81
subroutine atmos_hydrometeor_lhf_0d(lhf, temp)
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
Definition: scale_const.F90:57
integer, public ieb
real(rp), parameter, public const_lhs0
latent heat of sublimation at 0C [J/kg]
Definition: scale_const.F90:79
module grid index
module TRACER
subroutine atmos_hydrometeor_lhs_0d(lhs, temp)
real(rp), parameter, public const_lhv0
latent heat of vaporizaion at 0C [J/kg]
Definition: scale_const.F90:77
real(rp), public const_pre00
pressure reference [Pa]
Definition: scale_const.F90:90
real(rp), public const_lhf00
latent heat of fusion at 0K [J/kg]
Definition: scale_const.F90:82
subroutine atmos_hydrometeor_lhv_1d(lhv, temp)
module PROCESS
real(rp), public const_lhs00
latent heat of sublimation at 0K [J/kg]
Definition: scale_const.F90:80
real(rp), public const_lhv00
latent heat of vaporizaion at 0K [J/kg]
Definition: scale_const.F90:78
real(rp), public lhf
latent heat of fusion for use [J/kg]
subroutine atmos_hydrometeor_lhs_3d(lhs, temp)
real(rp), parameter, public const_rvap
specific gas constant (water vapor) [J/kg/K]
Definition: scale_const.F90:65
real(rp), public lhv
latent heat of vaporization for use [J/kg]
real(rp), public lhs
latent heat of sublimation for use [J/kg]
module CONSTANT
Definition: scale_const.F90:14
integer, parameter, public i_hc
liquid water cloud
integer, public ks
start point of inner domain: z, local
real(rp), public const_eps
small number
Definition: scale_const.F90:36
subroutine, public atmos_hydrometeor_setup
Setup.
module PRECISION
subroutine, public atmos_hydrometeor_regist(Q0, NV, NL, NI, NAME, DESC, UNIT, ADVC)
Regist tracer.
integer, public isb
real(rp), public const_pi
pi
Definition: scale_const.F90:34
subroutine atmos_hydrometeor_lhf_3d(lhf, temp)
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
integer, parameter, public n_hyd
real(rp), parameter, public const_cpvap
specific heat (water vapor, constant pressure) [J/kg/K]
Definition: scale_const.F90:66
integer, public jsb
character(len=h_short), public const_thermodyn_type
internal energy type
Definition: scale_const.F90:98
integer, parameter, public i_hg
graupel
subroutine atmos_hydrometeor_lhf_1d(lhf, temp)