diff --git a/dumux/common/math.hh b/dumux/common/math.hh index a2ebd0f91ae7569a1d9c102829a26ae7231575c1..95a329a20738ce51aed87dfdd21c390e9e7cd117 100644 --- a/dumux/common/math.hh +++ b/dumux/common/math.hh @@ -32,6 +32,7 @@ #include <dune/common/fvector.hh> #include <dune/common/fmatrix.hh> #include <dune/common/dynmatrix.hh> +#include <dune/common/float_cmp.hh> namespace Dumux { @@ -110,7 +111,7 @@ void harmonicMeanMatrix(Dune::FieldMatrix<Scalar, m, n> &K, { for (int rowIdx=0; rowIdx < m; rowIdx++){ for (int colIdx=0; colIdx< n; colIdx++){ - if (Ki[rowIdx][colIdx] != Kj[rowIdx][colIdx]) { + if (Dune::FloatCmp::ne<Scalar>(Ki[rowIdx][colIdx], Kj[rowIdx][colIdx])) { K[rowIdx][colIdx] = harmonicMean(Ki[rowIdx][colIdx], Kj[rowIdx][colIdx]); diff --git a/dumux/common/splinecommon_.hh b/dumux/common/splinecommon_.hh index fd9a8ff0387c84f297cac4fa88e6762bb54ac4d9..722c19a63d5a1483b300181884f07b40add793fd 100644 --- a/dumux/common/splinecommon_.hh +++ b/dumux/common/splinecommon_.hh @@ -251,9 +251,9 @@ public: } // corner case where the whole spline is a constant - if (moment_(0) == 0 && - moment_(1) == 0 && - y_(0) == y_(1)) + if (Dune::FloatCmp::eq<Scalar>(moment_(0), 0) && + Dune::FloatCmp::eq<Scalar>(moment_(1), 0) && + Dune::FloatCmp::eq<Scalar>(y_(0), y_(1))) { // actually the is monotonically increasing as well as // monotonously decreasing @@ -562,9 +562,9 @@ protected: Scalar xE1 = (-2*b + disc)/(6*a); Scalar xE2 = (-2*b - disc)/(6*a); - if (disc == 0) { + if (Dune::FloatCmp::eq<Scalar>(disc, 0)) { // saddle point -> no extrema - if (xE1 == x0) + if (Dune::FloatCmp::eq<Scalar>(xE1, x0)) // make sure that we're not picking the saddle point // to determine whether we're monotonically increasing // or decreasing diff --git a/dumux/discretization/box/maxwellstefanslaw.hh b/dumux/discretization/box/maxwellstefanslaw.hh index b1b5c5a3dbbd3e0f3b28597ce8636e98bb09ac5b..4dd4449c790ec0ba17927dd6dd0bfc9da16450a2 100644 --- a/dumux/discretization/box/maxwellstefanslaw.hh +++ b/dumux/discretization/box/maxwellstefanslaw.hh @@ -153,7 +153,7 @@ private: const auto outsideScvIdx = scvf.outsideScvIdx(); //this is to not devide by 0 if the saturation in 0 and the effectiveDiffusivity becomes zero due to that - if(insideVolVars.saturation(phaseIdx) == 0 || outsideVolVars.saturation(phaseIdx) == 0) + if(Dune::FloatCmp::eq<Scalar>(insideVolVars.saturation(phaseIdx), 0) || Dune::FloatCmp::eq<Scalar>(outsideVolVars.saturation(phaseIdx), 0)) return reducedDiffusionMatrix; for (int compIIdx = 0; compIIdx < numComponents-1; compIIdx++) diff --git a/dumux/discretization/cellcentered/tpfa/maxwellstefanslaw.hh b/dumux/discretization/cellcentered/tpfa/maxwellstefanslaw.hh index 2f704d49be7884169b3b8af57787ea805c8dc74f..4378fd2a74dc1ab57e4fca33c912edea34b1585a 100644 --- a/dumux/discretization/cellcentered/tpfa/maxwellstefanslaw.hh +++ b/dumux/discretization/cellcentered/tpfa/maxwellstefanslaw.hh @@ -115,7 +115,7 @@ public: } //we cannot solve that if the matrix is 0 everywhere - if(!(insideVolVars.saturation(phaseIdx) == 0 || outsideVolVars.saturation(phaseIdx) == 0)) + if(!(Dune::FloatCmp::eq<Scalar>(insideVolVars.saturation(phaseIdx), 0) || Dune::FloatCmp::eq<Scalar>(outsideVolVars.saturation(phaseIdx), 0))) { const auto insideScvIdx = scvf.insideScvIdx(); const auto& insideScv = fvGeometry.scv(insideScvIdx); @@ -211,7 +211,7 @@ private: ReducedComponentMatrix reducedDiffusionMatrix(0.0); //this is to not devide by 0 if the saturation in 0 and the effectiveDiffusivity becomes zero due to that - if(volVars.saturation(phaseIdx) == 0) + if(Dune::FloatCmp::eq<Scalar>(volVars.saturation(phaseIdx), 0)) return reducedDiffusionMatrix; for (int compIIdx = 0; compIIdx < numComponents-1; compIIdx++) diff --git a/dumux/linear/amgparallelhelpers.hh b/dumux/linear/amgparallelhelpers.hh index aac602d7311a5ef66e08136056b783a525cc6924..31900bc39fbafd7ba7ab61dbd7ded04075625950 100644 --- a/dumux/linear/amgparallelhelpers.hh +++ b/dumux/linear/amgparallelhelpers.hh @@ -424,7 +424,7 @@ public: } // access to ghost vector - double ghost (std::size_t i) const + std::size_t ghost (std::size_t i) const { return isGhost_[i]; } diff --git a/dumux/material/constraintsolvers/immiscibleflash.hh b/dumux/material/constraintsolvers/immiscibleflash.hh index ff4a71dd4efd043138a86aa797cd2abe98bb1d05..c8cf66acd2542ba1dcba046efa04daeba7db9750 100644 --- a/dumux/material/constraintsolvers/immiscibleflash.hh +++ b/dumux/material/constraintsolvers/immiscibleflash.hh @@ -295,7 +295,6 @@ protected: Scalar x_i = getQuantity_(fluidState, pvIdx); const Scalar eps = 1e-10/quantityWeight_(fluidState, pvIdx); setQuantity_<MaterialLaw>(fluidState, paramCache, matParams, pvIdx, x_i + eps); - assert(getQuantity_(fluidState, pvIdx) == x_i + eps); // compute derivative of the defect calculateDefect_(tmp, origFluidState, fluidState, globalMolarities); diff --git a/dumux/material/constraintsolvers/ncpflash.hh b/dumux/material/constraintsolvers/ncpflash.hh index f07b278b2523b21cda9a2f01c43b1d15f41e3ef6..a10c2c3959f69e2ce1ba656bbf3123c35a52da1a 100644 --- a/dumux/material/constraintsolvers/ncpflash.hh +++ b/dumux/material/constraintsolvers/ncpflash.hh @@ -345,7 +345,6 @@ protected: Scalar x_i = getQuantity_(fluidState, pvIdx); const Scalar eps = 1e-8/quantityWeight_(fluidState, pvIdx); setQuantity_<MaterialLaw>(fluidState, paramCache, matParams, pvIdx, x_i + eps); - assert(getQuantity_(fluidState, pvIdx) == x_i + eps); // compute derivative of the defect calculateDefect_(tmp, origFluidState, fluidState, globalMolarities); diff --git a/dumux/material/fluidsystems/h2oair.hh b/dumux/material/fluidsystems/h2oair.hh index c1ea24d39d3e57d93ac510aaf59e26244cdf7f37..0efa87856c69ffe0a2d0274ed9ce198a771f59d0 100644 --- a/dumux/material/fluidsystems/h2oair.hh +++ b/dumux/material/fluidsystems/h2oair.hh @@ -266,7 +266,7 @@ public: return H2O::vaporPressure(t); else { - const auto pc = (fluidState.wettingPhase() == H2OIdx) + const auto pc = (fluidState.wettingPhase() == (int) H2OIdx) ? fluidState.pressure(AirIdx)-fluidState.pressure(H2OIdx) : fluidState.pressure(H2OIdx)-fluidState.pressure(AirIdx); return H2O::vaporPressure(t)*exp( -pc * molarMass(H2OIdx) diff --git a/dumux/porousmediumflow/2p2c/sequential/fvpressure.hh b/dumux/porousmediumflow/2p2c/sequential/fvpressure.hh index df84a9c1ba2053cc797bd97604ae692da441a58a..74e58630e2cd7b1eee8c57e6c57521bd5b8e040b 100644 --- a/dumux/porousmediumflow/2p2c/sequential/fvpressure.hh +++ b/dumux/porousmediumflow/2p2c/sequential/fvpressure.hh @@ -1026,7 +1026,7 @@ void FVPressure2P2C<TypeTag>::updateMaterialLawsInElement(const Element& element Scalar massw = sumConc * fluidState.phaseMassFraction(wPhaseIdx); Scalar massn = sumConc * fluidState.phaseMassFraction(nPhaseIdx); - if ((cellData.density(wPhaseIdx)*cellData.density(nPhaseIdx)) == 0) + if (Dune::FloatCmp::eq<Scalar>((cellData.density(wPhaseIdx)*cellData.density(nPhaseIdx)), 0)) DUNE_THROW(Dune::MathError, "Sequential2p2c::postProcessUpdate: try to divide by 0 density"); Scalar vol = massw / cellData.density(wPhaseIdx) + massn / cellData.density(nPhaseIdx); if (Dune::FloatCmp::ne<Scalar, Dune::FloatCmp::absolute>(problem().timeManager().timeStepSize(), 0.0, 1.0e-30))