Skip to content

Commit

Permalink
fix: uninit var in ignire_fire, units were from patch center -> small…
Browse files Browse the repository at this point in the history
… diff serial/parallel
  • Loading branch information
Jan Mandel authored and Jan Mandel committed Oct 21, 2008
1 parent 45a49f8 commit 50835e2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
12 changes: 11 additions & 1 deletion wrfv2_fire/phys/module_fr_sfire_core.F
Expand Up @@ -137,8 +137,8 @@ subroutine ignite_fire( ifds,ifde,jfds,jfde, & ! fire domain
! = |a-m| (a-m).(e-s))/(|a-m|*|e-s|)
des2 = (ex-sx)*(ex-sx)*cx2+(ey-sy)*(ey-sy)*cy2 ! des2 = |e-s|^2
dames = dam2*des2
am_es=(ax-mx)*(ex-sx)*cx2+(ay-my)*(ey-sy)*cy2 ! am_es = (a-m).(e-s)
if(dames>0)then
am_es=(ax-mx)*(ex-sx)*cx2+(ay-my)*(ey-sy)*cy2 ! am_es = (a-m).(e-s)
cos2 = (am_es*am_es)/dames ! cos2 = cos^2 (a-m,e-s)
else ! point a already is the midpoint
cos2 = 0.
Expand All @@ -158,6 +158,16 @@ subroutine ignite_fire( ifds,ifde,jfds,jfde, & ! fire domain
ignited=ignited+1 ! count
endif
lfn(i,j)=min(lfn(i,j),lfn_new) ! update the level set function

! debug
! write(msg,'(2i4,10f12.6)')i,j,d,sx,ex,sy,ey
! call message(msg)
! write(msg,'(10f12.6)')ax,ay,dmc2,des2,cos2
! call message(msg)
! write(msg,'(10f16.6)')unit_xf,unit_yf,cx2,cy2,dam2
! call message(msg)
! write(msg,'(10f16.6)')des2,dames,am_es,mx,my
! call message(msg)
enddo
enddo
write(msg,'(a,2f11.6,a,2f11.6)')'ignite_fire: from',sx,sy,' to ',ex,ey
Expand Down
11 changes: 8 additions & 3 deletions wrfv2_fire/phys/module_fr_sfire_driver.F
Expand Up @@ -100,6 +100,7 @@ subroutine sfire_driver_em ( grid , config_flags &
! uf vf only do not need to be in the state but we need halo on them
real, dimension(ifms:ifme, jfms:jfme)::lfn_out
integer, dimension(ifms:ifme, jfms:jfme)::nfuel_cat_int
real::lat_ctr,lon_ctr

!*** executable

Expand All @@ -115,6 +116,9 @@ subroutine sfire_driver_em ( grid , config_flags &
ir=grid%sr_x ! refinement ratio
jr=grid%sr_y
itimestep=grid%itimestep

lat_ctr=(grid%em_lat_ll_t+ grid%em_lat_ul_t+grid%em_lat_ur_t+grid%em_lat_lr_t)/4.
lon_ctr=(grid%em_lon_ll_t+ grid%em_lon_ul_t+grid%em_lon_ur_t+grid%em_lon_lr_t)/4.

do istep=0,fire_test_steps ! istep >0 is for testing only, exit after the first call
itimestep = itimestep + istep ! in the first call, do fire_test_steps steps of the fire model
Expand Down Expand Up @@ -175,6 +179,7 @@ subroutine sfire_driver_em ( grid , config_flags &
itimestep,config_flags%fire_fuel_read,config_flags%fire_fuel_cat, & ! in scalars
grid%dt,grid%dx,grid%dy, &
grid%u_frame,grid%v_frame, &
lat_ctr,lon_ctr, & ! coordinates of grid center
config_flags%fire_ext_grnd,config_flags%fire_ext_crwn,config_flags%fire_crwn_hgt, &
fire_num_ignitions, &
fire_ignition_longlat, &
Expand Down Expand Up @@ -218,6 +223,7 @@ subroutine sfire_driver_phys (ifun,need_lfn_update, &
num_tiles,i_start,i_end,j_start,j_end, & ! atm grid tiling
itimestep,ifuelread,nfuel_cat0,dt,dx,dy, & ! in scalars
u_frame,v_frame, &
lat_ctr,lon_ctr, &
fire_ext_grnd,fire_ext_crwn,fire_crwn_hgt, &
num_ignitions, &
ignition_longlat, &
Expand Down Expand Up @@ -270,6 +276,7 @@ subroutine sfire_driver_phys (ifun,need_lfn_update, &
dt, & ! time step
dx,dy, & ! atm grid step
u_frame,v_frame, & ! velocity offset
lat_ctr,lon_ctr, & ! coordinates of domain center
fire_crwn_hgt, & ! lowest height crown fire heat is released (m)
fire_ext_grnd, & ! extinction depth of ground fire heat (m)
fire_ext_crwn ! extinction depth of crown fire heat (m)
Expand Down Expand Up @@ -388,11 +395,9 @@ subroutine sfire_driver_phys (ifun,need_lfn_update, &
if(xlong(ips,jps).eq.0. .and. xlong(ipe,jpe).eq. 0.) then
call crash('sfire_driver_phys: xlong xlat not set, use fire_ignition_longlat=0 or run real not ideal')
endif
! latitude in the middle of the patch
latm=xlat((ips+ipe)/2,(jps+jpe)/2)
! 1 degree in m (approximate OK)
unit_fxlat=6378e3*2*3.14159/360. ! earth circumference in m / 360 degrees
unit_fxlong=cos(latm*3.14159/180.)*unit_fxlat ! latitude
unit_fxlong=cos(lat_ctr*3.14159/180.)*unit_fxlat ! latitude
! will interpolate nodal coordinates to the fire mesh
endif

Expand Down

0 comments on commit 50835e2

Please sign in to comment.