Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update branch gsd/develop with Vlab master as of 03/08/2019 #228

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 69 additions & 33 deletions physics/GFS_DCNV_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,40 @@ end subroutine GFS_DCNV_generic_pre_finalize
!! | ldiag3d | flag_diagnostics_3D | flag for 3d diagnostic fields | flag | 0 | logical | | in | F |
!! | cnvgwd | flag_convective_gravity_wave_drag | flag for conv gravity wave drag | flag | 0 | logical | | in | F |
!! | lgocart | flag_gocart | flag for 3d diagnostic fields for gocart 1 | flag | 0 | logical | | in | F |
!! | do_ca | flag_for_cellular_automata | cellular automata main switch | flag | 0 | logical | | in | F |
!! | isppt_deep | flag_for_combination_of_sppt_with_isppt_deep | switch for combination with isppt_deep. | flag | 0 | logical | | in | F |
!! | gu0 | x_wind_updated_by_physics | zonal wind updated by physics | m s-1 | 2 | real | kind_phys | in | F |
!! | gv0 | y_wind_updated_by_physics | meridional wind updated by physics | m s-1 | 2 | real | kind_phys | in | F |
!! | gt0 | air_temperature_updated_by_physics | temperature updated by physics | K | 2 | real | kind_phys | in | F |
!! | gq0_water_vapor | water_vapor_specific_humidity_updated_by_physics | water vapor specific humidity updated by physics | kg kg-1 | 2 | real | kind_phys | in | F |
!! | gq0_water_vapor | water_vapor_specific_humidity_updated_by_physics | water vapor specific humidity updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F |
!! | save_u | x_wind_save | x-wind before entering a physics scheme | m s-1 | 2 | real | kind_phys | inout | F |
!! | save_v | y_wind_save | y-wind before entering a physics scheme | m s-1 | 2 | real | kind_phys | inout | F |
!! | save_t | air_temperature_save | air temperature before entering a physics scheme | K | 2 | real | kind_phys | inout | F |
!! | save_qv | water_vapor_specific_humidity_save | water vapor specific humidity before entering a physics scheme | kg kg-1 | 2 | real | kind_phys | inout | F |
!! | ca_deep | fraction_of_cellular_automata_for_deep_convection | fraction of cellular automata for deep convection | frac | 1 | real | kind_phys | in | F |
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!!
subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, cnvgwd, lgocart, gu0, gv0, gt0, gq0_water_vapor, &
save_u, save_v, save_t, save_qv, errmsg, errflg)
subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, cnvgwd, lgocart, do_ca, &
isppt_deep, gu0, gv0, gt0, gq0_water_vapor, &
save_u, save_v, save_t, save_qv, ca_deep, &
errmsg, errflg)

use machine, only: kind_phys

implicit none

integer, intent(in) :: im, levs
logical, intent(in) :: ldiag3d, cnvgwd, lgocart
real(kind=kind_phys), dimension(im,levs), intent(in) :: gu0
real(kind=kind_phys), dimension(im,levs), intent(in) :: gv0
real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0
real(kind=kind_phys), dimension(im,levs), intent(in) :: gq0_water_vapor
logical, intent(in) :: ldiag3d, cnvgwd, lgocart, do_ca, isppt_deep
real(kind=kind_phys), dimension(im,levs), intent(in) :: gu0
real(kind=kind_phys), dimension(im,levs), intent(in) :: gv0
real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0
real(kind=kind_phys), dimension(im,levs), intent(inout) :: gq0_water_vapor
real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_u
real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_v
real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_t
real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_qv
real(kind=kind_phys), dimension(im), intent(in) :: ca_deep
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

Expand All @@ -57,7 +63,15 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, cnvgwd, lgocart, gu0, gv
errmsg = ''
errflg = 0

if (ldiag3d) then
if (do_ca) then
do k=1,levs
do i=1,im
gq0_water_vapor(i,k) = gq0_water_vapor(i,k)*(1.0 + ca_deep(i)/500.)
enddo
enddo
endif

