Skip to content

Commit

Permalink
implement FA scheme water loading option if nwat =4
Browse files Browse the repository at this point in the history
  • Loading branch information
mzhangw committed Nov 14, 2019
1 parent 9871607 commit 77f4fba
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions model/fv_sg.F90
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,28 @@ subroutine fv_subgrid_z( isd, ied, jsd, jed, is, ie, js, je, km, nq, dt, &
enddo
elseif ( nwat==4 ) then
do i=is,ie
#ifndef ccpp
q_liq = q0(i,k,liq_wat) + q0(i,k,rainwat)
#ifdef MULTI_GASES
cpm(i) = (1.-(q0(i,k,sphum)+q_liq))*cp_air*vicpqd(q0(i,k,:)) + q0(i,k,sphum)*cp_vapor + q_liq*c_liq
cvm(i) = (1.-(q0(i,k,sphum)+q_liq))*cv_air*vicvqd(q0(i,k,:)) + q0(i,k,sphum)*cv_vap + q_liq*c_liq
#else
cpm(i) = (1.-(q0(i,k,sphum)+q_liq))*cp_air + q0(i,k,sphum)*cp_vapor + q_liq*c_liq
cvm(i) = (1.-(q0(i,k,sphum)+q_liq))*cv_air + q0(i,k,sphum)*cv_vap + q_liq*c_liq
#endif

#else
q_liq = q0(i,k,liq_wat) + q0(i,k,rainwat)
q_sol = q0(i,k,ice_wat)
#ifdef MULTI_GASES
cpm(i) = (1.-(q0(i,k,sphum)+q_liq+q_sol))*cp_air*vicpqd(q0(i,k,:)) + q0(i,k,sphum)*cp_vapor + q_liq*c_liq + q_sol*c_ice
cvm(i) = (1.-(q0(i,k,sphum)+q_liq+q_sol))*cv_air*vicvqd(q0(i,k,:)) + q0(i,k,sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
#else
cpm(i) = (1.-(q0(i,k,sphum)+q_liq+q_sol))*cp_air + q0(i,k,sphum)*cp_vapor + q_liq*c_liq + q_sol*c_ice
cvm(i) = (1.-(q0(i,k,sphum)+q_liq+q_sol))*cv_air + q0(i,k,sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
#endif


#endif
enddo
elseif ( nwat==5 ) then
Expand Down Expand Up @@ -382,7 +397,11 @@ subroutine fv_subgrid_z( isd, ied, jsd, jed, is, ie, js, je, km, nq, dt, &
elseif ( nwat==4 ) then
do k=1,kbot
do i=is,ie
#ifndef ccpp
qcon(i,k) = q0(i,k,liq_wat) + q0(i,k,rainwat)
#else
qcon(i,k) = q0(i,k,liq_wat) + q0(i,k,rainwat) + q0(i,k,ice_wat)
#endif
enddo
enddo
elseif ( nwat==5 ) then
Expand Down Expand Up @@ -451,7 +470,12 @@ subroutine fv_subgrid_z( isd, ied, jsd, jed, is, ie, js, je, km, nq, dt, &
elseif ( nwat==3 ) then ! AM3/AM4
qcon(i,km1) = q0(i,km1,liq_wat) + q0(i,km1,ice_wat)
elseif ( nwat==4 ) then ! K_warm_rain scheme with fake ice
#ifndef ccpp
qcon(i,km1) = q0(i,km1,liq_wat) + q0(i,km1,rainwat)
#else
qcon(i,km1) = q0(i,km1,liq_wat) + q0(i,km1,ice_wat) + &
q0(i,km1,rainwat)
#endif
elseif ( nwat==5 ) then ! K_warm_rain scheme with fake ice
qcon(i,km1) = q0(i,km1,liq_wat) + q0(i,km1,ice_wat) + &
q0(i,km1,snowwat) + q0(i,km1,rainwat)
Expand Down Expand Up @@ -572,13 +596,27 @@ subroutine fv_subgrid_z( isd, ied, jsd, jed, is, ie, js, je, km, nq, dt, &
enddo
elseif ( nwat == 4 ) then
do i=is,ie
#ifndef ccpp
q_liq = q0(i,kk,liq_wat) + q0(i,kk,rainwat)
#ifdef MULTI_GASES
cpm(i) = (1.-(q0(i,kk,sphum)+q_liq))*cp_air*vicpqd(q0(i,kk,:)) + q0(i,kk,sphum)*cp_vapor + q_liq*c_liq
cvm(i) = (1.-(q0(i,kk,sphum)+q_liq))*cv_air*vicvqd(q0(i,kk,:)) + q0(i,kk,sphum)*cv_vap + q_liq*c_liq
#else
cpm(i) = (1.-(q0(i,kk,sphum)+q_liq))*cp_air + q0(i,kk,sphum)*cp_vapor + q_liq*c_liq
cvm(i) = (1.-(q0(i,kk,sphum)+q_liq))*cv_air + q0(i,kk,sphum)*cv_vap + q_liq*c_liq
#endif
#else
q_liq = q0(i,kk,liq_wat) + q0(i,kk,rainwat)
q_sol = q0(i,kk,ice_wat)
#ifdef MULTI_GASES
cpm(i) = (1.-(q0(i,kk,sphum)+q_liq+q_sol))*cp_air*vicpqd(q0(i,kk,:)) + q0(i,kk,sphum)*cp_vapor + q_liq*c_liq + q_sol*c_ice
cvm(i) = (1.-(q0(i,kk,sphum)+q_liq+q_sol))*cv_air*vicvqd(q0(i,kk,:)) + q0(i,kk,sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
#else
cpm(i) = (1.-(q0(i,kk,sphum)+q_liq+q_sol))*cp_air + q0(i,kk,sphum)*cp_vapor + q_liq*c_liq + q_sol*c_ice
cvm(i) = (1.-(q0(i,kk,sphum)+q_liq+q_sol))*cv_air + q0(i,kk,sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
#endif


#endif
enddo
elseif ( nwat == 5 ) then
Expand Down Expand Up @@ -850,13 +888,26 @@ subroutine fv_subgrid_z( isd, ied, jsd, jed, is, ie, js, je, km, nq, dt, &
enddo
elseif ( nwat==4 ) then
do i=is,ie
#ifndef CCPP
q_liq = q0(i,k,liq_wat) + q0(i,k,rainwat)
#ifdef MULTI_GASES
cpm(i) = (1.-(q0(i,k,sphum)+q_liq))*cp_air*vicpqd(q0(i,k,:)) + q0(i,k,sphum)*cp_vapor + q_liq*c_liq
cvm(i) = (1.-(q0(i,k,sphum)+q_liq))*cv_air*vicvqd(q0(i,k,:)) + q0(i,k,sphum)*cv_vap + q_liq*c_liq
#else
cpm(i) = (1.-(q0(i,k,sphum)+q_liq))*cp_air + q0(i,k,sphum)*cp_vapor + q_liq*c_liq
cvm(i) = (1.-(q0(i,k,sphum)+q_liq))*cv_air + q0(i,k,sphum)*cv_vap + q_liq*c_liq
#endif
#else
q_liq = q0(i,k,liq_wat) + q0(i,k,rainwat)
q_sol = q0(i,k,ice_wat)
#ifdef MULTI_GASES
cpm(i) = (1.-(q0(i,k,sphum)+q_liq+q_sol))*cp_air*vicpqd(q0(i,k,:)) + q0(i,k,sphum)*cp_vapor + q_liq*c_liq + q_sol*c_ice
cvm(i) = (1.-(q0(i,k,sphum)+q_liq+q_sol))*cv_air*vicvqd(q0(i,k,:)) + q0(i,k,sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
#else
cpm(i) = (1.-(q0(i,k,sphum)+q_liq+q_sol))*cp_air + q0(i,k,sphum)*cp_vapor + q_liq*c_liq + q_sol*c_ice
cvm(i) = (1.-(q0(i,k,sphum)+q_liq+q_sol))*cv_air + q0(i,k,sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
#endif

#endif
enddo
elseif ( nwat==5 ) then
Expand Down Expand Up @@ -933,7 +984,11 @@ subroutine fv_subgrid_z( isd, ied, jsd, jed, is, ie, js, je, km, nq, dt, &
elseif ( nwat==4 ) then
do k=1,kbot
do i=is,ie
#ifndef ccpp
qcon(i,k) = q0(i,k,liq_wat) + q0(i,k,rainwat)
#else
qcon(i,k) = q0(i,k,liq_wat) + q0(i,k,rainwat) + q0(i,k,ice_wat)
#endif
enddo
enddo
elseif ( nwat==5 ) then
Expand Down Expand Up @@ -998,7 +1053,11 @@ subroutine fv_subgrid_z( isd, ied, jsd, jed, is, ie, js, je, km, nq, dt, &
elseif ( nwat==3 ) then ! AM3/AM4
qcon(i,km1) = q0(i,km1,liq_wat) + q0(i,km1,ice_wat)
elseif ( nwat==4 ) then ! K_warm_rain scheme with fake ice
#ifndef ccpp
qcon(i,km1) = q0(i,km1,liq_wat) + q0(i,km1,rainwat)
#else
qcon(i,km1) = q0(i,km1,liq_wat) + q0(i,km1,rainwat) + q0(i,km1,ice_wat)
#endif
elseif ( nwat==5 ) then
qcon(i,km1) = q0(i,km1,liq_wat) + q0(i,km1,ice_wat) + &
q0(i,km1,snowwat) + q0(i,km1,rainwat)
Expand Down Expand Up @@ -1118,13 +1177,26 @@ subroutine fv_subgrid_z( isd, ied, jsd, jed, is, ie, js, je, km, nq, dt, &
enddo
elseif ( nwat == 4 ) then
do i=is,ie
#ifndef ccpp
q_liq = q0(i,kk,liq_wat) + q0(i,kk,rainwat)
#ifdef MULTI_GASES
cpm(i) = (1.-(q0(i,kk,sphum)+q_liq))*cp_air*vicpqd(q0(i,kk,:)) + q0(i,kk,sphum)*cp_vapor + q_liq*c_liq
cvm(i) = (1.-(q0(i,kk,sphum)+q_liq))*cv_air*vicvqd(q0(i,kk,:)) + q0(i,kk,sphum)*cv_vap + q_liq*c_liq
#else
cpm(i) = (1.-(q0(i,kk,sphum)+q_liq))*cp_air + q0(i,kk,sphum)*cp_vapor + q_liq*c_liq
cvm(i) = (1.-(q0(i,kk,sphum)+q_liq))*cv_air + q0(i,kk,sphum)*cv_vap + q_liq*c_liq
#endif
#else
q_liq = q0(i,kk,liq_wat) + q0(i,kk,rainwat)
q_sol = q0(i,kk,ice_wat)
#ifdef MULTI_GASES
cpm(i) = (1.-(q0(i,kk,sphum)+q_liq+q_sol))*cp_air*vicpqd(q0(i,kk,:)) + q0(i,kk,sphum)*cp_vapor + q_liq*c_liq + q_sol*c_ice
cvm(i) = (1.-(q0(i,kk,sphum)+q_liq+q_sol))*cv_air*vicvqd(q0(i,kk,:)) + q0(i,kk,sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
#else
cpm(i) = (1.-(q0(i,kk,sphum)+q_liq+q_sol))*cp_air + q0(i,kk,sphum)*cp_vapor + q_liq*c_liq + q_sol*c_ice
cvm(i) = (1.-(q0(i,kk,sphum)+q_liq+q_sol))*cv_air + q0(i,kk,sphum)*cv_vap + q_liq*c_liq + q_sol*c_ice
#endif

#endif
enddo
elseif ( nwat == 5 ) then
Expand Down

0 comments on commit 77f4fba

Please sign in to comment.