From f6c6ee0fa0830101cffa032bf9134af90d7f1d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 16 May 2013 14:46:54 +0200 Subject: [PATCH] Fixes in computeFluxes(). - Give AD variables the correct block pattern (although as we change fluid interface they will not need to be ad types). - Make sure 'flux' is only on inner faces. - Copy full fluxes to state.faceflux(). --- opm/autodiff/ImpesTPFAAD.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/opm/autodiff/ImpesTPFAAD.hpp b/opm/autodiff/ImpesTPFAAD.hpp index 9a0b253da..881e84e9a 100644 --- a/opm/autodiff/ImpesTPFAAD.hpp +++ b/opm/autodiff/ImpesTPFAAD.hpp @@ -457,14 +457,13 @@ namespace Opm { const int np = state.numPhases(); const V p0 = Eigen::Map(&state.pressure()[0], nc, 1); - const ADB p = ADB::constant(p0, std::vector(1, nc)); + const ADB p = ADB::constant(p0, cell_residual_.blockPattern()); const V transi = subset(geo_.transmissibility(), ops_.internal_faces); const V nkgradp = transi * (ops_.ngrad * p0.matrix()).array(); - V flux = Eigen::Map(&state.faceflux()[0], - grid_.number_of_faces, 1); + V flux = V::Zero(ops_.internal_faces.size(), 1); for (int phase = 0; phase < np; ++phase) { const ADB cell_rho = pdepfdata_.phaseDensity(phase, p); @@ -479,6 +478,8 @@ namespace Opm { flux += mf * head; } + V all_flux = superset(flux, ops_.internal_faces, grid_.number_of_faces); + std::copy(all_flux.data(), all_flux.data() + grid_.number_of_faces, state.faceflux().data()); } }; } // namespace Opm