handing the numComponents in WellInterface

This commit is contained in:
Kai Bao 2017-06-19 16:46:06 +02:00
parent 266442b0bd
commit 7223163155
4 changed files with 78 additions and 11 deletions

View File

@ -44,8 +44,10 @@ namespace Opm
public:
// using WellInterface<TypeTag>::Simulator;
// using WellInterface<TypeTag>::WellState;
typedef typename WellInterface<TypeTag>::Simulator Simulator;
typedef typename WellInterface<TypeTag>::WellState WellState;
using Simulator = typename WellInterface<TypeTag>::Simulator;
using WellState = typename WellInterface<TypeTag>::WellState;
using IntensiveQuantities = typename WellInterface<TypeTag>::IntensiveQuantities;
// the positions of the primary variables for StandardWell
// there are three primary variables, the second and the third ones are F_w and F_g
// the first one can be total rate (G_t) or bhp, based on the control
@ -111,6 +113,12 @@ namespace Opm
EvalWell extendEval(const Eval& in) const;
// TODO: to check whether all the paramters are required
void computePerfRate(const IntensiveQuantities& intQuants,
const std::vector<EvalWell>& mob_perfcells_dense,
const EvalWell& bhp, const double& cdp,
const bool& allow_cf, std::vector<EvalWell>& cq_s) const;
using WellInterface<TypeTag>::phaseUsage;
using WellInterface<TypeTag>::active;
using WellInterface<TypeTag>::numberOfPerforations;
@ -122,6 +130,7 @@ namespace Opm
using WellInterface<TypeTag>::numberOfPhases;
using WellInterface<TypeTag>::perfDepth;
using WellInterface<TypeTag>::flowToEbosPvIdx;
using WellInterface<TypeTag>::numComponents;
protected:

View File

@ -104,16 +104,16 @@ namespace Opm
void StandardWell<TypeTag>::
setWellVariables(const WellState& well_state)
{
const int np = numberOfPhases();
const int nw = well_state.bhp().size();
// TODO: it should be the number of primary variables
// TODO: this is from the old version of StandardWellsDense, it is a coincidence, 3 phases and 3 primary variables
// TODO: it needs to be careful.
// TODO: the following code has to be rewritten later for correctness purpose.
for (int phase = 0; phase < np; ++phase) {
well_variables_[phase] = 0.0;
well_variables_[phase].setValue(well_state.wellSolutions()[indexOfWell() + nw * phase]);
well_variables_[phase].setDerivative(numEq + phase, 1.0);
const int numComp = numComponents();
for (int eqIdx = 0; eqIdx < numComp; ++eqIdx) {
const unsigned int idx = nw * eqIdx + indexOfWell();
assert( eqIdx < well_variables_.size() );
assert( idx < well_state.wellSolutions().size() );
well_variables_[eqIdx] = 0.0;
well_variables_[eqIdx].setValue(well_state.wellSolutions()[idx]);
well_variables_[eqIdx].setDerivative(numEq + eqIdx, 1.0);
}
}
@ -407,4 +407,22 @@ namespace Opm
return out;
}
template<typename TypeTag>
void
StandardWell<TypeTag>::
computePerfRate(const IntensiveQuantities& intQuants,
const std::vector<EvalWell>& mob_perfcells_dense,
const EvalWell& bhp, const double& cdp,
const bool& allow_cf, std::vector<EvalWell>& cq_s) const
{
}
}

View File

@ -55,8 +55,10 @@ namespace Opm
typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, Indices) BlackoilIndices;
typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
static const int solventCompIdx = 3; //TODO get this from ebos
static const bool has_solvent = GET_PROP_VALUE(TypeTag, EnableSolvent);
/// Constructor
WellInterface(const Well* well, const int time_step, const Wells* wells);
@ -127,7 +129,12 @@ namespace Opm
int flowPhaseToEbosPhaseIdx( const int phaseIdx ) const;
int numPhases() const;
int numComponents() const;
protected:
// TODO: some variables shared by all the wells should be made static
// well name
std::string name_;

View File

@ -296,4 +296,37 @@ namespace Opm
return flowToEbos[ phaseIdx ];
}
template<typename TypeTag>
int
WellInterface<TypeTag>::
numPhases() const
{
return number_of_phases_;
}
template<typename TypeTag>
int
WellInterface<TypeTag>::
numComponents() const
{
if (numPhases() == 2) {
return 2;
}
int numComp = FluidSystem::numComponents;
if (has_solvent) {
numComp ++;
}
return numComp;
}
}