From b8d3bc270db74960e02646e4f9b9b39d8f9843b8 Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Fri, 28 Jun 2013 14:10:00 +0000 Subject: [PATCH] allow to specify a constant Neumann boundary function from the parameter file [[Imported from SVN: r9278]] --- cosserat-continuum.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cosserat-continuum.cc b/cosserat-continuum.cc index cff9b6c8..1dde871f 100644 --- a/cosserat-continuum.cc +++ b/cosserat-continuum.cc @@ -81,18 +81,23 @@ void dirichletValues(const FieldVector<double,dim>& in, FieldVector<double,3>& o } +/** \brief A constant vector-valued function, for simple Neumann boundary values */ struct NeumannFunction : public Dune::VirtualFunction<FieldVector<double,dim>, FieldVector<double,3> > { - NeumannFunction(double homotopyParameter) - : homotopyParameter_(homotopyParameter) + NeumannFunction(const FieldVector<double,3> values, + double homotopyParameter) + : values_(values), + homotopyParameter_(homotopyParameter) {} void evaluate(const FieldVector<double, dim>& x, FieldVector<double,3>& out) const { out = 0; + out.axpy(homotopyParameter_, values_); out[2] = -40*homotopyParameter_; } + FieldVector<double,3> values_; double homotopyParameter_; }; @@ -236,7 +241,8 @@ int main (int argc, char *argv[]) try // //////////////////////////////////////////////////////////// const ParameterTree& materialParameters = parameterSet.sub("materialParameters"); - NeumannFunction neumannFunction(homotopyParameter); + NeumannFunction neumannFunction(parameterSet.get<FieldVector<double,3> >("neumannValues"), + homotopyParameter); std::cout << "Material parameters:" << std::endl; materialParameters.report(); -- GitLab