Skip to content
Snippets Groups Projects
Commit d283d4ee authored by podlesny's avatar podlesny
Browse files

.

parent acfdc49c
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ add_custom_target(faultnetworks_faultfactories_src SOURCES
geofaultfactory.hh
cantorconvergencefaultfactory.hh
cantorfaultfactory.hh
rockfaultfactory.hh
sparsecantorfaultfactory.hh
)
......@@ -12,5 +13,6 @@ install(FILES
geofaultfactory.hh
cantorconvergencefaultfactory.hh
cantorfaultfactory.hh
rockfaultfactory.hh
sparsecantorfaultfactory.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dune/faultnetworks/faultfactories)
This diff is collapsed.
......@@ -147,6 +147,10 @@ public:
void updateLocalRhs(const RangeType& rhs){
localRhs = rhs;
/*for (size_t i=0; i<localRhs.size(); i++) {
if (!boundaryDofs_[i][0])
localRhs[i] = rhs[i];
}*/
}
void updateRhsAndBoundary(const RangeType& rhs, const RangeType& boundary) {
......@@ -160,6 +164,8 @@ public:
}
void solve(DomainType& x){
//print(boundaryDofs_, "boundaryDofs:");
#if HAVE_UMFPACK
RangeType localRhsCopy(localRhs);
Dune::InverseOperatorResult res;
......
......@@ -182,19 +182,46 @@ private:
auto& localProblem = *localProblems_[i];
VectorType v;
VectorType v, v1, v2, v3;
localProblem.restrict(*(this->x_), v);
VectorType r;
localProblem.restrict(*(this->rhs_), r);
Dune::MatrixVector::subtractProduct(r, localProblem.getLocalMat(), v);
localProblem.updateLocalRhs(r);
v1.resize(localProblem.getLocalMat().N());
localProblem.getLocalMat().mv(v, v1);
v3.resize(matrix_.N());
matrix_.mv(*(this->x_), v3);
localProblem.restrict(v3, v2);
//print(v1, "v1");
//print(v2, "v2");
VectorType r1;
localProblem.restrict(*(this->rhs_), r1);
Dune::MatrixVector::subtractProduct(r1, localProblem.getLocalMat(), v);
/*localProblem.updateLocalRhs(r);
VectorType x;
localProblem.solve(x);
v += x;
localProblem.updateVector(v, *(this->x_));
localProblem.updateVector(v, *(this->x_));*/
VectorType localR;
VectorType r = *(this->rhs_);
Dune::MatrixVector::subtractProduct(r, matrix_, *(this->x_));
localProblem.restrict(r, localR);
// print(r1, "r1");
// print(localR, "localR");
localProblem.updateLocalRhs(localR);
VectorType x;
localProblem.solve(x);
//VectorType v;
localProblem.prolong(x, v);
*(this->x_) += v;
}
};
......
......@@ -60,6 +60,8 @@
#include <dune/faultnetworks/faultfactories/cantorfaultfactory.hh>
#include <dune/solvers/solvers/loopsolver.hh>
int main(int argc, char** argv) { try
{
MPIHelper::instance(argc, argv);
......@@ -86,7 +88,7 @@ int main(int argc, char** argv) { try
typedef OscLocalAssembler<GridType, DGFE, DGFE> LocalOscAssembler;
typedef IntersectionJumpMassAssembler<GV, DGFE, DGFE> LocalInterfaceAssembler;
// parse parameter file
ParameterTree parameterSet;
if (argc==2)
......@@ -110,7 +112,6 @@ int main(int argc, char** argv) { try
const int minCantorResolution = problemParameters.get<int>("minCantorResolution");
const double c = problemParameters.get<double>("penaltyFactor");
const int patchDepth = problemParameters.get<int>("patchDepth");
const int maxIterations = problemParameters.get<int>("maxIterations");
const double solverTolerance = problemParameters.get<double>("tol");
......@@ -331,13 +332,23 @@ int main(int argc, char** argv) { try
DGMGTransfer<DGBasis> discMGTransfer(*fineBasis, *exactBasis);
// solve
OscCGSolver<MatrixType, VectorType, DGBasis>
/*OscCGSolver<MatrixType, VectorType, DGBasis>
solver(*fineBasis, &fineGlobalAssembler.matrix(), &initialX, &rhs, &preconditioner,
maxIterations, solverTolerance, &exactEnergyNorm,
Solver::FULL, &exactSol, &fineSol, discMGTransfer, 1.0, true); //((oscGridN+0.0)/fineGridN)
Solver::FULL, &exactSol, &fineSol, discMGTransfer, 1.0, true); //((oscGridN+0.0)/fineGridN) */
//solver.historyBuffer_ = resultPath + "solutions/level_" + std::to_string(fineResolution) + ".vec";
VectorType x = initialX;
preconditioner.setProblem(fineGlobalAssembler.matrix(), x, rhs);
solver.historyBuffer_ = resultPath + "solutions/level_" + std::to_string(fineResolution) + ".vec";
Dune::Solvers::LoopSolver<VectorType>
solver (preconditioner, maxIterations, solverTolerance,
fineEnergyNorm,
Solver::FULL,
true, &fineSol);
solver.check();
solver.preprocess();
......
path = ../data/
resultPath = ../cantorfaultnetworks/results/
[preconditioner]
patch = SUPPORT # CELL , SUPPORT
mode = MULTIPLICATIVE # ADDITIVE , MULTIPLICATIVE
multDirection = SYMMETRIC # SYMMETRIC , FORWARD , BACKWARD
patchDepth = 1
###########################################
......@@ -10,88 +15,10 @@ oscDataFile = oscDataLaplace32.mat
# level resolution in 2^(-...)
coarseResolution = 0
fineResolution = 5
exactResolution = 10
minCantorResolution = 0
penaltyFactor = 1
patchDepth = 1
# cg solver
nestedIteration = 0
tol = 1e-12
maxIterations = 8
###########################################
[problem1]
oscDataFile = oscDataLaplace32.mat
# level resolution in 2^(-...)
coarseResolution = 0
fineResolution = 6
exactResolution = 10
exactResolution = 8
minCantorResolution = 0
penaltyFactor = 1
patchDepth = 1
# cg solver
nestedIteration = 0
tol = 1e-12
maxIterations = 8
###########################################
[problem2]
oscDataFile = oscDataLaplace32.mat
# level resolution in 2^(-...)
coarseResolution = 0
fineResolution = 7
exactResolution = 10
minCantorResolution = 0
penaltyFactor = 1
patchDepth = 1
# cg solver
nestedIteration = 0
tol = 1e-12
maxIterations = 8
###########################################
[problem3]
oscDataFile = oscDataLaplace32.mat
# level resolution in 2^(-...)
coarseResolution = 0
fineResolution = 8
exactResolution = 10
minCantorResolution = 0
penaltyFactor = 1
patchDepth = 1
# cg solver
nestedIteration = 0
tol = 1e-12
maxIterations = 8
###########################################
[problem4]
oscDataFile = oscDataLaplace32.mat
# level resolution in 2^(-...)
coarseResolution = 0
fineResolution = 9
exactResolution = 10
minCantorResolution = 0
penaltyFactor = 1
patchDepth = 1
# cg solver
nestedIteration = 0
......
......@@ -59,6 +59,9 @@
#include <dune/faultnetworks/dgmgtransfer.hh>
#include <dune/faultnetworks/faultfactories/sparsecantorfaultfactory.hh>
#include <dune/faultnetworks/faultfactories/rockfaultfactory.hh>
#include <dune/solvers/solvers/loopsolver.hh>
int main(int argc, char** argv) { try
{
......@@ -332,6 +335,15 @@ int main(int argc, char** argv) { try
maxIterations, solverTolerance, &exactEnergyNorm,
Solver::FULL, &exactSol, &fineSol, discMGTransfer, 1.0, true); //((oscGridN+0.0)/fineGridN)
/* VectorType x = initialX;
preconditioner.setProblem(fineGlobalAssembler.matrix(), x, rhs);
Dune::Solvers::LoopSolver<VectorType>
solver (preconditioner, maxIterations, solverTolerance,
fineEnergyNorm,
Solver::FULL,
true, &fineSol);*/
//solver.historyBuffer_ = resultPath + "solutions/level_" + std::to_string(fineCantorLevel) + ".vec";
......
......@@ -2,7 +2,7 @@ path = ../data/
resultPath = ../cantorfaultnetworks/results/sparse/
[preconditioner]
patch = CELL # CELL , SUPPORT
patch = SUPPORT # CELL , SUPPORT
mode = MULTIPLICATIVE # ADDITIVE , MULTIPLICATIVE
multDirection = SYMMETRIC # SYMMETRIC , FORWARD , BACKWARD
patchDepth = 1
......@@ -13,9 +13,9 @@ patchDepth = 1
oscDataFile = oscDataLaplace4.mat
# level resolution in 2^(-...)
coarseCantorLevel = 2
fineCantorLevel = 3
maxCantorLevel = 4
coarseCantorLevel = 1
fineCantorLevel = 2
maxCantorLevel = 3
penaltyFactor = 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment