adding extractWellPerfProperties to StandardWellsSolvent

to fix the flow_solvent running.
This commit is contained in:
Kai Bao 2016-04-11 17:10:15 +02:00
parent 5da57973fe
commit 19734f2103
7 changed files with 77 additions and 8 deletions

View File

@ -386,6 +386,8 @@ namespace Opm {
void
assembleMassBalanceEq(const SolutionState& state);
// TODO: only kept for now due to flow_multisegment
// will be removed soon
void
extractWellPerfProperties(const SolutionState& state,
std::vector<ADB>& mob_perfcells,

View File

@ -855,7 +855,7 @@ namespace detail {
std::vector<ADB> mob_perfcells;
std::vector<ADB> b_perfcells;
asImpl().stdWells().extractWellPerfProperties(rq_, fluid_.numPhases(), mob_perfcells, b_perfcells);
asImpl().stdWells().extractWellPerfProperties(state, rq_, fluid_.numPhases(), fluid_, active_, mob_perfcells, b_perfcells);
if (param_.solve_welleq_initially_ && initial_assembly) {
// solve the well equations as a pre-processing step
asImpl().solveWellEq(mob_perfcells, b_perfcells, state, well_state);

View File

@ -90,7 +90,7 @@ namespace Opm {
solvent_pos_(detail::solventPos(fluid.phaseUsage())),
solvent_props_(solvent_props),
is_miscible_(is_miscible),
std_wells_(wells_arg, solvent_props)
std_wells_(wells_arg, solvent_props, solvent_pos_)
{
if (has_solvent_) {

View File

@ -101,9 +101,12 @@ namespace Opm {
const std::vector<double>& depth_perf,
const double grav);
template <class ReservoirResidualQuant>
void extractWellPerfProperties(const std::vector<ReservoirResidualQuant>& rq,
template <class ReservoirResidualQuant, class SolutionState>
void extractWellPerfProperties(const SolutionState& state,
const std::vector<ReservoirResidualQuant>& rq,
const int np,
const BlackoilPropsAdInterface& fluid,
const std::vector<bool>& active,
std::vector<ADB>& mob_perfcells,
std::vector<ADB>& b_perfcells) const;

View File

@ -36,7 +36,7 @@ namespace Opm {
using Base = StandardWells;
// --------- Public methods ---------
explicit StandardWellsSolvent(const Wells* wells, const SolventPropsAdFromDeck& solvent_props);
explicit StandardWellsSolvent(const Wells* wells, const SolventPropsAdFromDeck& solvent_props, const int solvent_pos);
template <class SolutionState, class WellState>
void computePropertiesForWellConnectionPressures(const SolutionState& state,
@ -48,8 +48,19 @@ namespace Opm {
std::vector<double>& rsmax_perf,
std::vector<double>& rvmax_perf,
std::vector<double>& surf_dens_perf);
// TODO: fluid and active may be can put in the member list
template <class ReservoirResidualQuant, class SolutionState>
void extractWellPerfProperties(const SolutionState& state,
const std::vector<ReservoirResidualQuant>& rq,
const int np,
const BlackoilPropsAdInterface& fluid,
const std::vector<bool>& active,
std::vector<ADB>& mob_perfcells,
std::vector<ADB>& b_perfcells) const;
protected:
const SolventPropsAdFromDeck& solvent_props_;
const int solvent_pos_;
};

View File

@ -33,9 +33,11 @@ namespace Opm
StandardWellsSolvent::StandardWellsSolvent(const Wells* wells_arg,
const SolventPropsAdFromDeck& solvent_props)
const SolventPropsAdFromDeck& solvent_props,
const int solvent_pos)
: Base(wells_arg)
, solvent_props_(solvent_props)
, solvent_pos_(solvent_pos)
{
}
@ -178,4 +180,52 @@ namespace Opm
}
template <class ReservoirResidualQuant, class SolutionState>
void
StandardWellsSolvent::
extractWellPerfProperties(const SolutionState& state,
const std::vector<ReservoirResidualQuant>& rq,
const int np,
const BlackoilPropsAdInterface& fluid,
const std::vector<bool>& active,
std::vector<ADB>& mob_perfcells,
std::vector<ADB>& b_perfcells) const
{
Base::extractWellPerfProperties(state, rq, np, fluid, active, mob_perfcells, b_perfcells);
// handle the solvent related
{
int gas_pos = fluid.phaseUsage().phase_pos[Gas];
const std::vector<int>& well_cells = wellOps().well_cells;
const int nperf = well_cells.size();
// Gas and solvent is combinded and solved together
// The input in the well equation is then the
// total gas phase = hydro carbon gas + solvent gas
// The total mobility is the sum of the solvent and gas mobiliy
mob_perfcells[gas_pos] += subset(rq[solvent_pos_].mob, well_cells);
// A weighted sum of the b-factors of gas and solvent are used.
const int nc = rq[solvent_pos_].mob.size();
const Opm::PhaseUsage& pu = fluid.phaseUsage();
const ADB zero = ADB::constant(Vector::Zero(nc));
const ADB& ss = state.solvent_saturation;
const ADB& sg = (active[ Gas ]
? state.saturation[ pu.phase_pos[ Gas ] ]
: zero);
Selector<double> zero_selector(ss.value() + sg.value(), Selector<double>::Zero);
ADB F_solvent = subset(zero_selector.select(ss, ss / (ss + sg)),well_cells);
Vector ones = Vector::Constant(nperf,1.0);
b_perfcells[gas_pos] = (ones - F_solvent) * b_perfcells[gas_pos];
b_perfcells[gas_pos] += (F_solvent * subset(rq[solvent_pos_].b, well_cells));
}
}
}

View File

@ -289,11 +289,14 @@ namespace Opm
template <class ReservoirResidualQuant>
template <class ReservoirResidualQuant, class SolutionState>
void
StandardWells::
extractWellPerfProperties(const std::vector<ReservoirResidualQuant>& rq,
extractWellPerfProperties(const SolutionState& /* state */,
const std::vector<ReservoirResidualQuant>& rq,
const int np,
const BlackoilPropsAdInterface& /* fluid */,
const std::vector<bool>& /* active */,
std::vector<ADB>& mob_perfcells,
std::vector<ADB>& b_perfcells) const
{