equilibrium composition of H2, N2, NH3

32 views
Skip to first unread message

Evgenii Rudnyi

unread,
Sep 2, 2007, 2:56:33 PM9/2/07
to thermody...@googlegroups.com
Hello Wee Nien,

As I have promised, I have made a small example to show how one can
compute an equilibrium composition in your case with TDLIB.

File NH3_ass.mod describes the associated ideal solution consisting from
H2, N2 and NH3 and file out.mode shows how to get the equilibrium
composition in this case.

A mixture of H2, N2 and NH3 at equilibrium is a two-component solution.
I have chosen as independent components H2 and N2 but this is rather
arbitrary. Their mole fractions should be considered as total (or when
there is no any reaction). The components in the internal solution at
equilibrium have some other mole fractions. They are considered as
internal variables of the phase.

This is often called as associated ideal solution, so the name of the
object. You will find more information in the TDLIB manual.

I have used an older implementation associated_solution, as it is
numerically more robust, than the newer AssociatedSolution.

When you make computations

assess NH3_ass out

you will find also a file debug.phase.gas with information from the
solver (VCS in the case of associated_solution). You can disable it by
setting debug to 0.

Finally I should say that your parameters for the Gibbs energy of H2, N2
and NH3 were wrong. They led to some very strange equilibrium
compositions. For simplicity I have used very simple approximation Del
Cp = const to describe the Gibbs energy of the reaction and now the
equilibrium composition looks much more reasonable.

Best wishes,

Evgenii

NH3_ass.mod
out.mod

WNien

unread,
Sep 6, 2007, 1:39:59 PM9/6/07
to thermodynamicslib
Hello Evgenii,

thank you very much for your detailed explanations. I realized that I
have made some errors in my parameters for Gibbs energy of H2 and have
made the necessary corrections. However, to my horror. a new set of
problems arose:
1. I cannot get a minimum for the Gibbs energy by using the reference
object like before.
2. The equilibrium compositions of the elements don't look good
either.

Up to this point, I have a few more questions which I hope you can
clarify. Firstly, in what units of pressure does tdlib compute? I know
this may sound absurd, but I haven't found any information regarding
the units of calculation in the guide. I assumed them to be in SI
units, meaning the unit for pressure in tdlib would be in Pa, am I
right? Furthermore, I didn't really explore every details of the codes
in the library(C++), or should I do so? Secondly, I have double
checked the parameters I have entered for the Gibbs energy in the
IVT_Tp object, I couldn't find any errors. Here's how I calculated the
parameters:

1. I got the necessary coefficients from the Shomate Equation in the
NIST chemistry webbook, for example N2 with the following link:
http://webbook.nist.gov/cgi/cbook.cgi?ID=C7727379&Mask=1&Type=JANAFG&Table=on#JANAFG

2. Then I converted them to the parameters in the IVT_Tp object and
let tdlib compute the output for me. After that, I compared the
results (file: n2.txt) I got, with the datas on the same website of
the NIST. Both my results and the thermochemistry datas (H, S, Cp)
were perfectly identical.

3. Finally, I entered the same parameters in the Reference object
(files: refNH3.mod and outNH3.mod) as well as the associated_solution
object (file: NH3_ass1.mod and out.mod). None of them delivered
satisfactory results when I let tdlib do the computation.

I am just confused by the results. Am I missing out something else
here? In the file outNH3.mod, I am also trying to automate the
calculation of the mole fractions of each element, meaning the user
needs only to enter the initial number of moles of the elements (N2
and H2), and tdlib will compute the increment of the NH3 mole fraction
in steps of x=0.1, but it didn't work out well. Is it actually
possible to automate the calculation of mole fractions in XML or
should I create a new model (with C++) in the library? Please help.
Hope to hear from you again. Thank you.


Best regards,

Wee Nien


Evgenii Rudnyi

unread,
Sep 7, 2007, 2:54:11 PM9/7/07
to thermody...@googlegroups.com
Hello Wee Nien,

I will answer your question by starting new threads: one thread for one
question. I guess this will make things more managable.

> Furthermore, I didn't really explore every details of the codes
> in the library(C++), or should I do so?

The simplest is just to ask the question. If you would like just to use
TDLIB by means of using assess, then you do not need to deal with the code
at all. The code is not documented anyway. However, if you want to
understand the code, please. It would be my pleasure to answer your
questions in this respect as well.

Once more, I would suggest not to put several questions in one message. I
would prefer several small messages rather than a long one.

Best wishes,

Evgenii


Reply all
Reply to author
Forward
0 new messages