]> https://gitweb.dealii.org/ - dealii.git/commitdiff
step-75: enable pseudo-3d solution 15918/head
authorMarc Fehling <mafehling.git@gmail.com>
Wed, 23 Aug 2023 00:33:45 +0000 (18:33 -0600)
committerMarc Fehling <mafehling.git@gmail.com>
Wed, 23 Aug 2023 00:42:00 +0000 (18:42 -0600)
examples/step-75/step-75.cc

index 75181b33fe155b2f4033697edd6f86ec61c30944..0d781469ddc1f57c5da50eae8839f75cbb69f206 100644 (file)
@@ -110,16 +110,18 @@ namespace Step75
   public:
     Solution()
       : Function<dim>()
-    {}
+    {
+      Assert(dim > 1, ExcNotImplemented());
+    }
 
     virtual double value(const Point<dim> &p,
                          const unsigned int /*component*/) const override
     {
-      const std::array<double, dim> p_sphere =
-        GeometricUtilities::Coordinates::to_spherical(p);
+      const std::array<double, 2> polar =
+        GeometricUtilities::Coordinates::to_spherical(Point<2>(p[0], p[1]));
 
       constexpr const double alpha = 2. / 3.;
-      return std::pow(p_sphere[0], alpha) * std::sin(alpha * p_sphere[1]);
+      return std::pow(polar[0], alpha) * std::sin(alpha * polar[1]);
     }
   };
 

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.