194 real(wp),
dimension(ntb_c),
parameter :: &
195 r_c = [1.e-6_wp,2.e-6_wp,3.e-6_wp,4.e-6_wp,5.e-6_wp,6.e-6_wp,7.e-6_wp,8.e-6_wp,9.e-6_wp, &
196 1.e-5_wp,2.e-5_wp,3.e-5_wp,4.e-5_wp,5.e-5_wp,6.e-5_wp,7.e-5_wp,8.e-5_wp,9.e-5_wp, &
197 1.e-4_wp,2.e-4_wp,3.e-4_wp,4.e-4_wp,5.e-4_wp,6.e-4_wp,7.e-4_wp,8.e-4_wp,9.e-4_wp, &
198 1.e-3_wp,2.e-3_wp,3.e-3_wp,4.e-3_wp,5.e-3_wp,6.e-3_wp,7.e-3_wp,8.e-3_wp,9.e-3_wp, &
201 real(wp),
dimension(ntb_i),
parameter :: &
202 r_i = [1.e-10_wp,2.e-10_wp,3.e-10_wp,4.e-10_wp, &
203 5.e-10_wp,6.e-10_wp,7.e-10_wp,8.e-10_wp,9.e-10_wp, &
204 1.e-9_wp,2.e-9_wp,3.e-9_wp,4.e-9_wp,5.e-9_wp,6.e-9_wp,7.e-9_wp,8.e-9_wp,9.e-9_wp, &
205 1.e-8_wp,2.e-8_wp,3.e-8_wp,4.e-8_wp,5.e-8_wp,6.e-8_wp,7.e-8_wp,8.e-8_wp,9.e-8_wp, &
206 1.e-7_wp,2.e-7_wp,3.e-7_wp,4.e-7_wp,5.e-7_wp,6.e-7_wp,7.e-7_wp,8.e-7_wp,9.e-7_wp, &
207 1.e-6_wp,2.e-6_wp,3.e-6_wp,4.e-6_wp,5.e-6_wp,6.e-6_wp,7.e-6_wp,8.e-6_wp,9.e-6_wp, &
208 1.e-5_wp,2.e-5_wp,3.e-5_wp,4.e-5_wp,5.e-5_wp,6.e-5_wp,7.e-5_wp,8.e-5_wp,9.e-5_wp, &
209 1.e-4_wp,2.e-4_wp,3.e-4_wp,4.e-4_wp,5.e-4_wp,6.e-4_wp,7.e-4_wp,8.e-4_wp,9.e-4_wp, &
212 real(wp),
dimension(ntb_r),
parameter :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,3.e-3_wp,4.e-3_wp,5.e-3_wp,6.e-3_wp,7.e-3_wp,8.e-3_wp,9.e-3_wp, &
233 real(wp),
dimension(ntb_r1),
parameter :: &
234 n0r_exp = [1.e6_wp,2.e6_wp,3.e6_wp,4.e6_wp,5.e6_wp,6.e6_wp,7.e6_wp,8.e6_wp,9.e6_wp, &
235 1.e7_wp,2.e7_wp,3.e7_wp,4.e7_wp,5.e7_wp,6.e7_wp,7.e7_wp,8.e7_wp,9.e7_wp, &
236 1.e8_wp,2.e8_wp,3.e8_wp,4.e8_wp,5.e8_wp,6.e8_wp,7.e8_wp,8.e8_wp,9.e8_wp, &
237 1.e9_wp,2.e9_wp,3.e9_wp,4.e9_wp,5.e9_wp,6.e9_wp,7.e9_wp,8.e9_wp,9.e9_wp, &
240 real(wp),
dimension(ntb_g1),
parameter :: &
241 n0g_exp = [1.e2_wp,2.e2_wp,3.e2_wp,4.e2_wp,5.e2_wp,6.e2_wp,7.e2_wp,8.e2_wp,9.e2_wp, &
242 1.e3_wp,2.e3_wp,3.e3_wp,4.e3_wp,5.e3_wp,6.e3_wp,7.e3_wp,8.e3_wp,9.e3_wp, &
243 1.e4_wp,2.e4_wp,3.e4_wp,4.e4_wp,5.e4_wp,6.e4_wp,7.e4_wp,8.e4_wp,9.e4_wp, &
244 1.e5_wp,2.e5_wp,3.e5_wp,4.e5_wp,5.e5_wp,6.e5_wp,7.e5_wp,8.e5_wp,9.e5_wp, &
247 real(wp),
dimension(ntb_i1),
parameter :: &
248 nt_i = [1.0_wp,2.0_wp,3.0_wp,4.0_wp,5.0_wp,6.0_wp,7.0_wp,8.0_wp,9.0_wp, &
249 1.e1_wp,2.e1_wp,3.e1_wp,4.e1_wp,5.e1_wp,6.e1_wp,7.e1_wp,8.e1_wp,9.e1_wp, &
250 1.e2_wp,2.e2_wp,3.e2_wp,4.e2_wp,5.e2_wp,6.e2_wp,7.e2_wp,8.e2_wp,9.e2_wp, &
251 1.e3_wp,2.e3_wp,3.e3_wp,4.e3_wp,5.e3_wp,6.e3_wp,7.e3_wp,8.e3_wp,9.e3_wp, &
252 1.e4_wp,2.e4_wp,3.e4_wp,4.e4_wp,5.e4_wp,6.e4_wp,7.e4_wp,8.e4_wp,9.e4_wp, &
253 1.e5_wp,2.e5_wp,3.e5_wp,4.e5_wp,5.e5_wp,6.e5_wp,7.e5_wp,8.e5_wp,9.e5_wp, &
256 real(wp),
dimension(ntb_in),
parameter :: &
257 nt_in = [1.0_wp,2.0_wp,3.0_wp,4.0_wp,5.0_wp,6.0_wp,7.0_wp,8.0_wp,9.0_wp, &
258 1.e1_wp,2.e1_wp,3.e1_wp,4.e1_wp,5.e1_wp,6.e1_wp,7.e1_wp,8.e1_wp,9.e1_wp, &
259 1.e2_wp,2.e2_wp,3.e2_wp,4.e2_wp,5.e2_wp,6.e2_wp,7.e2_wp,8.e2_wp,9.e2_wp, &
260 1.e3_wp,2.e3_wp,3.e3_wp,4.e3_wp,5.e3_wp,6.e3_wp,7.e3_wp,8.e3_wp,9.e3_wp, &
261 1.e4_wp,2.e4_wp,3.e4_wp,4.e4_wp,5.e4_wp,6.e4_wp,7.e4_wp,8.e4_wp,9.e4_wp, &
262 1.e5_wp,2.e5_wp,3.e5_wp,4.e5_wp,5.e5_wp,6.e5_wp,7.e5_wp,8.e5_wp,9.e5_wp, &
429 subroutine initialize_parameters()
435 am_i = pi * rho_i / 6.0_wp
436 am_r = pi * rho_w / 6.0_wp
437 am_g = [pi * rho_g(1) / 6.0_wp, &
438 pi * rho_g(2) / 6.0_wp, &
439 pi * rho_g(3) / 6.0_wp, &
440 pi * rho_g(4) / 6.0_wp, &
441 pi * rho_g(5) / 6.0_wp, &
442 pi * rho_g(6) / 6.0_wp, &
443 pi * rho_g(7) / 6.0_wp, &
444 pi * rho_g(8) / 6.0_wp, &
445 pi * rho_g(9) / 6.0_wp]
447 ar_volume = 4.0_wp / 3.0_wp * pi * (2.5e-6_wp)**3
450 olfus = 1.0_wp / lfus
453 rho_not = 101325.0_wp / (rdry*298.0_wp)
454 rho_not0 = 101325.0_wp / (rdry*t0)
457 sc3 = sc**(1.0_wp/3.0_wp)
460 d0i = (xm0i/am_i)**(1.0_wp/bm_i)
463 xm0s = am_s * d0s**bm_s
464 xm0g = am_g(nrhg) * d0g**bm_g
472 oamg(m) = 1.0_wp / am_g(m)
473 ocmg(m) = oamg(m)**obmg
479 cce(2,n) = bm_r + n + 1._wp
480 cce(3,n) = bm_r + n + 4._wp
481 cce(4,n) = n + bv_c + 1._wp
482 cce(5,n) = bm_r + n + bv_c + 1._wp
483 ccg(1,n) = gamma(cce(1,n))
484 ccg(2,n) = gamma(cce(2,n))
485 ccg(3,n) = gamma(cce(3,n))
486 ccg(4,n) = gamma(cce(4,n))
487 ccg(5,n) = gamma(cce(5,n))
488 ocg1(n) = 1.0_wp / ccg(1,n)
489 ocg2(n) = 1.0_wp / ccg(2,n)
493 cie(1) = mu_i + 1._wp
494 cie(2) = bm_i + mu_i + 1._wp
495 cie(3) = bm_i + mu_i + bv_i + 1._wp
496 cie(4) = mu_i + bv_i + 1._wp
497 cie(5) = mu_i + 2._wp
498 cie(6) = bm_i*0.5_wp + mu_i + bv_i + 1._wp
499 cie(7) = bm_i*0.5_wp + mu_i + 1._wp
500 cig(1) = gamma(cie(1))
501 cig(2) = gamma(cie(2))
502 cig(3) = gamma(cie(3))
503 cig(4) = gamma(cie(4))
504 cig(5) = gamma(cie(5))
505 cig(6) = gamma(cie(6))
506 cig(7) = gamma(cie(7))
507 oig1 = 1.0_wp / cig(1)
508 oig2 = 1.0_wp / cig(2)
511 cre(1) = bm_r + 1._wp
512 cre(2) = mu_r + 1._wp
513 cre(3) = bm_r + mu_r + 1._wp
514 cre(4) = bm_r*2._wp + mu_r + 1._wp
515 cre(5) = mu_r + bv_r + 1._wp
516 cre(6) = bm_r + mu_r + bv_r + 1._wp
517 cre(7) = bm_r*0.5_wp + mu_r + bv_r + 1._wp
518 cre(8) = bm_r + mu_r + bv_r + 3._wp
519 cre(9) = mu_r + bv_r + 3._wp
520 cre(10) = mu_r + 2._wp
521 cre(11) = 0.5_wp*(bv_r + 5._wp + 2._wp*mu_r)
522 cre(12) = bm_r*0.5_wp + mu_r + 1._wp
523 cre(13) = bm_r*2._wp + mu_r + bv_r + 1._wp
526 crg(n) = gamma(cre(n))
529 ore1 = 1.0_wp / cre(1)
530 org1 = 1.0_wp / crg(1)
531 org2 = 1.0_wp / crg(2)
532 org3 = 1.0_wp / crg(3)
535 cse(1) = bm_s + 1._wp
536 cse(2) = bm_s + 2._wp
538 cse(4) = bm_s + bv_s + 1._wp
539 cse(5) = bm_s*2._wp + bv_s + 1._wp
540 cse(6) = bm_s*2._wp + 1._wp
541 cse(7) = bm_s + mu_s + 1._wp
542 cse(8) = bm_s + mu_s + 2._wp
543 cse(9) = bm_s + mu_s + 3._wp
544 cse(10) = bm_s + mu_s + bv_s + 1._wp
545 cse(11) = bm_s*2._wp + mu_s + bv_s + 1._wp
546 cse(12) = bm_s*2._wp + mu_s + 1._wp
547 cse(13) = bv_s + 2._wp
548 cse(14) = bm_s + bv_s
549 cse(15) = mu_s + 1._wp
550 cse(16) = 1.0_wp + (1.0_wp + bv_s)/2._wp
551 cse(17) = bm_s + bv_s + 2._wp
554 csg(n) = gamma(cse(n))
558 cge(1,:) = bm_g + 1._wp
559 cge(2,:) = mu_g + 1._wp
560 cge(3,:) = bm_g + mu_g + 1._wp
561 cge(4,:) = bm_g*2. + mu_g + 1._wp
562 cge(10,:) = mu_g + 2._wp
563 cge(12,:) = bm_g*0.5_wp + mu_g + 1._wp
566 cge(5,m) = bm_g*2._wp + mu_g + bv_g(m) + 1._wp
567 cge(6,m) = bm_g + mu_g + bv_g(m) + 1._wp
568 cge(7,m) = bm_g*0.5_wp + mu_g + bv_g(m) + 1._wp
569 cge(8,m) = mu_g + bv_g(m) + 1._wp
570 cge(9,m) = mu_g + bv_g(m) + 3._wp
571 cge(11,m) = 0.5_wp*(bv_g(m) + 5._wp + 2._wp*mu_g)
576 cgg(n,m) = gamma(cge(n,m))
579 oge1 = 1.0_wp / cge(1,1)
580 ogg1 = 1.0_wp / cgg(1,1)
581 ogg2 = 1.0_wp / cgg(2,1)
582 ogg3 = 1.0_wp / cgg(3,1)
585 t1_qr_qc = pi * 0.25_wp * av_r * crg(9)
586 t1_qr_qi = pi * 0.25_wp * av_r * crg(9)
587 t2_qr_qi = pi * 0.25_wp * am_r*av_r * crg(8)
590 t1_qs_qc = pi * 0.25_wp * av_s
591 t1_qs_qi = pi * 0.25_wp * av_s
594 t1_qr_ev = 0.78_wp * crg(10)
595 t2_qr_ev = 0.308_wp * sc3 * sqrt(av_r) * crg(11)
599 t2_qs_sd = 0.28_wp * sc3 * sqrt(av_s)
602 t1_qs_me = pi * 4._wp *c_sqrd * olfus * 0.86_wp
603 t2_qs_me = pi * 4._wp *c_sqrd * olfus * 0.28_wp * sc3 * sqrt(av_s)
606 t1_qg_sd = 0.86_wp * cgg(10,1)
609 t1_qg_me = pi * 4._wp * c_cube * olfus * 0.86_wp * cgg(10,1)
613 subroutine initialize_bins_for_tables()
619 nic2 = nint(log10(r_c(1)))
620 nii2 = nint(log10(r_i(1)))
621 nir2 = nint(log10(r_r(1)))
622 nis2 = nint(log10(r_s(1)))
623 nig2 = nint(log10(r_g(1)))
624 nii3 = nint(log10(nt_i(1)))
625 nir3 = nint(log10(n0r_exp(1)))
626 nig3 = nint(log10(n0g_exp(1)))
627 niin2 = nint(log10(nt_in(1)))
630 dc(1) = real(d0c, kind=dp)
631 dtc(1) = real(d0c, kind=dp)
633 dc(n) = dc(n-1) + 1.0e-6_dp
634 dtc(n) = (dc(n) - dc(n-1))
638 call create_bins(numbins=nbi, lowbin=real(d0i, kind=dp), &
639 highbin=2.0_dp*d0s, bins=di, deltabins=dti)
642 call create_bins(numbins=nbr, lowbin=real(d0r, kind=dp), &
643 highbin=0.005_dp, bins=dr, deltabins=dtr)
646 call create_bins(numbins=nbs, lowbin=real(d0s, kind=dp), &
647 highbin=0.02_dp, bins=ds, deltabins=dts)
650 call create_bins(numbins=nbg, lowbin=real(d0g, kind=dp), &
651 highbin=0.05_dp, bins=dg, deltabins=dtg)
654 call create_bins(numbins=nbc, lowbin=1.0_dp, &
655 highbin=3000.0_dp, bins=t_nc)
656 t_nc = t_nc * 1.0e6_dp
657 nic1 = real(log(t_nc(nbc)/t_nc(1)), kind=dp)
725 subroutine initialize_arrays_freezewater(table_size)
731 integer,
intent(out),
optional :: table_size
734 if (.not.
allocated(tpi_qcfz))
allocate(tpi_qcfz(ntb_c,nbc,ntb_t1,ntb_in), source=0._table_dp)
735 if (.not.
allocated(tni_qcfz))
allocate(tni_qcfz(ntb_c,nbc,ntb_t1,ntb_in), source=0._table_dp)
738 if (.not.
allocated(tpi_qrfz))
allocate(tpi_qrfz(ntb_r,ntb_r1,ntb_t1,ntb_in), source=0._table_dp)
739 if (.not.
allocated(tpg_qrfz))
allocate(tpg_qrfz(ntb_r,ntb_r1,ntb_t1,ntb_in), source=0._table_dp)
740 if (.not.
allocated(tni_qrfz))
allocate(tni_qrfz(ntb_r,ntb_r1,ntb_t1,ntb_in), source=0._table_dp)
741 if (.not.
allocated(tnr_qrfz))
allocate(tnr_qrfz(ntb_r,ntb_r1,ntb_t1,ntb_in), source=0._table_dp)
744 if (
present(table_size))
then
745 table_size = (table_dp * 2 * (ntb_c*nbc*ntb_t1*ntb_in)) + &
746 (table_dp * 4 * (ntb_r*ntb_r1*ntb_t1*ntb_in))
751 subroutine initialize_arrays_qr_acr_qs(table_size)
757 integer,
intent(out),
optional :: table_size
759 if (.not.
allocated(tcs_racs1))
allocate(tcs_racs1(ntb_s,ntb_t,ntb_r1,ntb_r), source=0._table_dp)
760 if (.not.
allocated(tmr_racs1))
allocate(tmr_racs1(ntb_s,ntb_t,ntb_r1,ntb_r), source=0._table_dp)
761 if (.not.
allocated(tcs_racs2))
allocate(tcs_racs2(ntb_s,ntb_t,ntb_r1,ntb_r), source=0._table_dp)
762 if (.not.
allocated(tmr_racs2))
allocate(tmr_racs2(ntb_s,ntb_t,ntb_r1,ntb_r), source=0._table_dp)
763 if (.not.
allocated(tcr_sacr1))
allocate(tcr_sacr1(ntb_s,ntb_t,ntb_r1,ntb_r), source=0._table_dp)
764 if (.not.
allocated(tms_sacr1))
allocate(tms_sacr1(ntb_s,ntb_t,ntb_r1,ntb_r), source=0._table_dp)
765 if (.not.
allocated(tcr_sacr2))
allocate(tcr_sacr2(ntb_s,ntb_t,ntb_r1,ntb_r), source=0._table_dp)
766 if (.not.
allocated(tms_sacr2))
allocate(tms_sacr2(ntb_s,ntb_t,ntb_r1,ntb_r), source=0._table_dp)
767 if (.not.
allocated(tnr_racs1))
allocate(tnr_racs1(ntb_s,ntb_t,ntb_r1,ntb_r), source=0._table_dp)
768 if (.not.
allocated(tnr_racs2))
allocate(tnr_racs2(ntb_s,ntb_t,ntb_r1,ntb_r), source=0._table_dp)
769 if (.not.
allocated(tnr_sacr1))
allocate(tnr_sacr1(ntb_s,ntb_t,ntb_r1,ntb_r), source=0._table_dp)
770 if (.not.
allocated(tnr_sacr2))
allocate(tnr_sacr2(ntb_s,ntb_t,ntb_r1,ntb_r), source=0._table_dp)
773 if (
present(table_size))
then
774 table_size = table_dp * 12 * (ntb_s*ntb_t*ntb_r1*ntb_r)
779 subroutine initialize_arrays_qr_acr_qg(table_size)
785 integer,
intent(out),
optional :: table_size
788 if (.not.
allocated(tcg_racg))
allocate(tcg_racg(ntb_g1,ntb_g,nrhg,ntb_r1,ntb_r), source=0._table_dp)
789 if (.not.
allocated(tmr_racg))
allocate(tmr_racg(ntb_g1,ntb_g,nrhg,ntb_r1,ntb_r), source=0._table_dp)
790 if (.not.
allocated(tcr_gacr))
allocate(tcr_gacr(ntb_g1,ntb_g,nrhg,ntb_r1,ntb_r), source=0._table_dp)
791 if (.not.
allocated(tnr_racg))
allocate(tnr_racg(ntb_g1,ntb_g,nrhg,ntb_r1,ntb_r), source=0._table_dp)
792 if (.not.
allocated(tnr_gacr))
allocate(tnr_gacr(ntb_g1,ntb_g,nrhg,ntb_r1,ntb_r), source=0._table_dp)
795 if (
present(table_size))
then
796 table_size = table_dp * 5 * (ntb_g1*ntb_g*nrhg*ntb_r1*ntb_r)