cp ts_smoke_by_xr.py ts_smoke.py
[wrf-fire-matlab.git] / vis3d / check_ros.m
blob31f9af5c82e7c4eac5881d62e1cbdde7f3d554fc
1 function err=check_ros(fuel)
2 % err=check_ros(fuel)
3 % check relative error between fortran and matlab
4 % example: fuels; big(check_ros(fuel)) should return of order 1e-5
5 nfuels=length(fuel);
6 for k=1:nfuels
7     nwinds=length(fuel(k).wind);
8     for j=1:nwinds
9         speed=fuel(k).wind(j);
10         ros=fire_ros(fuel(k),speed,0);
11         err(k,j,1)=(fuel(k).ros_wind(j)-ros)/(ros+eps);
12         % ros_before=fire_ros_before(fuel(k),speed,0);
13         % fprintf('fuel=%g speed=%g ros=%g ros_before=%g\n',k,speed,ros,ros_before)
14         % if abs(ros-ros_before)>eps, error('ros different'),end
15     end
16     nslopes=length(fuel(k).slope);
17     for j=1:nslopes
18         tanphi=fuel(k).slope(j);
19         ros=fire_ros(fuel(k),0,tanphi);
20         err(k,j,2)=(fuel(k).ros_slope(j)-ros)/(ros+eps);
21     end
22 end