Sie sind auf Seite 1von 6

GROUP 2

ChE 524 & ChE 524L 1:00-4:00, 4:00-6:00 F A310, H511


Computer Application in ChE

Regula Falsi Method


Problem 1: Compute for the critical depth for flow of fluid at 0.4 m3/s flow rate through the
cross section of a triangular weir given the figure and the equation to be used.

Value of a is: 0.7 Value of b is: 0.5 Number of iteration: 10

60

2
=1
3
Analytical Solution:

60 60
= 2 ( ( 2
))=2 ( ( 2 )) = 1.1547y
60
= ( ( )) = 0.5774 2
2

(0.4)2 (1.1547)
=1
(9.81)(0.5774 2 )3

Solving for y gives: y= 0.628 m

60 60 3
Simplifying the equation gives f(x)= ( 2 ) (2( )) [(9.81)( 2 ( ) ]
2 2

The program for the problem is:

package regulafalsi;
import java.util.Scanner;
public class RegulaFalsi {

public static void main(String[] args) {


// TODO code application logic here

Domagas|Faycan|Lopez|Umalla|Dacwag|Danigos|Degay,Z.|Gamboa|Piano|Ramos,E. Page 1
Scanner input= new Scanner (System.in);

double Q,a,b,c,fxa,fxb,theta2,xa,xb,fxc,fxd;
int n,i,j;
double weir [][]= new double [10][8];

System.out.println("Input the volumetric flowrate of the fluid passing through the triangular
weir in m^3/second");
Q=input.nextDouble();

System.out.println("Input the value of a:");


a=input.nextDouble();

System.out.println("Input the value of b:");


b=input.nextDouble();

System.out.print(" \n xa fxa b fxb c fxc fxd\n");

for(n=0; n<10; n++){

theta2=0.5773502692;
fxa=((((Q*Q)*(2*a*theta2))-((9.81*((a*a*theta2)*(a*a*theta2)*(a*a*theta2))))));
fxb=((((Q*Q)*(2*b*theta2))-((9.81*((b*b*theta2)*(b*b*theta2)*(b*b*theta2))))));
xa= a*fxb;
xb=b*fxa;

c=((xa-xb)/(fxb-fxa));
fxc=((((Q*Q)*(2*c*theta2))-((9.81*((c*c*theta2)*(c*c*theta2)*(c*c*theta2))))));
fxd= fxa*fxb;

for (j=0; j<7; j++){

if (j==0){weir[n][j]=a;}
if (j==1){weir[n][j]=fxa;}
if (j==2){weir[n][j]=b;}
if (j==3){weir[n][j]=fxb;}
if (j==4){weir[n][j]=c;}
if (j==5){weir[n][j]=fxc;}
if (j==6){weir[n][j]=fxd;}

System.out.printf("%.4f", weir[n][j]);
System.out.print(" ");
}

System.out.println(" ");

if(fxa*c>0){a=c;}

Domagas|Faycan|Lopez|Umalla|Dacwag|Danigos|Degay,Z.|Gamboa|Piano|Ramos,E. Page 2
else {b=c;}
}}}

The result of the program is

The root of the problem (value of c) , which is equivalent to y = 0.6282 in meters.

Domagas|Faycan|Lopez|Umalla|Dacwag|Danigos|Degay,Z.|Gamboa|Piano|Ramos,E. Page 3
Problem 2: A high speed subsonic Boeing 707 airline is flying at a pressure altitude of 12 km. A
pitot tube on the vertical tail measures a pressure of 29,600 Pa. At which Mach number is the
airplane flying? ( At 12 km, the pressure in a standard atmosphere is 19320 Pa).

1 1
=[1+ ( ) (2 )]
2

Value of a & b: between 0-0.8 since subsonic is at Mach number 0-0.8


Number of iteration: 30
where : P= standard atmosphere in Pa units

Po= pressure reading of pitot tube in Pa units


7
2
= = 5 = 1.4
2

M= Mach number

Analytical Solution:

29,600 1.4 1 1.41


=[1+ ( ) (2 )] 1.4
19,320 2

M= 0.805

Simplifying the equation for the program gives:


1 1
() = [1+ ( ) (2 )] = 0
2

The program for the problem is:

package regulafalsi2;
import java.util.Scanner;

public class RegulaFalsi2 {

public static void main(String[] args) {


// TODO code application logic here

Scanner input= new Scanner (System.in);

double Po,P,y,M,A,a,b,d1,d2,d3,fxa,fxb,c,fxc,fxd,xa,xb;
int n,i,j;
double weir [][]= new double [30][8];

System.out.println("Input the altitude in km at which the airplane is flying");


A=input.nextDouble();

Domagas|Faycan|Lopez|Umalla|Dacwag|Danigos|Degay,Z.|Gamboa|Piano|Ramos,E. Page 4
System.out.println(" At 12km, the pressure in a standard atmosphere is 19320 Pa");

System.out.println("Input the stagnation pressure reading of the Pitot tube in Pa");


Po=input.nextDouble();

System.out.print("Input the value of a:");


a=input.nextDouble();
System.out.print("Input the value of b:");
b=input.nextDouble();

System.out.print(" \n xa \t\t fxa\t\t b\t\tc\t fxb\t fxc\t fxd\n");

for(n=0; n<30; n++){


P=19320;
y=1.4;
d1=(1+((y-1)/2)*a*a);
d2=(1+((y-1)/2)*b*b);

fxa=((Po/P)-(Math.pow(d1,3.5)));
fxb=((Po/P)-(Math.pow(d2,3.5)));
xa= a*fxb;
xb=b*fxa;

c= ((xa-xb)/(fxb-fxa));
d3=(1+((y-1)/2)*c*c);
fxc=((Po/P)-(Math.pow(d3,3.5)));
fxd= fxa*fxb;

for (j=0; j<7; j++){

if (j==0){weir[n][j]=a;}
if (j==1){weir[n][j]=fxa;}
if (j==2){weir[n][j]=b;}
if (j==3){weir[n][j]=fxb;}
if (j==4){weir[n][j]=c;}
if (j==5){weir[n][j]=fxc;}
if (j==6){weir[n][j]=fxd;}

System.out.printf("%10.4f", weir[n][j]);
System.out.print(" ");
}

System.out.println(" ");
if(fxa*c>0){a=c;}
else {b=c;}
}}}

Domagas|Faycan|Lopez|Umalla|Dacwag|Danigos|Degay,Z.|Gamboa|Piano|Ramos,E. Page 5
The result of the program is:

The root of the problem (value of c), which is equivalent to 0.8051.

Mach number is 0.8051.

Domagas|Faycan|Lopez|Umalla|Dacwag|Danigos|Degay,Z.|Gamboa|Piano|Ramos,E. Page 6

Das könnte Ihnen auch gefallen