Skip to content

Commit

Permalink
adding moisture model time control with large time step, similar to m…
Browse files Browse the repository at this point in the history
…odule_radiation_driver.F

thanks Jon for pointing the way!
  • Loading branch information
janmandel committed Feb 26, 2012
1 parent 294ba1b commit 6eccbe0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
8 changes: 6 additions & 2 deletions wrfv2_fire/Registry/registry.fire
Expand Up @@ -57,8 +57,12 @@ state real rain_old ij fire 1 z hr "RAIN_OLD"
state real t2_old ij fire 1 z hr "T2_OLD" "previous value of accumulated rain" "mm"
state real q2_old ij fire 1 z hr "Q2_OLD" "previous value of accumulated rain" "mm"
state real psfc_old ij fire 1 z hr "PSFC_OLD" "previous value of accumulated rain" "mm"
rconfig logical initialize_fmc namelist,fire 1 .true. hr "initialize_fmc" "set initial moisture to fuelmc_g from namelist.fire"
rconfig logical dynamic_fuel_moisture namelist,fire 1 .true. hr "run fuel moisture model or not"
state real fmoist_lasttime - fire - - hr "FMOIST_LASTTIME" "last time the moisture model was run" "s"
state real fmoist_nexttime - fire - - hr "FMOIST_NEXTTIME" "next time the moisture model will run" "s"
rconfig logical fmoist_run namelist,fire max_domains .true. hr "fmoist_run" "run fuel moisture model"
rconfig integer fmoist_freq namelist,fire max_domains 0 hr "fmoist_freq" "frequency to run moisture model 0: use fmoist_dt, k>0: every k timesteps" "1"
rconfig real fmoist_dt namelist,fire max_domains 600 hr "fmoist_dt " "moisture model time step" "s"
rconfig logical initialize_fmc namelist,fire max_domains .true. hr "initialize_fmc" "set initial moisture to fuelmc_g from namelist.fire"
halo HALO_FIRE_MFG dyn_em 24:fmc_g
halo HALO_FIRE_MAG dyn_em 8:fmc_gc

Expand Down
38 changes: 36 additions & 2 deletions wrfv2_fire/phys/module_fr_sfire_driver.F
Expand Up @@ -133,6 +133,7 @@ subroutine sfire_driver_em ( grid , config_flags &
real:: corner_ll,corner_ul,corner_ur,corner_lr
character(len=128)msg
type(fire_params)::fp
real:: time_step_end

logical:: run_moisture
real:: dt_moisture
Expand Down Expand Up @@ -160,12 +161,45 @@ subroutine sfire_driver_em ( grid , config_flags &
ir=grid%sr_x ! refinement ratio
jr=grid%sr_y
itimestep=grid%itimestep
time_step_end = time_step_start + dt
restart=config_flags%restart .or. config_flags%cycling .or. config_flags%fire_restart ! skip state initialization

! **** moisture model
! run moisture model this timestep?
run_moisture = .true. .or. config_flags%dynamic_fuel_moisture
dt_moisture = dt ! Time since moisture model run the last time. Should be long. ********* REPLACE *********
run_moisture = .false.
if(config_flags%fmoist_run)then
if(fire_ifun_start < 3)then
call message('moisture model runs because are initializing')
grid%fmoist_lasttime=0.
run_moisture = .true.
endif
if(config_flags%fmoist_freq > 0)then ! go by mutliples?
if(mod(grid%itimestep,config_flags%fmoist_freq) .eq. 0)then
write(msg,*)'moisture model runs because timestep ',grid%itimestep,' is multiple of ',config_flags%fmoist_freq
call message(msg)
run_moisture = .true. ! yes, it is the given multiple
endif
else ! no, by specified interval
if(.not. time_step_end < grid%fmoist_nexttime) then ! the time has come
write(msg,*)'moisture model runs because time ',grid%fmoist_nexttime,'s has arrived'
run_moisture = .true.
endif
endif
endif
if(run_moisture)then
dt_moisture = time_step_end - grid%fmoist_lasttime ! Time since moisture model run the last time. Should be long.
grid%fmoist_lasttime = time_step_end
write(msg,*)'moisture time step is ',dt_moisture,'s'
call message(msg)
if(config_flags%fmoist_freq > 0)then
else
grid%fmoist_nexttime = time_step_end + config_flags%fmoist_dt
write(msg,*)'next run at ',grid%fmoist_nexttime,'s'
endif
endif




!$OMP CRITICAL(SFIRE_DRIVER_CRIT)
write(msg,'(a,i1,a,i1,a,l1)') &
Expand Down

0 comments on commit 6eccbe0

Please sign in to comment.