From: Wolfgang Bangerth Date: Sat, 15 Aug 2009 05:16:35 +0000 (+0000) Subject: Break out the function that computes the gravity vector. X-Git-Tag: v8.0.0~7295 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcb430372ec03f975affe4702bec71fa0531b39f;p=dealii.git Break out the function that computes the gravity vector. git-svn-id: https://svn.dealii.org/trunk@19273 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-32/step-32.cc b/deal.II/examples/step-32/step-32.cc index 2cded377f9..6a7b2e25a4 100644 --- a/deal.II/examples/step-32/step-32.cc +++ b/deal.II/examples/step-32/step-32.cc @@ -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 + Tensor<1,dim> gravity_vector (const Point &p) + { + return -9.81 * p / p.norm_square(); + } + + template class TemperatureInitialValues : public Function { @@ -2029,11 +2036,12 @@ local_assemble_stokes_system (const typename DoFHandler::active_cell_iterat - scratch.phi_p[i] * scratch.div_phi_u[j]) * scratch.stokes_fe_values.JxW(q); - const Point 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