mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #1 from dr-robertk/ebos_restruct
make code compile and run.
This commit is contained in:
commit
bfddaa3402
@ -226,7 +226,8 @@ namespace detail {
|
|||||||
assert(nw * np == int(residual_well.size()));
|
assert(nw * np == int(residual_well.size()));
|
||||||
|
|
||||||
// Do the global reductions
|
// Do the global reductions
|
||||||
#if HAVE_MPI
|
#if 0
|
||||||
|
HAVE_MPI
|
||||||
if ( linsolver_.parallelInformation().type() == typeid(ParallelISTLInformation) )
|
if ( linsolver_.parallelInformation().type() == typeid(ParallelISTLInformation) )
|
||||||
{
|
{
|
||||||
const ParallelISTLInformation& info =
|
const ParallelISTLInformation& info =
|
||||||
|
@ -290,7 +290,16 @@ namespace Opm {
|
|||||||
// -------- Well equations ----------
|
// -------- Well equations ----------
|
||||||
double dt = timer.currentStepLength();
|
double dt = timer.currentStepLength();
|
||||||
|
|
||||||
IterationReport iter_report = wellModel().assemble(ebosSimulator_, iterationIdx, dt, well_state, residual_);
|
IterationReport iter_report;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
iter_report = wellModel().assemble(ebosSimulator_, iterationIdx, dt, well_state, residual_);
|
||||||
|
}
|
||||||
|
catch ( const Dune::FMatrixError& e )
|
||||||
|
{
|
||||||
|
OPM_THROW(Opm::NumericalProblem,"no convergence");
|
||||||
|
}
|
||||||
|
|
||||||
typedef double Scalar;
|
typedef double Scalar;
|
||||||
typedef Dune::FieldVector<Scalar, 3 > VectorBlockType;
|
typedef Dune::FieldVector<Scalar, 3 > VectorBlockType;
|
||||||
typedef Dune::FieldMatrix<Scalar, 3, 3 > MatrixBlockType;
|
typedef Dune::FieldMatrix<Scalar, 3, 3 > MatrixBlockType;
|
||||||
|
@ -253,26 +253,22 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void matAdd( Mat& res, const Mat& A, const Mat& B ) const
|
Mat matAdd( const Mat& A, const Mat& B ) const
|
||||||
{
|
{
|
||||||
matBinaryOp( res, A, B, true );
|
return matBinaryOp( A, B, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void matSubstract( Mat& res, const Mat& A, const Mat& B ) const
|
Mat matSubstract( const Mat& A, const Mat& B ) const
|
||||||
{
|
{
|
||||||
matBinaryOp( res, A, B, false );
|
return matBinaryOp( A, B, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Mat matBinaryOp( const Mat& A, const Mat& B, const bool add ) const
|
||||||
void matBinaryOp( Mat& res, const Mat& A, const Mat& B, const bool add ) const
|
|
||||||
{
|
{
|
||||||
assert( A.N() == B.N() && A.M() == B.M() );
|
|
||||||
res.setSize( A.N(), A.M() );
|
|
||||||
res.setBuildMode( Mat::implicit );
|
|
||||||
|
|
||||||
const int avg_cols_per_row = 20;
|
const int avg_cols_per_row = 20;
|
||||||
const double overflow_fraction = 0.4;
|
const double overflow_fraction = 0.4;
|
||||||
res.setImplicitBuildModeParameters(avg_cols_per_row,overflow_fraction);
|
Mat res( A.N(), A.M(), avg_cols_per_row,overflow_fraction, Mat::implicit );
|
||||||
|
assert( A.N() == B.N() && A.M() == B.M() );
|
||||||
|
|
||||||
// res = A
|
// res = A
|
||||||
for( auto rowit = A.begin(), rowEnd = A.end(); rowit != rowEnd; ++rowit )
|
for( auto rowit = A.begin(), rowEnd = A.end(); rowit != rowEnd; ++rowit )
|
||||||
@ -294,7 +290,6 @@ namespace Opm {
|
|||||||
for( auto colit = rowit->begin(); colit != colEnd; ++colit )
|
for( auto colit = rowit->begin(); colit != colEnd; ++colit )
|
||||||
{
|
{
|
||||||
const int colIdx = colit.index();
|
const int colIdx = colit.index();
|
||||||
// op either implements += or -=
|
|
||||||
if( add )
|
if( add )
|
||||||
{
|
{
|
||||||
res.entry( rowIdx, colIdx ) += (*colit);
|
res.entry( rowIdx, colIdx ) += (*colit);
|
||||||
@ -307,16 +302,15 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.compress();
|
res.compress();
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addRhs(BVector& x, Mat& jac) const {
|
void addRhs(BVector& x, Mat& jac) const {
|
||||||
assert(x.size() == rhs.size());
|
assert(x.size() == rhs.size());
|
||||||
x += rhs_;
|
x += rhs_;
|
||||||
Mat A;//( jac );
|
|
||||||
// jac = A + duneA
|
// jac = A + duneA
|
||||||
//matAdd( A, jac, duneA_ );
|
jac = matAdd( jac, duneA_ );
|
||||||
//jac = A;
|
//jac += duneA_;
|
||||||
jac += duneA_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply( Mat& A,
|
void apply( Mat& A,
|
||||||
@ -334,11 +328,9 @@ namespace Opm {
|
|||||||
//std::cout << "duneA" << std::endl;
|
//std::cout << "duneA" << std::endl;
|
||||||
|
|
||||||
//print(duneA);
|
//print(duneA);
|
||||||
Mat E;//( A );
|
|
||||||
// A = E - duneA
|
// A = E - duneA
|
||||||
//matSubstract( E, A, duneA );
|
A = matSubstract( A, duneA );
|
||||||
//A = E;
|
//A -= duneA;
|
||||||
A -= duneA;
|
|
||||||
//std::cout << "after" << std::endl;
|
//std::cout << "after" << std::endl;
|
||||||
//print(A);
|
//print(A);
|
||||||
BmultinvD.mmv(resWell_, res);
|
BmultinvD.mmv(resWell_, res);
|
||||||
|
Loading…
Reference in New Issue
Block a user