adding a few more members to the Wells classes.

gravity, vfp_properties_ and depth_.

to further simplify the interfaces.
This commit is contained in:
Kai Bao 2016-05-09 14:00:21 +02:00
parent 50385013fe
commit be165a26e0
7 changed files with 57 additions and 22 deletions

View File

@ -142,6 +142,21 @@ namespace detail {
return act2can;
}
inline
double getGravity(const double* g, const int dim) {
double grav = 0.0;
if (g) {
// Guard against gravity in anything but last dimension.
for (int dd = 0; dd < dim - 1; ++dd) {
assert(g[dd] == 0.0);
}
grav = g[dim - 1];
}
return grav;
}
} // namespace detail
@ -201,7 +216,10 @@ namespace detail {
assert(numMaterials() == std::accumulate(active_.begin(), active_.end(), 0)); // Due to the material_name_ init above.
std_wells_.init(&fluid_, &active_, &phaseCondition_);
const double gravity = detail::getGravity(geo_.gravity(), UgGridHelpers::dimensions(grid_));
const V depth = Opm::AutoDiffGrid::cellCentroidsZToEigen(grid_);
std_wells_.init(&fluid_, &active_, &phaseCondition_, &vfp_properties_, gravity, &depth);
#if HAVE_MPI
if ( linsolver_.parallelInformation().type() == typeid(ParallelISTLInformation) )
@ -729,21 +747,6 @@ namespace detail {
}
}
namespace detail {
inline
double getGravity(const double* g, const int dim) {
double grav = 0.0;
if (g) {
// Guard against gravity in anything but last dimension.
for (int dd = 0; dd < dim - 1; ++dd) {
assert(g[dd] == 0.0);
}
grav = g[dim - 1];
}
return grav;
}
}

View File

@ -137,6 +137,7 @@ namespace Opm {
using Base::param_;
using Base::linsolver_;
using Base::phaseCondition_;
using Base::vfp_properties_;
MultisegmentWells ms_wells_;

View File

@ -73,7 +73,10 @@ namespace Opm {
eclState, has_disgas, has_vapoil, terminal_output)
, ms_wells_(multisegment_wells)
{
ms_wells_.init(&fluid_, &active_, &phaseCondition_);
const double gravity = detail::getGravity(geo_.gravity(), UgGridHelpers::dimensions(grid_));
const V depth = Opm::AutoDiffGrid::cellCentroidsZToEigen(grid_);
ms_wells_.init(&fluid_, &active_, &phaseCondition_, &vfp_properties_, gravity, &depth);
// TODO: there should be a better way do the following
ms_wells_.setWellsActive(Base::wellsActive());
}

View File

@ -218,11 +218,17 @@ namespace Opm {
void
MultisegmentWells::init(const BlackoilPropsAdInterface* fluid_arg,
const std::vector<bool>* active_arg,
const std::vector<PhasePresence>* pc_arg)
const std::vector<PhasePresence>* pc_arg,
const VFPProperties* vfp_properties_arg,
const double gravity_arg,
const Vector* depth_arg)
{
fluid_ = fluid_arg;
active_ = active_arg;
phase_condition_ = pc_arg;
vfp_properties_ = vfp_properties_arg;
gravity_ = gravity_arg;
depth_ = depth_arg;
}

View File

@ -37,6 +37,7 @@
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/LinearisedBlackoilResidual.hpp>
#include <opm/autodiff/WellHelpers.hpp>
#include <opm/autodiff/VFPProperties.hpp>
#include <opm/autodiff/WellMultiSegment.hpp>
#include <opm/autodiff/WellDensitySegmented.hpp>
@ -91,7 +92,10 @@ namespace Opm {
void init(const BlackoilPropsAdInterface* fluid_arg,
const std::vector<bool>* active_arg,
const std::vector<PhasePresence>* pc_arg);
const std::vector<PhasePresence>* pc_arg,
const VFPProperties* vfp_properties_arg,
const double gravity_arg,
const Vector* depth_arg);
const std::vector<WellMultiSegmentConstPtr>& wells() const;
const MultisegmentWellOps& wellOps() const;
@ -229,6 +233,11 @@ namespace Opm {
const BlackoilPropsAdInterface* fluid_;
const std::vector<bool>* active_;
const std::vector<PhasePresence>* phase_condition_;
const VFPProperties* vfp_properties_;
double gravity_;
// TODO: the depth of the all the cell centers
// it can be better to store only the perforation depth and segment depth
const Vector* depth_;
// Pressure correction due to the different depth of the perforation
// and the cell center of the grid block

View File

@ -64,8 +64,10 @@ namespace Opm {
void init(const BlackoilPropsAdInterface* fluid_arg,
const std::vector<bool>* active_arg,
const std::vector<PhasePresence>* pc_arg);
const std::vector<PhasePresence>* pc_arg,
const VFPProperties* vfp_properties_arg,
const double gravity_arg,
const Vector* depth_arg);
const WellOps& wellOps() const;
@ -174,6 +176,11 @@ namespace Opm {
const BlackoilPropsAdInterface* fluid_;
const std::vector<bool>* active_;
const std::vector<PhasePresence>* phase_condition_;
const VFPProperties* vfp_properties_;
double gravity_;
// TODO: the depth of the all the cell centers
// it can be better to store only the perforation depth and segment depth
const Vector* depth_;
Vector well_perforation_densities_;
Vector well_perforation_pressure_diffs_;

View File

@ -87,11 +87,17 @@ namespace Opm
void
StandardWells::init(const BlackoilPropsAdInterface* fluid_arg,
const std::vector<bool>* active_arg,
const std::vector<PhasePresence>* pc_arg)
const std::vector<PhasePresence>* pc_arg,
const VFPProperties* vfp_properties_arg,
const double gravity_arg,
const Vector* depth_arg)
{
fluid_ = fluid_arg;
active_ = active_arg;
phase_condition_ = pc_arg;
vfp_properties_ = vfp_properties_arg;
gravity_ = gravity_arg;
depth_ = depth_arg;
}