diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 6aecb38021865f32dcd93738b71bc409b010b65a..4b5586fb0c45ea7c9fba9038ff16ac8ee21801bb 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -266,7 +266,9 @@ int main(int argc, char *argv[]) { mySolver(parset.sub("solver.tnnmg"), refinements, solver_tolerance, *grid, ignoreNodes); - std::fstream octave_writer("data", std::fstream::out); + std::fstream state_writer("state", std::fstream::out); + std::fstream displacement_writer("displacement", std::fstream::out); + std::fstream velocity_writer("velocity", std::fstream::out); std::fstream coefficient_writer("coefficient", std::fstream::out); std::fstream velocity_stepping_writer("velocity_stepping", std::fstream::out); @@ -280,10 +282,6 @@ int main(int argc, char *argv[]) { auto const timesteps = parset.get<size_t>("timeSteps"); double const tau = 1.0 / timesteps; - octave_writer << "# name: A" << std::endl << "# type: matrix" << std::endl - << "# rows: " << timesteps << std::endl << "# columns: 3" - << std::endl; - velocity_stepping_writer << "# name: B" << std::endl << "# type: matrix" << std::endl << "# rows: " << timesteps << std::endl << "# columns: 2" << std::endl; @@ -405,16 +403,6 @@ int main(int argc, char *argv[]) { if (parset.get<bool>("printProgress")) std::cerr << std::endl; - // Record the state, (scaled) displacement, and Neumann - // condition at a fixed node - if (parset.get<bool>("writeEvolution")) { - double out; - neumannFunction.evaluate(time, out); - octave_writer << alpha[first_frictional_node][0] << " " - << u[first_frictional_node][0] * 1e6 << " " << out - << std::endl; - } - // Comparison with the analytic solution of a velocity stepping test // with the Ruina state evolution law. // Jumps at 120 and 360 timesteps; v1 = .6 * v2; @@ -440,24 +428,31 @@ int main(int argc, char *argv[]) { } velocity_stepping_writer << euler << " " << direct << std::endl; } - - // Record the coefficient of friction at a fixed node - if (parset.get<bool>("printCoefficient")) { - double const V = ud[first_frictional_node].two_norm(); - double const state = alpha[first_frictional_node]; - - coefficient_writer << (mu + a * std::log(V * eta) + - b * (state - std::log(eta * L))) << std::endl; - } } alpha_old = alpha; - if (parset.get<bool>("printFrictionalVelocity")) { + { // Write all kinds of data + for (size_t i = 0; i < frictionalNodes.size(); ++i) + if (frictionalNodes[i][0]) + state_writer << alpha[i][0] << " "; + state_writer << std::endl; + + for (size_t i = 0; i < frictionalNodes.size(); ++i) + if (frictionalNodes[i][0]) + displacement_writer << u[i][0] << " "; + displacement_writer << std::endl; + + for (size_t i = 0; i < frictionalNodes.size(); ++i) + if (frictionalNodes[i][0]) + velocity_writer << ud[i][0] << " "; + velocity_writer << std::endl; + for (size_t i = 0; i < frictionalNodes.size(); ++i) if (frictionalNodes[i][0]) - std::cout << ud[i][0] << " "; - std::cout << std::endl; + coefficient_writer << mu + a *std::log(ud[i].two_norm() * eta) + + b * (alpha[i] - std::log(eta * L)) << " "; + coefficient_writer << std::endl; } // Compute von Mises stress and write everything to a file @@ -478,7 +473,9 @@ int main(int argc, char *argv[]) { std::cerr << std::endl << "Making " << timesteps << " time steps took " << timer.elapsed() << "s" << std::endl; - octave_writer.close(); + state_writer.close(); + displacement_writer.close(); + velocity_writer.close(); coefficient_writer.close(); velocity_stepping_writer.close(); diff --git a/src/one-body-sample.parset b/src/one-body-sample.parset index 47257fab3dc33926ba31ad8b02ef389cbbe20439..1bb03df59ee0132dea858d562681bbe8d8c288ec 100644 --- a/src/one-body-sample.parset +++ b/src/one-body-sample.parset @@ -2,11 +2,8 @@ timeSteps = 1000 verbose = false -printCoefficient = false -printFrictionalVelocity = false printProgress = false -writeEvolution = false writeVTK = false printVelocitySteppingComparison = false