From 08d37d879597e98aecda190d1ecdd0697322469d Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Sun, 13 Nov 2011 21:24:49 +0100 Subject: [PATCH] The current globalnonlinearity was Laursen's --- dune/tectonic/globallaursennonlinearity.hh | 52 ++++++++++++++++++++++ dune/tectonic/globalnonlinearity.hh | 33 +------------- src/one-body-sample.cc | 6 +-- 3 files changed, 56 insertions(+), 35 deletions(-) create mode 100644 dune/tectonic/globallaursennonlinearity.hh diff --git a/dune/tectonic/globallaursennonlinearity.hh b/dune/tectonic/globallaursennonlinearity.hh new file mode 100644 index 00000000..539abedb --- /dev/null +++ b/dune/tectonic/globallaursennonlinearity.hh @@ -0,0 +1,52 @@ +/* -*- mode:c++; mode:semantic -*- */ + +#ifndef DUNE_TECTONIC_GLOBAL_LAURSEN_NONLINEARITY_HH +#define DUNE_TECTONIC_GLOBAL_LAURSEN_NONLINEARITY_HH + +#include <dune/common/fvector.hh> + +#include "globalnonlinearity.hh" + +namespace Dune { +template <int dim, class OuterFunctionType> +class GlobalLaursenNonlinearity + : public Dune::GlobalNonlinearity<dim, OuterFunctionType> { +public: + GlobalLaursenNonlinearity( + std::vector<double> const &coefficientOfFriction, + std::vector<double> const &normalStress, + std::vector<Dune::FieldVector<double, 1>> const &nodalIntegrals) + : coefficientOfFriction(coefficientOfFriction), + normalStress(normalStress), + nodalIntegrals(nodalIntegrals) {} + + /* + Return a restriction of the outer function to the i'th node. If + mu and sigma_n denote the coefficient of friction and the normal + stress, respectively, at the i'th node, this function is given + by + + sigma_n [(1/eta \bar Gamma)* + mu id] + + TODO: We chose Gamma = id, so that (\bar Gamma)* = \Gamma^{-1} + = id^{-1} = id. The factor 1/eta cancels in this special case, leaving us + with + + sigma_n [id + mu id] = sigma_n (1 + mu) id + */ + virtual void restriction(int i, OuterFunctionType &f) const { + double coefficient = nodalIntegrals[i][0]; + coefficient *= normalStress[i]; + coefficient *= 1 + coefficientOfFriction[i]; + f = OuterFunctionType(coefficient); + } + +private: + // TODO: If we're clever, we only store one vector with the precomputed + // results + std::vector<double> coefficientOfFriction; + std::vector<double> normalStress; + std::vector<Dune::FieldVector<double, 1>> nodalIntegrals; +}; +} +#endif diff --git a/dune/tectonic/globalnonlinearity.hh b/dune/tectonic/globalnonlinearity.hh index a33e4a4e..a72c2bb2 100644 --- a/dune/tectonic/globalnonlinearity.hh +++ b/dune/tectonic/globalnonlinearity.hh @@ -8,41 +8,10 @@ namespace Dune { template <int dim, class OuterFunctionType> class GlobalNonlinearity { public: - GlobalNonlinearity( - std::vector<double> const &coefficientOfFriction, - std::vector<double> const &normalStress, - std::vector<Dune::FieldVector<double, 1>> const &nodalIntegrals) - : coefficientOfFriction(coefficientOfFriction), - normalStress(normalStress), - nodalIntegrals(nodalIntegrals) {} - /* Return a restriction of the outer function to the i'th node. If - mu and sigma_n denote the coefficient of friction and the normal - stress, respectively, at the i'th node, this function is given - by - - sigma_n [(1/eta \bar Gamma)* + mu id] - - TODO: We chose Gamma = id, so that (\bar Gamma)* = \Gamma^{-1} - = id^{-1} = id. The factor 1/eta cancels in this special case, leaving us - with - - sigma_n [id + mu id] = sigma_n (1 + mu) id */ - void restriction(int i, OuterFunctionType &f) const { - double coefficient = nodalIntegrals[i][0]; - coefficient *= normalStress[i]; - coefficient *= 1 + coefficientOfFriction[i]; - f = OuterFunctionType(coefficient); - } - -private: - // TODO: If we're clever, we only store one vector with the precomputed - // results - std::vector<double> coefficientOfFriction; - std::vector<double> normalStress; - std::vector<Dune::FieldVector<double, 1>> nodalIntegrals; + virtual void restriction(int i, OuterFunctionType &f) const = 0; }; } #endif diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 826e7dee..3b0b6146 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -41,7 +41,7 @@ #include <dune/solvers/solvers/loopsolver.hh> #include <dune/tnnmg/iterationsteps/genericnonlineargs.hh> -#include <dune/tectonic/globalnonlinearity.hh> +#include <dune/tectonic/globallaursennonlinearity.hh> #include <dune/tectonic/myconvexproblem.hh> #include <dune/tectonic/myblockproblem.hh> @@ -226,8 +226,8 @@ int main(int argc, char *argv[]) { std::fill(coefficientOfFriction.begin(), coefficientOfFriction.end(), parset.get<double>("boundary.mu")); - Dune::GlobalNonlinearity<dim, Dune::LinearFunction> myGlobalNonlinearity( - coefficientOfFriction, normalStress, nodalIntegrals); + Dune::GlobalLaursenNonlinearity<dim, Dune::LinearFunction> + myGlobalNonlinearity(coefficientOfFriction, normalStress, nodalIntegrals); // }}} { -- GitLab