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

camlCase; move writer to a block; rename variable

parent f5206652
No related branches found
No related tags found
No related merge requests found
...@@ -340,30 +340,31 @@ int main(int argc, char *argv[]) { ...@@ -340,30 +340,31 @@ int main(int argc, char *argv[]) {
// }}} // }}}
// Set up TNNMG solver // Set up TNNMG solver
auto const solver_tolerance = parset.get<double>("solver.tolerance"); auto const solverTolerance = parset.get<double>("solver.tolerance");
typedef MyConvexProblem<MatrixType, VectorType> MyConvexProblemType; typedef MyConvexProblem<MatrixType, VectorType> MyConvexProblemType;
typedef MyBlockProblem<MyConvexProblemType> MyBlockProblemType; typedef MyBlockProblem<MyConvexProblemType> MyBlockProblemType;
MySolver<dims, MatrixType, VectorType, GridType, MyBlockProblemType> MySolver<dims, MatrixType, VectorType, GridType, MyBlockProblemType>
mySolver(parset.sub("solver.tnnmg"), refinements, solver_tolerance, *grid, solverHost(parset.sub("solver.tnnmg"), refinements, solverTolerance, *grid,
ignoreNodes); ignoreNodes);
auto multigridStep = mySolver.getSolver(); auto multigridStep = solverHost.getSolver();
Solver::VerbosityMode const verbosity = Solver::VerbosityMode const verbosity =
parset.get<bool>("verbose") ? Solver::FULL : Solver::QUIET; parset.get<bool>("verbose") ? Solver::FULL : Solver::QUIET;
std::fstream coordinate_writer("coordinates", std::fstream::out); {
for (size_t i = 0; i < frictionalNodes.size(); ++i) std::fstream coordinateWriter("coordinates", std::fstream::out);
if (frictionalNodes[i][0]) for (size_t i = 0; i < frictionalNodes.size(); ++i)
coordinate_writer << coordinates[i] << std::endl; if (frictionalNodes[i][0])
coordinate_writer.close(); coordinateWriter << coordinates[i] << std::endl;
coordinateWriter.close();
std::fstream state_writer("states", std::fstream::out); }
std::fstream displacement_writer("displacements", std::fstream::out); std::fstream stateWriter("states", std::fstream::out);
std::fstream velocity_writer("velocities", std::fstream::out); std::fstream displacementWriter("displacements", std::fstream::out);
std::fstream coefficient_writer("coefficients", std::fstream::out); std::fstream velocityWriter("velocities", std::fstream::out);
std::fstream coefficientWriter("coefficients", std::fstream::out);
; ;
std::fstream iteration_writer("iterations", std::fstream::out); std::fstream iterationWriter("iterations", std::fstream::out);
; ;
std::fstream damping_writer("damping", std::fstream::out); std::fstream dampingWriter("damping", std::fstream::out);
; ;
auto timeSteppingScheme = auto timeSteppingScheme =
...@@ -408,7 +409,7 @@ int main(int argc, char *argv[]) { ...@@ -408,7 +409,7 @@ int main(int argc, char *argv[]) {
LoopSolver<VectorType> velocityProblemSolver( LoopSolver<VectorType> velocityProblemSolver(
multigridStep, parset.get<size_t>("solver.tnnmg.maxiterations"), multigridStep, parset.get<size_t>("solver.tnnmg.maxiterations"),
solver_tolerance, &velocityEnergyNorm, verbosity, solverTolerance, &velocityEnergyNorm, verbosity,
false); // absolute error false); // absolute error
size_t iterationCounter; size_t iterationCounter;
...@@ -447,11 +448,11 @@ int main(int argc, char *argv[]) { ...@@ -447,11 +448,11 @@ int main(int argc, char *argv[]) {
if (state_fpi <= 2 // Let the first two steps pass through unchanged if (state_fpi <= 2 // Let the first two steps pass through unchanged
|| correction < minimalCorrectionReduction * lastCorrection) { || correction < minimalCorrectionReduction * lastCorrection) {
alpha = computed_state; alpha = computed_state;
damping_writer << "N "; dampingWriter << "N ";
} else { } else {
alpha *= damping; alpha *= damping;
alpha.axpy(1.0 - damping, computed_state); alpha.axpy(1.0 - damping, computed_state);
damping_writer << "Y "; dampingWriter << "Y ";
} }
lastCorrection = correction; lastCorrection = correction;
} }
...@@ -461,7 +462,7 @@ int main(int argc, char *argv[]) { ...@@ -461,7 +462,7 @@ int main(int argc, char *argv[]) {
timeSteppingScheme->extractDisplacement(u); timeSteppingScheme->extractDisplacement(u);
timeSteppingScheme->extractVelocity(ud); timeSteppingScheme->extractVelocity(ud);
iteration_writer << iterationCounter << " "; iterationWriter << iterationCounter << " ";
if (parset.get<bool>("printProgress")) { if (parset.get<bool>("printProgress")) {
std::cerr << '.'; std::cerr << '.';
std::cerr.flush(); std::cerr.flush();
...@@ -487,19 +488,19 @@ int main(int argc, char *argv[]) { ...@@ -487,19 +488,19 @@ int main(int argc, char *argv[]) {
for (size_t i = 0; i < frictionalNodes.size(); ++i) for (size_t i = 0; i < frictionalNodes.size(); ++i)
if (frictionalNodes[i][0]) { if (frictionalNodes[i][0]) {
state_writer << alpha[i][0] << " "; stateWriter << alpha[i][0] << " ";
displacement_writer << u[i][0] << " "; displacementWriter << u[i][0] << " ";
velocity_writer << ud[i][0] << " "; velocityWriter << ud[i][0] << " ";
coefficient_writer << computeCOF(mu0, a, b, V0, L, ud[i].two_norm(), coefficientWriter << computeCOF(mu0, a, b, V0, L, ud[i].two_norm(),
alpha[i]) << " "; alpha[i]) << " ";
} }
state_writer << std::endl; stateWriter << std::endl;
displacement_writer << std::endl; displacementWriter << std::endl;
velocity_writer << std::endl; velocityWriter << std::endl;
coefficient_writer << std::endl; coefficientWriter << std::endl;
iteration_writer << std::endl; iterationWriter << std::endl;
damping_writer << std::endl; dampingWriter << std::endl;
if (parset.get<bool>("writeVTK")) { if (parset.get<bool>("writeVTK")) {
SingletonVectorType vonMisesStress; SingletonVectorType vonMisesStress;
...@@ -520,12 +521,12 @@ int main(int argc, char *argv[]) { ...@@ -520,12 +521,12 @@ int main(int argc, char *argv[]) {
<< timer.elapsed() << "s" << std::endl; << timer.elapsed() << "s" << std::endl;
; ;
state_writer.close(); stateWriter.close();
displacement_writer.close(); displacementWriter.close();
velocity_writer.close(); velocityWriter.close();
coefficient_writer.close(); coefficientWriter.close();
iteration_writer.close(); iterationWriter.close();
damping_writer.close(); dampingWriter.close();
Python::stop(); Python::stop();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment