From c0c388f7d53e774636490cb392005c0a31de39ee Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel <lisa_julia.nebel@tu-dresden.de> Date: Wed, 4 Aug 2021 13:41:45 +0300 Subject: [PATCH] Print relative stretch of elastic material in x-direction at the end --- src/film-on-substrate.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/film-on-substrate.cc b/src/film-on-substrate.cc index 89e73a6a..8978172a 100644 --- a/src/film-on-substrate.cc +++ b/src/film-on-substrate.cc @@ -333,9 +333,12 @@ int main (int argc, char *argv[]) try BlockVector<FieldVector<double,dim> > identity(compositeBasis.size({0})); Dune::Functions::interpolate(deformationPowerBasis, identity, [](FieldVector<double,dim> x){ return x; }); - + + double max_x = 0; + double initial_max_x = 0; for (int i = 0; i < displacement.size(); i++) { x[_0][i] = displacement[i]; //Copy over the initial deformation to the deformation part of x + initial_max_x = std::max(x[_0][i][0], initial_max_x); displacement[i] -= identity[i]; //Subtract identity to get the initial displacement as a function } auto displacementFunction = Dune::Functions::makeDiscreteGlobalBasisFunction<FieldVector<double,dim>>(deformationPowerBasis, displacement); @@ -654,6 +657,14 @@ int main (int argc, char *argv[]) try vtkWriter.addVertexData(displacementFunction, VTK::FieldInfo("displacement", VTK::FieldInfo::Type::scalar, dim)); vtkWriter.write(resultPath + "finite-strain_homotopy_" + parameterSet.get<std::string>("energy") + "_" + std::to_string(neumannValues[0]) + "_" + std::to_string(i+1)); } + for (int i = 0; i < x[_0].size(); i++) { + max_x = std::max(x[_0][i][0], max_x); + } + + if (mpiHelper.rank()==0) { + std::cout << "Maximal value in x-direction: " << max_x << ", this is a stretch in of " << 100*(max_x - initial_max_x)/initial_max_x << " %." << std::endl; + } + std::string ending = grid->leafGridView().comm().size() > 1 ? std::to_string(mpiHelper.rank()) : ""; std::ofstream file; std::string pathToOutput = parameterSet.hasKey("pathToOutput") ? parameterSet.get<std::string>("pathToOutput") : "./"; -- GitLab