Skip to content

Commit

Permalink
fix #49, modsimpleice2: move lookup table creation from init to main …
Browse files Browse the repository at this point in the history
…routine because of init order dependencies
  • Loading branch information
Fredrik Jansson committed Feb 13, 2020
1 parent 5592161 commit be3f971
Showing 1 changed file with 15 additions and 24 deletions.
39 changes: 15 additions & 24 deletions src/modsimpleice2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,6 @@ subroutine initsimpleice2
gammadds3=lacz_gamma(3.+dds)
gammaddg3=lacz_gamma(3.+ddg)


! Density corrected fall speed parameters, see Tomita 2008
! rhobf is constant in time
do k=1,k1
ccrz(k)=ccr*(1.29/rhobf(k))**0.5
ccsz(k)=ccs*(1.29/rhobf(k))**0.5
ccgz(k)=ccg*(1.29/rhobf(k))**0.5

! these coefficients are used in evapdep - tabulated because of sqrt
ccrz2(k) = gam2dr*.27*n0rr*sqrt(ccrz(k)/2.e-5)
ccsz2(k) = gam2ds*.39*n0rs*sqrt(ccsz(k)/2.e-5) ! NOTE: .27 here is suspect -> .39
ccgz2(k) = gam2dg*.27*n0rg*sqrt(ccgz(k)/2.e-5)
end do

nrp=0. ! not used in this scheme
nr=0. ! set to 0 here in case the statistics use them

Expand All @@ -129,7 +115,7 @@ end subroutine exitsimpleice2

!> Calculates the microphysical source term.
subroutine simpleice2
use modglobal, only : i1,j1,rdt,rk3step,timee,rlv,cp,tup,tdn,pi,tmelt,kmax,dzf,dzh
use modglobal, only : i1,j1,k1,rdt,rk3step,timee,rlv,cp,tup,tdn,pi,tmelt,kmax,dzf,dzh
use modfields, only : sv0,svm,svp,qtp,thlp,qt0,ql0,exnf,rhof,tmp0,rhobf,qvsl,qvsi,esl,surf_rain

use modsimpleicestat, only : simpleicetend
Expand Down Expand Up @@ -158,15 +144,20 @@ subroutine simpleice2
! sed_qr = 0. ! reset sedimentation fluxes
sed_qr(:,:,kmax+1) = 0 ! initialize ghost cells, other cells are initialized before use


! Density corrected fall speed parameters, see Tomita 2008
! rhobf is constant in time
! do k=1,k1
! ccrz(k)=ccr*(1.29/rhobf(k))**0.5
! ccsz(k)=ccs*(1.29/rhobf(k))**0.5
! ccgz(k)=ccg*(1.29/rhobf(k))**0.5
! end do

! rhobf is constant in time. could initialize tables in initsimpleice2, but that would requires that
! microphysics is initialized AFTER readinitfiles (for rhobf def), which breaks chemistry or surface
do k=1,k1
ccrz(k)=ccr*(1.29/rhobf(k))**0.5
ccsz(k)=ccs*(1.29/rhobf(k))**0.5
ccgz(k)=ccg*(1.29/rhobf(k))**0.5

! these coefficients are used in evapdep - tabulated because of sqrt
ccrz2(k) = gam2dr*.27*n0rr*sqrt(ccrz(k)/2.e-5)
ccsz2(k) = gam2ds*.39*n0rs*sqrt(ccsz(k)/2.e-5) ! NOTE: .27 here is suspect -> .39
ccgz2(k) = gam2dg*.27*n0rg*sqrt(ccgz(k)/2.e-5)
end do

! used to check on negative qr and nr
qrsum=0.
qrsmall=0.
Expand All @@ -175,7 +166,7 @@ subroutine simpleice2

!nrp=0. ! not used in this scheme
!nr=0.

thlpmcr=0.
qtpmcr=0.

Expand Down

0 comments on commit be3f971

Please sign in to comment.