Skip to content
Merged
57 changes: 53 additions & 4 deletions io/namelist_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module namelist_mod
integer :: fire_upwinding_reinit = 4 ! "numerical scheme (space) for reinitialization PDE: 1=WENO3, 2=WENO5, 3=hybrid WENO3-ENO1, 4=hybrid WENO5-ENO1"
integer :: fire_lsm_band_ngp = 4 ! "number of grid points around lfn=0 that WENO5/3 is used (ENO1 elsewhere),
! for fire_upwinding_reinit=4,5 and fire_upwinding=8,9 options"
real :: reinit_pseudot_coef = 0.01 ! Coefficient for the pseudo time

integer :: fast_dist_reinit_opt = 0 ! Fast distance reinitialization method (or eikonal solver): 0) None, 1) FSM
integer :: fast_dist_reinit_freq = 600 ! Number of time steps to perform a reinit with fast distance reinit method
Expand All @@ -77,6 +78,7 @@ module namelist_mod
real :: fmoist_dt = 600.0 ! moisture model time step [s]

integer :: ideal_opt = 0 ! 0) real world, 1) ideal
integer :: devel_opt = 0 ! 0) Standard nml options, 1) reads options in the devel nml block

! Objects
integer :: fuel_opt = FUEL_ANDERSON ! 1) Anderson 13
Expand Down Expand Up @@ -154,10 +156,15 @@ module namelist_mod
! Atm block
integer :: interval_atm = -1 ! Time step [s] of the atm (or frequency to read atm data if offline)
integer :: kde = 1 ! Number of atm vertical levels

! Devel block
integer :: check_isolated_neg_lfn = 0 ! 0) Nothing, 1) Check for isolated negative values of the level set function
integer :: output_level = 0 ! 0) Standard output, >0) Specialized output
contains
procedure, public :: Broadcast_nml => Broadcast_nml
procedure, public :: Check_nml => Check_nml
procedure, public :: Initialization => Init_namelist
procedure, public :: Init_devel_block => Init_devel_block
procedure, public :: Init_fire_block => Init_fire_block
procedure, public :: Init_ideal_block => Init_ideal_block
procedure, public :: Init_time_block => Init_time_block
Expand All @@ -184,6 +191,7 @@ subroutine Broadcast_nml (this)
call Broadcast_integer (this%fire_lsm_reinit_iter)
call Broadcast_integer (this%fire_upwinding_reinit)
call Broadcast_integer (this%fire_lsm_band_ngp)
call Broadcast_real (this%reinit_pseudot_coef)
call Broadcast_integer (this%fast_dist_reinit_opt)
call Broadcast_integer (this%fast_dist_reinit_freq)
call Broadcast_logical (this%fire_lsm_zcoupling)
Expand All @@ -202,6 +210,7 @@ subroutine Broadcast_nml (this)
call Broadcast_real (this%fuelmc_c)

call Broadcast_integer (this%ideal_opt)
call Broadcast_integer (this%devel_opt)
call Broadcast_integer (this%fuel_opt)
call Broadcast_integer (this%ros_opt)
call Broadcast_integer (this%emis_opt)
Expand Down Expand Up @@ -298,6 +307,9 @@ subroutine Broadcast_nml (this)
call Broadcast_integer (this%interval_atm)
call Broadcast_integer (this%kde)

! Devel block
call Broadcast_integer (this%check_isolated_neg_lfn)
call Broadcast_integer (this%output_level)
contains

subroutine Broadcast_integer (val)
Expand Down Expand Up @@ -395,6 +407,38 @@ subroutine Init_atm_block (this, file_name)

end subroutine Init_atm_block

subroutine Init_devel_block (this, file_name)

implicit none

class (namelist_t), intent (in out) :: this
character (len = *), intent (in) :: file_name

integer :: check_isolated_neg_lfn, output_level
integer :: unit_nml, io_stat
character (len = :), allocatable :: msg

namelist /devel/ check_isolated_neg_lfn, output_level


check_isolated_neg_lfn = this%check_isolated_neg_lfn
output_level = this%output_level

open (newunit = unit_nml, file = trim (file_name), action = 'read', iostat = io_stat)
if (io_stat /= 0) then
msg = 'Problems opening namelist file ' // trim (file_name)
call Stop_simulation (msg)
end if

