mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Renamed variables to match Ax = b
This commit is contained in:
parent
37a47711e5
commit
8fbbdad722
@ -122,27 +122,24 @@ namespace{
|
|||||||
/* Convenience struct to handle automatic (de)allocation of some useful
|
/* Convenience struct to handle automatic (de)allocation of some useful
|
||||||
* variables, as well as group them up for easier parameter passing
|
* variables, as well as group them up for easier parameter passing
|
||||||
*/
|
*/
|
||||||
Vec rhs;
|
Vec x;
|
||||||
Vec solution;
|
Vec b;
|
||||||
Mat A;
|
Mat A;
|
||||||
KSP ksp;
|
KSP ksp;
|
||||||
PC preconditioner;
|
PC preconditioner;
|
||||||
|
|
||||||
OEM_DATA( const int size ) {
|
OEM_DATA( const int size ) {
|
||||||
VecCreate( PETSC_COMM_WORLD, &solution );
|
VecCreate( PETSC_COMM_WORLD, &b );
|
||||||
auto err = VecSetSizes( solution, PETSC_DECIDE, size );
|
auto err = VecSetSizes( b, PETSC_DECIDE, size );
|
||||||
CHKERRXX( err );
|
CHKERRXX( err );
|
||||||
VecSetFromOptions( solution );
|
|
||||||
VecDuplicate( solution, &rhs );
|
|
||||||
|
|
||||||
VecSetFromOptions( b );
|
VecSetFromOptions( b );
|
||||||
|
|
||||||
KSPCreate( PETSC_COMM_WORLD, &ksp );
|
KSPCreate( PETSC_COMM_WORLD, &ksp );
|
||||||
}
|
}
|
||||||
|
|
||||||
~OEM_DATA() {
|
~OEM_DATA() {
|
||||||
VecDestroy( &rhs );
|
VecDestroy( &x );
|
||||||
VecDestroy( &solution );
|
VecDestroy( &b );
|
||||||
MatDestroy( &A );
|
MatDestroy( &A );
|
||||||
KSPDestroy( &ksp );
|
KSPDestroy( &ksp );
|
||||||
}
|
}
|
||||||
@ -203,7 +200,7 @@ namespace{
|
|||||||
err = KSPSetFromOptions( t.ksp );
|
err = KSPSetFromOptions( t.ksp );
|
||||||
CHKERRXX( err );
|
CHKERRXX( err );
|
||||||
KSPSetInitialGuessNonzero( t.ksp, PETSC_TRUE );
|
KSPSetInitialGuessNonzero( t.ksp, PETSC_TRUE );
|
||||||
KSPSolve( t.ksp, t.rhs, t.solution );
|
KSPSolve( t.ksp, t.x, t.b );
|
||||||
KSPGetConvergedReason( t.ksp, &reason );
|
KSPGetConvergedReason( t.ksp, &reason );
|
||||||
KSPGetIterationNumber( t.ksp, &its );
|
KSPGetIterationNumber( t.ksp, &its );
|
||||||
KSPGetResidualNorm( t.ksp, &residual );
|
KSPGetResidualNorm( t.ksp, &residual );
|
||||||
@ -255,10 +252,10 @@ namespace{
|
|||||||
|
|
||||||
OEM_DATA t( size );
|
OEM_DATA t( size );
|
||||||
t.A = to_petsc_mat( size, nonzeros, ia, ja, sa );
|
t.A = to_petsc_mat( size, nonzeros, ia, ja, sa );
|
||||||
t.rhs = to_petsc_vec( rhs, size );
|
t.x = to_petsc_vec( rhs, size );
|
||||||
|
|
||||||
solve_system( t, ksp_type, pc_type, rtol_, atol_, dtol_, maxits_, ksp_view_ );
|
solve_system( t, ksp_type, pc_type, rtol_, atol_, dtol_, maxits_, ksp_view_ );
|
||||||
from_petsc_vec( solution, t.solution );
|
from_petsc_vec( solution, t.b );
|
||||||
|
|
||||||
LinearSolverReport rep = {};
|
LinearSolverReport rep = {};
|
||||||
rep.converged = true;
|
rep.converged = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user