Commit 329c0fb9 authored by Praetorius, Simon's avatar Praetorius, Simon

small error in petsc helpers corrected

parent 5f059f08
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "parallel/MeshDistributor.h" #include "parallel/MeshDistributor.h"
#include "parallel/MpiHelper.h" #include "parallel/MpiHelper.h"
#include "parallel/ParallelDofMapping.h" #include "parallel/ParallelDofMapping.h"
#include "parallel/PetscHelper.h"
#include "parallel/PetscSolver.h" #include "parallel/PetscSolver.h"
#include "parallel/StdMpi.h" #include "parallel/StdMpi.h"
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "parallel/PetscSolverGlobalBlockMatrix.h" #include "parallel/PetscSolverGlobalBlockMatrix.h"
#include "parallel/PetscHelper.h"
#include "parallel/StdMpi.h" #include "parallel/StdMpi.h"
#include "parallel/MpiHelper.h" #include "parallel/MpiHelper.h"
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
// #include "DirichletBC.h" // #include "DirichletBC.h"
#include "DOFVector.h" #include "DOFVector.h"
#include "parallel/PetscSolverGlobalMatrix.h" #include "parallel/PetscSolverGlobalMatrix.h"
#include "parallel/PetscHelper.h"
#include "parallel/StdMpi.h" #include "parallel/StdMpi.h"
#include "parallel/MpiHelper.h" #include "parallel/MpiHelper.h"
#include "solver/PetscTypes.h" #include "solver/PetscTypes.h"
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "parallel/PetscSolverSchur.h" #include "parallel/PetscSolverSchur.h"
#include "parallel/PetscHelper.h"
#include "parallel/StdMpi.h" #include "parallel/StdMpi.h"
#include "parallel/MpiHelper.h" #include "parallel/MpiHelper.h"
......
...@@ -68,11 +68,7 @@ namespace AMDiS { namespace Parallel { ...@@ -68,11 +68,7 @@ namespace AMDiS { namespace Parallel {
/// create new solver for S /// create new solver for S
KSP kspS; KSP kspS;
KSPCreate(*data->mpiCommGlobal, &kspS); KSPCreate(*data->mpiCommGlobal, &kspS);
#if (PETSC_VERSION_MINOR >= 5) petsc::ksp_set_operators(kspS, S, S);
KSPSetOperators(kspS, S, S);
#else
KSPSetOperators(kspS, S, S, SAME_NONZERO_PATTERN);
#endif
petsc_helper::setSolver(kspS, "S_", KSPFGMRES, PCSHELL, 1e-6, 1e-8, 5); petsc_helper::setSolver(kspS, "S_", KSPFGMRES, PCSHELL, 1e-6, 1e-8, 5);
{ {
PC pc; PC pc;
...@@ -118,15 +114,11 @@ namespace AMDiS { namespace Parallel { ...@@ -118,15 +114,11 @@ namespace AMDiS { namespace Parallel {
MSG("CREATE POS 1: %p\n", &ksp); MSG("CREATE POS 1: %p\n", &ksp);
KSPCreate(domainComm, &ksp); KSPCreate(domainComm, &ksp);
#if (PETSC_VERSION_MINOR >= 5) petsc::ksp_set_operators(ksp, getMatInterior(), getMatInterior());
KSPSetOperators(ksp, getMatInterior(), getMatInterior());
#else
KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN);
#endif
if (getInfo() >= 10) if (getInfo() >= 10)
KSPMonitorSet(ksp, KSPMonitorDefault, PETSC_NULL, PETSC_NULL); petsc::ksp_monitor_set(ksp, KSPMonitorDefault);
else if (getInfo() >= 20) else if (getInfo() >= 20)
KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm, PETSC_NULL, PETSC_NULL); petsc::ksp_monitor_set(ksp, KSPMonitorTrueResidualNorm);
petsc_helper::setSolver(ksp, "ch_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations()); petsc_helper::setSolver(ksp, "ch_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations());
if (useOldInitialGuess) if (useOldInitialGuess)
......
...@@ -133,15 +133,11 @@ namespace AMDiS { namespace Parallel { ...@@ -133,15 +133,11 @@ namespace AMDiS { namespace Parallel {
{ {
// Create FGMRES based outer solver // Create FGMRES based outer solver
KSPCreate(domainComm, &ksp); KSPCreate(domainComm, &ksp);
#if (PETSC_VERSION_MINOR >= 5) petsc::ksp_set_operators(ksp, getMatInterior(), getMatInterior());
KSPSetOperators(ksp, getMatInterior(), getMatInterior());
#else
KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN);
#endif
if (getInfo() >= 10) if (getInfo() >= 10)
KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorDefault), PETSC_NULL, PETSC_NULL); petsc::ksp_monitor_set(ksp, KSPMonitorDefault);
else if (getInfo() >= 20) else if (getInfo() >= 20)
KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorTrueResidualNorm), PETSC_NULL, PETSC_NULL); petsc::ksp_monitor_set(ksp, KSPMonitorTrueResidualNorm);
petsc_helper::setSolver(ksp, "ns_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations()); petsc_helper::setSolver(ksp, "ns_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations());
// Create null space information. // Create null space information.
......
...@@ -78,15 +78,11 @@ namespace AMDiS { namespace Parallel { ...@@ -78,15 +78,11 @@ namespace AMDiS { namespace Parallel {
{ {
// Create FGMRES based outer solver // Create FGMRES based outer solver
KSPCreate(meshDistributor->getMpiComm(0), &ksp); KSPCreate(meshDistributor->getMpiComm(0), &ksp);
#if (PETSC_VERSION_MINOR >= 5) petsc::ksp_set_operators(ksp, getMatInterior(), getMatInterior());
KSPSetOperators(ksp, getMatInterior(), getMatInterior());
#else
KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN);
#endif
if (getInfo() >= 10) if (getInfo() >= 10)
KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorDefault), PETSC_NULL, PETSC_NULL); petsc::ksp_monitor_set(ksp, KSPMonitorDefault);
else if (getInfo() >= 20) else if (getInfo() >= 20)
KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorTrueResidualNorm), PETSC_NULL, PETSC_NULL); petsc::ksp_monitor_set(ksp, KSPMonitorTrueResidualNorm);
petsc_helper::setSolver(ksp, "pfc_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations()); petsc_helper::setSolver(ksp, "pfc_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations());
KSPSetFromOptions(ksp); KSPSetFromOptions(ksp);
......
...@@ -76,15 +76,11 @@ namespace AMDiS { namespace Parallel { ...@@ -76,15 +76,11 @@ namespace AMDiS { namespace Parallel {
{ {
// Create FGMRES based outer solver // Create FGMRES based outer solver
KSPCreate(meshDistributor->getMpiComm(0), &ksp); KSPCreate(meshDistributor->getMpiComm(0), &ksp);
#if (PETSC_VERSION_MINOR >= 5) petsc::ksp_set_operators(ksp, getMatInterior(), getMatInterior());
KSPSetOperators(ksp, getMatInterior(), getMatInterior());
#else
KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN);
#endif
if (getInfo() >= 10) if (getInfo() >= 10)
KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorDefault), PETSC_NULL, PETSC_NULL); petsc::ksp_monitor_set(ksp, KSPMonitorDefault);
else if (getInfo() >= 20) else if (getInfo() >= 20)
KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorTrueResidualNorm), PETSC_NULL, PETSC_NULL); petsc::ksp_monitor_set(ksp, KSPMonitorTrueResidualNorm);
petsc_helper::setSolver(ksp, "pfc_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations()); petsc_helper::setSolver(ksp, "pfc_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations());
KSPSetFromOptions(ksp); KSPSetFromOptions(ksp);
...@@ -167,11 +163,7 @@ namespace AMDiS { namespace Parallel { ...@@ -167,11 +163,7 @@ namespace AMDiS { namespace Parallel {
VecDestroy(&x); VecDestroy(&x);
MatDestroy(&DK); MatDestroy(&DK);
#if (PETSC_VERSION_MINOR >= 5) petsc::ksp_set_operators(data.kspS, matS, matS);
KSPSetOperators(data.kspS, matS, matS);
#else
KSPSetOperators(data.kspS, matS, matS, SAME_NONZERO_PATTERN);
#endif
// === Setup preconditioner data === // === Setup preconditioner data ===
data.delta = delta; data.delta = delta;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment