Professional Documents
Culture Documents
__
QUESTION-1
Following second order reaction is carried out in a batch reactor with initial concentration of A as 3
kmol/m3. Reaction is 2A B.
For a rate constant of 0.8 units, find the time required for concentration of A to draw 0.5 kmol/m3 using
Euler’s Method. Take h=0.01.
Assumptions:
ANSWER-1
PROGRAM:
#include<stdio.h>
#include<conio.h>
float fun(float x,float y)
{
float f;
f=0.8*y*y;
return f;
}
main()
{
float a,b,x,y,h,t,k;
clrscr();
printf("\n Enter x0,y0,h,yn");
scanf("%f%f%f%f",&a,&b,&h,&t);
x=a;
y=b;
printf("\n x\t y\n");
while(y>=t)
{
k=h*fun(x,y);
y=y-k;
x=x+h;
printf("%0.3f\t%0.3f\n",x,y);
}
getch();
}
OUTPUT:
Enter x0,y0,h,yn0
3
0.01
0.5
x y
0.010 2.928
0.020 2.859
0.030 2.794
0.040 2.732
0.050 2.672
0.060 2.615
0.070 2.560
0.080 2.508
0.090 2.457
0.100 2.409
0.110 2.363
0.120 2.318
0.130 2.275
0.140 2.234
0.150 2.194
0.160 2.155
0.170 2.118
0.180 2.082
0.190 2.047
0.200 2.014
0.210 1.981
0.220 1.950
0.230 1.920
0.240 1.890
0.250 1.862
0.260 1.834
0.270 1.807
0.280 1.781
0.290 1.755
0.300 1.731
0.310 1.707
0.320 1.684
0.330 1.661
0.340 1.639
0.350 1.617
0.360 1.596
0.370 1.576
0.380 1.556
0.390 1.537
0.400 1.518
0.410 1.499
0.420 1.481
0.430 1.464
0.440 1.447
0.450 1.430
0.460 1.414
0.470 1.398
0.480 1.382
0.490 1.367
0.500 1.352
0.510 1.337
0.520 1.323
0.530 1.309
0.540 1.295
0.550 1.282
0.560 1.269
0.570 1.256
0.580 1.243
0.590 1.231
0.600 1.219
0.610 1.207
0.620 1.195
0.630 1.184
0.640 1.172
0.650 1.161
0.660 1.151
0.670 1.140
0.680 1.130
0.690 1.119
0.700 1.109
0.710 1.100
0.720 1.090
0.730 1.080
0.740 1.071
0.750 1.062
0.760 1.053
0.770 1.044
0.780 1.035
0.790 1.027
0.800 1.018
0.810 1.010
0.820 1.002
0.830 0.994
0.840 0.986
0.850 0.978
0.860 0.970
0.870 0.963
0.880 0.956
0.890 0.948
0.900 0.941
0.910 0.934
0.920 0.927
0.930 0.920
0.940 0.913
0.950 0.907
0.960 0.900
0.970 0.894
0.980 0.887
0.990 0.881
1.000 0.875
1.010 0.869
1.020 0.863
1.030 0.857
1.040 0.851
1.050 0.845
1.060 0.839
1.070 0.834
1.080 0.828
1.090 0.823
1.100 0.817
1.110 0.812
1.120 0.807
1.130 0.801
1.140 0.796
1.150 0.791
1.160 0.786
1.170 0.781
1.180 0.776
1.190 0.771
1.200 0.767
1.210 0.762
1.220 0.757
1.230 0.753
1.240 0.748
1.250 0.744
1.260 0.739
1.270 0.735
1.280 0.731
1.290 0.726
1.300 0.722
1.310 0.718
1.320 0.714
1.330 0.710
1.340 0.706
1.350 0.702
1.360 0.698
1.370 0.694
1.380 0.690
1.390 0.686
1.400 0.682
1.410 0.679
1.420 0.675
1.430 0.671
1.440 0.668
1.450 0.664
1.460 0.661
1.470 0.657
1.480 0.654
1.490 0.650
1.500 0.647
1.510 0.644
1.520 0.640
1.530 0.637
1.540 0.634
1.550 0.631
1.560 0.627
1.570 0.624
1.580 0.621
1.590 0.618
1.600 0.615
1.610 0.612
1.620 0.609
1.630 0.606
1.640 0.603
1.650 0.600
1.660 0.597
1.670 0.594
1.680 0.592
1.690 0.589
1.700 0.586
1.710 0.583
1.720 0.581
1.730 0.578
1.740 0.575
1.750 0.573
1.760 0.570
1.770 0.567
1.780 0.565
1.790 0.562
1.800 0.560
1.810 0.557
1.820 0.555
1.830 0.552
1.840 0.550
1.850 0.547
1.860 0.545
1.870 0.543
1.880 0.540
1.890 0.538
1.900 0.536
1.910 0.533
1.920 0.531
1.930 0.529
1.940 0.527
1.950 0.524
1.960 0.522
1.970 0.520
1.980 0.518
1.990 0.516
2.000 0.513
2.010 0.511
2.020 0.509
2.030 0.507
2.040 0.505
2.050 0.503
2.060 0.501
2.070 0.499
QUESTION-2
Following second order reaction is carried out in a batch reactor with initial concentration of A as 3
kmol/m3. Reaction is 2A B.
For a rate constant of 0.8 units, find the time required for concentration of A to draw 0.5 kmol/m3 using
Ranga-Kutta Method. Take h=0.01.
Assumptions:
ANSWER-2
PROGRAM:
#include<stdio.h>
#include<math.h>
#include<conio.h>
float f(float x,float y);
void main()
{
float x0,y0,k1,k2,k3,k4,k,y,x,h,xn;
clrscr();
printf("enter x0,y0,xn,h");
scanf("%f%f%f%f",&x0,&y0,&xn,&h);
x=x0;
y=y0;
printf("\n\nx\t\ty\n");
while(x<xn)
{
k1=f(x0,y0);
k2=f((x0+h/2.0),(y0+k1*h/2.0));
k3=f((x0+h/2.0),(y0+k2*h/2.0));
k4=f((x0+h),(y0+k3*h));
k=((k1+2*k2+2*k3+k4)/6);
y=y+k*h;
x=x+h;
printf("%f\t%f\n",x,y);
}
getch();
}
float f(float x,float y)
{
float k;
k=(x-y)/(x+y);
return k;
}
OUTPUT:
enter x0,y0,xn,h0
3
0.5
0.01
x y
0.010000 2.990033
0.020000 2.980067
0.030000 2.970100
0.040000 2.960134
0.050000 2.950167
0.060000 2.940200
0.070000 2.930234
0.080000 2.920267
0.090000 2.910300
0.100000 2.900334
0.110000 2.890367
0.120000 2.880401
0.130000 2.870434
0.140000 2.860467
0.150000 2.850501
0.160000 2.840534
0.170000 2.830568
0.180000 2.820601
0.190000 2.810634
0.200000 2.800668
0.210000 2.790701
0.220000 2.780735
0.230000 2.770768
0.240000 2.760801
0.250000 2.750835
0.260000 2.740868
0.270000 2.730901
0.280000 2.720935
0.290000 2.710968
0.300000 2.701002
0.310000 2.691035
0.320000 2.681068
0.330000 2.671102
0.340000 2.661135
0.350000 2.651169
0.360000 2.641202
0.370000 2.631235
0.380000 2.621269
0.390000 2.611302
0.400000 2.601336
0.410000 2.591369
0.420000 2.581402
0.430000 2.571436
0.440000 2.561469
0.450000 2.551502
0.460000 2.541536
0.470000 2.531569
0.480000 2.521603
0.490000 2.511636
0.500000 2.501669
0.510000 2.491703