Skip to content

Commit

Permalink
1)Incorprate the fixes of using mersenne_twister in CALWXT_BOURG.f fr…
Browse files Browse the repository at this point in the history
…om Moorthi; 2)bug fix in TIMEF.f.
  • Loading branch information
WenMeng-NOAA committed Dec 17, 2020
1 parent 2c43340 commit 2327206
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.0.0
10.0.1
7 changes: 6 additions & 1 deletion sorc/ncep_post.fd/CALWXT_BOURG.f
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ subroutine calwxt_bourg_post(im,jm,jsta_2l,jend_2u,jsta,jend,lm,lp1, &
!
integer i,j,ifrzl,iwrml,l,lhiwrm,lmhk,jlen
real pintk1,areane,tlmhk,areape,pintk2,surfw,area1,dzkl,psfck,r1,r2
real rn(im*jm*2)
real(kind=8):: rn(im*jm*2)
!real(kind=8) :: rn8(im*jm*2)
!
! initialize weather type array to zero (ie, off).
! we do this since we want ptype to represent the
Expand All @@ -102,6 +103,10 @@ subroutine calwxt_bourg_post(im,jm,jsta_2l,jend_2u,jsta,jend,lm,lp1, &
jlen = jend - jsta + 1
call random_setseed(iseed)
call random_number(rn)
!if(maxval(rn)>10. .or. minval(rn)<0.)then
! call random_number(rn8)
! rn=rn8
!endif
! call random_number(rn,iseed)
!
!!$omp parallel do &
Expand Down
11 changes: 11 additions & 0 deletions sorc/ncep_post.fd/SURFCE.f
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ SUBROUTINE SURFCE
lp1, imp_physics, me, asrfc, tsrfc, pt, pdtop, &
mpi_comm_comp, im, jm, prec_acc_dt1
use rqstfld_mod, only: iget, lvls, id, iavblfld, lvlsxml
use mersenne_twister, only: random_number, random_setseed
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
implicit none
!
Expand Down Expand Up @@ -145,6 +146,8 @@ SUBROUTINE SURFCE
real RDTPHS,TLOW,TSFCK,QSAT,DTOP,DBOT,SNEQV,RRNUM,SFCPRS,SFCQ, &
RC,SFCTMP,SNCOVR,FACTRS,SOLAR, s,tk,tl,w,t2c,dlt,APE, &
qv,e,dwpt,dum1,dum2,dum3,dum1s,dum3s,dum21,dum216,es
real (kind=8) :: wrk(1)
integer :: iseed0

real,external :: fpvsnew

Expand Down Expand Up @@ -3871,6 +3874,10 @@ SUBROUTINE SURFCE
! BOURGOUIN ALGORITHM
ISEED=44641*(INT(SDAT(1)-1)*24*31+INT(SDAT(2))*24+IHRST)+ &
& MOD(IFHR*60+IFMIN,44641)+4357
iseed0 = sdat(1) + sdat(2) + sdat(3) + ihrst
call random_setseed(iseed0)
call random_number(wrk)
iseed = iseed0 + nint(wrk(1)*1000.0d0) + ifhr + ifmin
! write(0,*)'in SURFCE,me=',me,'bef 1st CALWXT_BOURG_POST iseed=',iseed
CALL CALWXT_BOURG_POST(IM,JM,JSTA_2L,JEND_2U,JSTA,JEND,LM,LP1,&
& ISEED,G,PTHRESH, &
Expand Down Expand Up @@ -4072,6 +4079,10 @@ SUBROUTINE SURFCE
! BOURGOUIN ALGORITHM
ISEED=44641*(INT(SDAT(1)-1)*24*31+INT(SDAT(2))*24+IHRST)+ &
& MOD(IFHR*60+IFMIN,44641)+4357
iseed0 = sdat(1) + sdat(2) + sdat(3) + ihrst
call random_setseed(iseed0)
call random_number(wrk)
iseed = iseed0 + nint(wrk(1)*1000.0d0) + ifhr + ifmin
! write(0,*)'in SURFCE,me=',me,'bef sec CALWXT_BOURG_POST'
CALL CALWXT_BOURG_POST(IM,JM,JSTA_2L,JEND_2U,JSTA,JEND,LM,LP1,&
& ISEED,G,PTHRESH, &
Expand Down
4 changes: 2 additions & 2 deletions sorc/ncep_post.fd/TIMEF.f
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
function timef()
implicit none
real et(2)
real*8 timef
real*8 timef, etime
timef=etime(et)
timef=timef*1.e3
end

function rtc()
implicit none
real et(2)
real*8 rtc
real*8 rtc, etime
rtc=etime(et)
rtc=rtc*1.e3
end

0 comments on commit 2327206

Please sign in to comment.