What Does the Final Equation Represent in a Chemical Distillation Column?

  • Context: MATLAB 
  • Thread starter Thread starter dRic2
  • Start date Start date
  • Tags Tags
    Integration Matlab
Click For Summary

Discussion Overview

The discussion revolves around the mathematical modeling and numerical solution of a problem related to chemical distillation columns. Participants explore the integration of a specific function and the iterative process required to find values for variables involved in the distillation equations.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant describes an iterative approach to find the variable ##x_D## based on an initial guess for ##x_b## and evaluates an integral numerically.
  • Another participant questions the necessity of numerical integration when an analytic solution might be available, prompting a discussion about the accuracy of the initial integration.
  • Some participants express uncertainty about the correctness of the function being integrated and its relation to the original problem.
  • A later reply suggests that the problem may be more complex than initially thought, as ##x_D## depends on ##x_b## in a complicated manner.
  • Participants discuss the need for clarity in defining the problem, inputs, and outputs to ensure the correctness of the code and the solution.
  • One participant outlines a set of equations that need to be solved, indicating the relationship between the variables involved and the final equation's representation.
  • There is a request for clarification on the purpose of iterating the equations and what the final equation signifies in the context of the distillation process.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach to solve the problem, with some advocating for numerical methods while others suggest analytic solutions. The discussion remains unresolved regarding the clarity of the problem and the correctness of the code.

Contextual Notes

Some participants note that the integration and iterative methods may not yield the expected results due to the complex dependencies between the variables. There are also indications that the definitions of certain parameters and their roles in the equations need to be explicitly stated for better understanding.

dRic2
Gold Member
Messages
887
Reaction score
225
Here's what I have to do:

1) I arbitrary give a first value to the variable ##x_b##. Let's say ##x^{(0)}_b = 0.3##
2) I find ##x_D## by evaluating this integral:

$$ln(\frac {52.32} {100}) = \int_{0.5}^{x^{(0)}_b} \frac {dx} {x^{(0)}_D - x}$$

3) I use the value I got for ## x^{(0)}_D## to evaluate ##y^{(0)}_n##

$$y^{(0)}_n = f(x^{(0)}_D, x^{(0)}_b)$$

4) I check if ##x^{(0)}_D - y^{(0)}_n = 0## then I stop, otherwise I have to choose an other ##x^{(1)}## and start iterating again.

In matlab:

Code:
function out = my_int(xD, xB)

fun = @(xD) 1./(xD - x)
out = log(52.32/100) - integral(fun, 0.5, xB);

end

function out = system(xb)

find_xD = @(xD_) my_int(xD_, xb);
xD = fzero(find_xD, 0.7);

% other lines of the code
% where I calculate y_n

out = y_n - xD;

end

and I call this with:

Code:
fsolve(@system, 0.3);

I keep getting a warning that the integral my not exist and fsolve won't start...

Any help?
 
Last edited:
Physics news on Phys.org
Some questions to consider:
Why are you integrating numerically when you can get an analytic solution for your integral?
Is the function you want to integrate the one you have coded?
 
tnich said:
Why are you integrating numerically when you can get an analytic solution for your integral?

At first I just integrated but the result was slightly off (0.2 instead of 0.25). Then I realized that ##x_D## depends on the value of ##x_b##... so I guess I have to integrate numerically.

tnich said:
Is the function you want to integrate the one you have coded?

yes. The function "my_int" represents the integral minus ##ln(52.32/100)##. I call "my_int" with fzero in order to get the value of ##x_D## then I procede with the algorithm inside the function "system".
 
dRic2 said:
yes. The function "my_int" represents the integral minus ##ln(52.32/100)##. I call "my_int" with fzero in order to get the value of ##x_D## then I procede with the algorithm inside the function "system".
I ask because ##
ln(\frac {52.32} {100})
- \int_{0.5}^{x^{(0)}_b} \frac x {x^{(0)}_D - x} dx## does not look like the same thing as
fun = @(xD) 1./(xD - xB)
out = log(52.32/100) - integral(fun, 0.5, xB);
 
Sorry, my mistake. I edited the original post
 
dRic2 said:
Sorry, my mistake. I edited the original post
The two versions of the integral still don't look the same.
 
Sorry 2.0 :-D

(this errors are only in my post, but not in the real program. I apologize)
 
dRic2 said:
Sorry 2.0 :-D

(this errors are only in my post, but not in the real program. I apologize)
Once again I ask, why not just use the calculus to do your integration?
 
dRic2 said:
At first I just integrated but the result was slightly off (0.2 instead of 0.25). Then I realized that xDxDx_D depends on the value of xbxbx_b... so I guess I have to integrate numerically.

It's kind hard to explain but I think it is not possible because ##x_D## depends on ##x_b## i a very complicated way
 
  • #10