if (ldiag3d .or. isppt_deep) then
do k=1,levs
do i=1,im
save_t(i,k) = gt0(i,k)
Expand All @@ -69,7 +83,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, cnvgwd, lgocart, gu0, gv
save_t(1:im,:) = gt0(1:im,:)
endif ! end if_ldiag3d/cnvgwd

if (ldiag3d .or. lgocart) then
if (ldiag3d .or. lgocart .or. isppt_deep) then
save_qv(1:im,:) = gq0_water_vapor(1:im,:)
endif ! end if_ldiag3d/lgocart

Expand Down Expand Up @@ -97,6 +111,8 @@ end subroutine GFS_DCNV_generic_post_finalize
!! | lgocart | flag_gocart | flag for 3d diagnostic fields for gocart 1 | flag | 0 | logical | | in | F |
!! | ras | flag_for_ras_deep_convection | flag for ras convection scheme | flag | 0 | logical | | in | F |
!! | cscnv | flag_for_Chikira_Sugiyama_deep_convection | flag for Chikira-Sugiyama convection | flag | 0 | logical | | in | F |
!! | do_ca | flag_for_cellular_automata | cellular automata main switch | flag | 0 | logical | | in | F |
!! | isppt_deep | flag_for_combination_of_sppt_with_isppt_deep | switch for combination with isppt_deep. | flag | 0 | logical | | in | F |
!! | frain | dynamics_to_physics_timestep_ratio | ratio of dynamics timestep to physics timestep | none | 0 | real | kind_phys | in | F |
!! | rain1 | lwe_thickness_of_deep_convective_precipitation_amount | deep convective rainfall amount on physics timestep | m | 1 | real | kind_phys | in | F |
!! | dtf | time_step_for_dynamics | dynamics timestep | s | 0 | real | kind_phys | in | F |
Expand Down Expand Up @@ -138,21 +154,27 @@ end subroutine GFS_DCNV_generic_post_finalize
!! | cnvc | convective_cloud_cover | convective cloud cover | frac | 2 | real | kind_phys | inout | F |
!! | cnvw_phy_f3d | convective_cloud_water_mixing_ratio_in_phy_f3d | convective cloud water mixing ratio in the phy_f3d array | kg kg-1 | 2 | real | kind_phys | inout | F |
!! | cnvc_phy_f3d | convective_cloud_cover_in_phy_f3d | convective cloud cover in the phy_f3d array | frac | 2 | real | kind_phys | inout | F |
!! | cape | convective_available_potential_energy_for_coupling | convective available potential energy for coupling DH* CHECK THIS DOESN'T MAKE SENSE!!! *DH | m2 s-2 | 1 | real | kind_phys | inout | F |
!! | tconvtend | tendency_of_air_temperature_due_to_deep_convection_for_coupling_on_physics_timestep | tendency of air temperature due to deep convection | K | 2 | real | kind_phys | inout | F |
!! | qconvtend | tendency_of_water_vapor_specific_humidity_due_to_deep_convection_for_coupling_on_physics_timestep | tendency of specific humidity due to deep convection | kg kg-1 | 2 | real | kind_phys | inout | F |
!! | uconvtend | tendency_of_x_wind_due_to_deep_convection_for_coupling_on_physics_timestep | tendency_of_x_wind_due_to_deep_convection | m s-1 | 2 | real | kind_phys | inout | F |
!! | vconvtend | tendency_of_y_wind_due_to_deep_convection_for_coupling_on_physics_timestep | tendency_of_y_wind_due_to_deep_convection | m s-1 | 2 | real | kind_phys | inout | F |
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!!
subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, lgocart, ras, cscnv, &
frain, rain1, dtf, cld1d, save_u, save_v, save_t, save_qv, gu0, gv0, gt0, gq0_water_vapor, &
ud_mf, dd_mf, dt_mf, con_g, clw_ice, clw_liquid, npdf3d, num_p3d, ncnvcld3d, &
rainc, cldwrk, cnvprcp, cnvprcpb, dt3dt, dq3dt, du3dt, dv3dt, upd_mf, dwn_mf, det_mf, dqdti, &
cnvqci, upd_mfi, dwn_mfi, det_mfi, cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d, errmsg, errflg)
subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, lgocart, ras, cscnv, do_ca, &
isppt_deep, frain, rain1, dtf, cld1d, save_u, save_v, save_t, save_qv, gu0, gv0, gt0, &
gq0_water_vapor, ud_mf, dd_mf, dt_mf, con_g, clw_ice, clw_liquid, npdf3d, num_p3d, ncnvcld3d, &
rainc, cldwrk, cnvprcp, cnvprcpb, dt3dt, dq3dt, du3dt, dv3dt, upd_mf, dwn_mf, det_mf, dqdti, &
cnvqci, upd_mfi, dwn_mfi, det_mfi, cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d, &
cape, tconvtend, qconvtend, uconvtend, vconvtend, errmsg, errflg)

