From fe544f58385b57a96cd0ede2d4be8ef684a0c02e Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Fri, 5 Oct 2012 16:22:28 +0200
Subject: [PATCH] Store normal stress in a vector

---
 src/assemblers.cc      | 5 +----
 src/assemblers.hh      | 3 +--
 src/assemblers_tmpl.cc | 2 +-
 src/one-body-sample.cc | 8 +++++++-
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/assemblers.cc b/src/assemblers.cc
index cad3e273..c3e3c414 100644
--- a/src/assemblers.cc
+++ b/src/assemblers.cc
@@ -58,7 +58,7 @@ assemble_nonlinearity(
     Dune::ParameterTree const &parset,
     Dune::BlockVector<Dune::FieldVector<double, 1>> const &nodalIntegrals,
     Dune::BlockVector<Dune::FieldVector<double, 1>> const &state,
-    double scalarNormalStress) {
+    Dune::BlockVector<Dune::FieldVector<double, 1>> const &normalStress) {
   auto const size = nodalIntegrals.size();
 
   typedef Dune::BlockVector<Dune::FieldVector<double, 1>> SingletonVectorType;
@@ -66,9 +66,6 @@ assemble_nonlinearity(
   SingletonVectorType mu(size);
   mu = parset.get<double>("mu");
 
-  SingletonVectorType normalStress(size);
-  normalStress = scalarNormalStress;
-
   switch (parset.get<Config::model>("model")) {
     case Config::Exponential: {
       SingletonVectorType a(size);
diff --git a/src/assemblers.hh b/src/assemblers.hh
index 12b49c1f..dd2a1cf2 100644
--- a/src/assemblers.hh
+++ b/src/assemblers.hh
@@ -28,6 +28,5 @@ assemble_nonlinearity(
     Dune::ParameterTree const &parset,
     Dune::BlockVector<Dune::FieldVector<double, 1>> const &nodalIntegrals,
     Dune::BlockVector<Dune::FieldVector<double, 1>> const &state,
-    double scalarNormalStress);
-
+    Dune::BlockVector<Dune::FieldVector<double, 1>> const &normalStress);
 #endif
diff --git a/src/assemblers_tmpl.cc b/src/assemblers_tmpl.cc
index f20d3a3b..9418d1ba 100644
--- a/src/assemblers_tmpl.cc
+++ b/src/assemblers_tmpl.cc
@@ -35,4 +35,4 @@ assemble_nonlinearity<MatrixType, VectorType>(
     Dune::ParameterTree const &parset,
     Dune::BlockVector<Dune::FieldVector<double, 1>> const &nodalIntegrals,
     Dune::BlockVector<Dune::FieldVector<double, 1>> const &state,
-    double scalarNormalStress);
+    Dune::BlockVector<Dune::FieldVector<double, 1>> const &normalStress);
diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc
index b3d1420e..d9148a1b 100644
--- a/src/one-body-sample.cc
+++ b/src/one-body-sample.cc
@@ -256,6 +256,12 @@ int main(int argc, char *argv[]) {
     SingletonVectorType alpha(alpha_old);
 
     SingletonVectorType vonMisesStress;
+
+    SingletonVectorType surfaceNormalStress(finestSize);
+    surfaceNormalStress = 0.0;
+    for (size_t i = 0; i < frictionalNodes.size(); ++i)
+      if (frictionalNodes[i][0])
+        surfaceNormalStress[i] = normalStress;
     // }}}
 
     typedef MyConvexProblem<MatrixType, VectorType> MyConvexProblemType;
@@ -345,7 +351,7 @@ int main(int argc, char *argv[]) {
           auto myGlobalNonlinearity =
               assemble_nonlinearity<MatrixType, VectorType>(
                   parset.sub("boundary.friction"), *nodalIntegrals, alpha,
-                  normalStress);
+                  surfaceNormalStress);
 
           MyConvexProblemType const myConvexProblem(
               problem_A, *myGlobalNonlinearity, problem_rhs);
-- 
GitLab