dRic2 said:
It's kind hard to explain but I think it is not possible because ##x_D## depends on ##x_b## i a very complicated way
I think that for your own benefit you really need to be clear on what problem you are trying to solve. Your code does not work. It does not work because it is incorrect. It is incorrect, at least in part, because you are not clear on what problem you are trying to solve.

I suggest that you try writing out a description of your problem. Define the inputs (what do ##\frac {52.32} {100}##, 0.5, and ##x_b## represent?), the outputs (what does ##x_D## represent?), and write out the equations that relate the inputs to the outputs. Until you do that, you have no way of knowing if your code is correct, or if the answer it gives you is the answer you are looking for.

I suspect that if you could write out a clear statement of your problem, you could solve it with pencil and paper and a calculator in a few minutes.
 
  • #11
I have to solve this set of equations (##\alpha = 2.499##):

## y_4 = x_D ##

## x_4 = \frac {y_4} {\alpha-y_4*(\alpha-1)}##
## y_3 = \frac R {R+1} x_4 + \frac {x_D} {R+1}##
## x_3 = \frac {y_3} {\alpha-y_3*(\alpha-1)}##
## y_2 = \frac R {R+1} x_3 + \frac {x_D} {R+1}##
## x_2 = \frac {y_2} {\alpha-y_2*(\alpha-1)}##
## y_1 = \frac R {R+1} x_2 + \frac {x_D} {R+1}##
## x_1 = \frac {y_1} {\alpha-y_1*(\alpha-1)}##

##x_b = x_1##

##ln(\frac {52.32}{100}) = \int^{x_b}_{0.5}\frac {dx} {x_D - x}##

In particular I need the value of ##x_b## and ##x_D##.

In order to do that I wrote this code (I made some corrections to the one I posted earlier):

Code:
function out = my_int(xD, xB)

fun = @(xD) 1./(xD - x)
out = log(52.32/100) - integral(fun, 0.5, xB);

end

function out = system(xb)

find_xD = @(xD_) my_int(xD_, xb);
xD = fzero(find_xD, 0.7);

y4=xD;
x4=y4/(alpha-y4*(alpha-1));
y3=(R/(R+1))*x4+xD/(R+1);
x3=y3/(alpha-y3*(alpha-1));
y2=(R/(R+1))*x3+xD/(R+1);
x2=y2/(alpha-y2*(alpha-1));
y1=(R/(R+1))*x2+xD/(R+1);
x1=y1/(alpha-y1*(alpha-1)));

out = x1-xb;

end

%**********************  Calling the function "system" with
fsolve(@system, 0.3);

##x_b## should be around ##0.25## and ##x_D≈0.7##
 
  • #12
dRic2 said:
I have to solve this set of equations (##\alpha = 2.499##):

## y_4 = x_D ##

## x_4 = \frac {y_4} {\alpha-y_4*(\alpha-1)}##
## y_3 = \frac R {R+1} x_4 + \frac {x_D} {R+1}##
## x_3 = \frac {y_3} {\alpha-y_3*(\alpha-1)}##
## y_2 = \frac R {R+1} x_3 + \frac {x_D} {R+1}##
## x_2 = \frac {y_2} {\alpha-y_2*(\alpha-1)}##
## y_1 = \frac R {R+1} x_2 + \frac {x_D} {R+1}##
## x_1 = \frac {y_1} {\alpha-y_1*(\alpha-1)}##

##x_b = x_1##

##ln(\frac {52.32}{100}) = \int^{x_b}_{0.5}\frac {dx} {x_D - x}##

In particular I need the value of ##x_b## and ##x_D##.
It looks like you want to find a value of ##x_D## such that when you set ##y = x_D## and iterate these two equations
## x = \frac {y} {\alpha-y*(\alpha-1)}##
## y = \frac R {R+1} x + \frac {x_D} {R+1}##

several times to converge on a value of ##x_b##, your values of ##x_D## and ##x_b## satisfy
##ln(\frac {52.32}{100}) = \int^{x_b}_{0.5}\frac {dx} {x_D - x}##

May I ask why you do the four iterations of the first two equations? Is it to get a good approximate value of x_b, or is it the value after exactly four iterations that you want?

What does the final equation represent? It looks like you want the ratio of ##\frac {x_D -0.5} {x_D - x_b}## to be 52.32%.

It looks like you will need to have a value for R also.
 
  • #13
Sorry for the late reply, I'm super busy right now.

tnich said:
is it the value after exactly four iterations that you want?

yes

tnich said:
It looks like you will need to have a value for R also.

yes, I forgot. I know the value for R.

tnich said:
What does the final equation represent?/QUOTE]
I really don't know how to explain (unless you are familiar with chemical distillation columns :biggrin:)
 

Similar threads

Replies
27
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 13 ·
Replies
13
Views
12K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
19K
  • · Replies 5 ·
Replies
5
Views
12K
  • · Replies 3 ·
Replies
3
Views
4K