moeslerfred

64 Reputation

2 Badges

17 years, 237 days

MaplePrimes Activity


These are replies submitted by moeslerfred

Acer/Robert,

Thanks for the quick feedback. I suspect it is a system of DAE's, but my primary question is how to format the problem for dsolve to handle it. I'll try laying out all of the equations with some explanation.

I'm separating methanol and water (in this example), and the mass balance equation is structured as:

change in moles of compound = Moles in - moles out = Liquid in from stage above - liquid out to stage below + vapor in from stage below - vapor out to stage above. Since the liquid and vapor flows are constant, L and V are not time variant, the equation is formulated as

M*diff(X1(t),t) = L*(X0(t)-X1(t))+V*(Y2(t)-Y1(t));

X represents mol concentration of methanol, M is the molar volume on the stage, the numbers 0,1,2 designate the stage the liquid or vapor comes from. The concentration of the water at every stage is simply equal to 1-X at each stage, since X is the mol concentration. We'll call water XW.

So I build a system of ODE's based on the number of stages. Next I need to solve for the temperature at each stage.

The total pressure of the mixture is equal to the mol fraction of each compound (XW1 or X1) times it's partial pressure (PPW1 or PPM1) times an activity coefficient (GAMW1 or GAMM1). The pressure PCALC is to be set equal to Pbar (the user specified pressure) by varying the system temperature (T1). This is the root finding part of the equation set that I don't quite know how to set up in MAPLE. It uses the following equations.

PCALC1=XW1*PPW1*GAMW1+X1*PPM1*GAMM1  (calculated pressure)
Pdiff = Pbar - PCALC1  (difference between the pressure specified Pbar and calculated pressure)

GAMM1=exp(A*XW1^2/((XW1+A*X1/B)^2))   (activity coefficient for methanol, A, B are constants, XW1 = 1-X1)
GAMW1=exp(B*X1^2 /((X1+B*XW1/A)^2))    (activity coefficient for water)
PPM1 =exp(CM+DM/(T1+273))     (pure vapor pressure for methanol)
PPW1 =exp(CW+DW/(T1+273))    (pure vapor pressure for water)
 

Finally, the vapor (Y for methanol, YW for water) mol fractions are calculated from the following equation. 


Y1=X1*PPM1*GAMM1/Pbar
YW1=1-Y1
 

So, the question for me is really how do I set up the temperature seeking function in the DAE system. The ODE's are simple enough, and the final vapor equations are easy, but it's the "search for the temperature" part I don't get. Does this help you out? I know I didn't drop the chemical engineering from the mathematics, but (at least for me) I think it helps wrap my head around the problem if I think of the physical model.

Thoughts?

Thanks again in advance!

Fred

Acer/Robert,

Thanks for the quick feedback. I suspect it is a system of DAE's, but my primary question is how to format the problem for dsolve to handle it. I'll try laying out all of the equations with some explanation.

I'm separating methanol and water (in this example), and the mass balance equation is structured as:

change in moles of compound = Moles in - moles out = Liquid in from stage above - liquid out to stage below + vapor in from stage below - vapor out to stage above. Since the liquid and vapor flows are constant, L and V are not time variant, the equation is formulated as

M*diff(X1(t),t) = L*(X0(t)-X1(t))+V*(Y2(t)-Y1(t));

X represents mol concentration of methanol, M is the molar volume on the stage, the numbers 0,1,2 designate the stage the liquid or vapor comes from. The concentration of the water at every stage is simply equal to 1-X at each stage, since X is the mol concentration. We'll call water XW.

So I build a system of ODE's based on the number of stages. Next I need to solve for the temperature at each stage.

The total pressure of the mixture is equal to the mol fraction of each compound (XW1 or X1) times it's partial pressure (PPW1 or PPM1) times an activity coefficient (GAMW1 or GAMM1). The pressure PCALC is to be set equal to Pbar (the user specified pressure) by varying the system temperature (T1). This is the root finding part of the equation set that I don't quite know how to set up in MAPLE. It uses the following equations.

PCALC1=XW1*PPW1*GAMW1+X1*PPM1*GAMM1  (calculated pressure)
Pdiff = Pbar - PCALC1  (difference between the pressure specified Pbar and calculated pressure)

GAMM1=exp(A*XW1^2/((XW1+A*X1/B)^2))   (activity coefficient for methanol, A, B are constants, XW1 = 1-X1)
GAMW1=exp(B*X1^2 /((X1+B*XW1/A)^2))    (activity coefficient for water)
PPM1 =exp(CM+DM/(T1+273))     (pure vapor pressure for methanol)
PPW1 =exp(CW+DW/(T1+273))    (pure vapor pressure for water)
 

Finally, the vapor (Y for methanol, YW for water) mol fractions are calculated from the following equation. 


Y1=X1*PPM1*GAMM1/Pbar
YW1=1-Y1
 

So, the question for me is really how do I set up the temperature seeking function in the DAE system. The ODE's are simple enough, and the final vapor equations are easy, but it's the "search for the temperature" part I don't get. Does this help you out? I know I didn't drop the chemical engineering from the mathematics, but (at least for me) I think it helps wrap my head around the problem if I think of the physical model.

Thoughts?

Thanks again in advance!

Fred

Scott, Thanks for the reply, but what I'm trying to do is plot the x variable vs. the y variable, not both variables vs. T. I should be able t to specify a T range, but plot the Y vs. X at each T, right? I suspect it should be easily done, but I just don't understand how... Thanks again! Fred
Scott, Thanks for the reply, but what I'm trying to do is plot the x variable vs. the y variable, not both variables vs. T. I should be able t to specify a T range, but plot the Y vs. X at each T, right? I suspect it should be easily done, but I just don't understand how... Thanks again! Fred
Sorry if that was a newbie mistake... The piecewise should read like this: Fexit := piecewise(`and`(t >= 25, t < 30), 2, `and`(t >= 34, t < 35), 2, 0) It should be equal to two when t is between 25-30 and when between 34-35, otherwise be equal to zero.
Sorry if that was a newbie mistake... The piecewise should read like this: Fexit := piecewise(`and`(t >= 25, t < 30), 2, `and`(t >= 34, t < 35), 2, 0) It should be equal to two when t is between 25-30 and when between 34-35, otherwise be equal to zero.
Hi Scott, Yes, you nailed it. I was defining the variables like X[inlet]. That's where I messed up. Thanks! Fred
Hi Scott, Yes, you nailed it. I was defining the variables like X[inlet]. That's where I messed up. Thanks! Fred
Page 1 of 1