From 1fda0c35d6e9a958830983a2361d4311b688b460 Mon Sep 17 00:00:00 2001
From: Robert K <robertk@posteo.org>
Date: Sat, 13 Feb 2016 22:33:02 +0100
Subject: [PATCH] [bugfix] make pulse work on unit square.

---
 .../examples/advdiff/algorithmcreator.hh      |  2 +-
 .../fem-dg/examples/advdiff/problems/pulse.hh | 20 +++++++++++++------
 .../examples/advdiff/test/parameter_cmake     | 16 +++++++--------
 3 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/dune/fem-dg/examples/advdiff/algorithmcreator.hh b/dune/fem-dg/examples/advdiff/algorithmcreator.hh
index 3212c4f7..293553ea 100644
--- a/dune/fem-dg/examples/advdiff/algorithmcreator.hh
+++ b/dune/fem-dg/examples/advdiff/algorithmcreator.hh
@@ -60,7 +60,7 @@ namespace Fem
                                      AdvectionLimiter::Enum::unlimited,
                                      Matrix::Enum::matrixfree,
                                      AdvectionFlux::Enum::upwind,
-                                     PrimalDiffusionFlux::Enum::general > AC;
+                                     PrimalDiffusionFlux::Enum::cdg2 > AC;
 
       typedef typename AC::GridType                         GridType;
       typedef typename AC::GridParts                        HostGridPartType;
diff --git a/dune/fem-dg/examples/advdiff/problems/pulse.hh b/dune/fem-dg/examples/advdiff/problems/pulse.hh
index 981ea314..c7b9cf46 100644
--- a/dune/fem-dg/examples/advdiff/problems/pulse.hh
+++ b/dune/fem-dg/examples/advdiff/problems/pulse.hh
@@ -48,11 +48,11 @@ namespace Fem
       startTime_( ParameterType::getValue<double>("femdg.stepper.starttime",0.0) ),
       epsilon_( ParameterType::getValue<double>("epsilon",0.1) ),
       spotmid_( 0 ),
-      myName_("AdvDiff")
+      center_( 0.5 ), // assume unit square
+      myName_("pulse")
     {
       spotmid_[0] = -0.25;
       std::cout <<"Problem: "<<myName_<< ", epsilon " << epsilon_ << "\n";
-      //std::cout <<"Problem: HeatEqnWithAdvection, epsilon_" <<  epsilon_ << "\n";
     }
 
     //! this problem has no source term
@@ -92,8 +92,8 @@ namespace Fem
     void velocity(const DomainType& x, DomainType& v) const
     {
       // rotation in 2d
-      v[0] = -4.0*x[1];
-      v[1] =  4.0*x[0];
+      v[0] = -4.0*(x[1] - center_[ 1 ]);
+      v[1] =  4.0*(x[0] - center_[ 0 ]);
       for(int i=2; i<DomainType :: dimension; ++i) v[i] = 0;
     }
 
@@ -110,8 +110,8 @@ namespace Fem
      */
     void evaluate(const DomainType& arg, const double t, RangeType& res) const
     {
-      const double x = arg[0];// - center_[ 0 ];
-      const double y = arg[1];// - center_[ 1 ];
+      const double x = arg[0] - center_[ 0 ];
+      const double y = arg[1] - center_[ 1 ];
 
       const double sig2 = 0.004; /* Siehe Paper P.Bastian Gl. 30 */
       const double sig2PlusDt4 = sig2+(4.0*epsilon_*t);
@@ -136,6 +136,13 @@ namespace Fem
       return ofs.str();
     }
 
+    // return prefix for data loops
+    virtual std::string dataPrefix() const
+    {
+      return myName_;
+    }
+
+
     /*  \brief finalize the simulation using the calculated numerical
      *  solution u for this problem
      *
@@ -151,6 +158,7 @@ namespace Fem
     const double  startTime_;
     const double  epsilon_;
     DomainType spotmid_;
+    DomainType center_;
     std::string myName_;
   };
 
diff --git a/dune/fem-dg/examples/advdiff/test/parameter_cmake b/dune/fem-dg/examples/advdiff/test/parameter_cmake
index 225cb8a4..68aeaa84 100644
--- a/dune/fem-dg/examples/advdiff/test/parameter_cmake
+++ b/dune/fem-dg/examples/advdiff/test/parameter_cmake
@@ -1,6 +1,6 @@
 # DATA WRITER
 #------------
-fem.io.datafileprefix: heat # prefix data data files 
+fem.io.datafileprefix: advdiff # prefix data data files 
 fem.io.savestep: 0.1 # save data every time interval 
 fem.io.savecount: -1 # save every i-th step
 
@@ -17,21 +17,20 @@ gridsol.filename: heat-checkpoint
 #--------
 paramfile: ../../parameter/paramBase
 
-
 # PROBLEM SETUP
 #--------------
 
 # problem: heat, quasi, plaplace
-#problem: deformational
 problem: pulse
 
+fem.eoc.steps: 5
 femdg.stepper.endtime: 1.0
 femdg.stepper.diffusiontimestep: 1
-epsilon: 1.0
-plaplace: 3.0 
-xvelocity: 1.    # the only advection part for the linear heat eqn
-yvelocity: 3.    # the only advection part for the linear heat eqn
-zvelocity: 0.    # the only advection part for the linear heat eqn
+epsilon: 0.001
+#plaplace: 3.0 
+#xvelocity: 1.    # the only advection part for the linear heat eqn
+#yvelocity: 3.    # the only advection part for the linear heat eqn
+#zvelocity: 0.    # the only advection part for the linear heat eqn
 
 
 # DOMAIN
@@ -39,6 +38,7 @@ zvelocity: 0.    # the only advection part for the linear heat eqn
 
 fem.io.macroGridFile_1d: ../../grids/unitcube1.dgf
 fem.io.macroGridFile_2d: ../../grids/unitcube2.dgf
+#fem.io.macroGridFile_2d: ../../grids/square2d.dgf
 fem.io.macroGridFile_3d: ../../grids/unitcube3.dgf
 
 
-- 
GitLab