From 9175ef7d4d3848ae492f93eb02cd349045017319 Mon Sep 17 00:00:00 2001 From: Oliver Sander <oliver.sander@tu-dresden.de> Date: Mon, 30 Nov 2015 07:19:09 +0100 Subject: [PATCH] Print the average deformation of the output deformation at the end --- src/mixed-cosserat-continuum.cc | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/mixed-cosserat-continuum.cc b/src/mixed-cosserat-continuum.cc index 7a55bae9..9a3512eb 100644 --- a/src/mixed-cosserat-continuum.cc +++ b/src/mixed-cosserat-continuum.cc @@ -195,6 +195,10 @@ int main (int argc, char *argv[]) try BoundaryPatch<GridView> dirichletBoundary(gridView, dirichletVertices); BoundaryPatch<GridView> neumannBoundary(gridView, neumannVertices); + BitSetVector<1> neumannNodes(deformationFEBasis.indexSet().size(), false); + constructBoundaryDofs(neumannBoundary,fufemDeformationFEBasis,neumannNodes); + + if (mpiHelper.rank()==0) std::cout << "Neumann boundary has " << neumannBoundary.numFaces() << " faces\n"; @@ -352,7 +356,7 @@ int main (int argc, char *argv[]) try solver.setInitialIterate(xDisp,xOrient); solver.solve(); - //x = solver.getSol(); + std::tie(xDisp,xOrient) = solver.getSol(); // Output result of each homotopy step std::stringstream iAsAscii; @@ -363,6 +367,24 @@ int main (int argc, char *argv[]) try } + // ////////////////////////////// + // Output result + // ////////////////////////////// + + // finally: compute the average deformation of the Neumann boundary + // That is what we need for the locking tests + FieldVector<double,3> averageDef(0); + for (size_t i=0; i<xDisp.size(); i++) + if (neumannNodes[i][0]) + averageDef += xDisp[i].globalCoordinates(); + averageDef /= neumannNodes.count(); + + if (mpiHelper.rank()==0) + { + std::cout << "Neumann values = " << parameterSet.get<FieldVector<double, 3> >("neumannValues") << " " + << ", average deflection: " << averageDef << std::endl; + } + } catch (Exception e) { std::cout << e << std::endl; -- GitLab