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

Rename: u -> u_old; use solution instead of u everywhere

parent 038364b7
No related branches found
No related tags found
No related merge requests found
...@@ -191,13 +191,12 @@ int main(int argc, char *argv[]) { ...@@ -191,13 +191,12 @@ int main(int argc, char *argv[]) {
leafView, p1Basis, frictionalNodes); leafView, p1Basis, frictionalNodes);
// {{{ Initialise vectors // {{{ Initialise vectors
VectorType u(finestSize); VectorType u_old(finestSize);
u = 0.0; // Has to be zero! u_old = 0.0; // Has to be zero!
VectorType u_previous; VectorType u_old_old;
VectorType u_diff(finestSize); VectorType u_diff(finestSize);
u_diff = 0.0; // Has to be zero! u_diff = 0.0; // Has to be zero!
// temporary storage for u
VectorType solution(finestSize); VectorType solution(finestSize);
SingletonVectorType alpha_old(finestSize); SingletonVectorType alpha_old(finestSize);
...@@ -257,7 +256,7 @@ int main(int argc, char *argv[]) { ...@@ -257,7 +256,7 @@ int main(int argc, char *argv[]) {
VectorType problem_rhs(finestSize); VectorType problem_rhs(finestSize);
VectorType problem_iterate(finestSize); VectorType problem_iterate(finestSize);
VectorType *u_old_old_ptr = (run == 1) ? nullptr : &u_previous; VectorType *u_old_old_ptr = (run == 1) ? nullptr : &u_old_old;
typedef TimeSteppingScheme<VectorType, MatrixType, typedef TimeSteppingScheme<VectorType, MatrixType,
decltype(dirichletFunction), dim> TS; decltype(dirichletFunction), dim> TS;
...@@ -269,16 +268,16 @@ int main(int argc, char *argv[]) { ...@@ -269,16 +268,16 @@ int main(int argc, char *argv[]) {
Dune::shared_ptr<TS> timeSteppingScheme; Dune::shared_ptr<TS> timeSteppingScheme;
if (run == 1 || !parset.get<bool>("implicitTwoStep")) if (run == 1 || !parset.get<bool>("implicitTwoStep"))
timeSteppingScheme = timeSteppingScheme =
Dune::make_shared<IE>(ell, stiffnessMatrix, u, u_old_old_ptr, Dune::make_shared<IE>(ell, stiffnessMatrix, u_old, u_old_old_ptr,
ignoreNodes, dirichletFunction, time, tau); ignoreNodes, dirichletFunction, time, tau);
else else
timeSteppingScheme = timeSteppingScheme =
Dune::make_shared<ITS>(ell, stiffnessMatrix, u, u_old_old_ptr, Dune::make_shared<ITS>(ell, stiffnessMatrix, u_old, u_old_old_ptr,
ignoreNodes, dirichletFunction, time, tau); ignoreNodes, dirichletFunction, time, tau);
timeSteppingScheme->setup(problem_rhs, problem_iterate, problem_A); timeSteppingScheme->setup(problem_rhs, problem_iterate, problem_A);
VectorType solution_saved = u; VectorType solution_saved = u_old;
auto const state_fpi_max = auto const state_fpi_max =
parset.get<size_t>("solver.tnnmg.fixed_point_iterations"); parset.get<size_t>("solver.tnnmg.fixed_point_iterations");
for (size_t state_fpi = 1; state_fpi <= state_fpi_max; ++state_fpi) { for (size_t state_fpi = 1; state_fpi <= state_fpi_max; ++state_fpi) {
...@@ -346,8 +345,8 @@ int main(int argc, char *argv[]) { ...@@ -346,8 +345,8 @@ int main(int argc, char *argv[]) {
double out; double out;
neumannFunction.evaluate(time, out); neumannFunction.evaluate(time, out);
octave_writer << alpha[first_frictional_node][0] << " " octave_writer << alpha[first_frictional_node][0] << " "
<< u[first_frictional_node][0] * 1e6 << " " << out << solution[first_frictional_node][0] * 1e6 << " "
<< std::endl; << out << std::endl;
} }
// Comparison with the analytic solution of a velocity stepping test // Comparison with the analytic solution of a velocity stepping test
...@@ -392,8 +391,8 @@ int main(int argc, char *argv[]) { ...@@ -392,8 +391,8 @@ int main(int argc, char *argv[]) {
std::cout << u_diff[i][0] * timesteps << " "; std::cout << u_diff[i][0] * timesteps << " ";
std::cout << std::endl; std::cout << std::endl;
} }
u_previous = u; u_old_old = u_old;
u = solution; u_old = solution;
alpha_old = alpha; alpha_old = alpha;
// Compute von Mises stress and write everything to a file // Compute von Mises stress and write everything to a file
...@@ -401,12 +400,12 @@ int main(int argc, char *argv[]) { ...@@ -401,12 +400,12 @@ int main(int argc, char *argv[]) {
VonMisesStressAssembler<GridType> localStressAssembler( VonMisesStressAssembler<GridType> localStressAssembler(
E, nu, E, nu,
Dune::make_shared<BasisGridFunction<P1Basis, VectorType> const>( Dune::make_shared<BasisGridFunction<P1Basis, VectorType> const>(
p1Basis, u)); p1Basis, solution));
FunctionalAssembler<P0Basis>(p0Basis) FunctionalAssembler<P0Basis>(p0Basis)
.assemble(localStressAssembler, vonMisesStress, true); .assemble(localStressAssembler, vonMisesStress, true);
writeVtk<P1Basis, P0Basis, VectorType, SingletonVectorType, GridView>( writeVtk<P1Basis, P0Basis, VectorType, SingletonVectorType, GridView>(
p1Basis, u, alpha, p0Basis, vonMisesStress, leafView, p1Basis, solution, alpha, p0Basis, vonMisesStress, leafView,
(boost::format("obs%d") % run).str()); (boost::format("obs%d") % run).str());
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment