Skip to content

Commit

Permalink
try using the initial pressure profile in the exner function
Browse files Browse the repository at this point in the history
  • Loading branch information
fjansson committed Sep 16, 2022
1 parent 0fd18d2 commit 854ca46
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/modstartup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -741,8 +741,8 @@ subroutine readinitfiles
svm = sv0
e12m = e120
call calc_halflev
exnf = (presf/pref0)**(rd/cp)
exnh = (presh/pref0)**(rd/cp)
exnf = (initial_presf/pref0)**(rd/cp)
exnh = (initial_presh/pref0)**(rd/cp)

do j=2,j1
do i=2,i1
Expand Down
31 changes: 19 additions & 12 deletions src/modthermodynamics.f90
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,10 @@ end subroutine calthv
!! \author Pier Siebesma K.N.M.I. 06/01/1995
subroutine diagfld

use modglobal, only : i1,ih,j1,jh,k1,nsv,zh,zf,cu,cv,ijtot,grav,rlv,cp,rd,rv,pref0
use modglobal, only : i1,ih,j1,jh,k1,nsv,zh,zf,cu,cv,ijtot,grav,rlv,cp,rd,rv,pref0,timee
use modfields, only : u0,v0,thl0,qt0,ql0,sv0,u0av,v0av,thl0av,qt0av,ql0av,sv0av, &
presf,presh,exnf,exnh,rhof,thvf
presf,presh,exnf,exnh,rhof,thvf, &
initial_presf,initial_presh
use modsurfdata,only : thls,ps
use modmpi, only : slabsum
implicit none
Expand Down Expand Up @@ -258,8 +259,11 @@ subroutine diagfld
thl0av = thl0av/ijtot
qt0av = qt0av /ijtot
ql0av = ql0av /ijtot
exnf = 1-grav*zf/(cp*thls)
exnh = 1-grav*zh/(cp*thls)
if (timee < 0.01) then
exnf = 1-grav*zf/(cp*thls) ! What's this?
exnh = 1-grav*zh/(cp*thls) !
endif

th0av = thl0av + (rlv/cp)*ql0av/exnf
do n=1,nsv
call slabsum(sv0av(1,n),1,k1,sv0(1,1,1,n),2-ih,i1+ih,2-jh,j1+jh,1,k1,2,i1,2,j1,1,k1)
Expand All @@ -272,7 +276,9 @@ subroutine diagfld

! 2.1 Use first guess of theta, then recalculate theta
call fromztop
exnf = (presf/pref0)**(rd/cp)
if (timee < 0.01) then
exnf = (presf/pref0)**(rd/cp)
endif
th0av = thl0av + (rlv/cp)*ql0av/exnf

! 2.2 Use new updated value of theta for determination of pressure
Expand All @@ -286,13 +292,14 @@ subroutine diagfld
!***********************************************************

! 3.1 determine exner

exnh(1) = (ps/pref0)**(rd/cp)
exnf(1) = (presf(1)/pref0)**(rd/cp)
do k=2,k1
exnf(k) = (presf(k)/pref0)**(rd/cp)
exnh(k) = (presh(k)/pref0)**(rd/cp)
end do
if (timee < 0.01) then
exnh(1) = (ps/pref0)**(rd/cp)
exnf(1) = (presf(1)/pref0)**(rd/cp)
do k=2,k1
exnf(k) = (presf(k)/pref0)**(rd/cp)
exnh(k) = (presh(k)/pref0)**(rd/cp)
end do
endif
thvf(1) = th0av(1)*exnf(1)*(1+(rv/rd-1)*qt0av(1)-rv/rd*ql0av(1))
rhof(1) = presf(1)/(rd*thvf(1))

Expand Down

0 comments on commit 854ca46

Please sign in to comment.