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

Suggested changed in MMM surface layer scheme #2

Closed
wants to merge 8 commits into from
Closed
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
37 changes: 27 additions & 10 deletions bl_gwdo.F → bl_gwdo.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ subroutine bl_gwdo_run(sina, cosa, &
g_, cp_, rd_, rv_, fv_, pi_, &
dxmeter, deltim, &
its, ite, kte, kme, &
errmsg, errflg )
l_norot, errmsg, errflg )
!-------------------------------------------------------------------------------
!
! abstract :
Expand Down Expand Up @@ -96,6 +96,7 @@ subroutine bl_gwdo_run(sina, cosa, &
real(kind=kind_phys), dimension(its:ite) , intent(in ) :: var, oc1, &
oa2d1, oa2d2, oa2d3, oa2d4, &
ol2d1, ol2d2, ol2d3, ol2d4
logical , intent(in ) :: l_norot
character(len=*) , intent( out) :: errmsg
integer , intent( out) :: errflg
!
Expand Down Expand Up @@ -227,9 +228,13 @@ subroutine bl_gwdo_run(sina, cosa, &

! Earth-relative zonal and meridional winds (m/s)

u1(i,k) = uproj(i,k)*cosa(i) - vproj(i,k)*sina(i)
v1(i,k) = uproj(i,k)*sina(i) + vproj(i,k)*cosa(i)

if (l_norot) then
u1(i,k) = uproj(i,k)
v1(i,k) = uproj(i,k)
else
u1(i,k) = uproj(i,k)*cosa(i) - vproj(i,k)*sina(i)
v1(i,k) = uproj(i,k)*sina(i) + vproj(i,k)*cosa(i)
endif
enddo
enddo

Expand Down Expand Up @@ -590,15 +595,27 @@ subroutine bl_gwdo_run(sina, cosa, &
!
do k = kts,kte
do i = its,ite
rublten(i,k) = rublten(i,k)+dudt(i,k)*cosa(i) + dvdt(i,k)*sina(i)
rvblten(i,k) = rvblten(i,k)-dudt(i,k)*sina(i) + dvdt(i,k)*cosa(i)
dtaux3d(i,k) = dtaux2d(i,k)*cosa(i) + dtauy2d(i,k)*sina(i)
dtauy3d(i,k) =-dtaux2d(i,k)*sina(i) + dtauy2d(i,k)*cosa(i)
if (l_norot) then
rublten(i,k) = dudt(i,k)
rvblten(i,k) = dvdt(i,k)
dtaux3d(i,k) = dtaux2d(i,k)
dtauy3d(i,k) = dtauy2d(i,k)
else
rublten(i,k) = rublten(i,k)+dudt(i,k)*cosa(i) + dvdt(i,k)*sina(i)
rvblten(i,k) = rvblten(i,k)-dudt(i,k)*sina(i) + dvdt(i,k)*cosa(i)
dtaux3d(i,k) = dtaux2d(i,k)*cosa(i) + dtauy2d(i,k)*sina(i)
dtauy3d(i,k) =-dtaux2d(i,k)*sina(i) + dtauy2d(i,k)*cosa(i)
endif
enddo
enddo
do i = its,ite
dusfcg(i) = dusfc(i)*cosa(i) + dvsfc(i)*sina(i)
dvsfcg(i) =-dusfc(i)*sina(i) + dvsfc(i)*cosa(i)
if (l_norot) then
dusfcg(i) = dusfc(i)
dvsfcg(i) = dvsfc(i)
else
dusfcg(i) = dusfc(i)*cosa(i) + dvsfc(i)*sina(i)
dvsfcg(i) =-dusfc(i)*sina(i) + dvsfc(i)*cosa(i)
endif
enddo
return
end subroutine bl_gwdo_run
Expand Down
56 changes: 36 additions & 20 deletions bl_ysu.F → bl_ysu.F90
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
#define NEED_B4B_DURING_CCPP_TESTING 1
!=================================================================================================================
module bl_ysu
use ccpp_kinds,only: kind_phys
use machine,only: kind_phys

implicit none
private
public:: bl_ysu_run , &
bl_ysu_init , &
bl_ysu_final , &
bl_ysu_finalize , &
bl_ysu_timestep_init, &
bl_ysu_timestep_final

bl_ysu_timestep_finalize

contains


!> \section arg_table_bl_ysu_run
!! \htmlinclude bl_ysu_run.html
!!
!=================================================================================================================
subroutine bl_ysu_run(ux,vx,tx,qvx,qcx,qix,nmix,qmix,p2d,p2di,pi2d, &
f_qc,f_qi, &
utnp,vtnp,ttnp,qvtnp,qctnp,qitnp,qmixtnp, &
cp,g,rovcp,rd,rovg,ep1,ep2,karman,xlv,rv, &
dz8w2d,psfcpa, &
znt,ust,hpbl,psim,psih, &
znt,ust,hpbl,dusfc,dvsfc,dtsfc,dqsfc,psim,psih, &
xland,hfx,qfx,wspd,br, &
dt,kpbl1d, &
exch_hx,exch_mx, &
Expand Down Expand Up @@ -119,7 +120,7 @@ subroutine bl_ysu_run(ux,vx,tx,qvx,qcx,qix,nmix,qmix,p2d,p2di,pi2d, &
!
integer, intent(in ) :: its,ite,kte,kme

integer, intent(in) :: ysu_topdown_pblmix
logical, intent(in) :: ysu_topdown_pblmix
!
integer, intent(in) :: nmix
!
Expand Down Expand Up @@ -160,7 +161,11 @@ subroutine bl_ysu_run(ux,vx,tx,qvx,qcx,qix,nmix,qmix,p2d,p2di,pi2d, &
intent(in ) :: p2d
!
real(kind=kind_phys), dimension( its:ite ) , &
intent(out ) :: hpbl
intent(out ) :: hpbl, &
dusfc,&
dvsfc,&
dtsfc,&
dqsfc
!
real(kind=kind_phys), dimension( its:ite ) , &
intent(in ) :: ust, &
Expand Down Expand Up @@ -235,8 +240,6 @@ subroutine bl_ysu_run(ux,vx,tx,qvx,qcx,qix,nmix,qmix,p2d,p2di,pi2d, &
hgamt,hgamq, &
brdn,brup, &
phim,phih, &
dusfc,dvsfc, &
dtsfc,dqsfc, &
prpbl, &
wspd1,thermalli
!
Expand Down Expand Up @@ -337,6 +340,7 @@ subroutine bl_ysu_run(ux,vx,tx,qvx,qcx,qix,nmix,qmix,p2d,p2di,pi2d, &
!
!-------------------------------------------------------------------------------
!

klpbl = kte
!
cont=cp/g
Expand Down Expand Up @@ -689,7 +693,7 @@ subroutine bl_ysu_run(ux,vx,tx,qvx,qcx,qix,nmix,qmix,p2d,p2di,pi2d, &
!
! enhance pbl by theta-li
!
if (ysu_topdown_pblmix.eq.1)then
if (ysu_topdown_pblmix)then
do i = its,ite
kpblold(i) = kpbl(i)
definebrup=.false.
Expand Down Expand Up @@ -796,7 +800,7 @@ subroutine bl_ysu_run(ux,vx,tx,qvx,qcx,qix,nmix,qmix,p2d,p2di,pi2d, &
bfxpbl(i) = -0.15*thvx(i,1)/g*wm3/hpbl(i)
dthvx(i) = max(thvx(i,k+1)-thvx(i,k),tmin)
we(i) = max(bfxpbl(i)/dthvx(i),-sqrt(wm2(i)))
if((qcxl(i,k)+qixl(i,k)).gt.0.01e-3.and.ysu_topdown_pblmix.eq.1)then
if((qcxl(i,k)+qixl(i,k)).gt.0.01e-3.and.ysu_topdown_pblmix)then
if ( kpbl(i) .ge. 2) then
cloudflg(i)=.true.
templ=thlix(i,k)*(p2di(i,k+1)/100000)**rovcp
Expand Down Expand Up @@ -1378,57 +1382,69 @@ subroutine bl_ysu_run(ux,vx,tx,qvx,qcx,qix,nmix,qmix,p2d,p2di,pi2d, &
!
end subroutine bl_ysu_run

!> \section arg_table_bl_init_run
!! \htmlinclude bl_ysu_init.html
!!
!=================================================================================================================
subroutine bl_ysu_init (errmsg, errflg)

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

! This routine currently does nothing
! This routine currently does nothing (DJS2023: Remove if not used)

errmsg = ''
errflg = 0

end subroutine bl_ysu_init

!> \section arg_table_bl_ysu_finalize
!! \htmlinclude bl_ysu_finalize.html
!!
!=================================================================================================================
subroutine bl_ysu_final (errmsg, errflg)
subroutine bl_ysu_finalize (errmsg, errflg)

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

! This routine currently does nothing
! This routine currently does nothing (DJS2023: Remove if not used)

errmsg = ''
errflg = 0

end subroutine bl_ysu_final
end subroutine bl_ysu_finalize

!> \section arg_table_bl_ysu_timestep_init
!! \htmlinclude bl_ysu_timestep_init.html
!!
!=================================================================================================================
subroutine bl_ysu_timestep_init (errmsg, errflg)

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

! This routine currently does nothing
! This routine currently does nothing (DJS2023: Remove if not used)

errmsg = ''
errflg = 0

end subroutine bl_ysu_timestep_init

!> \section arg_table_bl_ysu_timestep_finalize
!! \htmlinclude bl_ysu_timestep_finalize.html
!!
!=================================================================================================================
subroutine bl_ysu_timestep_final (errmsg, errflg)
subroutine bl_ysu_timestep_finalize (errmsg, errflg)

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

! This routine currently does nothing
! This routine currently does nothing (DJS2023: Remove if not used)

errmsg = ''
errflg = 0

end subroutine bl_ysu_timestep_final
end subroutine bl_ysu_timestep_finalize
!-------------------------------------------------------------------------------
!
!-------------------------------------------------------------------------------
Expand Down
Loading