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

Count iterations

parent 780e7d64
No related branches found
No related tags found
No related merge requests found
...@@ -327,6 +327,8 @@ int main(int argc, char *argv[]) { ...@@ -327,6 +327,8 @@ int main(int argc, char *argv[]) {
std::fstream velocity_writer("velocities", std::fstream::out); std::fstream velocity_writer("velocities", std::fstream::out);
std::fstream coefficient_writer("coefficients", std::fstream::out); std::fstream coefficient_writer("coefficients", std::fstream::out);
; ;
std::fstream iteration_writer("iterations", std::fstream::out);
;
auto timeSteppingScheme = auto timeSteppingScheme =
initTimeStepper(parset.get<Config::scheme>("timeSteppingScheme"), initTimeStepper(parset.get<Config::scheme>("timeSteppingScheme"),
...@@ -368,6 +370,7 @@ int main(int argc, char *argv[]) { ...@@ -368,6 +370,7 @@ int main(int argc, char *argv[]) {
timeSteppingScheme->setup(ell, tau, time, problem_rhs, problem_iterate, timeSteppingScheme->setup(ell, tau, time, problem_rhs, problem_iterate,
problem_A); problem_A);
size_t iterationCounter;
auto solveDisplacementProblem = [&](VectorType &_problem_iterate, auto solveDisplacementProblem = [&](VectorType &_problem_iterate,
SingletonVectorType const &_alpha) { SingletonVectorType const &_alpha) {
auto myGlobalNonlinearity = auto myGlobalNonlinearity =
...@@ -382,6 +385,7 @@ int main(int argc, char *argv[]) { ...@@ -382,6 +385,7 @@ int main(int argc, char *argv[]) {
overallSolver.preprocess(); overallSolver.preprocess();
overallSolver.solve(); overallSolver.solve();
iterationCounter = overallSolver.getResult().iterations;
}; };
// Since the velocity explodes in the quasistatic case, use the // Since the velocity explodes in the quasistatic case, use the
...@@ -397,6 +401,7 @@ int main(int argc, char *argv[]) { ...@@ -397,6 +401,7 @@ int main(int argc, char *argv[]) {
stateUpdater->solve(ud); stateUpdater->solve(ud);
stateUpdater->extractState(alpha); stateUpdater->extractState(alpha);
iteration_writer << iterationCounter << " ";
if (parset.get<bool>("printProgress")) { if (parset.get<bool>("printProgress")) {
std::cerr << '.'; std::cerr << '.';
std::cerr.flush(); std::cerr.flush();
...@@ -428,6 +433,7 @@ int main(int argc, char *argv[]) { ...@@ -428,6 +433,7 @@ int main(int argc, char *argv[]) {
displacement_writer << std::endl; displacement_writer << std::endl;
velocity_writer << std::endl; velocity_writer << std::endl;
coefficient_writer << std::endl; coefficient_writer << std::endl;
iteration_writer << std::endl;
if (parset.get<bool>("writeVTK")) { if (parset.get<bool>("writeVTK")) {
SingletonVectorType vonMisesStress; SingletonVectorType vonMisesStress;
...@@ -447,11 +453,12 @@ int main(int argc, char *argv[]) { ...@@ -447,11 +453,12 @@ int main(int argc, char *argv[]) {
std::cerr << std::endl << "Making " << timesteps << " time steps took " std::cerr << std::endl << "Making " << timesteps << " time steps took "
<< timer.elapsed() << "s" << std::endl; << timer.elapsed() << "s" << std::endl;
; ;
state_writer.close(); state_writer.close();
displacement_writer.close(); displacement_writer.close();
velocity_writer.close(); velocity_writer.close();
coefficient_writer.close(); coefficient_writer.close();
; iteration_writer.close();
Python::stop(); Python::stop();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment