diff --git a/opm/autodiff/ImpesTPFAAD.hpp b/opm/autodiff/ImpesTPFAAD.hpp index 60b34ef1e..6ecab0c9e 100644 --- a/opm/autodiff/ImpesTPFAAD.hpp +++ b/opm/autodiff/ImpesTPFAAD.hpp @@ -100,158 +100,6 @@ namespace { namespace Opm { -#if 0 - template - class PressureDependentFluidData { - public: - typedef AutoDiff::ForwardBlock ADB; - typedef typename AutoDiff::ForwardBlock::V V; - typedef typename AutoDiff::ForwardBlock::M M; - - PressureDependentFluidData(const int nc, - const BOFluid& fluid) - : nc_ (nc) - , np_ (fluid.numPhases()) - , cells_(buildAllCells(nc)) - , fluid_(fluid) - , A_ (nc_, np_ * np_) - , dA_ (nc_, np_ * np_) - , mu_ (nc_, np_ ) - , dmu_ (nc_, np_ ) - , kr_ (nc_, np_ ) - , zero_ (ADB::V::Zero(nc, 1)) - , one_ (ADB::V::Ones(nc, 1)) - { - } - - void - computeSatQuant(const BlackoilState& state) - { - const std::vector& s = state.saturation(); - - assert (s.size() == std::vector::size_type(nc_ * np_)); - - double* dkrds = 0; // Ignore rel-perm derivatives - fluid_.relperm(nc_, & s[0], & cells_[0], - kr_.data(), dkrds); - } - - void - computePressQuant(const BlackoilState& state) - { - const std::vector& p = state.pressure(); - const std::vector& z = state.surfacevol(); - - assert (p.size() == std::vector::size_type(nc_ * 1 )); - assert (z.size() == std::vector::size_type(nc_ * np_)); - - fluid_.matrix (nc_, & p[0], & z[0], & cells_[0], - A_ .data(), dA_ .data()); - - fluid_.viscosity(nc_, & p[0], & z[0], & cells_[0], - mu_.data(), /*dmu_.data()*/ 0); - dmu_.fill(0.0); - } - - ADB - fvf(const int phase, const ADB& p) const - { - assert (0 <= phase); - assert (phase < np_ ); - - typedef typename ADB::V V; - - const V A = A_ .block(0, phase * (np_ + 1), nc_, 1); - const V dA = dA_.block(0, phase * (np_ + 1), nc_, 1); - - std::vector jac(p.numBlocks()); - assert(p.numBlocks() == 2); - jac[0] = spdiag(dA); - assert(jac[0].cols() == p.blockPattern()[0]); - jac[1] = M(A.rows(), p.blockPattern()[1]); - return one_ / ADB::function(A, jac); - } - - typename ADB::V - phaseRelPerm(const int phase) const - { - const typename ADB::V kr = kr_.block(0, phase, nc_, 1); - - return kr; - } - - ADB - phaseViscosity(const int phase, const ADB& p) const - { - assert (0 <= phase); - assert (phase < np_ ); - - typedef typename ADB::V V; - - const V mu = mu_ .block(0, phase, nc_, 1); - const V dmu = dmu_.block(0, phase, nc_, 1); - - std::vector jac(p.numBlocks()); - assert(p.numBlocks() == 2); - jac[0] = spdiag(dmu); - assert(jac[0].cols() == p.blockPattern()[0]); - jac[1] = M(mu.rows(), p.blockPattern()[1]); - - return ADB::function(mu, jac); - } - - ADB - phaseDensity(const int phase, const ADB& p) const - { - typedef typename ADB::V V; - - const double* rho0 = fluid_.surfaceDensity(); - - V rho = V::Zero(nc_, 1); - V drho = V::Zero(nc_, 1); - for (int i = 0; i < np_; ++i) { - rho += rho0[i] * A_ .block(0, phase*np_ + i, nc_, 1); - drho += rho0[i] * dA_.block(0, phase*np_ + i, nc_, 1); - } - - assert (p.numBlocks() == 2); - std::vector jac(p.numBlocks()); - jac[0] = spdiag(drho); - jac[1] = M(rho.rows(), p.blockPattern()[1]); - - assert (jac[0].cols() == p.blockPattern()[0]); - - return ADB::function(rho, jac); - } - - private: - const int nc_; - const int np_; - - const std::vector cells_; - const BOFluid& fluid_; - - typedef Eigen::Array DerivedQuant; - - // Pressure dependent quantities (essentially B and \mu) - DerivedQuant A_ ; - DerivedQuant dA_ ; - DerivedQuant mu_ ; - DerivedQuant dmu_; - - // Saturation dependent quantities (rel-perm only) - DerivedQuant kr_; - - const typename ADB::V zero_; - const typename ADB::V one_ ; - }; -#endif - - - template class ImpesTPFAAD { @@ -279,7 +127,6 @@ namespace Opm { BlackoilState& state, WellState& well_state) { - // pdepfdata_.computeSatQuant(state); const int nc = grid_.number_of_cells; const int np = state.numPhases(); DataBlock s = Eigen::Map(state.saturation().data(), nc, np);