From ab1591df40cab8a0326e2d80d77c9b37c5d900cd Mon Sep 17 00:00:00 2001 From: Xavier Raynaud Date: Wed, 13 Jun 2012 17:07:08 +0200 Subject: [PATCH] fixed computation of derivatives in PolymerProperties.cpp (default branch) --- opm/polymer/PolymerProperties.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/opm/polymer/PolymerProperties.cpp b/opm/polymer/PolymerProperties.cpp index 45ea4d94f..262df635d 100644 --- a/opm/polymer/PolymerProperties.cpp +++ b/opm/polymer/PolymerProperties.cpp @@ -211,7 +211,7 @@ namespace Opm double rk = 1 + (res_factor_ - 1)*c_ads/c_max_ads_; eff_relperm_wat = relperm[0]/rk; if (if_with_der) { - deff_relperm_wat_ds = drelperm_ds[0]/rk; + deff_relperm_wat_ds = (drelperm_ds[0]-drelperm_ds[3])/rk; //derivative with respect to sw deff_relperm_wat_dc = dc_ads_dc*relperm[0]/(rk*rk*c_max_ads_); } else { deff_relperm_wat_ds = -1.0; @@ -268,6 +268,9 @@ namespace Opm deff_relperm_wat_ds, deff_relperm_wat_dc, if_with_der); + // The "function" eff_relperm_wat is defined as a function of only sw (so that its + // partial derivative with respect to so is zero). + mob[0] = eff_relperm_wat*inv_mu_w_eff; mob[1] = relperm[1]/visc[1]; @@ -275,9 +278,9 @@ namespace Opm dmobwat_dc = eff_relperm_wat*dinv_mu_w_eff_dc + deff_relperm_wat_dc*inv_mu_w_eff; dmob_ds[0*2 + 0] = deff_relperm_wat_ds*inv_mu_w_eff; - dmob_ds[0*2 + 1] = drelperm_ds[0*2 + 1]/visc[1]; - dmob_ds[1*2 + 0] = drelperm_ds[1*2 + 0]*inv_mu_w_eff; - dmob_ds[1*2 + 1] = drelperm_ds[1*2 + 1]/visc[1]; + dmob_ds[0*2 + 1] = (drelperm_ds[0*2 + 1] - drelperm_ds[1*2 + 2])/visc[1]; + dmob_ds[1*2 + 0] = -deff_relperm_wat_ds*inv_mu_w_eff; + dmob_ds[1*2 + 1] = (drelperm_ds[1*2 + 1] - drelperm_ds[0*2 + 1])/visc[1]; } } @@ -321,7 +324,8 @@ namespace Opm mob, dmob_ds, dmobwat_dc, if_with_der); totmob = mob[0] + mob[1]; if (if_with_der) { - dtotmob_dsdc[0] = dmob_ds[0] + dmob_ds[2]; //derivative with respect to s + dtotmob_dsdc[0] = dmob_ds[0*2 + 0] - dmob_ds[1*2 + 0] + + dmob_ds[0*2 + 1] - dmob_ds[1*2 + 1]; //derivative with respect to sw dtotmob_dsdc[1] = dmobwat_dc; //derivative with respect to c } }