mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #640 from GitPaean/wells_moving_out
Moving the StandardWells class definition to separate files.
This commit is contained in:
commit
079fce79d9
@ -47,6 +47,7 @@ list (APPEND MAIN_SOURCE_FILES
|
|||||||
opm/autodiff/VFPProdProperties.cpp
|
opm/autodiff/VFPProdProperties.cpp
|
||||||
opm/autodiff/VFPInjProperties.cpp
|
opm/autodiff/VFPInjProperties.cpp
|
||||||
opm/autodiff/WellMultiSegment.cpp
|
opm/autodiff/WellMultiSegment.cpp
|
||||||
|
opm/autodiff/StandardWells.cpp
|
||||||
opm/autodiff/BlackoilSolventState.cpp
|
opm/autodiff/BlackoilSolventState.cpp
|
||||||
opm/polymer/PolymerState.cpp
|
opm/polymer/PolymerState.cpp
|
||||||
opm/polymer/PolymerBlackoilState.cpp
|
opm/polymer/PolymerBlackoilState.cpp
|
||||||
@ -185,6 +186,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
|||||||
opm/autodiff/VFPInjProperties.hpp
|
opm/autodiff/VFPInjProperties.hpp
|
||||||
opm/autodiff/WellStateMultiSegment.hpp
|
opm/autodiff/WellStateMultiSegment.hpp
|
||||||
opm/autodiff/WellMultiSegment.hpp
|
opm/autodiff/WellMultiSegment.hpp
|
||||||
|
opm/autodiff/StandardWells.hpp
|
||||||
opm/polymer/CompressibleTpfaPolymer.hpp
|
opm/polymer/CompressibleTpfaPolymer.hpp
|
||||||
opm/polymer/GravityColumnSolverPolymer.hpp
|
opm/polymer/GravityColumnSolverPolymer.hpp
|
||||||
opm/polymer/GravityColumnSolverPolymer_impl.hpp
|
opm/polymer/GravityColumnSolverPolymer_impl.hpp
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <opm/autodiff/NewtonIterationBlackoilInterface.hpp>
|
#include <opm/autodiff/NewtonIterationBlackoilInterface.hpp>
|
||||||
#include <opm/autodiff/BlackoilModelEnums.hpp>
|
#include <opm/autodiff/BlackoilModelEnums.hpp>
|
||||||
#include <opm/autodiff/VFPProperties.hpp>
|
#include <opm/autodiff/VFPProperties.hpp>
|
||||||
|
#include <opm/autodiff/StandardWells.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
@ -269,44 +270,6 @@ namespace Opm {
|
|||||||
ADB mob; // Phase mobility (per cell)
|
ADB mob; // Phase mobility (per cell)
|
||||||
};
|
};
|
||||||
|
|
||||||
class StandardWells {
|
|
||||||
protected:
|
|
||||||
struct WellOps {
|
|
||||||
explicit WellOps(const Wells* wells);
|
|
||||||
Eigen::SparseMatrix<double> w2p; // well -> perf (scatter)
|
|
||||||
Eigen::SparseMatrix<double> p2w; // perf -> well (gather)
|
|
||||||
std::vector<int> well_cells; // the set of perforated cells
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit StandardWells(const Wells* wells);
|
|
||||||
|
|
||||||
const Wells& wells() const;
|
|
||||||
|
|
||||||
// return true if wells are available in the reservoir
|
|
||||||
bool wellsActive() const;
|
|
||||||
void setWellsActive(const bool wells_active);
|
|
||||||
// return true if wells are available on this process
|
|
||||||
bool localWellsActive() const;
|
|
||||||
|
|
||||||
const WellOps& wellOps() const;
|
|
||||||
|
|
||||||
//Density of each well perforation
|
|
||||||
V& wellPerforationDensities();
|
|
||||||
const V& wellPerforationDensities() const;
|
|
||||||
|
|
||||||
// Diff to bhp for each well perforation.
|
|
||||||
V& wellPerforationPressureDiffs();
|
|
||||||
const V& wellPerforationPressureDiffs() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool wells_active_;
|
|
||||||
const Wells* wells_;
|
|
||||||
const WellOps wops_;
|
|
||||||
V well_perforation_densities_;
|
|
||||||
V well_perforation_pressure_diffs_;
|
|
||||||
};
|
|
||||||
|
|
||||||
// --------- Data members ---------
|
// --------- Data members ---------
|
||||||
|
|
||||||
const Grid& grid_;
|
const Grid& grid_;
|
||||||
|
@ -418,169 +418,6 @@ namespace detail {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class Grid, class Implementation>
|
|
||||||
BlackoilModelBase<Grid, Implementation>::
|
|
||||||
StandardWells::
|
|
||||||
WellOps::WellOps(const Wells* wells)
|
|
||||||
: w2p(),
|
|
||||||
p2w(),
|
|
||||||
well_cells()
|
|
||||||
{
|
|
||||||
if( wells )
|
|
||||||
{
|
|
||||||
w2p = Eigen::SparseMatrix<double>(wells->well_connpos[ wells->number_of_wells ], wells->number_of_wells);
|
|
||||||
p2w = Eigen::SparseMatrix<double>(wells->number_of_wells, wells->well_connpos[ wells->number_of_wells ]);
|
|
||||||
|
|
||||||
const int nw = wells->number_of_wells;
|
|
||||||
const int* const wpos = wells->well_connpos;
|
|
||||||
|
|
||||||
typedef Eigen::Triplet<double> Tri;
|
|
||||||
|
|
||||||
std::vector<Tri> scatter, gather;
|
|
||||||
scatter.reserve(wpos[nw]);
|
|
||||||
gather .reserve(wpos[nw]);
|
|
||||||
|
|
||||||
for (int w = 0, i = 0; w < nw; ++w) {
|
|
||||||
for (; i < wpos[ w + 1 ]; ++i) {
|
|
||||||
scatter.push_back(Tri(i, w, 1.0));
|
|
||||||
gather .push_back(Tri(w, i, 1.0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
w2p.setFromTriplets(scatter.begin(), scatter.end());
|
|
||||||
p2w.setFromTriplets(gather .begin(), gather .end());
|
|
||||||
|
|
||||||
well_cells.assign(wells->well_cells, wells->well_cells + wells->well_connpos[wells->number_of_wells]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class Grid, class Implementation>
|
|
||||||
BlackoilModelBase<Grid, Implementation>::
|
|
||||||
StandardWells::StandardWells(const Wells* wells_arg)
|
|
||||||
: wells_(wells_arg)
|
|
||||||
, wops_(wells_arg)
|
|
||||||
, well_perforation_densities_(V())
|
|
||||||
, well_perforation_pressure_diffs_(V())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class Grid, class Implementation>
|
|
||||||
const Wells&
|
|
||||||
BlackoilModelBase<Grid, Implementation>::
|
|
||||||
StandardWells::wells() const
|
|
||||||
{
|
|
||||||
assert(wells_ != 0);
|
|
||||||
return *(wells_);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class Grid, class Implementation>
|
|
||||||
bool
|
|
||||||
BlackoilModelBase<Grid, Implementation>::
|
|
||||||
StandardWells::wellsActive() const
|
|
||||||
{
|
|
||||||
return wells_active_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class Grid, class Implementation>
|
|
||||||
void
|
|
||||||
BlackoilModelBase<Grid, Implementation>::
|
|
||||||
StandardWells::setWellsActive(const bool wells_active)
|
|
||||||
{
|
|
||||||
wells_active_ = wells_active;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class Grid, class Implementation>
|
|
||||||
bool
|
|
||||||
BlackoilModelBase<Grid, Implementation>::
|
|
||||||
StandardWells::localWellsActive() const
|
|
||||||
{
|
|
||||||
return wells_ ? (wells_->number_of_wells > 0 ) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class Grid, class Implementation>
|
|
||||||
const typename BlackoilModelBase<Grid, Implementation>::StandardWells::WellOps&
|
|
||||||
BlackoilModelBase<Grid, Implementation>::
|
|
||||||
StandardWells::wellOps() const
|
|
||||||
{
|
|
||||||
return wops_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class Grid, class Implementation>
|
|
||||||
V&
|
|
||||||
BlackoilModelBase<Grid, Implementation>::
|
|
||||||
StandardWells::wellPerforationDensities()
|
|
||||||
{
|
|
||||||
return well_perforation_densities_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class Grid, class Implementation>
|
|
||||||
const V&
|
|
||||||
BlackoilModelBase<Grid, Implementation>::
|
|
||||||
StandardWells::wellPerforationDensities() const
|
|
||||||
{
|
|
||||||
return well_perforation_densities_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class Grid, class Implementation>
|
|
||||||
V&
|
|
||||||
BlackoilModelBase<Grid, Implementation>::
|
|
||||||
StandardWells::wellPerforationPressureDiffs()
|
|
||||||
{
|
|
||||||
return well_perforation_pressure_diffs_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class Grid, class Implementation>
|
|
||||||
const V&
|
|
||||||
BlackoilModelBase<Grid, Implementation>::
|
|
||||||
StandardWells::wellPerforationPressureDiffs() const
|
|
||||||
{
|
|
||||||
return well_perforation_pressure_diffs_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class Grid, class Implementation>
|
template <class Grid, class Implementation>
|
||||||
int
|
int
|
||||||
BlackoilModelBase<Grid, Implementation>::numWellVars() const
|
BlackoilModelBase<Grid, Implementation>::numWellVars() const
|
||||||
|
159
opm/autodiff/StandardWells.cpp
Normal file
159
opm/autodiff/StandardWells.cpp
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016 SINTEF ICT, Applied Mathematics.
|
||||||
|
Copyright 2016 Statoil ASA.
|
||||||
|
|
||||||
|
This file is part of the Open Porous Media project (OPM).
|
||||||
|
|
||||||
|
OPM is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OPM is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <opm/autodiff/StandardWells.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace Opm
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
StandardWells::
|
||||||
|
WellOps::WellOps(const Wells* wells)
|
||||||
|
: w2p(),
|
||||||
|
p2w(),
|
||||||
|
well_cells()
|
||||||
|
{
|
||||||
|
if( wells )
|
||||||
|
{
|
||||||
|
w2p = Eigen::SparseMatrix<double>(wells->well_connpos[ wells->number_of_wells ], wells->number_of_wells);
|
||||||
|
p2w = Eigen::SparseMatrix<double>(wells->number_of_wells, wells->well_connpos[ wells->number_of_wells ]);
|
||||||
|
|
||||||
|
const int nw = wells->number_of_wells;
|
||||||
|
const int* const wpos = wells->well_connpos;
|
||||||
|
|
||||||
|
typedef Eigen::Triplet<double> Tri;
|
||||||
|
|
||||||
|
std::vector<Tri> scatter, gather;
|
||||||
|
scatter.reserve(wpos[nw]);
|
||||||
|
gather .reserve(wpos[nw]);
|
||||||
|
|
||||||
|
for (int w = 0, i = 0; w < nw; ++w) {
|
||||||
|
for (; i < wpos[ w + 1 ]; ++i) {
|
||||||
|
scatter.push_back(Tri(i, w, 1.0));
|
||||||
|
gather .push_back(Tri(w, i, 1.0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
w2p.setFromTriplets(scatter.begin(), scatter.end());
|
||||||
|
p2w.setFromTriplets(gather .begin(), gather .end());
|
||||||
|
|
||||||
|
well_cells.assign(wells->well_cells, wells->well_cells + wells->well_connpos[wells->number_of_wells]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
StandardWells::StandardWells(const Wells* wells_arg)
|
||||||
|
: wells_(wells_arg)
|
||||||
|
, wops_(wells_arg)
|
||||||
|
, well_perforation_densities_(Vector())
|
||||||
|
, well_perforation_pressure_diffs_(Vector())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const Wells& StandardWells::wells() const
|
||||||
|
{
|
||||||
|
assert(wells_ != 0);
|
||||||
|
return *(wells_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool StandardWells::wellsActive() const
|
||||||
|
{
|
||||||
|
return wells_active_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void StandardWells::setWellsActive(const bool wells_active)
|
||||||
|
{
|
||||||
|
wells_active_ = wells_active;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool StandardWells::localWellsActive() const
|
||||||
|
{
|
||||||
|
return wells_ ? (wells_->number_of_wells > 0 ) : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const StandardWells::WellOps&
|
||||||
|
StandardWells::wellOps() const
|
||||||
|
{
|
||||||
|
return wops_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Vector& StandardWells::wellPerforationDensities()
|
||||||
|
{
|
||||||
|
return well_perforation_densities_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const Vector& StandardWells::wellPerforationDensities() const
|
||||||
|
{
|
||||||
|
return well_perforation_densities_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Vector& StandardWells::wellPerforationPressureDiffs()
|
||||||
|
{
|
||||||
|
return well_perforation_pressure_diffs_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const Vector& StandardWells::wellPerforationPressureDiffs() const
|
||||||
|
{
|
||||||
|
return well_perforation_pressure_diffs_;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
84
opm/autodiff/StandardWells.hpp
Normal file
84
opm/autodiff/StandardWells.hpp
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016 SINTEF ICT, Applied Mathematics.
|
||||||
|
Copyright 2016 Statoil ASA.
|
||||||
|
|
||||||
|
This file is part of the Open Porous Media project (OPM).
|
||||||
|
|
||||||
|
OPM is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OPM is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef OPM_STANDARDWELLS_HEADER_INCLUDED
|
||||||
|
#define OPM_STANDARDWELLS_HEADER_INCLUDED
|
||||||
|
|
||||||
|
#include <opm/common/utility/platform_dependent/disable_warnings.h>
|
||||||
|
#include <Eigen/Eigen>
|
||||||
|
#include <Eigen/Sparse>
|
||||||
|
#include <opm/common/utility/platform_dependent/reenable_warnings.h>
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include <opm/core/wells.h>
|
||||||
|
#include <opm/autodiff/AutoDiffBlock.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Opm {
|
||||||
|
|
||||||
|
// --------- Types ---------
|
||||||
|
typedef AutoDiffBlock<double> ADB;
|
||||||
|
typedef ADB::V Vector;
|
||||||
|
|
||||||
|
/// Class for handling the standard well model.
|
||||||
|
class StandardWells {
|
||||||
|
protected:
|
||||||
|
struct WellOps {
|
||||||
|
explicit WellOps(const Wells* wells);
|
||||||
|
Eigen::SparseMatrix<double> w2p; // well -> perf (scatter)
|
||||||
|
Eigen::SparseMatrix<double> p2w; // perf -> well (gather)
|
||||||
|
std::vector<int> well_cells; // the set of perforated cells
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
// --------- Public methods ---------
|
||||||
|
explicit StandardWells(const Wells* wells);
|
||||||
|
|
||||||
|
const Wells& wells() const;
|
||||||
|
|
||||||
|
/// return true if wells are available in the reservoir
|
||||||
|
bool wellsActive() const;
|
||||||
|
void setWellsActive(const bool wells_active);
|
||||||
|
/// return true if wells are available on this process
|
||||||
|
bool localWellsActive() const;
|
||||||
|
|
||||||
|
const WellOps& wellOps() const;
|
||||||
|
|
||||||
|
/// Density of each well perforation
|
||||||
|
Vector& wellPerforationDensities();
|
||||||
|
const Vector& wellPerforationDensities() const;
|
||||||
|
|
||||||
|
/// Diff to bhp for each well perforation.
|
||||||
|
Vector& wellPerforationPressureDiffs();
|
||||||
|
const Vector& wellPerforationPressureDiffs() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool wells_active_;
|
||||||
|
const Wells* wells_;
|
||||||
|
const WellOps wops_;
|
||||||
|
Vector well_perforation_densities_;
|
||||||
|
Vector well_perforation_pressure_diffs_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Opm
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user