For g++-4.4 support for nullptr is not complete. Using it
to initialize an empty shared_ptr breaks compilation:
/home/mblatt/src/dune/opm/opm-autodiff/opm/autodiff/AutoDiffHelpers.hpp: In constructor ‘Opm::HelperOps::HelperOps(const Grid&, Opm::EclipseStateConstPtr)’:
/home/mblatt/src/dune/opm/opm-autodiff/opm/autodiff/AutoDiffHelpers.hpp:87: error: no match for ternary ‘operator?:’ in ‘(bool)eclState ? eclState->.Opm::EclipseState::getNNC() : nullptr’
/home/mblatt/src/dune/opm/opm-autodiff/opm/autodiff/AutoDiffHelpers.hpp:87: note: candidates are: operator?:(bool, const Opm::NNC* std::__shared_ptr<const Opm::NNC, (__gnu_cxx::_Lock_policy)2u>::*, const Opm::NNC* std::__shared_ptr<const Opm::NNC, (__gnu_cxx::_Lock_policy)2u>::*) <built-in>
/home/mblatt/src/dune/opm/opm-autodiff/opm/autodiff/AutoDiffHelpers.hpp:87: note: operator?:(bool, const Opm::NNC* std::__shared_ptr<const Opm::NNC, (__gnu_cxx::_Lock_policy)2u>::*, T*) <built-in>
Here no conversion to shared_ptr happens.
/home/mblatt/src/dune/opm/opm-autodiff/opm/autodiff/ImpesTPFAAD.cpp: In constructor ‘Opm::HelperOps::HelperOps(const Grid&, Opm::EclipseStateConstPtr) [with Grid = UnstructuredGrid]’:
/home/mblatt/src/dune/opm/opm-autodiff/opm/autodiff/ImpesTPFAAD.cpp:160: error: no matching function for call to ‘std::shared_ptr<const Opm::EclipseState>::shared_ptr(const dune_nullptr_t&)’
/usr/include/c++/4.4/bits/shared_ptr.h:1263: note: candidates are: std::shared_ptr<_Tp>::shared_ptr(std::shared_ptr<_Tp>&&) [with _Tp = const Opm::EclipseState]
/usr/include/c++/4.4/bits/shared_ptr.h:1238: note: std::shared_ptr<_Tp>::shared_ptr() [with _Tp = const Opm::EclipseState]
/usr/include/c++/4.4/bits/shared_ptr.h:1236: note: std::shared_ptr<const Opm::EclipseState>::shared_ptr(const std::shared_ptr<const Opm::EclipseState>&)
Here the DUNE's nullptr implementation is used with std::shared_ptr which are not
compatible.
We fix this by using the emptry constructor of std::shared_ptr to create a nullptr.
1) NNC are added the grad, div and average operators
2) NNC are added the upwindSelector
3) NNC transmissibilities are added to the face transmissibilities
The simplifications are:
- Do not pass cell indices to fluidViscosity(), fluidReciprocFVF().
- Pass b (reciprocal f.v.f.) to fluidDensity() instead of pressure etc.
This saves one call to fluidReciprocFVF(), that is removed from
fluidDensity(). Instead the previously stored quantity is passed
to fluidDensity() as an argument.
The method has been split in three parts:
computeWellFlux(const SolutionState& state,
const std::vector<ADB>& mob_perfcells,
const std::vector<ADB>& b_perfcells,
V& aliveWells,
std::vector<ADB>& cq_s);
void
updatePerfPhaseRatesAndPressures(const std::vector<ADB>& cq_s,
const SolutionState& state,
WellState& xw);
void
addWellFluxEq(const std::vector<ADB>& cq_s,
const SolutionState& state);
This reduces the function length, although most of the content of addWellEq()
now is in computeWellFlux(), so that function is still quite long. It also
allows us to use smaller sets of function arguments, which makes methods easier
to understand.
Finally, it makes it easier to create derived models with custom behaviour.