Moved SolutionState to ModelTraits.

Also extracting existing private class and renamed it DefaultBlackoilSolutionState.
This commit is contained in:
Atgeirr Flø Rasmussen 2015-05-25 00:46:28 +02:00
parent 8f198986fd
commit 940853f9e5
3 changed files with 35 additions and 38 deletions

View File

@ -68,10 +68,10 @@ namespace Opm {
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
const bool terminal_output) const bool terminal_output)
: Base(param, grid, fluid, geo, rock_comp_props, wells, linsolver, : Base(param, grid, fluid, geo, rock_comp_props, wells, linsolver,
has_disgas, has_vapoil, terminal_output) has_disgas, has_vapoil, terminal_output)
{ {
} }
}; };
@ -81,8 +81,8 @@ namespace Opm {
{ {
typedef BlackoilState ReservoirState; typedef BlackoilState ReservoirState;
typedef WellStateFullyImplicitBlackoil WellState; typedef WellStateFullyImplicitBlackoil WellState;
typedef BlackoilModelBase< Grid, BlackoilModel<Grid> > Base;
typedef BlackoilModelParameters ModelParameters; typedef BlackoilModelParameters ModelParameters;
typedef DefaultBlackoilSolutionState SolutionState;
}; };
} // namespace Opm } // namespace Opm

View File

@ -33,7 +33,6 @@
#include <array> #include <array>
struct UnstructuredGrid;
struct Wells; struct Wells;
namespace Opm { namespace Opm {
@ -42,8 +41,35 @@ namespace Opm {
class DerivedGeology; class DerivedGeology;
class RockCompressibility; class RockCompressibility;
class NewtonIterationBlackoilInterface; class NewtonIterationBlackoilInterface;
class BlackoilState;
class WellStateFullyImplicitBlackoil;
/// Struct for containing iteration variables.
struct DefaultBlackoilSolutionState
{
typedef AutoDiffBlock<double> ADB;
explicit DefaultBlackoilSolutionState(const int np)
: pressure ( ADB::null())
, temperature( ADB::null())
, saturation(np, ADB::null())
, rs ( ADB::null())
, rv ( ADB::null())
, qs ( ADB::null())
, bhp ( ADB::null())
, canonical_phase_pressures(3, ADB::null())
{
}
ADB pressure;
ADB temperature;
std::vector<ADB> saturation;
ADB rs;
ADB rv;
ADB qs;
ADB bhp;
// Below are quantities stored in the state for optimization purposes.
std::vector<ADB> canonical_phase_pressures; // Always has 3 elements, even if only 2 phases active.
};
/// Traits to encapsulate the types used by classes using or /// Traits to encapsulate the types used by classes using or
@ -76,6 +102,7 @@ namespace Opm {
typedef typename ModelTraits<Implementation>::ReservoirState ReservoirState; typedef typename ModelTraits<Implementation>::ReservoirState ReservoirState;
typedef typename ModelTraits<Implementation>::WellState WellState; typedef typename ModelTraits<Implementation>::WellState WellState;
typedef typename ModelTraits<Implementation>::ModelParameters ModelParameters; typedef typename ModelTraits<Implementation>::ModelParameters ModelParameters;
typedef typename ModelTraits<Implementation>::SolutionState SolutionState;
// --------- Public methods --------- // --------- Public methods ---------
@ -192,19 +219,6 @@ namespace Opm {
ADB mob; // Phase mobility (per cell) ADB mob; // Phase mobility (per cell)
}; };
struct SolutionState {
SolutionState(const int np);
ADB pressure;
ADB temperature;
std::vector<ADB> saturation;
ADB rs;
ADB rv;
ADB qs;
ADB bhp;
// Below are quantities stored in the state for optimization purposes.
std::vector<ADB> canonical_phase_pressures; // Always has 3 elements, even if only 2 phases active.
};
struct WellOps { struct WellOps {
WellOps(const Wells* wells); WellOps(const Wells* wells);
M w2p; // well -> perf (scatter) M w2p; // well -> perf (scatter)

View File

@ -294,23 +294,6 @@ namespace detail {
template <class Grid, class Implementation>
BlackoilModelBase<Grid, Implementation>::SolutionState::SolutionState(const int np)
: pressure ( ADB::null())
, temperature( ADB::null())
, saturation(np, ADB::null())
, rs ( ADB::null())
, rv ( ADB::null())
, qs ( ADB::null())
, bhp ( ADB::null())
, canonical_phase_pressures(3, ADB::null())
{
}
template <class Grid, class Implementation> template <class Grid, class Implementation>
BlackoilModelBase<Grid, Implementation>:: BlackoilModelBase<Grid, Implementation>::
WellOps::WellOps(const Wells* wells) WellOps::WellOps(const Wells* wells)