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

Work with velocities rather than differences

parent 19e86cbd
Branches
No related tags found
No related merge requests found
...@@ -194,10 +194,10 @@ int main(int argc, char *argv[]) { ...@@ -194,10 +194,10 @@ int main(int argc, char *argv[]) {
VectorType u_old(finestSize); VectorType u_old(finestSize);
u_old = 0.0; // Has to be zero! u_old = 0.0; // Has to be zero!
VectorType u_old_old; VectorType u_old_old;
VectorType u_diff(finestSize);
u_diff = 0.0; // Has to be zero!
VectorType u(finestSize); VectorType u(finestSize);
VectorType ud(finestSize);
ud = 0.0;
SingletonVectorType alpha_old(finestSize); SingletonVectorType alpha_old(finestSize);
alpha_old = parset.get<double>("boundary.friction.state.initial"); alpha_old = parset.get<double>("boundary.friction.state.initial");
...@@ -298,12 +298,12 @@ int main(int argc, char *argv[]) { ...@@ -298,12 +298,12 @@ int main(int argc, char *argv[]) {
overallSolver.solve(); overallSolver.solve();
timeSteppingScheme->extractSolution(problem_iterate, u); timeSteppingScheme->extractSolution(problem_iterate, u);
timeSteppingScheme->extractDifference(problem_iterate, u_diff); timeSteppingScheme->extractVelocity(problem_iterate, ud);
// Update the state // Update the state
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]) {
double const unorm = u_diff[i].two_norm(); double const unorm = ud[i].two_norm() * tau;
// // the (logarithmic) steady state corresponding to the // // the (logarithmic) steady state corresponding to the
// // current velocity // // current velocity
...@@ -353,7 +353,7 @@ int main(int argc, char *argv[]) { ...@@ -353,7 +353,7 @@ int main(int argc, char *argv[]) {
// with the Ruina state evolution law. // with the Ruina state evolution law.
// Jumps at 120 and 360 timesteps; v1 = .6 * v2; // Jumps at 120 and 360 timesteps; v1 = .6 * v2;
if (parset.get<bool>("printVelocitySteppingComparison")) { if (parset.get<bool>("printVelocitySteppingComparison")) {
double const v = u_diff[first_frictional_node].two_norm() / tau / L; double const v = ud[first_frictional_node].two_norm() / L;
double const euler = alpha[first_frictional_node]; double const euler = alpha[first_frictional_node];
double direct; double direct;
...@@ -377,7 +377,7 @@ int main(int argc, char *argv[]) { ...@@ -377,7 +377,7 @@ int main(int argc, char *argv[]) {
// Record the coefficient of friction at a fixed node // Record the coefficient of friction at a fixed node
if (parset.get<bool>("printCoefficient")) { if (parset.get<bool>("printCoefficient")) {
double const V = u_diff[first_frictional_node].two_norm(); double const V = ud[first_frictional_node].two_norm();
double const state = alpha[first_frictional_node]; double const state = alpha[first_frictional_node];
coefficient_writer << (mu + a * std::log(V * eta) + coefficient_writer << (mu + a * std::log(V * eta) +
...@@ -388,7 +388,7 @@ int main(int argc, char *argv[]) { ...@@ -388,7 +388,7 @@ int main(int argc, char *argv[]) {
if (parset.get<bool>("printFrictionalVelocity")) { if (parset.get<bool>("printFrictionalVelocity")) {
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])
std::cout << u_diff[i][0] * timesteps << " "; std::cout << ud[i][0] << " ";
std::cout << std::endl; std::cout << std::endl;
} }
u_old_old = u_old; u_old_old = u_old;
......
...@@ -23,8 +23,8 @@ class TimeSteppingScheme { ...@@ -23,8 +23,8 @@ class TimeSteppingScheme {
void virtual extractSolution(VectorType const &problem_iterate, void virtual extractSolution(VectorType const &problem_iterate,
VectorType &solution) const = 0; VectorType &solution) const = 0;
void virtual extractDifference(VectorType const &problem_iterate, void virtual extractVelocity(VectorType const &problem_iterate,
VectorType &difference) const = 0; VectorType &velocity) const = 0;
protected: protected:
VectorType const &ell; VectorType const &ell;
...@@ -84,10 +84,9 @@ class ImplicitEuler ...@@ -84,10 +84,9 @@ class ImplicitEuler
solution.axpy(this->tau, problem_iterate); solution.axpy(this->tau, problem_iterate);
} }
void virtual extractDifference(VectorType const &problem_iterate, void virtual extractVelocity(VectorType const &problem_iterate,
VectorType &difference) const { VectorType &velocity) const {
difference = problem_iterate; velocity = problem_iterate;
difference *= this->tau;
} }
}; };
...@@ -151,9 +150,8 @@ class ImplicitTwoStep ...@@ -151,9 +150,8 @@ class ImplicitTwoStep
} }
} }
void virtual extractDifference(VectorType const &problem_iterate, void virtual extractVelocity(VectorType const &problem_iterate,
VectorType &difference) const { VectorType &velocity) const {
difference = problem_iterate; velocity = problem_iterate;
difference *= this->tau;
} }
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment