From 14baf042f3b9043df5a626f00878e4583d4331b1 Mon Sep 17 00:00:00 2001
From: Andreas Lauser <and@poware.org>
Date: Fri, 16 Dec 2011 13:24:19 +0000
Subject: [PATCH] fix valgrind complaint in the h2o-n2 fluid system

now we assume an ideal mixture of the gas phase again. we probably
want that, as the 2p2c model as currently implemented does not support
non-ideal mixtures, because the MiscibleMultiPhaseComposition
constraint solver does not support this yet. (On a different note, a
reference is missing for the approach taken for the fugacity
coefficients of the gas phase for the "gas as non-ideal mixture"
code.)

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@7096 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/material/fluidsystems/h2on2fluidsystem.hh | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/dumux/material/fluidsystems/h2on2fluidsystem.hh b/dumux/material/fluidsystems/h2on2fluidsystem.hh
index d52bfb9b87..0feca298dd 100644
--- a/dumux/material/fluidsystems/h2on2fluidsystem.hh
+++ b/dumux/material/fluidsystems/h2on2fluidsystem.hh
@@ -449,13 +449,21 @@ public:
         }
 
         // gas phase
+#if 1
+        return 1.0; // ideal gas
+#else
         if (!useComplexRelations)
         {
             return 1.0; // ideal gas
         }
         else
         {
-            Scalar fugH2O = std::max(1e-3, fluidState.moleFraction(gPhaseIdx, H2OIdx)
+            // this code is invalid: isIdealMixture() states that the
+            // fugacity coefficient for the gas phase does not depend
+            // on the composition (-> valgrind complains). If we would
+            // not assume an ideal mixture, the 2p2c model in its
+            // current form could not be used with this fluid system...
+            Scalar fugH2O = std::max(1e-3, fluidState.molFraction(gPhaseIdx, H2OIdx)
                                           *fluidState.pressure(gPhaseIdx));
             Scalar fugN2 = std::max(1e-3, fluidState.moleFraction(gPhaseIdx, N2Idx)
                                          *fluidState.pressure(gPhaseIdx));
@@ -469,6 +477,7 @@ public:
             else // (compIdx == N2Idx)
                 return fugN2/(alpha*cN2/(cH2O + cN2));
         }
+#endif
     }
 
 
-- 
GitLab