read (unit_nml, nml = devel, iostat = io_stat)
if (io_stat /= 0) call Stop_simulation ('Problems reading namelist devel block')
close (unit_nml)

this%check_isolated_neg_lfn = check_isolated_neg_lfn
this%output_level = output_level

end subroutine Init_devel_block

subroutine Init_fire_block (this, file_name)

implicit none
Expand All @@ -403,10 +447,10 @@ subroutine Init_fire_block (this, file_name)
character (len = *), intent (in) :: file_name

integer :: fire_print_msg, fire_upwinding, fire_lsm_reinit_iter, fire_upwinding_reinit, fire_lsm_band_ngp, &
fast_dist_reinit_opt, fast_dist_reinit_freq, fire_viscosity_ngp, wind_vinterp_opt, hinterp_opt, ideal_opt, &
fast_dist_reinit_opt, fast_dist_reinit_freq, fire_viscosity_ngp, wind_vinterp_opt, hinterp_opt, ideal_opt, devel_opt, &
fuel_opt, ros_opt, fmc_opt, emis_opt, fmoist_freq
real :: fire_atm_feedback, fire_viscosity, fire_lsm_zcoupling_ref, fire_viscosity_bg, fire_viscosity_band, &
fmoist_dt, fire_wind_height, frac_fburnt_to_smoke, fuelmc_g, fuelmc_g_live, fuelmc_c
fmoist_dt, fire_wind_height, frac_fburnt_to_smoke, fuelmc_g, fuelmc_g_live, fuelmc_c, reinit_pseudot_coef
logical :: fire_lsm_reinit, fire_lsm_zcoupling, fmoist_run, fire_is_real_perim

! ignitions
Expand All @@ -426,8 +470,8 @@ subroutine Init_fire_block (this, file_name)
fast_dist_reinit_opt, fast_dist_reinit_freq, fire_lsm_reinit_iter, fire_upwinding_reinit, &
fire_lsm_band_ngp, fire_lsm_zcoupling, fire_lsm_zcoupling_ref, fire_viscosity_bg, fire_viscosity_band, &
fire_viscosity_ngp, fmoist_run, fmoist_freq, fmoist_dt, fire_wind_height, fire_is_real_perim, &
frac_fburnt_to_smoke, fuelmc_g, fuelmc_g_live, fuelmc_c, ideal_opt, fuel_opt, ros_opt, fmc_opt, emis_opt, &
wind_vinterp_opt, hinterp_opt, &
frac_fburnt_to_smoke, fuelmc_g, fuelmc_g_live, fuelmc_c, ideal_opt, devel_opt, fuel_opt, ros_opt, fmc_opt, emis_opt, &
wind_vinterp_opt, hinterp_opt, reinit_pseudot_coef, &
! Ignitions
fire_num_ignitions, &
! Ignition 1
Expand Down Expand Up @@ -459,6 +503,7 @@ subroutine Init_fire_block (this, file_name)
fire_lsm_reinit_iter = this%fire_lsm_reinit_iter
fire_upwinding_reinit = this%fire_upwinding_reinit
fire_lsm_band_ngp = this%fire_lsm_band_ngp
reinit_pseudot_coef = this%reinit_pseudot_coef
fast_dist_reinit_opt = this%fast_dist_reinit_opt
fast_dist_reinit_freq = this%fast_dist_reinit_freq
fire_lsm_zcoupling = this%fire_lsm_zcoupling
Expand All @@ -477,6 +522,7 @@ subroutine Init_fire_block (this, file_name)
fuelmc_c = this%fuelmc_c

ideal_opt = this%ideal_opt
devel_opt = this%devel_opt

fuel_opt = this%fuel_opt
ros_opt = this%ros_opt
Expand Down Expand Up @@ -553,6 +599,7 @@ subroutine Init_fire_block (this, file_name)
this%fire_lsm_reinit_iter = fire_lsm_reinit_iter
this%fire_upwinding_reinit = fire_upwinding_reinit
this%fire_lsm_band_ngp = fire_lsm_band_ngp
this%reinit_pseudot_coef = reinit_pseudot_coef
this%fast_dist_reinit_opt = fast_dist_reinit_opt
this%fast_dist_reinit_freq = fast_dist_reinit_freq
this%fire_lsm_zcoupling = fire_lsm_zcoupling
Expand All @@ -571,6 +618,7 @@ subroutine Init_fire_block (this, file_name)
this%fuelmc_c = fuelmc_c

