Skip to content
Snippets Groups Projects
Commit 463d655a authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Move code around

Do not re-create overallSolver for every timestep
parent dbe18217
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,8 @@ class RuinaFunction : public NiceFunction {
}
double virtual second_deriv(double x) const {
assert(x >= 0);
assert(V0 > 0);
double const arg = x / V0;
if (arg <= rho)
return 0;
......@@ -81,6 +83,8 @@ class RuinaFunction : public NiceFunction {
}
double virtual regularity(double x) const {
assert(x >= 0);
assert(V0 > 0);
double const arg = x / V0;
// TODO: Make this controllable
if (std::abs(arg - rho) < 1e-14)
......
......@@ -308,9 +308,13 @@ int main(int argc, char *argv[]) {
MySolver<dims, MatrixType, VectorType, GridType, MyBlockProblemType>
mySolver(parset.sub("solver.tnnmg"), refinements, solver_tolerance, *grid,
ignoreNodes);
auto multigridStep = mySolver.getSolver();
Solver::VerbosityMode const verbosity =
parset.get<bool>("verbose") ? Solver::FULL : Solver::QUIET;
LoopSolver<VectorType> overallSolver(
multigridStep, parset.get<size_t>("solver.tnnmg.maxiterations"),
parset.get<double>("solver.tolerance"), &energyNorm, verbosity,
false); // absolute error
std::fstream coordinate_writer("coordinates", std::fstream::out);
for (size_t i = 0; i < frictionalNodes.size(); ++i)
......@@ -374,13 +378,8 @@ int main(int argc, char *argv[]) {
MyConvexProblemType const myConvexProblem(
problem_A, *myGlobalNonlinearity, problem_rhs);
MyBlockProblemType myBlockProblem(parset, myConvexProblem);
auto multigridStep = mySolver.getSolver();
multigridStep->setProblem(_problem_iterate, myBlockProblem);
LoopSolver<VectorType> overallSolver(
multigridStep, parset.get<size_t>("solver.tnnmg.maxiterations"),
parset.get<double>("solver.tolerance"), &energyNorm, verbosity,
false); // absolute error
overallSolver.preprocess();
overallSolver.solve();
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment