[Luyben] Process Mod.. - Student subdomain for University of Bath
[Luyben] Process Mod.. - Student subdomain for University of Bath
[Luyben] Process Mod.. - Student subdomain for University of Bath
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
98 COMPUTER SIMULATION<br />
TABLE 4.2<br />
Example <strong>of</strong> iterative bubblepoint calculation using “ Newton-Rapbson” algorithm<br />
C<br />
C MAIN PROGRAM SETS DIFFERENT VALUES FOR INITIAL<br />
C GUESS OF TEMPERATURE<br />
C SPECIFIC CHEMICAL SYSTEM IS BENZENE/TOLUENE<br />
c AT 760 MM HG PRESSURE<br />
C<br />
PROGRAM MAIN<br />
COMMON Al,Bl,A2,B2<br />
C CALCULATION OF VAPOR PRESSURE CONSTANTS<br />
C FORBENZENEANDTOLUENE<br />
C DATA GIVEN AT 100 AND 125 DEGREES CELCIUS<br />
A1=L0G(2600./1360.)/((1./(125.+273.)) - (L/(100.+273.)))<br />
BkLOG(2600.) - A1/(125.+273.)<br />
A2=L0G(1140./550.)/((1./(125.+273.)) - (1./(100.+273.)))<br />
B2=LOG(1140.) - A2/(125.+273.)<br />
C SET LIQUID COMPOSITION AND PRESSURE<br />
x=0.5<br />
P=760.<br />
WRITE(6,3)X,P<br />
3 FORMAT(’ X = ‘,F8.5,’ P = ‘,F8.2,/)<br />
TO=80.<br />
DO 100 NT=1,3<br />
WRITE(6,l) TO<br />
1 FORMAT(’ INITIAL TEMP GUESS = ‘,F7.2)<br />
T=TO<br />
CALL BUBPT(X,T,DT,P,Y,LOOP)<br />
WRITE(6,2) T,Y,LOOP<br />
2 FORMAT(’ T = ‘,F7.2,’ Y = ‘,F7.5,’ LOOP = ‘,13,/)<br />
100 TO=T0+20.<br />
STOP<br />
END<br />
iterations are required with Newton-Raphson, compared to 10 to 20 with<br />
interval-halving.<br />
If the function is not as smooth and/or if the initial guess is not as close to<br />
the solution, the Newton-Raphson method can diverge instead <strong>of</strong> converge.<br />
Functions that are not monotonic are particularly troublesome, since the derivative<br />
approaching zero makes Eq. (4.10) blow up. Thus Newton-Raphson is a<br />
very efficient algorithm but one that can give convergence problems. Sometimes<br />
these difficulties can be overcome by constraining the size <strong>of</strong> the change permitted<br />
to be made in the new guess.<br />
Newton-Raphson can be fairly easily extended to iteration problems involving<br />
more than one variable. For example, suppose we have two functionsf,(,,, X2j<br />
and f,(,,, X2) that depend on two variables x1 and x2. We want to find the values<br />
<strong>of</strong> x1 and x2 that satisfy the two equations<br />
f1(x1* x2) = 0 and hfx,, xz) = 0