Merge pull request #3788 from totto82/wpimult_wdfac
adapt wdfac for wpimult
This commit is contained in:
commit
659f4d9a9f
@ -50,6 +50,7 @@ namespace Opm {
|
||||
//void updateWDFACOR(const RestartIO::RstWell& rst_well);
|
||||
|
||||
void updateWDFACType(const WellConnections& connections);
|
||||
void updateTotalCF(const WellConnections& connections);
|
||||
bool useDFactor() const;
|
||||
|
||||
bool operator==(const WDFAC& other) const;
|
||||
|
@ -1634,6 +1634,7 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno)
|
||||
auto well = this->snapshots.back().wells.get(well_name);
|
||||
auto wdfac = std::make_shared<WDFAC>(well.getWDFAC());
|
||||
wdfac->updateWDFAC( record );
|
||||
wdfac->updateTotalCF(well.getConnections());
|
||||
if (well.updateWDFAC(std::move(wdfac)))
|
||||
this->snapshots.back().wells.update( std::move(well) );
|
||||
}
|
||||
|
@ -81,23 +81,27 @@ namespace Opm {
|
||||
// non-trivial dfactors detected use connection D factors
|
||||
if (non_trivial_dfactor) {
|
||||
m_type = WDFACTYPE::CON_DFACTOR;
|
||||
updateTotalCF(connections);
|
||||
}
|
||||
}
|
||||
|
||||
void WDFAC::updateTotalCF(const WellConnections& connections) {
|
||||
m_total_cf = std::accumulate(connections.begin(), connections.end(), 0.0,
|
||||
[](const double tot_cf, const auto& conn) { return tot_cf + conn.CF(); });
|
||||
}
|
||||
|
||||
double WDFAC::getDFactor(const Connection& connection, double mu, double rho, double phi) const {
|
||||
|
||||
if (m_total_cf < 0.0) {
|
||||
throw std::invalid_argument { "Total connection factor is not set" };
|
||||
}
|
||||
switch (m_type)
|
||||
{
|
||||
case WDFACTYPE::NONE:
|
||||
return 0.0;
|
||||
case WDFACTYPE::DFACTOR:
|
||||
return m_d * m_total_cf / connection.CF();
|
||||
case WDFACTYPE::DFACTOR: {
|
||||
if (m_total_cf < 0.0) {
|
||||
throw std::invalid_argument { "Total connection factor is not set" };
|
||||
}
|
||||
return m_d * m_total_cf / connection.CF();
|
||||
}
|
||||
case WDFACTYPE::CON_DFACTOR: {
|
||||
double d = connection.dFactor();
|
||||
// If a negative d factor is set in COMPDAT individual connection d factors should be used directly.
|
||||
@ -105,6 +109,10 @@ namespace Opm {
|
||||
return -d;
|
||||
// If a positive d factor is set in COMPDAT the connection d factors is treated like a well d factor.
|
||||
// and thus scaled with the connection index
|
||||
if (m_total_cf < 0.0) {
|
||||
throw std::invalid_argument { "Total connection factor is not set" };
|
||||
}
|
||||
|
||||
return d * m_total_cf / connection.CF();
|
||||
}
|
||||
case WDFACTYPE::DAKEMODEL:
|
||||
@ -113,7 +121,6 @@ namespace Opm {
|
||||
double Ke = connection.Ke();
|
||||
double h = Kh / Ke;
|
||||
double rw = connection.rw();
|
||||
|
||||
const auto k_md = unit::convert::to(Ke, prefix::milli*unit::darcy);
|
||||
double beta = m_a * (std::pow(k_md, m_b) * std::pow(phi, m_c));
|
||||
double specific_gravity = rho / 1.225; // divide by density of air at standard conditions.
|
||||
|
@ -1390,7 +1390,6 @@ bool Well::handleWPIMULT(const DeckRecord& record) {
|
||||
|
||||
new_connections->add(c);
|
||||
}
|
||||
|
||||
return this->updateConnections(std::move(new_connections), false);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user