48 public :: atmos_hydrostatic_buildrho
49 public :: atmos_hydrostatic_buildrho_real
50 public :: atmos_hydrostatic_buildrho_atmos
51 public :: atmos_hydrostatic_buildrho_bytemp
52 public :: atmos_hydrostatic_buildrho_bytemp_atmos
58 public :: atmos_hydrostatic_barometric_law_mslp
59 public :: atmos_hydrostatic_barometric_law_pres
61 interface atmos_hydrostatic_buildrho
64 end interface atmos_hydrostatic_buildrho
66 interface atmos_hydrostatic_buildrho_real
69 end interface atmos_hydrostatic_buildrho_real
71 interface atmos_hydrostatic_buildrho_atmos
74 end interface atmos_hydrostatic_buildrho_atmos
76 interface atmos_hydrostatic_buildrho_bytemp
79 end interface atmos_hydrostatic_buildrho_bytemp
81 interface atmos_hydrostatic_buildrho_bytemp_atmos
84 end interface atmos_hydrostatic_buildrho_bytemp_atmos
86 interface atmos_hydrostatic_barometric_law_mslp
88 module procedure atmos_hydrostatic_barometric_law_mslp_2d
89 end interface atmos_hydrostatic_barometric_law_mslp
91 interface atmos_hydrostatic_barometric_law_pres
92 module procedure atmos_hydrostatic_barometric_law_pres_0d
93 module procedure atmos_hydrostatic_barometric_law_pres_2d
94 end interface atmos_hydrostatic_barometric_law_pres
104 private :: atmos_hydrostatic_buildrho_atmos_2d
110 integer,
private,
parameter :: itelim = 100
111 real(RP),
private :: criteria
112 logical,
private :: HYDROSTATIC_uselapserate = .false.
113 integer,
private :: HYDROSTATIC_buildrho_real_kref = 1
115 real(RP),
private :: CV_qv
116 real(RP),
private :: CP_qv
117 real(RP),
private :: CV_qc
118 real(RP),
private :: CP_qc
137 namelist / param_atmos_hydrostatic / &
138 hydrostatic_uselapserate, &
139 hydrostatic_buildrho_real_kref
145 if(
io_l )
write(
io_fid_log,*)
'++++++ Module[HYDROSTATIC] / Categ[ATMOS SHARE] / Origin[SCALElib]' 149 read(
io_fid_conf,nml=param_atmos_hydrostatic,iostat=ierr)
151 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 152 elseif( ierr > 0 )
then 153 write(*,*)
'xxx Not appropriate names in namelist PARAM_ATMOS_HYDROSTATIC. Check!' 161 if(
io_l )
write(
io_fid_log,*)
'*** Use lapse rate for estimation of surface temperature? : ', hydrostatic_uselapserate
162 if(
io_l )
write(
io_fid_log,*)
'*** Buildrho conversion criteria : ', criteria
198 real(RP),
intent(out) :: dens(KA)
199 real(RP),
intent(out) :: temp(KA)
200 real(RP),
intent(out) :: pres(KA)
201 real(RP),
intent(in) :: pott(KA)
202 real(RP),
intent(in) :: qv (KA)
203 real(RP),
intent(in) :: qc (KA)
205 real(RP),
intent(out) :: temp_sfc
206 real(RP),
intent(in) :: pres_sfc
207 real(RP),
intent(in) :: pott_sfc
208 real(RP),
intent(in) :: qv_sfc
209 real(RP),
intent(in) :: qc_sfc
214 real(RP) :: CVtot_sfc
215 real(RP) :: CPovCV_sfc
221 real(RP) :: CVovCP_sfc, CPovR, CVovCP, RovCV
222 real(RP) :: dens_s, dhyd, dgrd
229 rtot_sfc = rdry * ( 1.0_rp - qv_sfc - qc_sfc ) &
231 cvtot_sfc = cvdry * ( 1.0_rp - qv_sfc - qc_sfc ) &
234 cpovcv_sfc = ( cvtot_sfc + rtot_sfc ) / cvtot_sfc
236 rtot = rdry * ( 1.0_rp - qv(
ks) - qc(
ks) ) &
238 cvtot = cvdry * ( 1.0_rp - qv(
ks) - qc(
ks) ) &
241 cptot = cpdry * ( 1.0_rp - qv(
ks) - qc(
ks) ) &
244 cpovcv = cptot / cvtot
247 cvovcp_sfc = 1.0_rp / cpovcv_sfc
248 dens_sfc = p00 / rtot_sfc / pott_sfc * ( pres_sfc/p00 )**cvovcp_sfc
249 temp_sfc = pres_sfc / ( dens_sfc * rtot_sfc )
252 if ( hydrostatic_uselapserate )
then 255 cvovcp = 1.0_rp / cpovcv
258 pres(
ks) = p00 * ( temp(
ks)/pott(
ks) )**cpovr
259 dens(
ks) = p00 / rtot / pott(
ks) * ( pres(
ks)/p00 )**cvovcp
270 if ( abs(dens(
ks)-dens_s) <= criteria )
then 277 dhyd = + ( p00 * ( dens_sfc * rtot_sfc * pott_sfc / p00 )**cpovcv_sfc &
278 - p00 * ( dens_s * rtot * pott(
ks) / p00 )**cpovcv ) /
grid_cz(
ks) &
279 - grav * 0.5_rp * ( dens_sfc + dens_s )
281 dgrd = - p00 * ( rtot * pott(
ks) / p00 )**cpovcv /
grid_cz(
ks) &
282 * cpovcv * dens_s**rovcv &
285 dens(
ks) = dens_s - dhyd/dgrd
287 if( dens(
ks)*0.0_rp /= 0.0_rp)
exit 290 if ( .NOT. converged )
then 291 write(*,*)
'xxx [buildrho 1D sfc] iteration not converged!', &
292 dens(
ks),ite,dens_s,dhyd,dgrd
329 real(RP),
intent(out) :: dens(KA,IA,JA)
330 real(RP),
intent(out) :: temp(KA,IA,JA)
331 real(RP),
intent(out) :: pres(KA,IA,JA)
332 real(RP),
intent(in) :: pott(KA,IA,JA)
333 real(RP),
intent(in) :: qv (KA,IA,JA)
334 real(RP),
intent(in) :: qc (KA,IA,JA)
336 real(RP),
intent(out) :: temp_sfc(1,IA,JA)
337 real(RP),
intent(in) :: pres_sfc(1,IA,JA)
338 real(RP),
intent(in) :: pott_sfc(1,IA,JA)
339 real(RP),
intent(in) :: qv_sfc (1,IA,JA)
340 real(RP),
intent(in) :: qc_sfc (1,IA,JA)
342 real(RP) :: dz(KA,IA,JA)
344 real(RP) :: dens_sfc (1,IA,JA)
345 real(RP) :: pott_toa (IA,JA)
346 real(RP) :: qv_toa (IA,JA)
347 real(RP) :: qc_toa (IA,JA)
348 real(RP) :: dens_1D (KA)
350 real(RP) :: Rtot_sfc (IA,JA)
351 real(RP) :: CVtot_sfc (IA,JA)
352 real(RP) :: CPtot_sfc (IA,JA)
353 real(RP) :: CPovCV_sfc(IA,JA)
354 real(RP) :: Rtot (IA,JA)
355 real(RP) :: CVtot (IA,JA)
356 real(RP) :: CPtot (IA,JA)
357 real(RP) :: CPovCV (IA,JA)
359 real(RP) :: CVovCP_sfc, CPovR, CVovCP
378 pott_toa(i,j) = pott(
ke,i,j)
379 qv_toa(i,j) = qv(
ke,i,j)
380 qc_toa(i,j) = qc(
ke,i,j)
387 rtot_sfc(i,j) = rdry * ( 1.0_rp - qv_sfc(1,i,j) - qc_sfc(1,i,j) ) &
388 + rvap * qv_sfc(1,i,j)
389 cvtot_sfc(i,j) = cvdry * ( 1.0_rp - qv_sfc(1,i,j) - qc_sfc(1,i,j) ) &
390 + cv_qv * qv_sfc(1,i,j) &
391 + cv_qc * qc_sfc(1,i,j)
392 cptot_sfc(i,j) = cpdry * ( 1.0_rp - qv_sfc(1,i,j) - qc_sfc(1,i,j) ) &
393 + cp_qv * qv_sfc(1,i,j) &
394 + cv_qc * qc_sfc(1,i,j)
395 cpovcv_sfc(i,j) = cptot_sfc(i,j) / cvtot_sfc(i,j)
401 rtot(i,j) = rdry * ( 1.0_rp - qv(
ks,i,j) - qc(
ks,i,j) ) &
403 cvtot(i,j) = cvdry * ( 1.0_rp - qv(
ks,i,j) - qc(
ks,i,j) ) &
404 + cv_qv * qv(
ks,i,j) &
406 cptot(i,j) = cpdry * ( 1.0_rp - qv(
ks,i,j) - qc(
ks,i,j) ) &
407 + cp_qv * qv(
ks,i,j) &
409 cpovcv(i,j) = cptot(i,j) / cvtot(i,j)
416 cvovcp_sfc = 1.0_rp / cpovcv_sfc(i,j)
417 dens_sfc(1,i,j) = p00 / rtot_sfc(i,j) / pott_sfc(1,i,j) * ( pres_sfc(1,i,j)/p00 )**cvovcp_sfc
418 temp_sfc(1,i,j) = pres_sfc(1,i,j) / ( dens_sfc(1,i,j) * rtot_sfc(i,j) )
423 if ( hydrostatic_uselapserate )
then 427 cpovr = cptot(i,j) / rtot(i,j)
428 cvovcp = 1.0_rp / cpovcv(i,j)
431 pres(
ks,i,j) = p00 * ( temp(
ks,i,j)/pott(
ks,i,j) )**cpovr
432 dens(
ks,i,j) = p00 / rtot(i,j) / pott(
ks,i,j) * ( pres(
ks,i,j)/p00 )**cvovcp
438 call atmos_hydrostatic_buildrho_atmos_2d( dens(
ks,:,:), &
462 call atmos_hydrostatic_buildrho_atmos_2d( dens(
ke+1,:,:), &
476 dens( 1:
ks-1,:,:) = 0.d0
477 dens(
ke+2:ka ,:,:) = 0.d0
482 dens(:,i,j) = dens_1d(:)
524 real(RP),
intent(out) :: dens(KA,IA,JA)
525 real(RP),
intent(out) :: temp(KA,IA,JA)
526 real(RP),
intent(inout) :: pres(KA,IA,JA)
527 real(RP),
intent(in) :: pott(KA,IA,JA)
528 real(RP),
intent(in) :: qv (KA,IA,JA)
529 real(RP),
intent(in) :: qc (KA,IA,JA)
531 real(RP) :: dz(KA,IA,JA)
533 real(RP) :: pott_toa(IA,JA)
534 real(RP) :: qv_toa (IA,JA)
535 real(RP) :: qc_toa (IA,JA)
560 pott_toa(i,j) = pott(
ke,i,j)
561 qv_toa(i,j) = qv(
ke,i,j)
562 qc_toa(i,j) = qc(
ke,i,j)
566 kref = hydrostatic_buildrho_real_kref +
ks - 1
571 rtot = rdry * ( 1.0_rp - qv(kref,i,j) - qc(kref,i,j) ) &
572 + rvap * qv(kref,i,j)
573 cvtot = cvdry * ( 1.0_rp - qv(kref,i,j) - qc(kref,i,j) ) &
574 + cv_qv * qv(kref,i,j) &
575 + cv_qc * qc(kref,i,j)
576 cptot = cpdry * ( 1.0_rp - qv(kref,i,j) - qc(kref,i,j) ) &
577 + cp_qv * qv(kref,i,j) &
578 + cv_qc * qc(kref,i,j)
579 cvovcp = cvtot / cptot
580 dens(kref,i,j) = p00 / ( rtot * pott(kref,i,j) ) * ( pres(kref,i,j)/p00 )**cvovcp
602 call atmos_hydrostatic_buildrho_atmos_2d( dens(
ke+1,:,:), &
616 dens( 1:
ks-1,:,:) = 0.d0
617 dens(
ke+2:ka ,:,:) = 0.d0
641 real(RP),
intent(out) :: dens_l2
642 real(RP),
intent(out) :: temp_l2
643 real(RP),
intent(out) :: pres_l2
644 real(RP),
intent(in) :: pott_l2
645 real(RP),
intent(in) :: qv_l2
646 real(RP),
intent(in) :: qc_l2
647 real(RP),
intent(in) :: dens_l1
648 real(RP),
intent(in) :: pott_l1
649 real(RP),
intent(in) :: qv_l1
650 real(RP),
intent(in) :: qc_l1
651 real(RP),
intent(in) :: dz
652 integer,
intent(in) :: k
654 real(RP) :: rtot_l1 , rtot_l2
655 real(RP) :: cvtot_l1 , cvtot_l2
656 real(RP) :: cptot_l1 , cptot_l2
657 real(RP) :: cpovcv_l1, cpovcv_l2
660 real(RP) :: dens_s, dhyd, dgrd
665 rtot_l1 = rdry * ( 1.0_rp - qv_l1 - qc_l1 ) &
667 cvtot_l1 = cvdry * ( 1.0_rp - qv_l1 - qc_l1 ) &
670 cptot_l1 = cpdry * ( 1.0_rp - qv_l1 - qc_l1 ) &
673 cpovcv_l1 = cptot_l1 / cvtot_l1
675 rtot_l2 = rdry * ( 1.0_rp - qv_l2 - qc_l2 ) &
677 cvtot_l2 = cvdry * ( 1.0_rp - qv_l2 - qc_l2 ) &
680 cptot_l2 = cpdry * ( 1.0_rp - qv_l2 - qc_l2 ) &
683 cpovcv_l2 = cptot_l2 / cvtot_l2
685 rovcv = rtot_l2 / cvtot_l2
692 if ( abs(dens_l2-dens_s) <= criteria )
then 699 dhyd = + ( p00 * ( dens_l1 * rtot_l1 * pott_l1 / p00 )**cpovcv_l1 &
700 - p00 * ( dens_s * rtot_l2 * pott_l2 / p00 )**cpovcv_l2 ) / dz &
701 - grav * 0.5_rp * ( dens_l1 + dens_s )
703 dgrd = - p00 * ( rtot_l2 * pott_l2 / p00 )**cpovcv_l2 / dz &
704 * cpovcv_l2 * dens_s**rovcv &
707 dens_l2 = dens_s - dhyd/dgrd
709 if( dens_l2*0.0_rp /= 0.0_rp)
exit 712 if ( .NOT. converged )
then 713 write(*,*)
'xxx [buildrho 0D atmos] iteration not converged!', &
714 k,dens_l2,ite,dens_s,dhyd,dgrd
718 pres_l2 = p00 * ( dens_l2 * rtot_l2 * pott_l2 / p00 )**cpovcv_l2
719 temp_l2 = pres_l2 / ( dens_l2 * rtot_l2 )
737 real(RP),
intent(inout) :: dens(KA)
738 real(RP),
intent(out) :: temp(KA)
739 real(RP),
intent(out) :: pres(KA)
740 real(RP),
intent(in) :: pott(KA)
741 real(RP),
intent(in) :: qv (KA)
742 real(RP),
intent(in) :: qc (KA)
744 real(RP) :: Rtot (KA)
745 real(RP) :: CVtot (KA)
746 real(RP) :: CPtot (KA)
747 real(RP) :: CPovCV(KA)
750 real(RP) :: dens_s, dhyd, dgrd
758 rtot(k) = rdry * ( 1.0_rp - qv(k) - qc(k) ) &
760 cvtot(k) = cvdry * ( 1.0_rp - qv(k) - qc(k) ) &
763 cptot(k) = cpdry * ( 1.0_rp - qv(k) - qc(k) ) &
766 cpovcv(k) = cptot(k) / cvtot(k)
770 rovcv = rtot(k) / cvtot(k)
777 if ( abs(dens(k)-dens_s) <= criteria )
then 784 dhyd = + ( p00 * ( dens(k-1) * rtot(k-1) * pott(k-1) / p00 )**cpovcv(k-1) &
785 - p00 * ( dens_s * rtot(k ) * pott(k ) / p00 )**cpovcv(k ) ) /
grid_fdz(k-1) &
786 - grav * 0.5_rp * ( dens(k-1) + dens_s )
788 dgrd = - p00 * ( rtot(k) * pott(k) / p00 )**cpovcv(k) /
grid_fdz(k-1) &
789 * cpovcv(k) * dens_s**rovcv &
792 dens(k) = dens_s - dhyd/dgrd
794 if( dens(k)*0.0_rp /= 0.0_rp)
exit 797 if ( .NOT. converged )
then 798 write(*,*)
'xxx [buildrho 1D atmos] iteration not converged!', &
799 k,dens(k),ite,dens_s,dhyd,dgrd
805 pres(k) = p00 * ( dens(k) * rtot(k) * pott(k) / p00 )**cpovcv(k)
806 temp(k) = pres(k) / ( dens(k) * rtot(k) )
809 dens( 1:
ks-1) = dens(
ks)
810 dens(
ke+1:ka ) = dens(
ke)
811 pres( 1:
ks-1) = pres(
ks)
812 pres(
ke+1:ka ) = pres(
ke)
813 temp( 1:
ks-1) = temp(
ks)
814 temp(
ke+1:ka ) = temp(
ke)
821 subroutine atmos_hydrostatic_buildrho_atmos_2d( &
838 real(RP),
intent(out) :: dens_L2(IA,JA)
839 real(RP),
intent(out) :: temp_L2(IA,JA)
840 real(RP),
intent(out) :: pres_L2(IA,JA)
841 real(RP),
intent(in) :: pott_L2(IA,JA)
842 real(RP),
intent(in) :: qv_L2 (IA,JA)
843 real(RP),
intent(in) :: qc_L2 (IA,JA)
844 real(RP),
intent(in) :: dens_L1(IA,JA)
845 real(RP),
intent(in) :: pott_L1(IA,JA)
846 real(RP),
intent(in) :: qv_L1 (IA,JA)
847 real(RP),
intent(in) :: qc_L1 (IA,JA)
848 real(RP),
intent(in) :: dz (IA,JA)
849 integer,
intent(in) :: k
851 real(RP) :: Rtot_L1 (IA,JA), Rtot_L2 (IA,JA)
852 real(RP) :: CVtot_L1 (IA,JA), CVtot_L2 (IA,JA)
853 real(RP) :: CPtot_L1 (IA,JA), CPtot_L2 (IA,JA)
854 real(RP) :: CPovCV_L1(IA,JA), CPovCV_L2(IA,JA)
857 real(RP) :: dens_s, dhyd, dgrd
866 rtot_l1(i,j) = rdry * ( 1.0_rp - qv_l1(i,j) - qc_l1(i,j) ) &
868 cvtot_l1(i,j) = cvdry * ( 1.0_rp - qv_l1(i,j) - qc_l1(i,j) ) &
869 + cv_qv * qv_l1(i,j) &
871 cptot_l1(i,j) = cpdry * ( 1.0_rp - qv_l1(i,j) - qc_l1(i,j) ) &
872 + cp_qv * qv_l1(i,j) &
874 cpovcv_l1(i,j) = cptot_l1(i,j) / cvtot_l1(i,j)
876 rtot_l2(i,j) = rdry * ( 1.0_rp - qv_l2(i,j) - qc_l2(i,j) ) &
878 cvtot_l2(i,j) = cvdry * ( 1.0_rp - qv_l2(i,j) - qc_l2(i,j) ) &
879 + cv_qv * qv_l2(i,j) &
881 cptot_l2(i,j) = cpdry * ( 1.0_rp - qv_l2(i,j) - qc_l2(i,j) ) &
882 + cp_qv * qv_l2(i,j) &
884 cpovcv_l2(i,j) = cptot_l2(i,j) / cvtot_l2(i,j)
890 rovcv = rtot_l2(i,j) / cvtot_l2(i,j)
893 dens_l2(i,j) = dens_l1(i,j)
897 if ( abs(dens_l2(i,j)-dens_s) <= criteria )
then 902 dens_s = dens_l2(i,j)
904 dhyd = + ( p00 * ( dens_l1(i,j) * rtot_l1(i,j) * pott_l1(i,j) / p00 )**cpovcv_l1(i,j) &
905 - p00 * ( dens_s * rtot_l2(i,j) * pott_l2(i,j) / p00 )**cpovcv_l2(i,j) ) / dz(i,j) &
906 - grav * 0.5_rp * ( dens_l1(i,j) + dens_s )
908 dgrd = - p00 * ( rtot_l2(i,j) * pott_l2(i,j) / p00 )**cpovcv_l2(i,j) / dz(i,j) &
909 * cpovcv_l2(i,j) * dens_s**rovcv &
912 dens_l2(i,j) = dens_s - dhyd/dgrd
914 if( dens_l2(i,j)*0.0_rp /= 0.0_rp)
exit 917 if ( .NOT. converged )
then 918 write(*,*)
'xxx [buildrho 2D atmos] iteration not converged!', &
919 i,j,k,dens_l2(i,j),ite,dens_s,dhyd,dgrd
927 pres_l2(i,j) = p00 * ( dens_l2(i,j) * rtot_l2(i,j) * pott_l2(i,j) / p00 )**cpovcv_l2(i,j)
928 temp_l2(i,j) = pres_l2(i,j) / ( dens_l2(i,j) * rtot_l2(i,j) )
933 end subroutine atmos_hydrostatic_buildrho_atmos_2d
950 real(RP),
intent(inout) :: dens(KA,IA,JA)
951 real(RP),
intent(out) :: temp(KA,IA,JA)
952 real(RP),
intent(out) :: pres(KA,IA,JA)
953 real(RP),
intent(in) :: pott(KA,IA,JA)
954 real(RP),
intent(in) :: qv (KA,IA,JA)
955 real(RP),
intent(in) :: qc (KA,IA,JA)
956 real(RP),
intent(in) :: dz (KA,IA,JA)
957 integer,
intent(in),
optional :: kref_in
959 real(RP) :: Rtot (KA,IA,JA)
960 real(RP) :: CVtot (KA,IA,JA)
961 real(RP) :: CPtot (KA,IA,JA)
962 real(RP) :: CPovCV(KA,IA,JA)
965 real(RP) :: dens_s, dhyd, dgrd
973 if (
present(kref_in) )
then 982 rtot(k,i,j) = rdry * ( 1.0_rp - qv(k,i,j) - qc(k,i,j) ) &
984 cvtot(k,i,j) = cvdry * ( 1.0_rp - qv(k,i,j) - qc(k,i,j) ) &
985 + cv_qv * qv(k,i,j) &
987 cptot(k,i,j) = cpdry * ( 1.0_rp - qv(k,i,j) - qc(k,i,j) ) &
988 + cp_qv * qv(k,i,j) &
990 cpovcv(k,i,j) = cptot(k,i,j) / cvtot(k,i,j)
998 rovcv = rtot(k,i,j) / cvtot(k,i,j)
1001 dens(k,i,j) = dens(k-1,i,j)
1005 if ( abs(dens(k,i,j)-dens_s) <= criteria )
then 1010 dens_s = dens(k,i,j)
1012 dhyd = + ( p00 * ( dens(k-1,i,j) * rtot(k-1,i,j) * pott(k-1,i,j) / p00 )**cpovcv(k-1,i,j) &
1013 - p00 * ( dens_s * rtot(k ,i,j) * pott(k ,i,j) / p00 )**cpovcv(k ,i,j) ) / dz(k,i,j) &
1014 - grav * 0.5_rp * ( dens(k-1,i,j) + dens_s )
1016 dgrd = - p00 * ( rtot(k,i,j) * pott(k,i,j) / p00 )**cpovcv(k,i,j) / dz(k,i,j) &
1017 * cpovcv(k,i,j) * dens_s**rovcv &
1020 dens(k,i,j) = dens_s - dhyd/dgrd
1022 if( dens(k,i,j)*0.0_rp /= 0.0_rp)
exit 1025 if ( .NOT. converged )
then 1026 write(*,*)
'xxx [buildrho 3D atmos] iteration not converged!', &
1027 k,i,j,dens(k,i,j),ite,dens_s,dhyd,dgrd
1037 pres(k,i,j) = p00 * ( dens(k,i,j) * rtot(k,i,j) * pott(k,i,j) / p00 )**cpovcv(k,i,j)
1038 temp(k,i,j) = pres(k,i,j) / ( dens(k,i,j) * rtot(k,i,j) )
1065 real(RP),
intent(out) :: dens_l1(
ia,
ja)
1066 real(RP),
intent(out) :: temp_l1(
ia,
ja)
1067 real(RP),
intent(out) :: pres_l1(
ia,
ja)
1068 real(RP),
intent(in) :: pott_l1(
ia,
ja)
1069 real(RP),
intent(in) :: qv_l1 (
ia,
ja)
1070 real(RP),
intent(in) :: qc_l1 (
ia,
ja)
1071 real(RP),
intent(in) :: dens_l2(
ia,
ja)
1072 real(RP),
intent(in) :: pott_l2(
ia,
ja)
1073 real(RP),
intent(in) :: qv_l2 (
ia,
ja)
1074 real(RP),
intent(in) :: qc_l2 (
ia,
ja)
1075 real(RP),
intent(in) :: dz (
ia,
ja)
1076 integer,
intent(in) :: k
1078 real(RP) :: rtot_l1 (
ia,
ja), rtot_l2 (
ia,
ja)
1079 real(RP) :: cvtot_l1 (
ia,
ja), cvtot_l2 (
ia,
ja)
1080 real(RP) :: cptot_l1 (
ia,
ja), cptot_l2 (
ia,
ja)
1081 real(RP) :: cpovcv_l1(
ia,
ja), cpovcv_l2(
ia,
ja)
1084 real(RP) :: dens_s, dhyd, dgrd
1086 logical :: converged
1093 rtot_l1(i,j) = rdry * ( 1.0_rp - qv_l1(i,j) - qc_l1(i,j) ) &
1095 cvtot_l1(i,j) = cvdry * ( 1.0_rp - qv_l1(i,j) - qc_l1(i,j) ) &
1096 + cv_qv * qv_l1(i,j) &
1097 + cv_qc * qc_l1(i,j)
1098 cptot_l1(i,j) = cpdry * ( 1.0_rp - qv_l1(i,j) - qc_l1(i,j) ) &
1099 + cp_qv * qv_l1(i,j) &
1100 + cv_qc * qc_l1(i,j)
1101 cpovcv_l1(i,j) = cptot_l1(i,j) / cvtot_l1(i,j)
1103 rtot_l2(i,j) = rdry * ( 1.0_rp - qv_l2(i,j) - qc_l2(i,j) ) &
1105 cvtot_l2(i,j) = cvdry * ( 1.0_rp - qv_l2(i,j) - qc_l2(i,j) ) &
1106 + cv_qv * qv_l2(i,j) &
1107 + cv_qc * qc_l2(i,j)
1108 cptot_l2(i,j) = cpdry * ( 1.0_rp - qv_l2(i,j) - qc_l2(i,j) ) &
1109 + cp_qv * qv_l2(i,j) &
1110 + cv_qc * qc_l2(i,j)
1111 cpovcv_l2(i,j) = cptot_l2(i,j) / cvtot_l2(i,j)
1117 rovcv = rtot_l1(i,j) / cvtot_l1(i,j)
1120 dens_l1(i,j) = dens_l2(i,j)
1124 if ( abs(dens_l1(i,j)-dens_s) <= criteria )
then 1129 dens_s = dens_l1(i,j)
1131 dhyd = + ( p00 * ( dens_s * rtot_l1(i,j) * pott_l1(i,j) / p00 )**cpovcv_l1(i,j) &
1132 - p00 * ( dens_l2(i,j) * rtot_l2(i,j) * pott_l2(i,j) / p00 )**cpovcv_l2(i,j) ) / dz(i,j) &
1133 - grav * 0.5_rp * ( dens_s + dens_l2(i,j) )
1135 dgrd = + p00 * ( rtot_l1(i,j) * pott_l1(i,j) / p00 )**cpovcv_l1(i,j) / dz(i,j) &
1136 * cpovcv_l1(i,j) * dens_s**rovcv &
1139 dens_l1(i,j) = dens_s - dhyd/dgrd
1141 if( dens_l1(i,j)*0.0_rp /= 0.0_rp)
exit 1144 if ( .NOT. converged )
then 1145 write(*,*)
'xxx [buildrho 2D rev atmos] iteration not converged!', &
1146 i,j,k,dens_l1(i,j),ite,dens_s,dhyd,dgrd
1154 pres_l1(i,j) = p00 * ( dens_l1(i,j) * rtot_l1(i,j) * pott_l1(i,j) / p00 )**cpovcv_l1(i,j)
1155 temp_l1(i,j) = pres_l1(i,j) / ( dens_l1(i,j) * rtot_l1(i,j) )
1177 real(RP),
intent(inout) :: dens(
ka,
ia,
ja)
1178 real(RP),
intent(out) :: temp(
ka,
ia,
ja)
1179 real(RP),
intent(out) :: pres(
ka,
ia,
ja)
1180 real(RP),
intent(in) :: pott(
ka,
ia,
ja)
1181 real(RP),
intent(in) :: qv (
ka,
ia,
ja)
1182 real(RP),
intent(in) :: qc (
ka,
ia,
ja)
1183 real(RP),
intent(in) :: dz (
ka,
ia,
ja)
1184 integer,
intent(in),
optional :: kref_in
1186 real(RP) :: rtot (
ka,
ia,
ja)
1187 real(RP) :: cvtot (
ka,
ia,
ja)
1188 real(RP) :: cptot (
ka,
ia,
ja)
1189 real(RP) :: cpovcv(
ka,
ia,
ja)
1192 real(RP) :: dens_s, dhyd, dgrd
1194 logical :: converged
1200 if (
present(kref_in) )
then 1209 rtot(k,i,j) = rdry * ( 1.0_rp - qv(k,i,j) - qc(k,i,j) ) &
1211 cvtot(k,i,j) = cvdry * ( 1.0_rp - qv(k,i,j) - qc(k,i,j) ) &
1212 + cv_qv * qv(k,i,j) &
1214 cptot(k,i,j) = cpdry * ( 1.0_rp - qv(k,i,j) - qc(k,i,j) ) &
1215 + cp_qv * qv(k,i,j) &
1217 cpovcv(k,i,j) = cptot(k,i,j) / cvtot(k,i,j)
1224 do k = kref-1,
ks, -1
1225 rovcv = rtot(k,i,j) / cvtot(k,i,j)
1228 dens(k,i,j) = dens(k+1,i,j)
1232 if ( abs(dens(k,i,j)-dens_s) <= criteria )
then 1237 dens_s = dens(k,i,j)
1239 dhyd = + ( p00 * ( dens_s * rtot(k ,i,j) * pott(k ,i,j) / p00 )**cpovcv(k ,i,j) &
1240 - p00 * ( dens(k+1,i,j) * rtot(k+1,i,j) * pott(k+1,i,j) / p00 )**cpovcv(k+1,i,j) ) / dz(k+1,i,j) &
1241 - grav * 0.5_rp * ( dens_s + dens(k+1,i,j) )
1243 dgrd = + p00 * ( rtot(k,i,j) * pott(k,i,j) / p00 )**cpovcv(k,i,j) / dz(k+1,i,j) &
1244 * cpovcv(k,i,j) * dens_s**rovcv &
1247 dens(k,i,j) = dens_s - dhyd/dgrd
1249 if( dens(k,i,j)*0.0_rp /= 0.0_rp)
exit 1252 if ( .NOT. converged )
then 1253 write(*,*)
'xxx [buildrho 3D rev atmos] iteration not converged!', &
1254 k,i,j,dens(k,i,j),ite,dens_s,dhyd,dgrd
1264 pres(k,i,j) = p00 * ( dens(k,i,j) * rtot(k,i,j) * pott(k,i,j) / p00 )**cpovcv(k,i,j)
1265 temp(k,i,j) = pres(k,i,j) / ( dens(k,i,j) * rtot(k,i,j) )
1291 real(RP),
intent(out) :: dens(KA)
1292 real(RP),
intent(out) :: pott(KA)
1293 real(RP),
intent(out) :: pres(KA)
1294 real(RP),
intent(in) :: temp(KA)
1295 real(RP),
intent(in) :: qv (KA)
1296 real(RP),
intent(in) :: qc (KA)
1298 real(RP),
intent(out) :: pott_sfc
1299 real(RP),
intent(in) :: pres_sfc
1300 real(RP),
intent(in) :: temp_sfc
1301 real(RP),
intent(in) :: qv_sfc
1302 real(RP),
intent(in) :: qc_sfc
1304 real(RP) :: dens_sfc
1306 real(RP) :: Rtot_sfc
1307 real(RP) :: CVtot_sfc
1308 real(RP) :: CPtot_sfc
1313 real(RP) :: RovCP_sfc
1314 real(RP) :: dens_s, dhyd, dgrd
1316 logical :: converged
1321 rtot_sfc = rdry * ( 1.0_rp - qv_sfc - qc_sfc ) &
1323 cvtot_sfc = cvdry * ( 1.0_rp - qv_sfc - qc_sfc ) &
1326 cptot_sfc = cpdry * ( 1.0_rp - qv_sfc - qc_sfc ) &
1330 rtot = rdry * ( 1.0_rp - qv(
ks) - qc(
ks) ) &
1332 cvtot = cvdry * ( 1.0_rp - qv(
ks) - qc(
ks) ) &
1335 cptot = cpdry * ( 1.0_rp - qv(
ks) - qc(
ks) ) &
1340 rovcp_sfc = rtot_sfc / cptot_sfc
1341 dens_sfc = pres_sfc / ( rtot_sfc * temp_sfc )
1342 pott_sfc = temp_sfc * ( p00/pres_sfc )**rovcp_sfc
1350 if ( abs(dens(
ks)-dens_s) <= criteria )
then 1357 dhyd = + ( dens_sfc * rtot_sfc * temp_sfc &
1359 - grav * 0.5_rp * ( dens_sfc + dens_s )
1364 dens(
ks) = dens_s - dhyd/dgrd
1366 if( dens(
ks)*0.0_rp /= 0.0_rp)
exit 1369 if ( .NOT. converged )
then 1370 write(*,*)
'xxx [buildrho bytemp 1D sfc] iteration not converged!', &
1371 dens(
ks),ite,dens_s,dhyd,dgrd
1404 real(RP),
intent(out) :: dens(KA,IA,JA)
1405 real(RP),
intent(out) :: pott(KA,IA,JA)
1406 real(RP),
intent(out) :: pres(KA,IA,JA)
1407 real(RP),
intent(in) :: temp(KA,IA,JA)
1408 real(RP),
intent(in) :: qv (KA,IA,JA)
1409 real(RP),
intent(in) :: qc (KA,IA,JA)
1411 real(RP),
intent(out) :: pott_sfc(1,IA,JA)
1412 real(RP),
intent(in) :: pres_sfc(1,IA,JA)
1413 real(RP),
intent(in) :: temp_sfc(1,IA,JA)
1414 real(RP),
intent(in) :: qv_sfc (1,IA,JA)
1415 real(RP),
intent(in) :: qc_sfc (1,IA,JA)
1417 real(RP) :: dens_sfc (1,IA,JA)
1419 real(RP) :: Rtot_sfc (IA,JA)
1420 real(RP) :: CVtot_sfc (IA,JA)
1421 real(RP) :: CPtot_sfc (IA,JA)
1422 real(RP) :: Rtot (IA,JA)
1423 real(RP) :: CVtot (IA,JA)
1424 real(RP) :: CPtot (IA,JA)
1426 real(RP) :: RovCP_sfc
1428 real(RP) :: dens_s, dhyd, dgrd
1430 logical :: converged
1439 rtot_sfc(i,j) = rdry * ( 1.0_rp - qv_sfc(1,i,j) - qc_sfc(1,i,j) ) &
1440 + rvap * qv_sfc(1,i,j)
1441 cvtot_sfc(i,j) = cvdry * ( 1.0_rp - qv_sfc(1,i,j) - qc_sfc(1,i,j) ) &
1442 + cv_qv * qv_sfc(1,i,j) &
1443 + cv_qc * qc_sfc(1,i,j)
1444 cptot_sfc(i,j) = cpdry * ( 1.0_rp - qv_sfc(1,i,j) - qc_sfc(1,i,j) ) &
1445 + cp_qv * qv_sfc(1,i,j) &
1446 + cv_qc * qc_sfc(1,i,j)
1452 rtot(i,j) = rdry * ( 1.0_rp - qv(
ks,i,j) - qc(
ks,i,j) ) &
1454 cvtot(i,j) = cvdry * ( 1.0_rp - qv(
ks,i,j) - qc(
ks,i,j) ) &
1455 + cv_qv * qv(
ks,i,j) &
1456 + cv_qc * qc(
ks,i,j)
1457 cptot(i,j) = cpdry * ( 1.0_rp - qv(
ks,i,j) - qc(
ks,i,j) ) &
1458 + cp_qv * qv(
ks,i,j) &
1459 + cv_qc * qc(
ks,i,j)
1466 rovcp_sfc = rtot_sfc(i,j) / cptot_sfc(i,j)
1467 dens_sfc(1,i,j) = pres_sfc(1,i,j) / ( rtot_sfc(i,j) * temp_sfc(1,i,j) )
1468 pott_sfc(1,i,j) = temp_sfc(1,i,j) / ( p00/pres_sfc(1,i,j) )**rovcp_sfc
1478 dens(
ks,i,j) = dens_sfc(1,i,j)
1482 if ( abs(dens(
ks,i,j)-dens_s) <= criteria )
then 1487 dens_s = dens(
ks,i,j)
1489 dhyd = + ( dens_sfc(1,i,j) * rtot_sfc(i,j) * temp_sfc(1,i,j) &
1490 - dens_s * rtot(i,j) * temp(
ks,i,j) ) / dz &
1491 - grav * 0.5_rp * ( dens_sfc(1,i,j) + dens_s )
1493 dgrd = - rtot(i,j) * temp(
ks,i,j) / dz &
1496 dens(
ks,i,j) = dens_s - dhyd/dgrd
1498 if( dens(
ks,i,j)*0.0_rp /= 0.0_rp)
exit 1501 if ( .NOT. converged )
then 1502 write(*,*)
'xxx [buildrho bytemp 3D sfc] iteration not converged!', &
1503 i,j,dens(
ks,i,j),ite,dens_s,dhyd,dgrd
1533 real(RP),
intent(inout) :: dens(KA)
1534 real(RP),
intent(out) :: pott(KA)
1535 real(RP),
intent(out) :: pres(KA)
1536 real(RP),
intent(in) :: temp(KA)
1537 real(RP),
intent(in) :: qv (KA)
1538 real(RP),
intent(in) :: qc (KA)
1540 real(RP) :: Rtot (KA)
1541 real(RP) :: CVtot (KA)
1542 real(RP) :: CPtot (KA)
1545 real(RP) :: dens_s, dhyd, dgrd
1547 logical :: converged
1553 rtot(k) = rdry * ( 1.0_rp - qv(k) - qc(k) ) &
1555 cvtot(k) = cvdry * ( 1.0_rp - qv(k) - qc(k) ) &
1558 cptot(k) = cpdry * ( 1.0_rp - qv(k) - qc(k) ) &
1570 if ( abs(dens(k)-dens_s) <= criteria )
then 1577 dhyd = + ( dens(k-1) * rtot(k-1) * temp(k-1) &
1578 - dens_s * rtot(k ) * temp(k ) ) /
grid_fdz(k-1) &
1579 - grav * 0.5_rp * ( dens(k-1) + dens_s )
1581 dgrd = - rtot(k) * temp(k) /
grid_fdz(k-1) &
1584 dens(k) = dens_s - dhyd/dgrd
1586 if( dens(k)*0.0_rp /= 0.0_rp)
exit 1589 if ( .NOT. converged )
then 1590 write(*,*)
'xxx [buildrho bytemp 1D atmos] iteration not converged!', &
1591 k,dens(k),ite,dens_s,dhyd,dgrd
1597 rovcp = rtot(k) / cptot(k)
1598 pres(k) = dens(k) * rtot(k) * temp(k)
1599 pott(k) = temp(k) * ( p00 / pres(k) )**rovcp
1618 real(RP),
intent(inout) :: dens(KA,IA,JA)
1619 real(RP),
intent(out) :: pott(KA,IA,JA)
1620 real(RP),
intent(out) :: pres(KA,IA,JA)
1621 real(RP),
intent(in) :: temp(KA,IA,JA)
1622 real(RP),
intent(in) :: qv (KA,IA,JA)
1623 real(RP),
intent(in) :: qc (KA,IA,JA)
1625 real(RP) :: Rtot (KA,IA,JA)
1626 real(RP) :: CVtot (KA,IA,JA)
1627 real(RP) :: CPtot (KA,IA,JA)
1631 real(RP) :: dens_s, dhyd, dgrd
1633 logical :: converged
1641 rtot(k,i,j) = rdry * ( 1.0_rp - qv(k,i,j) - qc(k,i,j) ) &
1643 cvtot(k,i,j) = cvdry * ( 1.0_rp - qv(k,i,j) - qc(k,i,j) ) &
1644 + cv_qv * qv(k,i,j) &
1646 cptot(k,i,j) = cpdry * ( 1.0_rp - qv(k,i,j) - qc(k,i,j) ) &
1647 + cp_qv * qv(k,i,j) &
1659 dens(k,i,j) = dens(k-1,i,j)
1663 if ( abs(dens(k,i,j)-dens_s) <= criteria )
then 1668 dens_s = dens(k,i,j)
1670 dhyd = + ( dens(k-1,i,j) * rtot(k-1,i,j) * temp(k-1,i,j) &
1671 - dens_s * rtot(k ,i,j) * temp(k ,i,j) ) / dz &
1672 - grav * 0.5_rp * ( dens(k-1,i,j) + dens_s )
1674 dgrd = - rtot(k,i,j) * temp(k,i,j) / dz &
1677 dens(k,i,j) = dens_s - dhyd/dgrd
1679 if( dens(k,i,j)*0.0_rp /= 0.0_rp)
exit 1682 if ( .NOT. converged )
then 1683 write(*,*)
'xxx [buildrho bytemp 3D atmos] iteration not converged!', &
1684 k,i,j,dens(k,i,j),ite,dens_s,dhyd,dgrd
1694 rovcp = rtot(k,i,j) / cptot(k,i,j)
1695 pres(k,i,j) = dens(k,i,j) * rtot(k,i,j) * temp(k,i,j)
1696 pott(k,i,j) = temp(k,i,j) * ( p00 / pres(k,i,j) )**rovcp
1713 real(RP),
intent(out) :: mslp
1714 real(RP),
intent(in) :: pres
1715 real(RP),
intent(in) :: temp
1716 real(RP),
intent(in) :: dz
1722 tm = temp + laps * dz * 0.5_rp
1725 mslp = pres * exp( grav * dz / ( rdry * tm ) )
1732 subroutine atmos_hydrostatic_barometric_law_mslp_2d( &
1739 real(RP),
intent(out) :: mslp(IA,JA)
1740 real(RP),
intent(in) :: pres(IA,JA)
1741 real(RP),
intent(in) :: temp(IA,JA)
1742 real(RP),
intent(in) :: dz (IA,JA)
1752 tm = temp(i,j) + laps * dz(i,j) * 0.5_rp
1755 mslp(i,j) = pres(i,j) * exp( grav * dz(i,j) / ( rdry * tm ) )
1760 end subroutine atmos_hydrostatic_barometric_law_mslp_2d
1764 subroutine atmos_hydrostatic_barometric_law_pres_0d( &
1771 real(RP),
intent(out) :: pres
1772 real(RP),
intent(in) :: mslp
1773 real(RP),
intent(in) :: temp
1774 real(RP),
intent(in) :: dz
1780 tm = temp + laps * dz * 0.5_rp
1783 pres = mslp / exp( grav * dz / ( rdry * tm ) )
1786 end subroutine atmos_hydrostatic_barometric_law_pres_0d
1790 subroutine atmos_hydrostatic_barometric_law_pres_2d( &
1797 real(RP),
intent(out) :: pres(IA,JA)
1798 real(RP),
intent(in) :: mslp(IA,JA)
1799 real(RP),
intent(in) :: temp(IA,JA)
1800 real(RP),
intent(in) :: dz (IA,JA)
1810 tm = temp(i,j) + laps * dz(i,j) * 0.5_rp
1813 pres(i,j) = mslp(i,j) / exp( grav * dz(i,j) / ( rdry * tm ) )
1818 end subroutine atmos_hydrostatic_barometric_law_pres_2d
subroutine atmos_hydrostatic_buildrho_3d(dens, temp, pres, pott, qv, qc, temp_sfc, pres_sfc, pott_sfc, qv_sfc, qc_sfc)
Build up density from surface (3D)
subroutine atmos_hydrostatic_buildrho_bytemp_atmos_1d(dens, pott, pres, temp, qv, qc)
Build up density from lowermost atmosphere (1D)
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, public prc_mpistop
Abort MPI.
subroutine, public atmos_hydrostatic_buildrho_atmos_rev_3d(dens, temp, pres, pott, qv, qc, dz, kref_in)
Build up density from lowermost atmosphere (3D)
logical, public io_l
output log or not? (this process)
real(rp), dimension(:), allocatable, public grid_cz
center coordinate [m]: z, local=global
real(rp), parameter, public const_cl
specific heat (liquid water) [J/kg/K]
integer, public ke
end point of inner domain: z, local
real(rp), dimension(:,:,:), allocatable, public real_fz
geopotential height [m] (cell face )
real(rp), dimension(:,:,:), allocatable, public real_cz
geopotential height [m] (cell center)
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), dimension(qa_max), public tracer_cv
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
real(rp), dimension(qa_max), public tracer_cp
logical, public io_nml
output log or not? (for namelist, this process)
integer, public ia
of whole cells: x, local, with HALO
subroutine, public comm_horizontal_mean(varmean, var)
calculate horizontal mean (global total with communication)
real(rp), dimension(:), allocatable, public grid_fdz
z-length of grid(k+1) to grid(k) [m]
subroutine atmos_hydrostatic_barometric_law_mslp_0d(mslp, pres, temp, dz)
Calculate mean sea-level pressure from barometric law (0D)
integer, public ka
of whole cells: z, local, with HALO
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]
subroutine atmos_hydrostatic_buildrho_atmos_1d(dens, temp, pres, pott, qv, qc)
Build up density from lowermost atmosphere (1D)
real(rp), parameter, public const_rvap
specific gas constant (water vapor) [J/kg/K]
subroutine atmos_hydrostatic_buildrho_1d(dens, temp, pres, pott, qv, qc, temp_sfc, pres_sfc, pott_sfc, qv_sfc, qc_sfc)
Build up density from surface (1D)
integer, public ks
start point of inner domain: z, local
subroutine atmos_hydrostatic_buildrho_atmos_3d(dens, temp, pres, pott, qv, qc, dz, kref_in)
Build up density from lowermost atmosphere (3D)
subroutine atmos_hydrostatic_buildrho_bytemp_3d(dens, pott, pres, temp, qv, qc, pott_sfc, pres_sfc, temp_sfc, qv_sfc, qc_sfc)
Build up density from surface (3D)
real(rp), public const_eps
small number
subroutine atmos_hydrostatic_buildrho_bytemp_1d(dens, pott, pres, temp, qv, qc, pott_sfc, pres_sfc, temp_sfc, qv_sfc, qc_sfc)
Build up density from surface (1D)
subroutine atmos_hydrostatic_buildrho_real_3d(dens, temp, pres, pott, qv, qc)
Build up density from surface (3D), not to reverse from TOA.
subroutine atmos_hydrostatic_buildrho_bytemp_atmos_3d(dens, pott, pres, temp, qv, qc)
Build up density from lowermost atmosphere (3D)
integer, public io_fid_conf
Config file ID.
integer, public io_fid_log
Log file ID.
real(rp), parameter, public const_cpvap
specific heat (water vapor, constant pressure) [J/kg/K]
character(len=h_short), public const_thermodyn_type
internal energy type
subroutine, public atmos_hydrostatic_buildrho_atmos_rev_2d(dens_L1, temp_L1, pres_L1, pott_L1, qv_L1, qc_L1, dens_L2, pott_L2, qv_L2, qc_L2, dz, k)
Build up density (2D)
integer, public io_fid_nml
Log file ID (only for output namelist)
subroutine, public atmos_hydrostatic_setup
Setup.
subroutine, public atmos_hydrostatic_buildrho_atmos_0d(dens_L2, temp_L2, pres_L2, pott_L2, qv_L2, qc_L2, dens_L1, pott_L1, qv_L1, qc_L1, dz, k)
Build up density (0D)
integer, public ja
of whole cells: y, local, with HALO