this%ideal_opt = ideal_opt
this%devel_opt = devel_opt

this%fuel_opt = fuel_opt
this%ros_opt = ros_opt
Expand Down Expand Up @@ -786,6 +834,7 @@ subroutine Init_namelist (this, file_name)
call this%Init_fire_block (file_name = trim (file_name))
call this%Init_atm_block (file_name = trim (file_name))
if (this%ideal_opt > 0) call this%Init_ideal_block (file_name = trim (file_name))
if (this%devel_opt > 0) call this%Init_devel_block (file_name = trim (file_name))

call this%Check_nml ()

Expand Down
8 changes: 4 additions & 4 deletions physics/fire_model_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ subroutine Advance_fire_model (config_flags, grid)

integer :: ij, ifds, ifde, jfds, jfde, ifts, ifte, jfts, jfte, ifms, ifme, jfms, jfme
real :: tbound, time_start
integer, parameter :: CHECK_ISOLATED_NEG_LFN = 0
logical, parameter :: DEBUG_LOCAL = .false.


Expand All @@ -53,7 +52,8 @@ subroutine Advance_fire_model (config_flags, grid)
config_flags%fire_upwinding, config_flags%fire_viscosity, config_flags%fire_viscosity_bg, config_flags%fire_viscosity_band, &
config_flags%fire_viscosity_ngp, config_flags%fire_lsm_band_ngp, tbound, grid%lfn, grid%lfn_0, grid%lfn_1, grid%lfn_2, &
grid%lfn_out, grid%tign_g, grid%ros, grid%uf, grid%vf, grid%dzdxf, grid%dzdyf, grid%ros_param, grid%cart_comm, &
grid%ifps, grid%ifpe, grid%jfps, grid%jfpe)
grid%ifps, grid%ifpe, grid%jfps, grid%jfpe, grid%grad_norm_ls, grid%grad_norm_residual_sq_sum, &
grid%grad_norm_residual_sq_sum_band, grid%grad_norm_residual_rms_band)

if (DEBUG_LOCAL) call Print_message ('calling Stop_if_close_to_bdy...')
!$OMP PARALLEL DO &
Expand Down Expand Up @@ -113,7 +113,7 @@ subroutine Advance_fire_model (config_flags, grid)
ifds, ifde, jfds, jfde, time_start, grid%dt, grid%dx, grid%dy, config_flags%fire_upwinding_reinit, &
config_flags%fire_lsm_reinit_iter, config_flags%fire_lsm_band_ngp, grid%lfn, grid%lfn_2, grid%lfn_s0, &
grid%lfn_s1, grid%lfn_s2, grid%lfn_s3, grid%lfn_out, grid%tign_g, grid%cart_comm, &
grid%ifps, grid%ifpe, grid%jfps, grid%jfpe)
grid%ifps, grid%ifpe, grid%jfps, grid%jfpe, config_flags%reinit_pseudot_coef, grid%grad_norm_reinit)

if (DEBUG_LOCAL) call Print_message ('calling Copy_lfnout_to_lfn...')
!$OMP PARALLEL DO &
Expand All @@ -132,7 +132,7 @@ subroutine Advance_fire_model (config_flags, grid)
call Do_halo_exchange_with_corners (grid%lfn, ifms, ifme, jfms, jfme, grid%ifps, grid%ifpe, grid%jfps, grid%jfpe, N_POINTS_IN_HALO, grid%cart_comm)
#endif

if (CHECK_ISOLATED_NEG_LFN == 1) call Check_isolated_negative_lfn (grid)
if (config_flags%check_isolated_neg_lfn == 1) call Check_isolated_negative_lfn (grid)

if (DEBUG_LOCAL) call Print_message ('calling Ignite_prescribed_fires...')
!$OMP PARALLEL DO &
Expand Down
Loading