]> https://gitweb.dealii.org/ - dealii.git/commitdiff
step-32: rescale 3d starting value to avoid artifacts at the +/- z poles
authorTimo Heister <timo.heister@gmail.com>
Sun, 6 Feb 2011 20:38:55 +0000 (20:38 +0000)
committerTimo Heister <timo.heister@gmail.com>
Sun, 6 Feb 2011 20:38:55 +0000 (20:38 +0000)
git-svn-id: https://svn.dealii.org/trunk@23299 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-32/step-32.cc

index 14e0e21ebeb8e2da4b34624cab3be9646867a5b2..6d072664265246abb220a6609bcfd6760d0b69ab 100644 (file)
@@ -175,10 +175,11 @@ namespace EquationData
    For a plot, see
    http://www.wolframalpha.com/input/?i=plot+%28%282*sqrt%28x^2%2By^2%29-1%29%2B0.2*%282*sqrt%28x^2%2By^2%29-1%29*%281-%282*sqrt%28x^2%2By^2%29-1%29%29*sin%286*atan2%28x%2Cy%29%29%29%2C+x%3D-1+to+1%2C+y%3D-1+to+1
 */
+    const double scale = (dim==3)?std::max(0.0,cos(3.14159*abs(p(2)/R1))):1.0;
     const double phi   = std::atan2(p(0),p(1));
-    const double s_mod = (s
-                         +
-                         0.2 * s * (1-s) * std::sin(6*phi));
+    const double s_mod = s
+                        +
+                        0.2 * s * (1-s) * std::sin(6*phi) * scale;
 
     return T0*(1.0-s_mod) + T1*s_mod;
   }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.