use machine, only: kind_phys

implicit none

integer, intent(in) :: im, levs
logical, intent(in) :: lssav, ldiag3d, lgocart, ras, cscnv
logical, intent(in) :: lssav, ldiag3d, lgocart, ras, cscnv, do_ca, isppt_deep

real(kind=kind_phys), intent(in) :: frain, dtf
real(kind=kind_phys), dimension(im), intent(in) :: rain1, cld1d
Expand All @@ -176,6 +198,8 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, lgocart, ras, cs
! as long as these do not get used when not allocated (it is still invalid Fortran code, though).
real(kind=kind_phys), dimension(:,:), intent(inout) :: cnvw_phy_f3d, cnvc_phy_f3d
! *DH
real(kind=kind_phys), dimension(im), intent(inout) :: cape
real(kind=kind_phys), dimension(im,levs), intent(inout) :: tconvtend, qconvtend, uconvtend, vconvtend

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
Expand All @@ -187,23 +211,28 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, lgocart, ras, cs
errflg = 0

if (.not. ras .and. .not. cscnv) then
if (npdf3d == 3 .and. num_p3d == 4) then
do k=1,levs
do i=1,im
cnvw_phy_f3d(i,k) = cnvw(i,k)
cnvc_phy_f3d(i,k) = cnvc(i,k)
cnvw(i,k) = 0.0
cnvc(i,k) = 0.0
enddo
enddo
elseif (npdf3d == 0 .and. ncnvcld3d == 1) then
do k=1,levs
do i=1,im
cnvw_phy_f3d(i,k) = cnvw(i,k)
cnvw(i,k) = 0.0
enddo
enddo
endif
if(do_ca) then
do i=1,im
cape(i)=cld1d(i)
enddo
endif
if (npdf3d == 3 .and. num_p3d == 4) then
do k=1,levs
do i=1,im
cnvw_phy_f3d(i,k) = cnvw(i,k)
cnvc_phy_f3d(i,k) = cnvc(i,k)
cnvw(i,k) = 0.0
cnvc(i,k) = 0.0
enddo
enddo
elseif (npdf3d == 0 .and. ncnvcld3d == 1) then
do k=1,levs
do i=1,im
cnvw_phy_f3d(i,k) = cnvw(i,k)
cnvw(i,k) = 0.0
enddo
enddo
endif
endif ! if (.not. ras .and. .not. cscnv)

do i=1,im
Expand Down Expand Up @@ -247,6 +276,13 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, lgocart, ras, cs
enddo
endif ! if (lgocart)

if (isppt_deep) then
tconvtend = gt0 - save_t
qconvtend = gq0_water_vapor - save_qv
uconvtend = gu0 - save_u
vconvtend = gv0 - save_v
endif

end subroutine GFS_DCNV_generic_post_run

end module GFS_DCNV_generic_post
Loading