diff --git a/test/material/compositionalflash/test_compositionalflash.cc b/test/material/compositionalflash/test_compositionalflash.cc index a44caec5da56c718017c51b945d6e3c91407f9a7..bdf540a30695539deaef0d2d3be05b4c6760531f 100644 --- a/test/material/compositionalflash/test_compositionalflash.cc +++ b/test/material/compositionalflash/test_compositionalflash.cc @@ -57,30 +57,35 @@ void checkSame(const FluidState1 &fsRef, const FluidState2 &fsFlash) using std::abs; error = 1 - fsRef.pressure(phaseIdx)/fsFlash.pressure(phaseIdx); if (abs(error) > 1e-6) { - std::cout << "pressure error phase " << phaseIdx << ": " - << fsFlash.pressure(phaseIdx) << " flash vs " - << fsRef.pressure(phaseIdx) << " reference" - << " error=" << error << "\n"; + DUNE_THROW(Dune::Exception, "Mismatch to reference. Pressure of phase " + << phaseIdx << " calculated by flash is: " + << fsFlash.pressure(phaseIdx) << " vs " + << fsRef.pressure(phaseIdx) << " calculated as reference." + << " Error = " << error << "\n"); } // check the saturations error = fsRef.saturation(phaseIdx) - fsFlash.saturation(phaseIdx); if (abs(error) > 1e-6) - std::cout << "saturation error phase " << phaseIdx << ": " - << fsFlash.saturation(phaseIdx) << " flash vs " - << fsRef.saturation(phaseIdx) << " reference" - << " error=" << error << "\n"; + DUNE_THROW(Dune::Exception, "Mismatch to reference. Saturation of phase " + << phaseIdx << " calculated by flash is: " + << fsFlash.saturation(phaseIdx) << " vs " + << fsRef.saturation(phaseIdx) << " calculated as reference." + << " Error = " << error << "\n"); // check the compositions for existing phases - if(fsRef.saturation(phaseIdx) > 0.0) + if(fsRef.saturation(phaseIdx) > 0.0) { for (int compIdx = 0; compIdx < numComponents; ++ compIdx) { error = fsRef.moleFraction(phaseIdx, compIdx) - fsFlash.moleFraction(phaseIdx, compIdx); if (abs(error) > 1e-6) - std::cout << "composition error phase " << phaseIdx << ", component " << compIdx << ": " - << fsFlash.moleFraction(phaseIdx, compIdx) << " flash vs " - << fsRef.moleFraction(phaseIdx, compIdx) << " reference" - << " error=" << error << "\n"; + DUNE_THROW(Dune::Exception, "Mismatch to reference. Mole fraction of component " + << compIdx << " in phase " + << phaseIdx << " calculated by flash is: " + << fsFlash.moleFraction(phaseIdx, compIdx) << " vs " + << fsRef.moleFraction(phaseIdx, compIdx) << " calculated as reference." + << " Error = " << error << "\n"); } + } } }