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, &
387 integer,
intent(in) :: KA, KS, KE
388 integer,
intent(in) :: IA, IS, IE
389 integer,
intent(in) :: JA, JS, JE
391 real(RP),
intent(in) :: pott(KA,IA,JA)
392 real(RP),
intent(in) :: qv (KA,IA,JA)
393 real(RP),
intent(in) :: qc (KA,IA,JA)
394 real(RP),
intent(in) :: cz (KA,IA,JA)
396 real(RP),
intent(inout) :: pres(KA,IA,JA)
398 real(RP),
intent(out) :: dens(KA,IA,JA)
399 real(RP),
intent(out) :: temp(KA,IA,JA)
401 real(RP) :: dz(KA,IA,JA)
403 real(RP) :: pott_toa(IA,JA)
404 real(RP) :: qv_toa (IA,JA)
405 real(RP) :: qc_toa (IA,JA)
411 integer :: kref(IA,JA)
421 dz(k,i,j) = cz(k+1,i,j) - cz(k,i,j)
429 pott_toa(i,j) = pott(ke,i,j)
430 qv_toa(i,j) = qv(ke,i,j)
431 qc_toa(i,j) = qc(ke,i,j)
438 kref(i,j) = hydrostatic_buildrho_real_kref + ks - 1
440 if ( pres(k,i,j) .ne. undef )
then
454 rtot = rdry * ( 1.0_rp - qv(k,i,j) - qc(k,i,j) ) &
456 cvtot = cvdry * ( 1.0_rp - qv(k,i,j) - qc(k,i,j) ) &
459 cptot = cpdry * ( 1.0_rp - qv(k,i,j) - qc(k,i,j) ) &
462 dens(k,i,j) = p00 / ( rtot * pott(k,i,j) ) * ( pres(k,i,j)/p00 )**(cvtot/cptot)
467 call atmos_hydrostatic_buildrho_atmos_3d( ka, ks, ke, ia, is, ie, ja, js, je, &
468 pott(:,:,:), qv(:,:,:), qc(:,:,:), &
471 temp(:,:,:), pres(:,:,:), &
473 call atmos_hydrostatic_buildrho_atmos_rev_3d( ka, ks, ke, ia, is, ie, ja, js, je, &
474 pott(:,:,:), qv(:,:,:), qc(:,:,:), &
477 temp(:,:,:), pres(:,:,:), &
488 dens( 1:ks-1,:,:) = 0.0_rp
490 dens(ke+1:ka ,:,:) = 0.0_rp
500 pott_L2, qv_L2, qc_L2, &
501 dens_L1, pott_L1, qv_L1, qc_L1, &
503 dens_L2, temp_L2, pres_L2 )
512 real(RP),
intent(in) :: pott_L2
513 real(RP),
intent(in) :: qv_L2
514 real(RP),
intent(in) :: qc_L2
515 real(RP),
intent(in) :: dens_L1
516 real(RP),
intent(in) :: pott_L1
517 real(RP),
intent(in) :: qv_L1
518 real(RP),
intent(in) :: qc_L1
519 real(RP),
intent(in) :: dz
520 integer,
intent(in) :: k
522 real(RP),
intent(out) :: dens_L2
523 real(RP),
intent(out) :: temp_L2
524 real(RP),
intent(out) :: pres_L2
526 real(RP) :: Rtot_L1 , Rtot_L2
527 real(RP) :: CVtot_L1 , CVtot_L2
528 real(RP) :: CPtot_L1 , CPtot_L2
529 real(RP) :: CPovCV_L1, CPovCV_L2
532 real(RP) :: dens_s, dhyd, dgrd
537 rtot_l1 = rdry * ( 1.0_rp - qv_l1 - qc_l1 ) &
539 cvtot_l1 = cvdry * ( 1.0_rp - qv_l1 - qc_l1 ) &
542 cptot_l1 = cpdry * ( 1.0_rp - qv_l1 - qc_l1 ) &
545 cpovcv_l1 = cptot_l1 / cvtot_l1
547 rtot_l2 = rdry * ( 1.0_rp - qv_l2 - qc_l2 ) &
549 cvtot_l2 = cvdry * ( 1.0_rp - qv_l2 - qc_l2 ) &
552 cptot_l2 = cpdry * ( 1.0_rp - qv_l2 - qc_l2 ) &
555 cpovcv_l2 = cptot_l2 / cvtot_l2
560 pres_l1 = p00 * ( dens_l1 * rtot_l1 * pott_l1 / p00 )**cpovcv_l1
564 if ( abs(dens_l2-dens_s) <= criteria )
then
570 pres_l2 = p00 * ( dens_s * rtot_l2 * pott_l2 / p00 )**cpovcv_l2
572 dhyd = + ( pres_l1 - pres_l2 ) / dz &
573 - grav * 0.5_rp * ( dens_l1 + dens_s )
575 dgrd = - pres_l2 * cpovcv_l2 / dens_s / dz &
578 dens_l2 = dens_s - dhyd/dgrd
580 if ( dens_l2*0.0_rp /= 0.0_rp )
exit
583 if ( .NOT. converged )
then
584 log_error(
"ATMOS_HYDROSTATIC_buildrho_atmos_0D",*)
'iteration not converged!', &
585 k,dens_l2,ite,dens_s,dhyd,dgrd
589 pres_l2 = p00 * ( dens_l2 * rtot_l2 * pott_l2 / p00 )**cpovcv_l2
590 temp_l2 = pres_l2 / ( dens_l2 * rtot_l2 )
614 integer,
intent(in) :: KA, KS, KE
616 real(RP),
intent(in) :: pott(KA)
617 real(RP),
intent(in) :: qv (KA)
618 real(RP),
intent(in) :: qc (KA)
619 real(RP),
intent(in) :: dz (KA)
621 real(RP),
intent(inout) :: dens(KA)
623 real(RP),
intent(out) :: temp(KA)
624 real(RP),
intent(out) :: pres(KA)
626 real(RP) :: Rtot (KA)
627 real(RP) :: CPovCV(KA)
631 real(RP) :: dens_s, dhyd, dgrd
639 rtot(k) = rdry * ( 1.0_rp - qv(k) - qc(k) ) &
641 cvtot = cvdry * ( 1.0_rp - qv(k) - qc(k) ) &
644 cptot = cpdry * ( 1.0_rp - qv(k) - qc(k) ) &
647 cpovcv(k) = cptot / cvtot
650 pres(ks) = p00 * ( dens(ks) * rtot(ks) * pott(ks) / p00 )**cpovcv(ks)
659 if ( abs(dens(k)-dens_s) <= criteria )
then
665 pres(k) = p00 * ( dens_s * rtot(k) * pott(k) / p00 )**cpovcv(k)
667 dhyd = + ( pres(k-1) - pres(k) ) / dz(k-1) &
668 - grav * 0.5_rp * ( dens(k-1) + dens_s )
670 dgrd = - cpovcv(k) * pres(k) / dens_s / dz(k-1) &
673 dens(k) = dens_s - dhyd/dgrd
675 if ( dens(k)*0.0_rp /= 0.0_rp )
exit
678 if ( .NOT. converged )
then
679 log_error(
"ATMOS_HYDROSTATIC_buildrho_atmos_1D",*)
'iteration not converged!', &
680 k,dens(k),ite,dens_s,dhyd,dgrd
684 pres(k) = p00 * ( dens(k) * rtot(k) * pott(k) / p00 )**cpovcv(k)
689 temp(k) = pres(k) / ( dens(k) * rtot(k) )
692 dens(ke+1:ka ) = dens(ke)
693 pres(ke+1:ka ) = pres(ke)
694 temp(ke+1:ka ) = temp(ke)
718 integer,
intent(in) :: KA, KS, KE
720 real(RP),
intent(in) :: pott(KA)
721 real(RP),
intent(in) :: qv (KA)
722 real(RP),
intent(in) :: qc (KA)
723 real(RP),
intent(in) :: dz (KA)
725 real(RP),
intent(inout) :: dens(KA)
727 real(RP),
intent(out) :: temp(KA)
728 real(RP),
intent(out) :: pres(KA)
730 real(RP) :: Rtot (KA)
731 real(RP) :: CPovCV(KA)
735 real(RP) :: dens_s, dhyd, dgrd
743 rtot(k) = rdry * ( 1.0_rp - qv(k) - qc(k) ) &
745 cvtot = cvdry * ( 1.0_rp - qv(k) - qc(k) ) &
748 cptot = cpdry * ( 1.0_rp - qv(k) - qc(k) ) &
751 cpovcv(k) = cptot / cvtot
754 pres(ke) = p00 * ( dens(ke) * rtot(ke) * pott(ke) / p00 )**cpovcv(ke)
763 if ( abs(dens(k)-dens_s) <= criteria )
then
769 pres(k) = p00 * ( dens_s * rtot(k) * pott(k) / p00 )**cpovcv(k)
771 dhyd = - ( pres(k+1) - pres(k) ) / dz(k) &
772 - grav * 0.5_rp * ( dens(k+1) + dens_s )
774 dgrd = + cpovcv(k) * pres(k) / dens_s / dz(k) &
777 dens(k) = dens_s - dhyd/dgrd
779 if ( dens(k)*0.0_rp /= 0.0_rp )
exit
782 if ( .NOT. converged )
then
783 log_error(
"ATMOS_HYDROSTATIC_buildrho_atmos_rev_1D",*)
'iteration not converged!', &
784 k,dens(k),ite,dens_s,dhyd,dgrd
788 pres(k) = p00 * ( dens(k) * rtot(k) * pott(k) / p00 )**cpovcv(k)
793 temp(k) = pres(k) / ( dens(k) * rtot(k) )
796 dens( 1:ks-1) = dens(ks)
797 pres( 1:ks-1) = pres(ks)
798 temp( 1:ks-1) = temp(ks)
805 subroutine atmos_hydrostatic_buildrho_atmos_2d( &
806 IA, IS, IE, JA, JS, JE, &
807 pott_L2, qv_L2, qc_L2, &
808 dens_L1, pott_L1, qv_L1, qc_L1, &
810 dens_L2, temp_L2, pres_L2 )
812 integer,
intent(in) :: IA, IS, IE
813 integer,
intent(in) :: JA, JS, JE
815 real(RP),
intent(in) :: pott_L2(IA,JA)
816 real(RP),
intent(in) :: qv_L2 (IA,JA)
817 real(RP),
intent(in) :: qc_L2 (IA,JA)
818 real(RP),
intent(in) :: dens_L1(IA,JA)
819 real(RP),
intent(in) :: pott_L1(IA,JA)
820 real(RP),
intent(in) :: qv_L1 (IA,JA)
821 real(RP),
intent(in) :: qc_L1 (IA,JA)
822 real(RP),
intent(in) :: dz (IA,JA)
823 integer,
intent(in) :: k
825 real(RP),
intent(out) :: dens_L2(IA,JA)
826 real(RP),
intent(out) :: temp_L2(IA,JA)
827 real(RP),
intent(out) :: pres_L2(IA,JA)
836 pott_l2(i,j), qv_l2(i,j), qc_l2(i,j), &
837 dens_l1(i,j), pott_l1(i,j), qv_l1(i,j), qc_l1(i,j), &
839 dens_l2(i,j), temp_l2(i,j), pres_l2(i,j) )
844 end subroutine atmos_hydrostatic_buildrho_atmos_2d
848 subroutine atmos_hydrostatic_buildrho_atmos_rev_2d( &
849 IA, IS, IE, JA, JS, JE, &
850 pott_L1, qv_L1, qc_L1, &
851 dens_L2, pott_L2, qv_L2, qc_L2, &
853 dens_L1, temp_L1, pres_L1 )
855 integer,
intent(in) :: IA, IS, IE
856 integer,
intent(in) :: JA, JS, JE
858 real(RP),
intent(in) :: pott_L1(IA,JA)
859 real(RP),
intent(in) :: qv_L1 (IA,JA)
860 real(RP),
intent(in) :: qc_L1 (IA,JA)
861 real(RP),
intent(in) :: dens_L2(IA,JA)
862 real(RP),
intent(in) :: pott_L2(IA,JA)
863 real(RP),
intent(in) :: qv_L2 (IA,JA)
864 real(RP),
intent(in) :: qc_L2 (IA,JA)
865 real(RP),
intent(in) :: dz (IA,JA)
866 integer,
intent(in) :: k
868 real(RP),
intent(out) :: dens_L1(IA,JA)
869 real(RP),
intent(out) :: temp_L1(IA,JA)
870 real(RP),
intent(out) :: pres_L1(IA,JA)
879 pott_l1(i,j), qv_l1(i,j), qc_l1(i,j), &
880 dens_l2(i,j), pott_l2(i,j), qv_l2(i,j), qc_l2(i,j), &
882 dens_l1(i,j), temp_l1(i,j), pres_l1(i,j) )
887 end subroutine atmos_hydrostatic_buildrho_atmos_rev_2d
891 subroutine atmos_hydrostatic_buildrho_atmos_3d( &
892 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
899 integer,
intent(in) :: KA, KS, KE
900 integer,
intent(in) :: IA, IS, IE
901 integer,
intent(in) :: JA, JS, JE
903 real(RP),
intent(in) :: pott(KA,IA,JA)
904 real(RP),
intent(in) :: qv (KA,IA,JA)
905 real(RP),
intent(in) :: qc (KA,IA,JA)
906 real(RP),
intent(in) :: dz (KA,IA,JA)
908 real(RP),
intent(inout) :: dens(KA,IA,JA)
910 real(RP),
intent(out) :: temp(KA,IA,JA)
911 real(RP),
intent(out) :: pres(KA,IA,JA)
913 integer,
intent(in),
optional,
target :: kref(IA,JA)
915 integer,
pointer :: kref_(:,:)
920 if (
present(kref) )
then
923 allocate( kref_(ia,ja) )
937 pott(:,i,j), qv(:,i,j), qc(:,i,j), &
940 temp(:,i,j), pres(:,i,j) )
944 if ( .not.
present(kref) )
then
949 end subroutine atmos_hydrostatic_buildrho_atmos_3d
953 subroutine atmos_hydrostatic_buildrho_atmos_rev_3d( &
954 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
962 integer,
intent(in) :: KA, KS, KE
963 integer,
intent(in) :: IA, IS, IE
964 integer,
intent(in) :: JA, JS, JE
965 real(RP),
intent(inout) :: dens(KA,IA,JA)
966 real(RP),
intent(out) :: temp(KA,IA,JA)
967 real(RP),
intent(out) :: pres(KA,IA,JA)
968 real(RP),
intent(in) :: pott(KA,IA,JA)
969 real(RP),
intent(in) :: qv (KA,IA,JA)
970 real(RP),
intent(in) :: qc (KA,IA,JA)
971 real(RP),
intent(in) :: dz (KA,IA,JA)
972 integer,
intent(in),
optional,
target :: kref(IA,JA)
974 integer,
pointer :: kref_(:,:)
978 if (
present(kref) )
then
985 pott(:,i,j), qv(:,i,j), qc(:,i,j), &
988 temp(:,i,j), pres(:,i,j) )
996 pott(:,i,j), qv(:,i,j), qc(:,i,j), &
999 temp(:,i,j), pres(:,i,j) )
1005 end subroutine atmos_hydrostatic_buildrho_atmos_rev_3d
1010 subroutine atmos_hydrostatic_buildrho_bytemp_1d( &
1013 pres_sfc, temp_sfc, qv_sfc, qc_sfc, &
1015 dens, pott, pres, pott_sfc )
1024 integer,
intent(in) :: KA, KS, KE
1026 real(RP),
intent(in) :: temp(KA)
1027 real(RP),
intent(in) :: qv (KA)
1028 real(RP),
intent(in) :: qc (KA)
1029 real(RP),
intent(in) :: pres_sfc
1030 real(RP),
intent(in) :: temp_sfc
1031 real(RP),
intent(in) :: qv_sfc
1032 real(RP),
intent(in) :: qc_sfc
1033 real(RP),
intent(in) :: cz( KA)
1034 real(RP),
intent(in) :: fz(0:KA)
1036 real(RP),
intent(out) :: dens(KA)
1037 real(RP),
intent(out) :: pott(KA)
1038 real(RP),
intent(out) :: pres(KA)
1039 real(RP),
intent(out) :: pott_sfc
1041 real(RP) :: dens_sfc
1043 real(RP) :: Rtot_sfc
1044 real(RP) :: CVtot_sfc
1045 real(RP) :: CPtot_sfc
1050 real(RP) :: RovCP_sfc
1051 real(RP) :: dens_s, dhyd, dgrd
1053 logical :: converged
1062 rtot_sfc = rdry * ( 1.0_rp - qv_sfc - qc_sfc ) &
1064 cvtot_sfc = cvdry * ( 1.0_rp - qv_sfc - qc_sfc ) &
1067 cptot_sfc = cpdry * ( 1.0_rp - qv_sfc - qc_sfc ) &
1071 rtot = rdry * ( 1.0_rp - qv(ks) - qc(ks) ) &
1073 cvtot = cvdry * ( 1.0_rp - qv(ks) - qc(ks) ) &
1076 cptot = cpdry * ( 1.0_rp - qv(ks) - qc(ks) ) &
1081 rovcp_sfc = rtot_sfc / cptot_sfc
1082 dens_sfc = pres_sfc / ( rtot_sfc * temp_sfc )
1083 pott_sfc = temp_sfc * ( p00/pres_sfc )**rovcp_sfc
1089 dz(ks-1) = cz(ks) - fz(ks-1)
1091 dz(k) = cz(k+1) - cz(k)
1096 if ( abs(dens(ks)-dens_s) <= criteria )
then
1103 dhyd = + ( pres_sfc - dens_s * rtot * temp(ks) ) / dz(ks-1) &
1104 - grav * 0.5_rp * ( dens_sfc + dens_s )
1106 dgrd = - rtot * temp(ks) / dz(ks-1) &
1109 dens(ks) = dens_s - dhyd/dgrd
1111 if ( dens(ks)*0.0_rp /= 0.0_rp )
exit
1114 if ( .NOT. converged )
then
1115 log_error(
"ATMOS_HYDROSTATIC_buildrho_bytemp_1D",*)
'iteration not converged!', &
1116 dens(ks),ite,dens_s,dhyd,dgrd
1121 call atmos_hydrostatic_buildrho_bytemp_atmos_1d( ka, ks, ke, &
1122 temp(:), qv(:), qc(:), &
1128 end subroutine atmos_hydrostatic_buildrho_bytemp_1d
1133 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
1135 pres_sfc, temp_sfc, qv_sfc, qc_sfc, &
1140 integer,
intent(in) :: KA, KS, KE
1141 integer,
intent(in) :: IA, IS, IE
1142 integer,
intent(in) :: JA, JS, JE
1144 real(RP),
intent(in) :: temp(KA,IA,JA)
1145 real(RP),
intent(in) :: qv (KA,IA,JA)
1146 real(RP),
intent(in) :: qc (KA,IA,JA)
1147 real(RP),
intent(in) :: pres_sfc(IA,JA)
1148 real(RP),
intent(in) :: temp_sfc(IA,JA)
1149 real(RP),
intent(in) :: qv_sfc (IA,JA)
1150 real(RP),
intent(in) :: qc_sfc (IA,JA)
1151 real(RP),
intent(in) :: cz(KA,IA,JA)
1152 real(RP),
intent(in) :: fz(KA,IA,JA)
1154 real(RP),
intent(out) :: dens(KA,IA,JA)
1155 real(RP),
intent(out) :: pott(KA,IA,JA)
1156 real(RP),
intent(out) :: pres(KA,IA,JA)
1157 real(RP),
intent(out) :: pott_sfc(IA,JA)
1166 call atmos_hydrostatic_buildrho_bytemp_1d( ka, ks, ke, &
1167 temp(:,i,j), qv(:,i,j), qc(:,i,j), &
1168 pres_sfc(i,j), temp_sfc(i,j), qv_sfc(i,j), qc_sfc(i,j), &
1169 cz(:,i,j), fz(:,i,j), &
1170 dens(:,i,j), pott(:,i,j), pres(:,i,j), &
1181 subroutine atmos_hydrostatic_buildrho_bytemp_atmos_1d( &
1195 integer,
intent(in) :: KA, KS, KE
1197 real(RP),
intent(in) :: temp(KA)
1198 real(RP),
intent(in) :: qv (KA)
1199 real(RP),
intent(in) :: qc (KA)
1200 real(RP),
intent(in) :: dz (KA)
1202 real(RP),
intent(inout) :: dens(KA)
1204 real(RP),
intent(out) :: pott(KA)
1205 real(RP),
intent(out) :: pres(KA)
1207 real(RP) :: Rtot (KA)
1208 real(RP) :: CVtot (KA)
1209 real(RP) :: CPtot (KA)
1212 real(RP) :: dens_s, dhyd, dgrd
1214 logical :: converged
1220 rtot(k) = rdry * ( 1.0_rp - qv(k) - qc(k) ) &
1222 cvtot(k) = cvdry * ( 1.0_rp - qv(k) - qc(k) ) &
1225 cptot(k) = cpdry * ( 1.0_rp - qv(k) - qc(k) ) &
1230 pres(ks) = dens(ks) * rtot(ks) * temp(ks)
1239 if ( abs(dens(k)-dens_s) <= criteria )
then
1246 dhyd = + ( pres(k-1) - dens_s * rtot(k) * temp(k) ) / dz(k-1) &
1247 - grav * 0.5_rp * ( dens(k-1) + dens_s )
1249 dgrd = - rtot(k) * temp(k) / dz(k-1) &
1252 dens(k) = dens_s - dhyd/dgrd
1254 if ( dens(k)*0.0_rp /= 0.0_rp )
exit
1257 if ( .NOT. converged )
then
1258 log_error(
"ATMOS_HYDROSTATIC_buildrho_bytemp_atmos_1D",*)
'iteration not converged!', &
1259 k,dens(k),ite,dens_s,dhyd,dgrd
1263 pres(k) = dens(k) * rtot(k) * temp(k)
1268 rovcp = rtot(k) / cptot(k)
1269 pott(k) = temp(k) * ( p00 / pres(k) )**rovcp
1273 end subroutine atmos_hydrostatic_buildrho_bytemp_atmos_1d
1292 integer,
intent(in) :: KA, KS, KE
1294 real(RP),
intent(in) :: temp(KA)
1295 real(RP),
intent(in) :: qv (KA)
1296 real(RP),
intent(in) :: qc (KA)
1297 real(RP),
intent(in) :: dz (KA)
1299 real(RP),
intent(inout) :: dens(KA)
1301 real(RP),
intent(out) :: pott(KA)
1302 real(RP),
intent(out) :: pres(KA)
1304 real(RP) :: Rtot (KA)
1305 real(RP) :: CVtot (KA)
1306 real(RP) :: CPtot (KA)
1309 real(RP) :: dens_s, dhyd, dgrd
1311 logical :: converged
1317 rtot(k) = rdry * ( 1.0_rp - qv(k) - qc(k) ) &
1319 cvtot(k) = cvdry * ( 1.0_rp - qv(k) - qc(k) ) &
1322 cptot(k) = cpdry * ( 1.0_rp - qv(k) - qc(k) ) &
1327 pres(ke) = dens(ke) * rtot(ke) * temp(ke)
1336 if ( abs(dens(k)-dens_s) <= criteria )
then
1343 dhyd = - ( pres(k+1) - dens_s * rtot(k) * temp(k) ) / dz(k) &
1344 - grav * 0.5_rp * ( dens(k+1) + dens_s )
1346 dgrd = + rtot(k) * temp(k) / dz(k) &
1349 dens(k) = dens_s - dhyd/dgrd
1351 if ( dens(k)*0.0_rp /= 0.0_rp )
exit
1354 if ( .NOT. converged )
then
1355 log_error(
"ATMOS_HYDROSTATIC_buildrho_bytemp_atmos_rev_1D",*)
'iteration not converged!', &
1356 k,dens(k),ite,dens_s,dhyd,dgrd
1360 pres(k) = dens(k) * rtot(k) * temp(k)
1365 rovcp = rtot(k) / cptot(k)
1366 pott(k) = temp(k) * ( p00 / pres(k) )**rovcp
1375 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
1381 integer,
intent(in) :: KA, KS, KE
1382 integer,
intent(in) :: IA, IS, IE
1383 integer,
intent(in) :: JA, JS, JE
1385 real(RP),
intent(in) :: temp(KA,IA,JA)
1386 real(RP),
intent(in) :: qv (KA,IA,JA)
1387 real(RP),
intent(in) :: qc (KA,IA,JA)
1388 real(RP),
intent(in) :: dz (KA,IA,JA)
1390 real(RP),
intent(inout) :: dens(KA,IA,JA)
1391 real(RP),
intent(out) :: pott(KA,IA,JA)
1392 real(RP),
intent(out) :: pres(KA,IA,JA)
1400 call atmos_hydrostatic_buildrho_bytemp_atmos_1d( ka, ks, ke, &
1401 temp(:,i,j), qv(:,i,j), qc(:,i,j), &
1404 pott(:,i,j), pres(:,i,j) )
1415 subroutine atmos_hydrostatic_barometric_law_mslp_0d( &
1421 integer,
intent(in) :: KA, KS, KE
1423 real(RP),
intent(in) :: pres(KA)
1424 real(RP),
intent(in) :: temp(KA)
1425 real(RP),
intent(in) :: qv (KA)
1426 real(RP),
intent(in) :: cz (KA)
1428 real(RP),
intent(out) :: mslp
1435 kref = hydrostatic_barometric_law_mslp_kref + ks - 1
1438 vtemp = temp(kref) * (1.0_rp + epstvap * qv(kref) )
1441 mslp = pres(kref) * ( ( vtemp + laps * cz(kref) ) / vtemp ) ** ( grav / ( rdry * laps ) )
1444 end subroutine atmos_hydrostatic_barometric_law_mslp_0d
1448 subroutine atmos_hydrostatic_barometric_law_mslp_2d( &
1449 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
1454 integer,
intent(in) :: KA, KS, KE
1455 integer,
intent(in) :: IA, IS, IE
1456 integer,
intent(in) :: JA, JS, JE
1458 real(RP),
intent(in) :: pres(KA,IA,JA)
1459 real(RP),
intent(in) :: temp(KA,IA,JA)
1460 real(RP),
intent(in) :: qv (KA,IA,JA)
1461 real(RP),
intent(in) :: cz (KA,IA,JA)
1463 real(RP),
intent(out) :: mslp(IA,JA)
1471 call atmos_hydrostatic_barometric_law_mslp_0d( ka, ks, ke, &
1472 pres(:,i,j), temp(:,i,j), qv(:,i,j), &
1479 end subroutine atmos_hydrostatic_barometric_law_mslp_2d
1485 subroutine atmos_hydrostatic_barometric_law_pres_0d( &
1490 real(RP),
intent(in) :: mslp
1491 real(RP),
intent(in) :: temp
1492 real(RP),
intent(in) :: dz
1494 real(RP),
intent(out) :: pres
1500 tm = temp + laps * dz * 0.5_rp
1503 pres = mslp / exp( grav * dz / ( rdry * tm ) )
1506 end subroutine atmos_hydrostatic_barometric_law_pres_0d
1510 subroutine atmos_hydrostatic_barometric_law_pres_2d( &
1511 IA, IS, IE, JA, JS, JE, &
1516 integer,
intent(in) :: IA, IS, IE
1517 integer,
intent(in) :: JA, JS, JE
1519 real(RP),
intent(in) :: mslp(IA,JA)
1520 real(RP),
intent(in) :: temp(IA,JA)
1521 real(RP),
intent(in) :: dz (IA,JA)
1523 real(RP),
intent(out) :: pres(IA,JA)
1531 call atmos_hydrostatic_barometric_law_pres_0d( mslp(i,j), temp(i,j), dz(i,j), &
1537 end subroutine atmos_hydrostatic_barometric_law_pres_2d