Commit e80c79ac authored by Thomas Witkowski's avatar Thomas Witkowski

More flexibel structure for FETI-DP preconditioner.

parent 92d14c6f
......@@ -17,6 +17,11 @@
#include "ProblemTimeInterface.h"
#include "Serializer.h"
#if HAVE_PARALLEL_DOMAIN_AMDIS
#include "parallel/MeshDistributor.h"
#include <petsc.h>
#endif
namespace AMDiS {
AdaptInstationary::AdaptInstationary(std::string name,
......@@ -31,8 +36,8 @@ namespace AMDiS {
{
FUNCNAME("AdaptInstationary::AdaptInstationary()");
// MSG("You make use of the obsolete constructor AdaptInstationary::AdaptInstationary(...)!\n");
// MSG("Please use the constructor that uses references instead of pointers!\n");
MSG("You make use of the obsolete constructor AdaptInstationary::AdaptInstationary(...)!\n");
MSG("Please use the constructor that uses references instead of pointers!\n");
initConstructor(problemStat, info, initialInfo, initialTimestampSet);
}
......@@ -262,6 +267,8 @@ namespace AMDiS {
{
FUNCNAME("AdaptInstationary::oneTimestep()");
MSG("ONE TIMESTEP!\n");
adaptInfo->setTimestepIteration(0);
switch (strategy) {
......@@ -294,6 +301,10 @@ namespace AMDiS {
TEST_EXIT(adaptInfo->getTimestep() > 0)("timestep <= 0!\n");
#if HAVE_PARALLEL_DOMAIN_AMDIS
MeshDistributor::globalMeshDistributor->initParallelization();
#endif
if (adaptInfo->getTimestepNumber() == 0) {
adaptInfo->setTime(adaptInfo->getStartTime());
initialAdaptInfo->setStartTime(adaptInfo->getStartTime());
......@@ -315,10 +326,7 @@ namespace AMDiS {
if (breakWhenStable && (adaptInfo->getSolverIterations() == 0))
break;
/*
if (adaptInfo->forceBreak)
break;
*/
// Check if there is a runtime limitation. If there is a runtime limitation
// and there is no more time for a next adaption loop, than return the error
// code for rescheduling the problem and break the adaption loop.
......@@ -328,6 +336,11 @@ namespace AMDiS {
}
}
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
MeshDistributor::globalMeshDistributor->exitParallelization();
PetscFinalize();
#endif
return errorCode;
}
......
......@@ -16,6 +16,11 @@
#include "ProblemIterationInterface.h"
#include <math.h>
#if HAVE_PARALLEL_DOMAIN_AMDIS
#include "parallel/MeshDistributor.h"
#include <petsc.h>
#endif
namespace AMDiS {
AdaptStationary::AdaptStationary(std::string name,
......@@ -25,8 +30,8 @@ namespace AMDiS {
{
FUNCNAME("AdaptStationary::AdaptStationary()");
// MSG("You make use of the obsolete constructor AdaptStationary::AdaptStationary(...)!\n");
// MSG("Please use the constructor that uses references instead of pointers!\n");
MSG("You make use of the obsolete constructor AdaptStationary::AdaptStationary(...)!\n");
MSG("Please use the constructor that uses references instead of pointers!\n");
initialize();
}
......@@ -45,6 +50,10 @@ namespace AMDiS {
{
FUNCNAME("AdaptStationary::adapt()");
#if HAVE_PARALLEL_DOMAIN_AMDIS
MeshDistributor::globalMeshDistributor->initParallelization();
#endif
// initial iteration
if (adaptInfo->getSpaceIteration() == -1) {
problemIteration->beginIteration(adaptInfo);
......@@ -68,6 +77,11 @@ namespace AMDiS {
adaptInfo->incSpaceIteration();
}
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
MeshDistributor::globalMeshDistributor->exitParallelization();
PetscFinalize();
#endif
return 0;
}
......
......@@ -143,6 +143,7 @@ namespace AMDiS {
TEST_EXIT(feSpace)("No FE space has been defined for the mesh distributor!\n");
TEST_EXIT(mesh)("No mesh has been defined for the mesh distributor!\n");
TEST_EXIT(!initialized)("MeshDistributor is already initialized!\n");
#ifdef HAVE_ZOLTAN
int a = 0;
......
This diff is collapsed.
......@@ -60,7 +60,7 @@ namespace AMDiS {
* the system matrix reduced to the Lagrange multipliers.
* \ref petscMultMatFeti
*/
struct PetscFetiData {
struct FetiData {
/// Pointers to the matrix containing the primal variables.
Mat *mat_primal_primal;
......@@ -87,11 +87,11 @@ namespace AMDiS {
};
struct PetscFetiPreconData {
struct FetiDirichletPreconData {
/// Matrix of scaled Lagrange variables.
Mat *mat_lagrange_scaled;
Mat *mat_interior_interior, *mat_bound_bound, *mat_interior_bound, *mat_bound_interior;
Mat *mat_interior_interior, *mat_duals_duals, *mat_interior_duals, *mat_duals_interior;
/// Pointer to the solver for \ref PetscSolverFeti::mat_bb.
KSP *ksp_interior;
......@@ -99,27 +99,42 @@ namespace AMDiS {
/// Temporal vector on the B variables.
Vec tmp_vec_b;
Vec tmp_vec_bound0, tmp_vec_bound1;
Vec tmp_vec_interior;
/// Temporal vector on the dual variables.
Vec tmp_vec_duals0, tmp_vec_duals1;
/// Temporal vector on the interior variables.
Vec tmp_vec_interior;
};
int nLocalInterior;
int nLocalBound;
struct FetiLumpedPreconData {
/// Matrix of scaled Lagrange variables.
Mat *mat_lagrange_scaled;
Mat *mat_duals_duals;
/// Temporal vector on the B variables.
Vec tmp_vec_b;
/// Temporal vector on the dual variables.
Vec tmp_vec_duals0, tmp_vec_duals1;
};
typedef enum {
FETI_NONE = 0,
FETI_DIRICHLET = 1,
FETI_LUMPED = 2
} FetiPreconditioner;
/** \brief
* FETI-DP implementation based on PETSc.
*/
class PetscSolverFeti : public PetscSolver
{
public:
PetscSolverFeti()
: PetscSolver(),
nComponents(-1)
{}
PetscSolverFeti();
/// Assemble the sequentially created matrices and vectors to the
/// global matrices and vectors required by the FETI-DP method.
......@@ -288,22 +303,29 @@ namespace AMDiS {
Mat mat_feti;
/// Data for MatMult operation in matrix \ref mat_feti
PetscFetiData petscFetiData;
FetiData fetiData;
/// Defines which preconditioner should be used to solve the reduced
/// FETI-DP system.
FetiPreconditioner fetiPreconditioner;
/// Preconditioner object for the reduced FETI-DP system.
PC precon_feti;
Mat mat_lagrange_scaled;
PC precon_feti;
FetiDirichletPreconData fetiDirichletPreconData;
PetscFetiPreconData petscFetiPreconData;
FetiLumpedPreconData fetiLumpedPreconData;
Mat mat_interior_interior, mat_bound_bound, mat_interior_bound, mat_bound_interior;
Mat mat_interior_interior, mat_duals_duals, mat_interior_duals, mat_duals_interior;
KSP ksp_interior;
int nLocalInterior;
int nLocalBound;
// Number of local nodes that are duals.
int nLocalDuals;
};
#endif
......
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