]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Break out the function that computes the gravity vector.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 15 Aug 2009 05:16:35 +0000 (05:16 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 15 Aug 2009 05:16:35 +0000 (05:16 +0000)
git-svn-id: https://svn.dealii.org/trunk@19273 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 2cded377f9e9f2876cf3d2f02652c0be6a538280..6a7b2e25a43739cb4abd1432975d3e81da84e87f 100644 (file)
@@ -89,13 +89,20 @@ namespace EquationData
   const double kappa = 1e-6;
   const double Rayleigh_number = 10;
 
-  const double R0 = 6371-2890;
-  const double R1 = 6371-35;
+  const double R0 = 6371000.-2890000.;
+  const double R1 = 6371000.-  35000.;
 
-  const double T0 = 4270;
-  const double T1 =  970;
+  const double T0 = 4000+273;
+  const double T1 =  700+273;
 
 
+  template <int dim>
+  Tensor<1,dim> gravity_vector (const Point<dim> &p)
+  {
+    return -9.81 * p / p.norm_square();
+  }
+
+  
   template <int dim>
   class TemperatureInitialValues : public Function<dim>
   {
@@ -2029,11 +2036,12 @@ local_assemble_stokes_system (const typename DoFHandler<dim>::active_cell_iterat
                                       - scratch.phi_p[i] * scratch.div_phi_u[j])
                                      * scratch.stokes_fe_values.JxW(q);
 
-      const Point<dim> gravity = 9.81 *
-                                scratch.stokes_fe_values.quadrature_point(q) /
-                                scratch.stokes_fe_values.quadrature_point(q).norm_square();
+      const Tensor<1,dim>
+       gravity = EquationData::gravity_vector (scratch.stokes_fe_values
+                                               .quadrature_point(q));
+      
       for (unsigned int i=0; i<dofs_per_cell; ++i)
-       data.local_rhs(i) += (EquationData::Rayleigh_number *
+       data.local_rhs(i) += (-EquationData::Rayleigh_number *
                              gravity * scratch.phi_u[i] * old_temperature)*
                             scratch.stokes_fe_values.JxW(q);
     }

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.