mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-15 22:21:55 -06:00
Merge pull request #535 from atgeirr/bug-in-scalar-autodiff
Fix bug in scalar autodiff
This commit is contained in:
commit
308a3fd57e
@ -256,7 +256,7 @@ namespace Opm
|
||||
const AutoDiff<Scalar>& rhs)
|
||||
{
|
||||
Scalar a = Scalar(lhs) / rhs.val();
|
||||
Scalar b = -Scalar(lhs) / (rhs.val() * rhs.val());
|
||||
Scalar b = (-Scalar(lhs) / (rhs.val() * rhs.val())) * rhs.der();
|
||||
|
||||
return AutoDiff<Scalar>::function(a, b);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE(Division)
|
||||
const double atol = 1.0e-14;
|
||||
|
||||
AdFW a = AdFW::variable(10.0);
|
||||
AdFW b = AdFW::variable(1.0);
|
||||
AdFW b = AdFW::function(1.0, 4.0);
|
||||
|
||||
AdFW aob = a / b;
|
||||
BOOST_CHECK_CLOSE(aob.val(), a.val() * b.val(), atol);
|
||||
|
Loading…
Reference in New Issue
Block a user