From 522f9cb275d42d5105b60a1e205ed4b377b5e586 Mon Sep 17 00:00:00 2001
From: Lisa Julia Nebel <lisa_julia.nebel@tu-dresden.de>
Date: Wed, 9 Jun 2021 15:37:07 +0200
Subject: [PATCH] Correct the sign of the Neumann and volume forces to make it
 consistent throughout dune-gfe and dune-elasticity

In the energy file, the energies are *added*.
The Neumann and volume forces get the correct sign in the actual program file by mulitplying with (-homotopyParameter).
---
 dune/gfe/cosseratenergystiffness.hh      | 4 ++--
 dune/gfe/nonplanarcosseratshellenergy.hh | 4 ++--
 src/cosserat-continuum.cc                | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dune/gfe/cosseratenergystiffness.hh b/dune/gfe/cosseratenergystiffness.hh
index 197a1d11..af54e5f1 100644
--- a/dune/gfe/cosseratenergystiffness.hh
+++ b/dune/gfe/cosseratenergystiffness.hh
@@ -371,7 +371,7 @@ energy(const typename Basis::LocalView& localView,
 
         // Only translational dofs are affected by the volume load
         for (size_t i=0; i<volumeLoadDensity.size(); i++)
-            energy -= thickness_ * (volumeLoadDensity[i] * value.r[i]) * quad[pt].weight() * integrationElement;
+            energy += thickness_ * (volumeLoadDensity[i] * value.r[i]) * quad[pt].weight() * integrationElement;
     }
 
 
@@ -405,7 +405,7 @@ energy(const typename Basis::LocalView& localView,
 
             // Only translational dofs are affected by the Neumann force
             for (size_t i=0; i<neumannValue.size(); i++)
-                energy -= thickness_ * (neumannValue[i] * value.r[i]) * quad[pt].weight() * integrationElement;
+                energy += thickness_ * (neumannValue[i] * value.r[i]) * quad[pt].weight() * integrationElement;
 
         }
 
diff --git a/dune/gfe/nonplanarcosseratshellenergy.hh b/dune/gfe/nonplanarcosseratshellenergy.hh
index 7061eab8..97a1b6bd 100644
--- a/dune/gfe/nonplanarcosseratshellenergy.hh
+++ b/dune/gfe/nonplanarcosseratshellenergy.hh
@@ -334,7 +334,7 @@ energy(const typename Basis::LocalView& localView,
 
     // Only translational dofs are affected by the volume load
     for (size_t i=0; i<volumeLoadDensity.size(); i++)
-      energy -= thickness_ * (volumeLoadDensity[i] * value.r[i]) * quad[pt].weight() * integrationElement;
+      energy += thickness_ * (volumeLoadDensity[i] * value.r[i]) * quad[pt].weight() * integrationElement;
   }
 
 
@@ -367,7 +367,7 @@ energy(const typename Basis::LocalView& localView,
 
       // Only translational dofs are affected by the Neumann force
       for (size_t i=0; i<neumannValue.size(); i++)
-        energy -= thickness_ * (neumannValue[i] * value.r[i]) * quad[pt].weight() * integrationElement;
+        energy += thickness_ * (neumannValue[i] * value.r[i]) * quad[pt].weight() * integrationElement;
     }
 
   }
diff --git a/src/cosserat-continuum.cc b/src/cosserat-continuum.cc
index 348182cf..b4aa70ab 100644
--- a/src/cosserat-continuum.cc
+++ b/src/cosserat-continuum.cc
@@ -398,7 +398,7 @@ int main (int argc, char *argv[]) try
 
     auto neumannFunction = [&]( FieldVector<double,dimworld> ) {
       auto nV = neumannValues;
-      nV *= homotopyParameter;
+      nV *= (-homotopyParameter);
       return nV;
     };
 
@@ -408,7 +408,7 @@ int main (int argc, char *argv[]) try
 
     auto volumeLoad = [&]( FieldVector<double,dimworld>) {
       auto vL = volumeLoadValues;
-      vL *= homotopyParameter;
+      vL *= (-homotopyParameter);
       return vL;
     };
 
-- 
GitLab