implement molecular diffusion for all compositional box models

This commit is contained in:
Andreas Lauser 2012-10-26 13:59:19 +02:00
parent 2e92139577
commit b4c2aba27f
2 changed files with 17 additions and 22 deletions

View File

@ -32,12 +32,14 @@ def isFuzzyEqual(vtkFile1, vtkFile2, absTol, relTol):
for i in range(0, len(curVals1)):
number1 = curVals1[i]
number2 = curVals2[i]
if curFieldName.startswith("saturation") and abs(number1 - number2) > 1e-3:
print 'Difference between %f and %f too large in data field "%s: %s"'%(number1,number2,curFieldName,abs(number1 - number2))
return False
elif curFieldName.startswith("pressure") and abs(number1 - number2) > 0.1 and abs(number1 - number2) > 1e-5*abs(number1 + number2):
print 'Difference between %f and %f too large in data field "%s: %s"'%(number1,number2,curFieldName,abs(number1 - number2))
return False
if curFieldName.startswith("saturation"):
if abs(number1 - number2) > 1e-3:
print 'Difference between %f and %f too large in data field "%s: %s"'%(number1,number2,curFieldName,abs(number1 - number2))
return False
elif curFieldName.startswith("pressure"):
if abs(number1 - number2) > 0.1 and abs(number1 - number2) > 1e-5*abs(number1 + number2):
print 'Difference between %f and %f too large in data field "%s: %s"'%(number1,number2,curFieldName,abs(number1 - number2))
return False
elif abs(number1 - number2) > absTol and number2 != 0 and abs(number1/number2 - 1) > relTol:
print 'Difference between %f and %f too large (%f%%) in data field "%s"'%(number1,number2,abs(number1/number2 - 1)*100, curFieldName)
return False

View File

@ -311,24 +311,17 @@ only needs to provide the following thermodynamic relations:
phase.
Molecular diffusion of a component $\kappa$ in phase $\alpha$ is
caused by a gradient of the chemical potential and follows the law
caused by a gradient of the chemical potential. Using some
simplifying assumptions~\cite{reid1987}, they can be also expressed
in terms of mole fraction gradients, i.e. the equation used for mass
fluxes due to molecular diffusion is
\[
J^\kappa_\alpha = - D^\kappa_\alpha\ \mathbf{grad} \zeta^\kappa_\alpha\;,
J^\kappa_\alpha = - \rho_{mol,\alpha} D^\kappa_\alpha\ \mathbf{grad} x^\kappa_\alpha\;,
\]
where $\zeta^\kappa_\alpha$ is the component's chemical potential,
$D^\kappa_\alpha$ is the diffusion coefficient and $J^\kappa_\alpha$
is the diffusive flux. $\zeta^\kappa_\alpha$ is connected to the
component's fugacity $f^\kappa_\alpha$ by the relation
\[
\zeta^\kappa_\alpha =
R T_\alpha \mathrm{ln} \frac{f^\kappa_\alpha}{p_\alpha} \;.
\]
\item[binaryDiffusionCoefficient():] Given a fluid state, an
up-to-date parameter cache, a phase index and two component indices,
return the binary diffusion coefficient for the binary mixture. This
method is less general than \texttt{diffusionCoefficient} method,
but relations can only be found for binary diffusion coefficients in
the literature.
where $\rho_{mol,\alpha}$ is the molar density of phase $\alpha$,
$x^\kappa_\alpha$ is the mole fraction of component $\kappa$ in
phase $\alpha$, $D^\kappa_\alpha$ is the diffusion coefficient and
$J^\kappa_\alpha$ is the diffusive flux.
\item[enthalpy():] Given a fluid state, an up-to-date parameter cache
and a phase index, this method calulates the specific enthalpy
$h_\alpha$ of the phase.