mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-02 05:49:09 -06:00
Merge remote-tracking branch 'atgeirr/master'
This commit is contained in:
commit
22372710b8
@ -36,8 +36,6 @@ namespace Opm
|
||||
PermeabilityKind fillTensor(const EclipseGridParser& parser,
|
||||
std::vector<const std::vector<double>*>& tensor,
|
||||
std::tr1::array<int,9>& kmap);
|
||||
|
||||
int numGlobalCells(const EclipseGridParser& parser);
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
@ -334,26 +332,6 @@ namespace Opm
|
||||
return kind;
|
||||
}
|
||||
|
||||
int numGlobalCells(const EclipseGridParser& parser)
|
||||
{
|
||||
int ngc = -1;
|
||||
|
||||
if (parser.hasField("DIMENS")) {
|
||||
const std::vector<int>&
|
||||
dims = parser.getIntegerValue("DIMENS");
|
||||
|
||||
ngc = dims[0] * dims[1] * dims[2];
|
||||
}
|
||||
else if (parser.hasField("SPECGRID")) {
|
||||
const SPECGRID& sgr = parser.getSPECGRID();
|
||||
|
||||
ngc = sgr.dimensions[ 0 ];
|
||||
ngc *= sgr.dimensions[ 1 ];
|
||||
ngc *= sgr.dimensions[ 2 ];
|
||||
}
|
||||
|
||||
return ngc;
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -504,13 +504,13 @@ namespace Opm
|
||||
cq.phasemobf = &face_phasemob_[0];
|
||||
cq.voldiscr = &cell_voldisc_[0];
|
||||
int was_adjusted = 0;
|
||||
if (rock_comp_props_ == NULL || !rock_comp_props_->isActive()) {
|
||||
was_adjusted =
|
||||
if (! (rock_comp_props_ && rock_comp_props_->isActive())) {
|
||||
was_adjusted =
|
||||
cfs_tpfa_res_assemble(gg, dt, &forces, z, &cq, &trans_[0],
|
||||
&face_gravcap_[0], cell_press, well_bhp,
|
||||
&porevol_[0], h_);
|
||||
} else {
|
||||
was_adjusted =
|
||||
was_adjusted =
|
||||
cfs_tpfa_res_comprock_assemble(gg, dt, &forces, z, &cq, &trans_[0],
|
||||
&face_gravcap_[0], cell_press, well_bhp,
|
||||
&porevol_[0], &initial_porevol_[0],
|
||||
|
@ -61,7 +61,7 @@ namespace Opm
|
||||
/// and completions does not change during the
|
||||
/// run. However, controls (only) are allowed
|
||||
/// to change.
|
||||
CompressibleTpfa(const UnstructuredGrid& grid,
|
||||
CompressibleTpfa(const UnstructuredGrid& grid,
|
||||
const BlackoilPropertiesInterface& props,
|
||||
const RockCompressibility* rock_comp_props,
|
||||
const LinearSolverInterface& linsolver,
|
||||
@ -71,8 +71,8 @@ namespace Opm
|
||||
const double* gravity,
|
||||
const Wells* wells);
|
||||
|
||||
/// Destructor.
|
||||
~CompressibleTpfa();
|
||||
/// Destructor.
|
||||
~CompressibleTpfa();
|
||||
|
||||
/// Solve the pressure equation by Newton-Raphson scheme.
|
||||
/// May throw an exception if the number of iterations
|
||||
@ -111,13 +111,13 @@ namespace Opm
|
||||
void solveIncrement();
|
||||
double residualNorm() const;
|
||||
double incrementNorm() const;
|
||||
void computeResults(BlackoilState& state,
|
||||
void computeResults(BlackoilState& state,
|
||||
WellState& well_state) const;
|
||||
protected:
|
||||
void computeWellPotentials(const BlackoilState& state);
|
||||
|
||||
// ------ Data that will remain unmodified after construction. ------
|
||||
const UnstructuredGrid& grid_;
|
||||
const UnstructuredGrid& grid_;
|
||||
const BlackoilPropertiesInterface& props_;
|
||||
const RockCompressibility* rock_comp_props_;
|
||||
const LinearSolverInterface& linsolver_;
|
||||
@ -126,12 +126,12 @@ namespace Opm
|
||||
const int maxiter_;
|
||||
const double* gravity_; // May be NULL
|
||||
const Wells* wells_; // May be NULL, outside may modify controls (only) between calls to solve().
|
||||
std::vector<double> htrans_;
|
||||
std::vector<double> trans_ ;
|
||||
std::vector<double> htrans_;
|
||||
std::vector<double> trans_ ;
|
||||
std::vector<int> allcells_;
|
||||
|
||||
// ------ Internal data for the cfs_tpfa_res solver. ------
|
||||
struct cfs_tpfa_res_data* h_;
|
||||
struct cfs_tpfa_res_data* h_;
|
||||
|
||||
// ------ Data that will be modified for every solve. ------
|
||||
std::vector<double> wellperf_gpot_;
|
||||
|
@ -96,7 +96,7 @@ namespace Opm
|
||||
props_.viscosity(props_.numCells(), pressure, NULL, &allcells_[0], &visc_[0], NULL);
|
||||
props_.matrix(props_.numCells(), pressure, NULL, &allcells_[0], &A_[0], NULL);
|
||||
|
||||
// Check non-miscibility requirement (only done for first cell).
|
||||
// Check immiscibility requirement (only done for first cell).
|
||||
if (A_[1] != 0.0 || A_[2] != 0.0) {
|
||||
THROW("TransportModelCompressibleTwophase requires a property object without miscibility.");
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ namespace Opm
|
||||
dt_(0.0),
|
||||
saturation_(grid.number_of_cells, -1.0),
|
||||
fractionalflow_(grid.number_of_cells, -1.0),
|
||||
reorder_iterations_(grid.number_of_cells, 0),
|
||||
mob_(2*grid.number_of_cells, -1.0)
|
||||
#ifdef EXPERIMENT_GAUSS_SEIDEL
|
||||
, ia_upw_(grid.number_of_cells + 1, -1),
|
||||
@ -101,11 +102,18 @@ namespace Opm
|
||||
&seq[0], &comp[0], &ncomp,
|
||||
&ia_downw_[0], &ja_downw_[0]);
|
||||
#endif
|
||||
|
||||
std::fill(reorder_iterations_.begin(),reorder_iterations_.end(),0);
|
||||
reorderAndTransport(grid_, darcyflux);
|
||||
toBothSat(saturation_, saturation);
|
||||
}
|
||||
|
||||
|
||||
const std::vector<int>& TransportModelTwophase::getReorderIterations() const
|
||||
{
|
||||
return reorder_iterations_;
|
||||
}
|
||||
|
||||
|
||||
// Residual function r(s) for a single-cell implicit Euler transport
|
||||
//
|
||||
// r(s) = s - s0 + dt/pv*( influx + outflux*f(s) )
|
||||
@ -170,9 +178,11 @@ namespace Opm
|
||||
// if (std::fabs(r0) < tol_) {
|
||||
// return;
|
||||
// }
|
||||
int iters_used;
|
||||
int iters_used = 0;
|
||||
// saturation_[cell] = modifiedRegulaFalsi(res, smin_[2*cell], smax_[2*cell], maxit_, tol_, iters_used);
|
||||
saturation_[cell] = RootFinder::solve(res, saturation_[cell], 0.0, 1.0, maxit_, tol_, iters_used);
|
||||
// add if it is iteration on an out loop
|
||||
reorder_iterations_[cell] = reorder_iterations_[cell] + iters_used;
|
||||
fractionalflow_[cell] = fracFlow(saturation_[cell], cell);
|
||||
}
|
||||
|
||||
@ -544,8 +554,9 @@ namespace Opm
|
||||
const int cell = cells[pos];
|
||||
GravityResidual res(*this, cells, pos, gravflux);
|
||||
if (std::fabs(res(saturation_[cell])) > tol_) {
|
||||
int iters_used;
|
||||
int iters_used = 0;
|
||||
saturation_[cell] = RootFinder::solve(res, smin_[2*cell], smax_[2*cell], maxit_, tol_, iters_used);
|
||||
reorder_iterations_[cell] = reorder_iterations_[cell] + iters_used;
|
||||
}
|
||||
saturation_[cell] = std::min(std::max(saturation_[cell], smin_[2*cell]), smax_[2*cell]);
|
||||
mobility(saturation_[cell], cell, &mob_[2*cell]);
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <opm/core/transport/reorder/TransportModelInterface.hpp>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <ostream>
|
||||
struct UnstructuredGrid;
|
||||
|
||||
namespace Opm
|
||||
@ -75,6 +75,10 @@ namespace Opm
|
||||
const double dt,
|
||||
std::vector<double>& saturation);
|
||||
|
||||
//// Return the number of iterations used by the reordering solver.
|
||||
//// \return vector of iteration per cell
|
||||
const std::vector<int>& getReorderIterations() const;
|
||||
|
||||
private:
|
||||
virtual void solveSingleCell(const int cell);
|
||||
virtual void solveMultiCell(const int num_cells, const int* cells);
|
||||
@ -83,7 +87,6 @@ namespace Opm
|
||||
const int pos,
|
||||
const double* gravflux);
|
||||
int solveGravityColumn(const std::vector<int>& cells);
|
||||
|
||||
private:
|
||||
const UnstructuredGrid& grid_;
|
||||
const IncompPropertiesInterface& props_;
|
||||
@ -99,6 +102,8 @@ namespace Opm
|
||||
double dt_;
|
||||
std::vector<double> saturation_; // one per cell, only water saturation!
|
||||
std::vector<double> fractionalflow_; // = m[0]/(m[0] + m[1]) per cell
|
||||
std::vector<int> reorder_iterations_;
|
||||
//std::vector<double> reorder_fval_;
|
||||
// For gravity segregation.
|
||||
std::vector<double> gravflux_;
|
||||
std::vector<double> mob_;
|
||||
|
@ -243,9 +243,9 @@ namespace Opm
|
||||
// matrix data.
|
||||
std::fill(surfacevol, surfacevol + n*np, 0.0);
|
||||
for (int i = 0; i < n; ++i) {
|
||||
for (int row = 0; row < np; ++row) {
|
||||
for (int col = 0; col < np; ++col) {
|
||||
surfacevol[i*np + row] += A[i*np*np + row*np + col] * saturation[i*np + col];
|
||||
for (int col = 0; col < np; ++col) {
|
||||
for (int row = 0; row < np; ++row) {
|
||||
surfacevol[i*np + row] += A[i*np*np + row + col*np] * saturation[i*np + col];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user