Skip to content

Commit

Permalink
adding standalone moisture code
Browse files Browse the repository at this point in the history
  • Loading branch information
janmandel authored and Jan Mandel committed Mar 6, 2012
1 parent ebdf9d4 commit e9a5ede
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 64 deletions.
77 changes: 57 additions & 20 deletions standalone/moisture_main.F
@@ -1,33 +1,70 @@
! standalone moisture model test
program moisture_main
use module_fr_sfire_phys, only: advance_moisture, init_fuel_cats
use module_fr_sfire_phys, only: advance_moisture, init_fuel_cats, moisture_classes
use module_fr_sfire_util, only: fire_print_msg
implicit none

integer, parameter:: ims=1,ime=10,jms=1,jme=15,nfms=5
integer, parameter:: ims=1,ime=10,jms=1,jme=15,nfmc=5
integer::its=ims,ite=ime,jts=jms,jte=jme
real, dimension(ims:ime,1:nfms,jms:jme)::fmc_gc,fmc_equi,fmc_tend
real, dimension(ims:ime,1:nfmc,jms:jme)::fmc_gc,fmc_equi,fmc_tend
real, dimension(ims:ime,jms:jme)::t2,q2,psfc,t2_old,q2_old,psfc_old, &
rainc,rainnc,rain_old
integer, parameter::nsteps=50
logical::initialize
integer::fmoist_init
real::moisture_dt
integer::fmoist_init=2
real::moisture_dt,dt
integer::istep,i
real, dimension(nsteps)::t,q,p,rain

! test data
integer, parameter::zs=nsteps-10;
data dt/600./
data t/300.,300.,300.,305.,310., 290.,290.,290.,290.,280.,zs*270/
data q/nsteps*0.002/
data p/nsteps*1e5/
data rain/0.0,0.01,0.01,0.1,1.0, 2.0,3.0,5.0,5.0,6.0,zs*6.0/

!*** executable
fire_print_msg = 2

call init_fuel_cats(.true.)
print *,moisture_classes,' moisture classes'

do istep=1,nsteps

if(istep.eq.1)then
moisture_dt=0. ! required on initialization
initialize=.true.
else
moisture_dt=dt !
initialize=.false.
endif

write(*,*)'step',istep,' dt=',moisture_dt,' t=',t(istep),' q2=',q(istep),' p=',p(istep), &
' rain=',rain(istep)

t2=t(istep)
q2=q(istep)
psfc=p(istep)
rainc=0
rainnc=rain(istep)

call advance_moisture( &
initialize, & ! initialize timestepping. true on the first call at time 0, then false
fmoist_init, & ! initial moisture: 1=fuelmc_g, 2=equilibrium, else = none
ims,ime, jms,jme, & ! memory dimensions
its,ite, jts,jte, & ! tile dimensions
nfmc, & ! dimension of moisture fields
moisture_dt, & ! timestep = time step time elapsed from the last call
rainc, rainnc, & ! accumulated rain
t2, q2, psfc, & ! temperature (K), vapor contents (kg/kg), pressure (Pa) at the surface
rain_old, & ! previous value of accumulated rain
t2_old, q2_old, psfc_old, & ! previous values of the atmospheric state at surface
fmc_gc, & ! fuel moisture by class, updated
fmc_equi, & ! fuel moisture equilibrium by class, for diagnostics only
fmc_tend & ! fuel moisture tendency by classe, for diagnostics only
)

call advance_moisture( &
initialize, & ! initialize timestepping. true on the first call at time 0, then false
fmoist_init, & ! initial moisture: 1=fuelmc_g, 2=equilibrium, else = none
ims,ime, jms,jme, & ! memory dimensions
its,ite, jts,jte, & ! tile dimensions
nfmc, & ! dimension of moisture fields
moisture_dt, & ! timestep = time step time elapsed from the last call
rainc, rainnc, & ! accumulated rain
t2, q2, psfc, & ! temperature (K), vapor contents (kg/kg), pressure (Pa) at the surface
rain_old, & ! previous value of accumulated rain
t2_old, q2_old, psfc_old, & ! previous values of the atmospheric state at surface
fmc_gc, & ! fuel moisture by class, updated
fmc_equi, & ! fuel moisture equilibrium by class, for diagnostics only
fmc_tend & ! fuel moisture tendency by classe, for diagnostics only
)
enddo

end program moisture_main
41 changes: 0 additions & 41 deletions standalone/namelist.fire

This file was deleted.

1 change: 1 addition & 0 deletions standalone/namelist.fire
1 change: 0 additions & 1 deletion standalone/wrf_fakes.F
Expand Up @@ -149,7 +149,6 @@ MODULE module_timing
INTEGER, PRIVATE :: cn = 0
REAL, PRIVATE :: elapsed_seconds , elapsed_seconds_total = 0
REAL, PRIVATE :: cpu_1 , cpu_2 , cpu_seconds , cpu_seconds_total = 0
data cn /0/

CONTAINS

Expand Down
4 changes: 2 additions & 2 deletions wrfv2_fire/phys/module_fr_sfire_phys.F
Expand Up @@ -386,10 +386,10 @@ subroutine advance_moisture( &
if(initialize) then
call message('advance_moisture: initializing, copying surface variables to old')
call copy2old
else
call print_3d_stats_by_slice(its,ite,1,moisture_classes,jts,jte,ims,ime,1,nfmc,jms,jme,fmc_gc,'before advance fmc_gc')
endif

call print_3d_stats_by_slice(its,ite,1,moisture_classes,jts,jte,ims,ime,1,nfmc,jms,jme,fmc_gc,'before advance fmc_gc')

if(check_data)then
do j=jts,jte
do i=its,ite
Expand Down

0 comments on commit e9a5ede

Please sign in to comment.