From 41887508ea2c4aca3ac83b4c7f99fefbf88d3444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Mon, 23 Jun 2014 14:03:49 +0200 Subject: [PATCH] Add tracers_ensure_unity parameter. When this boolean parameter is true (the default), tracer solutions will be normalized so that the tracer averages will sum to one in each cell. This behaviour is the same as before, the change is that it can now be turned off. --- opm/core/tof/TofDiscGalReorder.cpp | 4 +++- opm/core/tof/TofDiscGalReorder.hpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/opm/core/tof/TofDiscGalReorder.cpp b/opm/core/tof/TofDiscGalReorder.cpp index 2208b7421..5bfa52941 100644 --- a/opm/core/tof/TofDiscGalReorder.cpp +++ b/opm/core/tof/TofDiscGalReorder.cpp @@ -59,6 +59,8 @@ namespace Opm basis_func_.reset(new DGBasisBoundedTotalDegree(grid_, dg_degree)); } + tracers_ensure_unity_ = param.getDefault("tracers_ensure_unity", true); + use_cvi_ = param.getDefault("use_cvi", use_cvi_); use_limiter_ = param.getDefault("use_limiter", use_limiter_); if (use_limiter_) { @@ -305,7 +307,7 @@ namespace Opm } // Ensure that tracer averages sum to 1. - if (num_tracers_ && tracerhead_by_cell_[cell] == NoTracerHead) { + if (num_tracers_ && tracers_ensure_unity_ && tracerhead_by_cell_[cell] == NoTracerHead) { std::vector tr_aver(num_tracers_); double tr_sum = 0.0; for (int tr = 0; tr < num_tracers_; ++tr) { diff --git a/opm/core/tof/TofDiscGalReorder.hpp b/opm/core/tof/TofDiscGalReorder.hpp index 4aec28f26..880e864d2 100644 --- a/opm/core/tof/TofDiscGalReorder.hpp +++ b/opm/core/tof/TofDiscGalReorder.hpp @@ -150,6 +150,7 @@ namespace Opm int num_tracers_; enum { NoTracerHead = -1 }; std::vector tracerhead_by_cell_; + bool tracers_ensure_unity_; // Used by solveSingleCell(). std::vector rhs_; // single-cell right-hand-sides std::vector jac_; // single-cell jacobian