The derivation below is based on this resource from the people who created the CocoSimulator and this older paper from the same authors.
To write the derivative of the activity coefficient w.r.t to mole fraction, we’ll work from the Gibbs excess energy to find an expression for the activity coefficient in terms of derivatives of Gibbs excess energy.
Therefore, the activity coefficient is:
where indicates the unconstrained derivative where all components are fixed except
- Using chain rule to expand:
- We can expand the second term again using chain rule
- We can easily find , but how do we get the derivative of the mole fraction w.r.t moles?
- We know from the differential for partial moles:
- is the kronecker delta, so it is 1 when and 0 everywhere else
- We also know from the total differential
- By inspection of the last two equations
- Cancel out and expand the Kronecker delta out of the sum to get our desired expression for the activity coefficient:
- Now we can easily find the derivative of the activity coefficient w.r.t the mole fraction - this is the version that only constrains one mole fraction but doesn’t enforce them all summing to one:
- To get the constrained version, we can observe that an increase in the mole fraction of one component will result in an equal and opposite decrease in the mole fraction of another (given all other mole fractions are fixed except one). This then implies the following equations, starting from the total derivative of the activity coefficient:
Only two mole fractions are actually varying so when we take the partial derivative:
Note that that can be equal to .
We know by the logic above that , so
So if we put this in terms of the Gibbs excess energy directly:
From what I understand you can arbitrarily choose . This is the component which will be determined by all the others. In the paper, they choose the th component. From the third page in the PDF: