cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Something's wrong here (Gibbs Energy problem)

ptc-4423720
1-Newbie

Something's wrong here (Gibbs Energy problem)

I can't find ∆Greaction by plugging in points. If I type in ∆Greaction(418.15,20, 0) or ∆Greaction(418.15,20, 1), I get an error. I'm talking about right above the first graph.

6 REPLIES 6

y.ethanol(0)=0 and ln(0) is undefined, so the frist evaluation fails.

y.ethylene(1) = 0 and y.H2O(1) = 0, so the second evaluation fails.

I made some changes, and it seams to all calculate now, but the graph is nearly linear and does not have a minimum.

Also the Water terms heavily dominate.

If you take zero out the DeltaGo888(T) terms, the graphs are not linear and do have a minimum. But, I don't know the chemistry so am not able to help with what, if anything, is wrong.

There are normally three possible types of errors:

  1. coding errors
  2. input data errors
  3. science errors

It helps to debug the first two kinds if you print intermediate results as you write the model. Those print steps can be deleted after you have checked the results.

At least one of your errors is type 2. Check your heat capacities.

Also, it would help if you included units in your problem. Then you could check your results against different sources with different units easily. For example, you could check the enthalpy of steam at some temperature against a steam table.

The natural tendancy is to think you have a programming error. Even the people helping assume that because usually they are helping with Mathcad, not with the science or the data.

Eva:

The problem with your file is that both values of deltaGreaction at e=0 and e=1 are indeterminate so we have to use limits for e and everything goes OK.

You can see in the modified attached file that " helping Mathcad " you can even plot the functions with some changes.

ecarrizo

My guess is that Eva started this discussion last year while in a class and has no interest at this point. However, in the interest of bringing it to a close, I have posted the correct solution. As I suggested earlier, the heat capacity of water was incorrect. Changing it results in the expected equilibrium conversion.

You are correct about the problems with e = 0 and 1 for the plot of free energy. I have avoided that problem in a different manner.

Finally, Eva wanted a parametric solution showing the effect of pressure on the equilibrium conversion. I have changed that solve block so that it now works.

For Eva and others, I have the following tip. You will save a lot of repetitive coding if you use vectors and matrices instead of individually named variables. Notice how often the same definition had to be created for each compound. When you have say 20 compounds, that is very inefficient.

Harvey:

I want to congratulate you for the excellent solution to Eva's problem.It also gave me a lot of help specially in the use ln0 of which there is not much information.

Again,thank you

Ernesto Carrizo

Top Tags