From b61bb494dc2995fc4e2c30c7fa19fc19dd1a6be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Tue, 15 Jan 2013 13:52:44 +0100 Subject: [PATCH] Implement limiters with addConstant() and multiplyGradient(). This is instead of directly manipulating the coefficients, requiring assumptions on the basis used. --- .../reorder/TransportModelTracerTofDiscGal.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/opm/core/transport/reorder/TransportModelTracerTofDiscGal.cpp b/opm/core/transport/reorder/TransportModelTracerTofDiscGal.cpp index 44585673f..3025308b7 100644 --- a/opm/core/transport/reorder/TransportModelTracerTofDiscGal.cpp +++ b/opm/core/transport/reorder/TransportModelTracerTofDiscGal.cpp @@ -727,16 +727,14 @@ namespace Opm // Handle by setting a flat solution. std::cout << "Trouble in cell " << cell << std::endl; limiter = 0.0; - tof[num_basis*cell] = min_upstream_tof; + DGBasis::addConstant(min_upstream_tof - tof_c, dim, degree_, tof + num_basis*cell); } ASSERT(limiter >= 0.0); // Actually do the limiting (if applicable). if (limiter < 1.0) { // std::cout << "Applying limiter in cell " << cell << ", limiter = " << limiter << std::endl; - for (int i = num_basis*cell + 1; i < num_basis*(cell+1); ++i) { - tof[i] *= limiter; - } + DGBasis::multiplyGradient(limiter, dim, degree_, tof + num_basis*cell); } else { // std::cout << "Not applying limiter in cell " << cell << "!" << std::endl; } @@ -835,16 +833,14 @@ namespace Opm // Handle by setting a flat solution. std::cout << "Trouble in cell " << cell << std::endl; limiter = 0.0; - tof[num_basis*cell] = min_upstream_tof; + DGBasis::addConstant(min_upstream_tof - tof_c, dim, degree_, tof + num_basis*cell); } ASSERT(limiter >= 0.0); // Actually do the limiting (if applicable). if (limiter < 1.0) { // std::cout << "Applying limiter in cell " << cell << ", limiter = " << limiter << std::endl; - for (int i = num_basis*cell + 1; i < num_basis*(cell+1); ++i) { - tof[i] *= limiter; - } + DGBasis::multiplyGradient(limiter, dim, degree_, tof + num_basis*cell); } else { // std::cout << "Not applying limiter in cell " << cell << "!" << std::endl; }