40 public :: atmos_hydrostatic_buildrho
41 public :: atmos_hydrostatic_buildrho_real
42 public :: atmos_hydrostatic_buildrho_atmos
43 public :: atmos_hydrostatic_buildrho_atmos_rev
44 public :: atmos_hydrostatic_buildrho_bytemp
45 public :: atmos_hydrostatic_buildrho_bytemp_atmos
47 public :: atmos_hydrostatic_barometric_law_mslp
48 public :: atmos_hydrostatic_barometric_law_pres
50 interface atmos_hydrostatic_buildrho
53 end interface atmos_hydrostatic_buildrho
55 interface atmos_hydrostatic_buildrho_real
57 end interface atmos_hydrostatic_buildrho_real
59 interface atmos_hydrostatic_buildrho_atmos
62 module procedure atmos_hydrostatic_buildrho_atmos_3d
63 end interface atmos_hydrostatic_buildrho_atmos
65 interface atmos_hydrostatic_buildrho_atmos_rev
67 module procedure atmos_hydrostatic_buildrho_atmos_rev_2d
68 module procedure atmos_hydrostatic_buildrho_atmos_rev_3d
69 end interface atmos_hydrostatic_buildrho_atmos_rev
71 interface atmos_hydrostatic_buildrho_bytemp
72 module procedure atmos_hydrostatic_buildrho_bytemp_1d
74 end interface atmos_hydrostatic_buildrho_bytemp
76 interface atmos_hydrostatic_buildrho_bytemp_atmos
77 module procedure atmos_hydrostatic_buildrho_bytemp_atmos_1d
79 end interface atmos_hydrostatic_buildrho_bytemp_atmos
81 interface atmos_hydrostatic_barometric_law_mslp
82 module procedure atmos_hydrostatic_barometric_law_mslp_0d
83 module procedure atmos_hydrostatic_barometric_law_mslp_2d
84 end interface atmos_hydrostatic_barometric_law_mslp
86 interface atmos_hydrostatic_barometric_law_pres
87 module procedure atmos_hydrostatic_barometric_law_pres_0d
88 module procedure atmos_hydrostatic_barometric_law_pres_2d
89 end interface atmos_hydrostatic_barometric_law_pres
99 private :: atmos_hydrostatic_buildrho_atmos_2d
105 integer,
private,
parameter :: itelim = 100
106 real(RP),
private :: criteria
107 logical,
private :: hydrostatic_uselapserate = .false.
108 integer,
private :: hydrostatic_buildrho_real_kref = 1
109 integer,
private :: hydrostatic_barometric_law_mslp_kref = 1
122 namelist / param_atmos_hydrostatic / &
123 hydrostatic_uselapserate, &
124 hydrostatic_buildrho_real_kref, &
125 hydrostatic_barometric_law_mslp_kref
131 log_info(
"ATMOS_HYDROSTATIC_setup",*)
'Setup' 135 read(
io_fid_conf,nml=param_atmos_hydrostatic,iostat=ierr)
137 log_info(
"ATMOS_HYDROSTATIC_setup",*)
'Not found namelist. Default used.' 138 elseif( ierr > 0 )
then 139 log_error(
"ATMOS_HYDROSTATIC_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_HYDROSTATIC. Check!' 142 log_nml(param_atmos_hydrostatic)
147 log_info(
"ATMOS_HYDROSTATIC_setup",*)
'Use lapse rate for estimation of surface temperature? : ', hydrostatic_uselapserate
148 log_info(
"ATMOS_HYDROSTATIC_setup",*)
'Buildrho conversion criteria : ', criteria
159 pres_sfc, pott_sfc, qv_sfc, qc_sfc, &
172 integer,
intent(in) :: KA, KS, KE
173 real(RP),
intent(in) :: pott(ka)
174 real(RP),
intent(in) :: qv (ka)
175 real(RP),
intent(in) :: qc (ka)
176 real(RP),
intent(in) :: pres_sfc
177 real(RP),
intent(in) :: pott_sfc
178 real(RP),
intent(in) :: qv_sfc
179 real(RP),
intent(in) :: qc_sfc
180 real(RP),
intent(in) :: cz (ka)
181 real(RP),
intent(in) :: fz (0:ka)
182 real(RP),
intent(out) :: dens(ka)
183 real(RP),
intent(out) :: temp(ka)
184 real(RP),
intent(out) :: pres(ka)
185 real(RP),
intent(out) :: temp_sfc
189 real(RP) :: CVtot_sfc
190 real(RP) :: CPtot_sfc
191 real(RP) :: CPovCV_sfc
203 rtot_sfc = rdry * ( 1.0_rp - qv_sfc - qc_sfc ) &
205 cvtot_sfc = cvdry * ( 1.0_rp - qv_sfc - qc_sfc ) &
208 cptot_sfc = cpdry * ( 1.0_rp - qv_sfc - qc_sfc ) &
211 cpovcv_sfc = cptot_sfc / cvtot_sfc
213 rtot = rdry * ( 1.0_rp - qv(ks) - qc(ks) ) &
215 cvtot = cvdry * ( 1.0_rp - qv(ks) - qc(ks) ) &
218 cptot = cpdry * ( 1.0_rp - qv(ks) - qc(ks) ) &
221 cpovcv = cptot / cvtot
224 dens_sfc = p00 / rtot_sfc / pott_sfc * ( pres_sfc/p00 )**(cvtot_sfc/cptot_sfc)
225 temp_sfc = pres_sfc / ( dens_sfc * rtot_sfc )
227 dz(ks-1) = cz(ks) - fz(ks-1)
229 dz(k) = cz(k+1) - cz(k)
233 if ( hydrostatic_uselapserate )
then 235 temp(ks) = pott_sfc - lapsdry * dz(ks-1)
236 pres(ks) = p00 * ( temp(ks)/pott(ks) )**(cptot/rtot)
237 dens(ks) = p00 / rtot / pott(ks) * ( pres(ks)/p00 )**(cvtot/cptot)
242 dens_sfc, pott_sfc, qv_sfc, qc_sfc, &
244 dens(ks), temp(ks), pres(ks) )
250 pott(:), qv(:), qc(:), &
255 dens( 1:ks-1) = 0.0_rp
256 dens(ke+1:ka ) = 0.0_rp
264 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
266 pres_sfc, pott_sfc, &
272 statistics_horizontal_mean
275 integer,
intent(in) :: KA, KS, KE
276 integer,
intent(in) :: IA, IS, IE
277 integer,
intent(in) :: JA, JS, JE
279 real(RP),
intent(in) :: pott(ka,ia,ja)
280 real(RP),
intent(in) :: qv (ka,ia,ja)
281 real(RP),
intent(in) :: qc (ka,ia,ja)
282 real(RP),
intent(in) :: pres_sfc(ia,ja)
283 real(RP),
intent(in) :: pott_sfc(ia,ja)
284 real(RP),
intent(in) :: qv_sfc (ia,ja)
285 real(RP),
intent(in) :: qc_sfc (ia,ja)
286 real(RP),
intent(in) :: cz( ka,ia,ja)
287 real(RP),
intent(in) :: fz(0:ka,ia,ja)
288 real(RP),
intent(in) :: area(ia,ja)
290 real(RP),
intent(out) :: dens(ka,ia,ja)
291 real(RP),
intent(out) :: temp(ka,ia,ja)
292 real(RP),
intent(out) :: pres(ka,ia,ja)
293 real(RP),
intent(out) :: temp_sfc(ia,ja)
295 real(RP) :: dz(ka,ia,ja), dz_top(ia,ja)
298 real(RP) :: pott_toa(ia,ja)
299 real(RP) :: qv_toa (ia,ja)
300 real(RP) :: qc_toa (ia,ja)
301 real(RP) :: dens_toa(ia,ja)
302 real(RP) :: temp_toa(ia,ja)
303 real(RP) :: pres_toa(ia,ja)
305 real(RP) :: dens_mean
315 pott(:,i,j), qv(:,i,j), qc(:,i,j), &
316 pres_sfc(i,j), pott_sfc(i,j), qv_sfc(i,j), qc_sfc(i,j), &
317 cz(:,i,j), fz(:,i,j), &
318 dens(:,i,j), temp(:,i,j), pres(:,i,j), &
327 dz(k,i,j) = cz(k+1,i,j) - cz(k,i,j)
329 dz_top(i,j) = fz(ke,i,j) - cz(ke,i,j)
332 pott_toa(i,j) = pott(ke,i,j)
333 qv_toa(i,j) = qv(ke,i,j)
334 qc_toa(i,j) = qc(ke,i,j)
338 call atmos_hydrostatic_buildrho_atmos_2d( ia, is, ie, ja, js, je, &
339 pott_toa(:,:), qv_toa(:,:), qc_toa(:,:), &
340 dens(ke,:,:), pott(ke,:,:), qv(ke,:,:), qc(ke,:,:), &
342 dens_toa(:,:), temp_toa(:,:), pres_toa(:,:) )
344 call statistics_horizontal_mean( ia, is, ie, ja, js, je, &
345 dens_toa(:,:), area(:,:), &
351 dens_toa(i,j) = dens_mean
355 call atmos_hydrostatic_buildrho_atmos_rev_2d( ia, is, ie, ja, js, je, &
356 pott(ke,:,:), qv(ke,:,:), qc(ke,:,:), &
357 dens_toa(:,:), pott_toa(:,:), qv_toa(:,:), qc_toa(:,:), &
359 dens(ke,:,:), temp(ke,:,:), pres(ke,:,:) )
362 call atmos_hydrostatic_buildrho_atmos_rev_3d( ka, ks, ke, ia, is, ie, ja, js, je, &
363 pott(:,:,:), qv(:,:,:), qc(:,:,:), &
366 temp(:,:,:), pres(:,:,:) )
374 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
385 integer,
intent(in) :: KA, KS, KE
386 integer,
intent(in) :: IA, IS, IE
387 integer,
intent(in) :: JA, JS, JE
389 real(RP),
intent(in) :: pott(ka,ia,ja)
390 real(RP),
intent(in) :: qv (ka,ia,ja)
391 real(RP),
intent(in) :: qc (ka,ia,ja)
392 real(RP),
intent(in) :: cz (ka,ia,ja)
394 real(RP),
intent(inout) :: pres(ka,ia,ja)
396 real(RP),
intent(out) :: dens(ka,ia,ja)
397 real(RP),
intent(out) :: temp(ka,ia,ja)
399 real(RP) :: dz(ka,ia,ja)
401 real(RP) :: pott_toa(ia,ja)
402 real(RP) :: qv_toa (ia,ja)
403 real(RP) :: qc_toa (ia,ja)
419 dz(k,i,j) = cz(k+1,i,j) - cz(k,i,j)
427 pott_toa(i,j) = pott(ke,i,j)
428 qv_toa(i,j) = qv(ke,i,j)
429 qc_toa(i,j) = qc(ke,i,j)
433 kref = hydrostatic_buildrho_real_kref + ks - 1
440 rtot = rdry * ( 1.0_rp - qv(kref,i,j) - qc(kref,i,j) ) &
441 + rvap * qv(kref,i,j)
442 cvtot = cvdry * ( 1.0_rp - qv(kref,i,j) - qc(kref,i,j) ) &
445 cptot = cpdry * ( 1.0_rp - qv(kref,i,j) - qc(kref,i,j) ) &
448 dens(kref,i,j) = p00 / ( rtot * pott(kref,i,j) ) * ( pres(kref,i,j)/p00 )**(cvtot/cptot)
453 call atmos_hydrostatic_buildrho_atmos_3d( ka, ks, ke, ia, is, ie, ja, js, je, &
454 pott(:,:,:), qv(:,:,:), qc(:,:,:), &
457 temp(:,:,:), pres(:,:,:), &
459 call atmos_hydrostatic_buildrho_atmos_rev_3d( ka, ks, ke, ia, is, ie, ja, js, je, &
460 pott(:,:,:), qv(:,:,:), qc(:,:,:), &
463 temp(:,:,:), pres(:,:,:), &
474 dens( 1:ks-1,:,:) = 0.0_rp
476 dens(ke+1:ka ,:,:) = 0.0_rp
486 pott_L2, qv_L2, qc_L2, &
487 dens_L1, pott_L1, qv_L1, qc_L1, &
489 dens_L2, temp_L2, pres_L2 )
498 real(RP),
intent(in) :: pott_L2
499 real(RP),
intent(in) :: qv_L2
500 real(RP),
intent(in) :: qc_L2
501 real(RP),
intent(in) :: dens_L1
502 real(RP),
intent(in) :: pott_L1
503 real(RP),
intent(in) :: qv_L1
504 real(RP),
intent(in) :: qc_L1
505 real(RP),
intent(in) :: dz
506 integer,
intent(in) :: k
508 real(RP),
intent(out) :: dens_L2
509 real(RP),
intent(out) :: temp_L2
510 real(RP),
intent(out) :: pres_L2
512 real(RP) :: Rtot_L1 , Rtot_L2
513 real(RP) :: CVtot_L1 , CVtot_L2
514 real(RP) :: CPtot_L1 , CPtot_L2
515 real(RP) :: CPovCV_L1, CPovCV_L2
518 real(RP) :: dens_s, dhyd, dgrd
523 rtot_l1 = rdry * ( 1.0_rp - qv_l1 - qc_l1 ) &
525 cvtot_l1 = cvdry * ( 1.0_rp - qv_l1 - qc_l1 ) &
528 cptot_l1 = cpdry * ( 1.0_rp - qv_l1 - qc_l1 ) &
531 cpovcv_l1 = cptot_l1 / cvtot_l1
533 rtot_l2 = rdry * ( 1.0_rp - qv_l2 - qc_l2 ) &
535 cvtot_l2 = cvdry * ( 1.0_rp - qv_l2 - qc_l2 ) &
538 cptot_l2 = cpdry * ( 1.0_rp - qv_l2 - qc_l2 ) &
541 cpovcv_l2 = cptot_l2 / cvtot_l2
546 pres_l1 = p00 * ( dens_l1 * rtot_l1 * pott_l1 / p00 )**cpovcv_l1
550 if ( abs(dens_l2-dens_s) <= criteria )
then 556 pres_l2 = p00 * ( dens_s * rtot_l2 * pott_l2 / p00 )**cpovcv_l2
558 dhyd = + ( pres_l1 - pres_l2 ) / dz &
559 - grav * 0.5_rp * ( dens_l1 + dens_s )
561 dgrd = - pres_l2 * cpovcv_l2 / dens_s / dz &
564 dens_l2 = dens_s - dhyd/dgrd
566 if ( dens_l2*0.0_rp /= 0.0_rp )
exit 569 if ( .NOT. converged )
then 570 log_error(
"ATMOS_HYDROSTATIC_buildrho_atmos_0D",*)
'iteration not converged!', &
571 k,dens_l2,ite,dens_s,dhyd,dgrd
575 pres_l2 = p00 * ( dens_l2 * rtot_l2 * pott_l2 / p00 )**cpovcv_l2
576 temp_l2 = pres_l2 / ( dens_l2 * rtot_l2 )
599 integer,
intent(in) :: KA, KS, KE
601 real(RP),
intent(in) :: pott(ka)
602 real(RP),
intent(in) :: qv (ka)
603 real(RP),
intent(in) :: qc (ka)
604 real(RP),
intent(in) :: dz (ka)
606 real(RP),
intent(inout) :: dens(ka)
608 real(RP),
intent(out) :: temp(ka)
609 real(RP),
intent(out) :: pres(ka)
611 integer,
intent(in),
optional :: kref
613 real(RP) :: Rtot (ka)
614 real(RP) :: CPovCV(ka)
618 real(RP) :: dens_s, dhyd, dgrd
626 if (
present(kref) )
then 633 rtot(k) = rdry * ( 1.0_rp - qv(k) - qc(k) ) &
635 cvtot = cvdry * ( 1.0_rp - qv(k) - qc(k) ) &
638 cptot = cpdry * ( 1.0_rp - qv(k) - qc(k) ) &
641 cpovcv(k) = cptot / cvtot
644 pres(kref_) = p00 * ( dens(kref_) * rtot(kref_) * pott(kref_) / p00 )**cpovcv(kref_)
653 if ( abs(dens(k)-dens_s) <= criteria )
then 659 pres(k) = p00 * ( dens_s * rtot(k) * pott(k) / p00 )**cpovcv(k)
661 dhyd = + ( pres(k-1) - pres(k) ) / dz(k-1) &
662 - grav * 0.5_rp * ( dens(k-1) + dens_s )
664 dgrd = - cpovcv(k) * pres(k) / dens_s / dz(k-1) &
667 dens(k) = dens_s - dhyd/dgrd
669 if ( dens(k)*0.0_rp /= 0.0_rp )
exit 672 if ( .NOT. converged )
then 673 log_error(
"ATMOS_HYDROSTATIC_buildrho_atmos_1D",*)
'iteration not converged!', &
674 k,dens(k),ite,dens_s,dhyd,dgrd
678 pres(k) = p00 * ( dens(k) * rtot(k) * pott(k) / p00 )**cpovcv(k)
683 temp(k) = pres(k) / ( dens(k) * rtot(k) )
686 dens( 1:ks-1) = dens(ks)
687 dens(ke+1:ka ) = dens(ke)
688 pres( 1:ks-1) = pres(ks)
689 pres(ke+1:ka ) = pres(ke)
690 temp( 1:ks-1) = temp(ks)
691 temp(ke+1:ka ) = temp(ke)
714 integer,
intent(in) :: KA, KS, KE
716 real(RP),
intent(in) :: pott(ka)
717 real(RP),
intent(in) :: qv (ka)
718 real(RP),
intent(in) :: qc (ka)
719 real(RP),
intent(in) :: dz (ka)
721 real(RP),
intent(inout) :: dens(ka)
723 real(RP),
intent(out) :: temp(ka)
724 real(RP),
intent(out) :: pres(ka)
726 integer,
intent(in),
optional :: kref
728 real(RP) :: Rtot (ka)
729 real(RP) :: CPovCV(ka)
733 real(RP) :: dens_s, dhyd, dgrd
741 if (
present(kref) )
then 748 rtot(k) = rdry * ( 1.0_rp - qv(k) - qc(k) ) &
750 cvtot = cvdry * ( 1.0_rp - qv(k) - qc(k) ) &
753 cptot = cpdry * ( 1.0_rp - qv(k) - qc(k) ) &
756 cpovcv(k) = cptot / cvtot
759 pres(kref_) = p00 * ( dens(kref_) * rtot(kref_) * pott(kref_) / p00 )**cpovcv(kref_)
761 do k = kref_-1, ks, -1
768 if ( abs(dens(k)-dens_s) <= criteria )
then 774 pres(k) = p00 * ( dens_s * rtot(k) * pott(k) / p00 )**cpovcv(k)
776 dhyd = - ( pres(k+1) - pres(k) ) / dz(k) &
777 - grav * 0.5_rp * ( dens(k+1) + dens_s )
779 dgrd = + cpovcv(k) * pres(k) / dens_s / dz(k) &
782 dens(k) = dens_s - dhyd/dgrd
784 if ( dens(k)*0.0_rp /= 0.0_rp )
exit 787 if ( .NOT. converged )
then 788 log_error(
"ATMOS_HYDROSTATIC_buildrho_atmos_rev_1D",*)
'iteration not converged!', &
789 k,dens(k),ite,dens_s,dhyd,dgrd
793 pres(k) = p00 * ( dens(k) * rtot(k) * pott(k) / p00 )**cpovcv(k)
798 temp(k) = pres(k) / ( dens(k) * rtot(k) )
801 dens( 1:ks-1) = dens(ks)
802 dens(ke+1:ka ) = dens(ke)
803 pres( 1:ks-1) = pres(ks)
804 pres(ke+1:ka ) = pres(ke)
805 temp( 1:ks-1) = temp(ks)
806 temp(ke+1:ka ) = temp(ke)
813 subroutine atmos_hydrostatic_buildrho_atmos_2d( &
814 IA, IS, IE, JA, JS, JE, &
815 pott_L2, qv_L2, qc_L2, &
816 dens_L1, pott_L1, qv_L1, qc_L1, &
818 dens_L2, temp_L2, pres_L2 )
820 integer,
intent(in) :: IA, IS, IE
821 integer,
intent(in) :: JA, JS, JE
823 real(RP),
intent(in) :: pott_L2(ia,ja)
824 real(RP),
intent(in) :: qv_L2 (ia,ja)
825 real(RP),
intent(in) :: qc_L2 (ia,ja)
826 real(RP),
intent(in) :: dens_L1(ia,ja)
827 real(RP),
intent(in) :: pott_L1(ia,ja)
828 real(RP),
intent(in) :: qv_L1 (ia,ja)
829 real(RP),
intent(in) :: qc_L1 (ia,ja)
830 real(RP),
intent(in) :: dz (ia,ja)
831 integer,
intent(in) :: k
833 real(RP),
intent(out) :: dens_L2(ia,ja)
834 real(RP),
intent(out) :: temp_L2(ia,ja)
835 real(RP),
intent(out) :: pres_L2(ia,ja)
844 pott_l2(i,j), qv_l2(i,j), qc_l2(i,j), &
845 dens_l1(i,j), pott_l1(i,j), qv_l1(i,j), qc_l1(i,j), &
847 dens_l2(i,j), temp_l2(i,j), pres_l2(i,j) )
852 end subroutine atmos_hydrostatic_buildrho_atmos_2d
856 subroutine atmos_hydrostatic_buildrho_atmos_rev_2d( &
857 IA, IS, IE, JA, JS, JE, &
858 pott_L1, qv_L1, qc_L1, &
859 dens_L2, pott_L2, qv_L2, qc_L2, &
861 dens_L1, temp_L1, pres_L1 )
863 integer,
intent(in) :: IA, IS, IE
864 integer,
intent(in) :: JA, JS, JE
866 real(RP),
intent(in) :: pott_L1(ia,ja)
867 real(RP),
intent(in) :: qv_L1 (ia,ja)
868 real(RP),
intent(in) :: qc_L1 (ia,ja)
869 real(RP),
intent(in) :: dens_L2(ia,ja)
870 real(RP),
intent(in) :: pott_L2(ia,ja)
871 real(RP),
intent(in) :: qv_L2 (ia,ja)
872 real(RP),
intent(in) :: qc_L2 (ia,ja)
873 real(RP),
intent(in) :: dz (ia,ja)
874 integer,
intent(in) :: k
876 real(RP),
intent(out) :: dens_L1(ia,ja)
877 real(RP),
intent(out) :: temp_L1(ia,ja)
878 real(RP),
intent(out) :: pres_L1(ia,ja)
887 pott_l1(i,j), qv_l1(i,j), qc_l1(i,j), &
888 dens_l2(i,j), pott_l2(i,j), qv_l2(i,j), qc_l2(i,j), &
890 dens_l1(i,j), temp_l1(i,j), pres_l1(i,j) )
895 end subroutine atmos_hydrostatic_buildrho_atmos_rev_2d
899 subroutine atmos_hydrostatic_buildrho_atmos_3d( &
900 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
907 integer,
intent(in) :: KA, KS, KE
908 integer,
intent(in) :: IA, IS, IE
909 integer,
intent(in) :: JA, JS, JE
911 real(RP),
intent(in) :: pott(ka,ia,ja)
912 real(RP),
intent(in) :: qv (ka,ia,ja)
913 real(RP),
intent(in) :: qc (ka,ia,ja)
914 real(RP),
intent(in) :: dz (ka,ia,ja)
916 real(RP),
intent(inout) :: dens(ka,ia,ja)
918 real(RP),
intent(out) :: temp(ka,ia,ja)
919 real(RP),
intent(out) :: pres(ka,ia,ja)
921 integer,
intent(in),
optional :: kref
930 pott(:,i,j), qv(:,i,j), qc(:,i,j), &
933 temp(:,i,j), pres(:,i,j), &
939 end subroutine atmos_hydrostatic_buildrho_atmos_3d
943 subroutine atmos_hydrostatic_buildrho_atmos_rev_3d( &
944 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
952 integer,
intent(in) :: KA, KS, KE
953 integer,
intent(in) :: IA, IS, IE
954 integer,
intent(in) :: JA, JS, JE
955 real(RP),
intent(inout) :: dens(ka,ia,ja)
956 real(RP),
intent(out) :: temp(ka,ia,ja)
957 real(RP),
intent(out) :: pres(ka,ia,ja)
958 real(RP),
intent(in) :: pott(ka,ia,ja)
959 real(RP),
intent(in) :: qv (ka,ia,ja)
960 real(RP),
intent(in) :: qc (ka,ia,ja)
961 real(RP),
intent(in) :: dz (ka,ia,ja)
962 integer,
intent(in),
optional :: kref
971 pott(:,i,j), qv(:,i,j), qc(:,i,j), &
974 temp(:,i,j), pres(:,i,j), &
980 end subroutine atmos_hydrostatic_buildrho_atmos_rev_3d
985 subroutine atmos_hydrostatic_buildrho_bytemp_1d( &
988 pres_sfc, temp_sfc, qv_sfc, qc_sfc, &
990 dens, pott, pres, pott_sfc )
999 integer,
intent(in) :: KA, KS, KE
1001 real(RP),
intent(in) :: temp(ka)
1002 real(RP),
intent(in) :: qv (ka)
1003 real(RP),
intent(in) :: qc (ka)
1004 real(RP),
intent(in) :: pres_sfc
1005 real(RP),
intent(in) :: temp_sfc
1006 real(RP),
intent(in) :: qv_sfc
1007 real(RP),
intent(in) :: qc_sfc
1008 real(RP),
intent(in) :: cz( ka)
1009 real(RP),
intent(in) :: fz(0:ka)
1011 real(RP),
intent(out) :: dens(ka)
1012 real(RP),
intent(out) :: pott(ka)
1013 real(RP),
intent(out) :: pres(ka)
1014 real(RP),
intent(out) :: pott_sfc
1016 real(RP) :: dens_sfc
1018 real(RP) :: Rtot_sfc
1019 real(RP) :: CVtot_sfc
1020 real(RP) :: CPtot_sfc
1025 real(RP) :: RovCP_sfc
1026 real(RP) :: dens_s, dhyd, dgrd
1028 logical :: converged
1037 rtot_sfc = rdry * ( 1.0_rp - qv_sfc - qc_sfc ) &
1039 cvtot_sfc = cvdry * ( 1.0_rp - qv_sfc - qc_sfc ) &
1042 cptot_sfc = cpdry * ( 1.0_rp - qv_sfc - qc_sfc ) &
1046 rtot = rdry * ( 1.0_rp - qv(ks) - qc(ks) ) &
1048 cvtot = cvdry * ( 1.0_rp - qv(ks) - qc(ks) ) &
1051 cptot = cpdry * ( 1.0_rp - qv(ks) - qc(ks) ) &
1056 rovcp_sfc = rtot_sfc / cptot_sfc
1057 dens_sfc = pres_sfc / ( rtot_sfc * temp_sfc )
1058 pott_sfc = temp_sfc * ( p00/pres_sfc )**rovcp_sfc
1064 dz(ks-1) = cz(ks) - fz(ks-1)
1066 dz(k) = cz(k+1) - cz(k)
1071 if ( abs(dens(ks)-dens_s) <= criteria )
then 1078 dhyd = + ( pres_sfc - dens_s * rtot * temp(ks) ) / dz(ks-1) &
1079 - grav * 0.5_rp * ( dens_sfc + dens_s )
1081 dgrd = - rtot * temp(ks) / dz(ks-1) &
1084 dens(ks) = dens_s - dhyd/dgrd
1086 if ( dens(ks)*0.0_rp /= 0.0_rp )
exit 1089 if ( .NOT. converged )
then 1090 log_error(
"ATMOS_HYDROSTATIC_buildrho_bytemp_1D",*)
'iteration not converged!', &
1091 dens(ks),ite,dens_s,dhyd,dgrd
1096 call atmos_hydrostatic_buildrho_bytemp_atmos_1d( ka, ks, ke, &
1097 temp(:), qv(:), qc(:), &
1103 end subroutine atmos_hydrostatic_buildrho_bytemp_1d
1108 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
1110 pres_sfc, temp_sfc, qv_sfc, qc_sfc, &
1115 integer,
intent(in) :: KA, KS, KE
1116 integer,
intent(in) :: IA, IS, IE
1117 integer,
intent(in) :: JA, JS, JE
1119 real(RP),
intent(in) :: temp(ka,ia,ja)
1120 real(RP),
intent(in) :: qv (ka,ia,ja)
1121 real(RP),
intent(in) :: qc (ka,ia,ja)
1122 real(RP),
intent(in) :: pres_sfc(ia,ja)
1123 real(RP),
intent(in) :: temp_sfc(ia,ja)
1124 real(RP),
intent(in) :: qv_sfc (ia,ja)
1125 real(RP),
intent(in) :: qc_sfc (ia,ja)
1126 real(RP),
intent(in) :: cz(ka,ia,ja)
1127 real(RP),
intent(in) :: fz(ka,ia,ja)
1129 real(RP),
intent(out) :: dens(ka,ia,ja)
1130 real(RP),
intent(out) :: pott(ka,ia,ja)
1131 real(RP),
intent(out) :: pres(ka,ia,ja)
1132 real(RP),
intent(out) :: pott_sfc(ia,ja)
1141 call atmos_hydrostatic_buildrho_bytemp_1d( ka, ks, ke, &
1142 temp(:,i,j), qv(:,i,j), qc(:,i,j), &
1143 pres_sfc(i,j), temp_sfc(i,j), qv_sfc(i,j), qc_sfc(i,j), &
1144 cz(:,i,j), fz(:,i,j), &
1145 dens(:,i,j), pott(:,i,j), pres(:,i,j), &
1156 subroutine atmos_hydrostatic_buildrho_bytemp_atmos_1d( &
1170 integer,
intent(in) :: KA, KS, KE
1172 real(RP),
intent(in) :: temp(ka)
1173 real(RP),
intent(in) :: qv (ka)
1174 real(RP),
intent(in) :: qc (ka)
1175 real(RP),
intent(in) :: dz (ka)
1177 real(RP),
intent(inout) :: dens(ka)
1179 real(RP),
intent(out) :: pott(ka)
1180 real(RP),
intent(out) :: pres(ka)
1182 real(RP) :: Rtot (ka)
1183 real(RP) :: CVtot (ka)
1184 real(RP) :: CPtot (ka)
1187 real(RP) :: dens_s, dhyd, dgrd
1189 logical :: converged
1195 rtot(k) = rdry * ( 1.0_rp - qv(k) - qc(k) ) &
1197 cvtot(k) = cvdry * ( 1.0_rp - qv(k) - qc(k) ) &
1200 cptot(k) = cpdry * ( 1.0_rp - qv(k) - qc(k) ) &
1205 pres(ks) = dens(ks) * rtot(ks) * temp(ks)
1214 if ( abs(dens(k)-dens_s) <= criteria )
then 1221 dhyd = + ( pres(k-1) - dens_s * rtot(k) * temp(k) ) / dz(k-1) &
1222 - grav * 0.5_rp * ( dens(k-1) + dens_s )
1224 dgrd = - rtot(k) * temp(k) / dz(k-1) &
1227 dens(k) = dens_s - dhyd/dgrd
1229 if ( dens(k)*0.0_rp /= 0.0_rp )
exit 1232 if ( .NOT. converged )
then 1233 log_error(
"ATMOS_HYDROSTATIC_buildrho_bytemp_atmos_1D",*)
'iteration not converged!', &
1234 k,dens(k),ite,dens_s,dhyd,dgrd
1238 pres(k) = dens(k) * rtot(k) * temp(k)
1243 rovcp = rtot(k) / cptot(k)
1244 pott(k) = temp(k) * ( p00 / pres(k) )**rovcp
1248 end subroutine atmos_hydrostatic_buildrho_bytemp_atmos_1d
1267 integer,
intent(in) :: KA, KS, KE
1269 real(RP),
intent(in) :: temp(ka)
1270 real(RP),
intent(in) :: qv (ka)
1271 real(RP),
intent(in) :: qc (ka)
1272 real(RP),
intent(in) :: dz (ka)
1274 real(RP),
intent(inout) :: dens(ka)
1276 real(RP),
intent(out) :: pott(ka)
1277 real(RP),
intent(out) :: pres(ka)
1279 real(RP) :: Rtot (ka)
1280 real(RP) :: CVtot (ka)
1281 real(RP) :: CPtot (ka)
1284 real(RP) :: dens_s, dhyd, dgrd
1286 logical :: converged
1292 rtot(k) = rdry * ( 1.0_rp - qv(k) - qc(k) ) &
1294 cvtot(k) = cvdry * ( 1.0_rp - qv(k) - qc(k) ) &
1297 cptot(k) = cpdry * ( 1.0_rp - qv(k) - qc(k) ) &
1302 pres(ke) = dens(ke) * rtot(ke) * temp(ke)
1311 if ( abs(dens(k)-dens_s) <= criteria )
then 1318 dhyd = - ( pres(k+1) - dens_s * rtot(k) * temp(k) ) / dz(k) &
1319 - grav * 0.5_rp * ( dens(k+1) + dens_s )
1321 dgrd = + rtot(k) * temp(k) / dz(k) &
1324 dens(k) = dens_s - dhyd/dgrd
1326 if ( dens(k)*0.0_rp /= 0.0_rp )
exit 1329 if ( .NOT. converged )
then 1330 log_error(
"ATMOS_HYDROSTATIC_buildrho_bytemp_atmos_rev_1D",*)
'iteration not converged!', &
1331 k,dens(k),ite,dens_s,dhyd,dgrd
1335 pres(k) = dens(k) * rtot(k) * temp(k)
1340 rovcp = rtot(k) / cptot(k)
1341 pott(k) = temp(k) * ( p00 / pres(k) )**rovcp
1350 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
1356 integer,
intent(in) :: KA, KS, KE
1357 integer,
intent(in) :: IA, IS, IE
1358 integer,
intent(in) :: JA, JS, JE
1360 real(RP),
intent(in) :: temp(ka,ia,ja)
1361 real(RP),
intent(in) :: qv (ka,ia,ja)
1362 real(RP),
intent(in) :: qc (ka,ia,ja)
1363 real(RP),
intent(in) :: dz (ka,ia,ja)
1365 real(RP),
intent(inout) :: dens(ka,ia,ja)
1366 real(RP),
intent(out) :: pott(ka,ia,ja)
1367 real(RP),
intent(out) :: pres(ka,ia,ja)
1375 call atmos_hydrostatic_buildrho_bytemp_atmos_1d( ka, ks, ke, &
1376 temp(:,i,j), qv(:,i,j), qc(:,i,j), &
1379 pott(:,i,j), pres(:,i,j) )
1390 subroutine atmos_hydrostatic_barometric_law_mslp_0d( &
1396 integer,
intent(in) :: KA, KS, KE
1398 real(RP),
intent(in) :: pres(ka)
1399 real(RP),
intent(in) :: temp(ka)
1400 real(RP),
intent(in) :: qv (ka)
1401 real(RP),
intent(in) :: cz (ka)
1403 real(RP),
intent(out) :: mslp
1410 kref = hydrostatic_barometric_law_mslp_kref + ks - 1
1413 vtemp = temp(kref) * (1.0_rp + epstvap * qv(kref) )
1416 mslp = pres(kref) * ( ( vtemp + laps * cz(kref) ) / vtemp ) ** ( grav / ( rdry * laps ) )
1419 end subroutine atmos_hydrostatic_barometric_law_mslp_0d
1423 subroutine atmos_hydrostatic_barometric_law_mslp_2d( &
1424 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
1429 integer,
intent(in) :: KA, KS, KE
1430 integer,
intent(in) :: IA, IS, IE
1431 integer,
intent(in) :: JA, JS, JE
1433 real(RP),
intent(in) :: pres(ka,ia,ja)
1434 real(RP),
intent(in) :: temp(ka,ia,ja)
1435 real(RP),
intent(in) :: qv (ka,ia,ja)
1436 real(RP),
intent(in) :: cz (ka,ia,ja)
1438 real(RP),
intent(out) :: mslp(ia,ja)
1446 call atmos_hydrostatic_barometric_law_mslp_0d( ka, ks, ke, &
1447 pres(:,i,j), temp(:,i,j), qv(:,i,j), &
1454 end subroutine atmos_hydrostatic_barometric_law_mslp_2d
1460 subroutine atmos_hydrostatic_barometric_law_pres_0d( &
1465 real(RP),
intent(in) :: mslp
1466 real(RP),
intent(in) :: temp
1467 real(RP),
intent(in) :: dz
1469 real(RP),
intent(out) :: pres
1475 tm = temp + laps * dz * 0.5_rp
1478 pres = mslp / exp( grav * dz / ( rdry * tm ) )
1481 end subroutine atmos_hydrostatic_barometric_law_pres_0d
1485 subroutine atmos_hydrostatic_barometric_law_pres_2d( &
1486 IA, IS, IE, JA, JS, JE, &
1491 integer,
intent(in) :: IA, IS, IE
1492 integer,
intent(in) :: JA, JS, JE
1494 real(RP),
intent(in) :: mslp(ia,ja)
1495 real(RP),
intent(in) :: temp(ia,ja)
1496 real(RP),
intent(in) :: dz (ia,ja)
1498 real(RP),
intent(out) :: pres(ia,ja)
1506 call atmos_hydrostatic_barometric_law_pres_0d( mslp(i,j), temp(i,j), dz(i,j), &
1512 end subroutine atmos_hydrostatic_barometric_law_pres_2d
real(rp), public const_cvdry
specific heat (dry air,constant volume) [J/kg/K]
real(rp), public const_cpdry
specific heat (dry air,constant pressure) [J/kg/K]
subroutine atmos_hydrostatic_buildrho_bytemp_atmos_rev_1d(KA, KS, KE, temp, qv, qc, dz, dens, pott, pres)
Build up density from upermost atmosphere (1D)
integer, public io_fid_conf
Config file ID.
real(rp), public const_cvvap
specific heat (water vapor, constant volume) [J/kg/K]
real(rp), public const_laps
lapse rate of ISA [K/m]
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
subroutine atmos_hydrostatic_buildrho_real_3d(KA, KS, KE, IA, IS, IE, JA, JS, JE, pott, qv, qc, cz, pres, dens, temp)
Build up density from surface (3D), not to reverse from TOA.
real(rp), public cv_vapor
CV for vapor [J/kg/K].
subroutine atmos_hydrostatic_buildrho_bytemp_atmos_3d(KA, KS, KE, IA, IS, IE, JA, JS, JE, temp, qv, qc, dz, dens, pott, pres)
Build up density from lowermost atmosphere (3D)
module atmosphere / hydrometeor
subroutine atmos_hydrostatic_buildrho_atmos_0d(pott_L2, qv_L2, qc_L2, dens_L1, pott_L1, qv_L1, qc_L1, dz, k, dens_L2, temp_L2, pres_L2)
Build up density (0D)
real(rp), public const_lapsdry
dry adiabatic lapse rate [K/m]
real(rp), public const_pre00
pressure reference [Pa]
module atmosphere / hydrostatic barance
real(rp), public const_grav
standard acceleration of gravity [m/s2]
real(rp), public const_epstvap
1 / epsilon - 1
subroutine atmos_hydrostatic_buildrho_3d(KA, KS, KE, IA, IS, IE, JA, JS, JE, pott, qv, qc, pres_sfc, pott_sfc, qv_sfc, qc_sfc, cz, fz, area, dens, temp, pres, temp_sfc)
Build up density from surface (3D)
real(rp), parameter, public const_rvap
specific gas constant (water vapor) [J/kg/K]
subroutine, public prc_abort
Abort Process.
subroutine atmos_hydrostatic_buildrho_bytemp_3d(KA, KS, KE, IA, IS, IE, JA, JS, JE, temp, qv, qc, pres_sfc, temp_sfc, qv_sfc, qc_sfc, cz, fz, dens, pott, pres, pott_sfc)
Build up density from surface (3D)
subroutine atmos_hydrostatic_buildrho_atmos_1d(KA, KS, KE, pott, qv, qc, dz, dens, temp, pres, kref)
Build up density from lowermost atmosphere (1D)
real(rp), public const_eps
small number
subroutine atmos_hydrostatic_buildrho_atmos_rev_1d(KA, KS, KE, pott, qv, qc, dz, dens, temp, pres, kref)
Build up density from upermost atmosphere (1D)
subroutine atmos_hydrostatic_buildrho_1d(KA, KS, KE, pott, qv, qc, pres_sfc, pott_sfc, qv_sfc, qc_sfc, cz, fz, dens, temp, pres, temp_sfc)
Build up density from surface (1D)
real(rp), parameter, public const_cpvap
specific heat (water vapor, constant pressure) [J/kg/K]
real(rp), public cp_vapor
CP for vapor [J/kg/K].
real(rp), public cp_water
CP for water [J/kg/K].
subroutine, public atmos_hydrostatic_setup
Setup.
real(rp), public cv_water
CV for water [J/kg/K].