[cig-commits] r1407 - in trunk/aspect: include/aspect source/mesh_refinement source/postprocess source/simulator

bangerth at dealii.org bangerth at dealii.org
Sat Dec 1 05:33:08 PST 2012


Author: bangerth
Date: 2012-12-01 06:33:08 -0700 (Sat, 01 Dec 2012)
New Revision: 1407

Modified:
   trunk/aspect/include/aspect/simulator.h
   trunk/aspect/source/mesh_refinement/composition.cc
   trunk/aspect/source/mesh_refinement/density_c_p_temperature.cc
   trunk/aspect/source/mesh_refinement/temperature.cc
   trunk/aspect/source/postprocess/composition_statistics.cc
   trunk/aspect/source/postprocess/duretz_et_al.cc
   trunk/aspect/source/postprocess/heat_flux_statistics.cc
   trunk/aspect/source/postprocess/table_heat_flux_statistics.cc
   trunk/aspect/source/postprocess/table_velocity_statistics.cc
   trunk/aspect/source/postprocess/tan_gurnis.cc
   trunk/aspect/source/postprocess/temperature_statistics.cc
   trunk/aspect/source/postprocess/velocity_statistics.cc
   trunk/aspect/source/simulator/assembly.cc
   trunk/aspect/source/simulator/simulator_access.cc
Log:
Give SimulatorAccess direct access to the finite element; use this in a whole bunch of places that are currently just overly convoluted.

Modified: trunk/aspect/include/aspect/simulator.h
===================================================================
--- trunk/aspect/include/aspect/simulator.h	2012-12-01 06:36:48 UTC (rev 1406)
+++ trunk/aspect/include/aspect/simulator.h	2012-12-01 13:33:08 UTC (rev 1407)
@@ -258,6 +258,17 @@
       get_dof_handler () const;
 
       /**
+       * Return a reference to the finite element that the DoFHandler that
+       * is used to discretize the variables at the current time step is built
+       * on. This is the finite element for the entire, couple problem, i.e.,
+       * it contains sub-elements for velocity, pressure, temperature
+       * and all other variables in this problem (e.g., compositional variables,
+       * if used in this simulation).
+       */
+      const FiniteElement<dim> &
+      get_fe () const;
+
+      /**
        * Fill the argument with a set of depth averages of the current
        * temperature field. The function fills a
        * vector that contains average field values over slices of the

Modified: trunk/aspect/source/mesh_refinement/composition.cc
===================================================================
--- trunk/aspect/source/mesh_refinement/composition.cc	2012-12-01 06:36:48 UTC (rev 1406)
+++ trunk/aspect/source/mesh_refinement/composition.cc	2012-12-01 13:33:08 UTC (rev 1407)
@@ -49,7 +49,7 @@
                                               typename FunctionMap<dim>::type(),
                                               this->get_solution(),
                                               this_indicator,
-                                              this->get_dof_handler().get_fe().component_mask(this_composition),
+                                              this->get_fe().component_mask(this_composition),
                                               0,
                                               0,
                                               this->get_triangulation().locally_owned_subdomain());

Modified: trunk/aspect/source/mesh_refinement/density_c_p_temperature.cc
===================================================================
--- trunk/aspect/source/mesh_refinement/density_c_p_temperature.cc	2012-12-01 06:36:48 UTC (rev 1406)
+++ trunk/aspect/source/mesh_refinement/density_c_p_temperature.cc	2012-12-01 13:33:08 UTC (rev 1407)
@@ -90,10 +90,10 @@
       }
       LinearAlgebra::BlockVector vec_distributed (system_partitioning, this->get_mpi_communicator());
 
-      const Quadrature<dim> quadrature(this->get_dof_handler().get_fe().base_element(2).get_unit_support_points());
-      std::vector<unsigned int> local_dof_indices (this->get_dof_handler().get_fe().dofs_per_cell);
+      const Quadrature<dim> quadrature(this->get_fe().base_element(2).get_unit_support_points());
+      std::vector<unsigned int> local_dof_indices (this->get_fe().dofs_per_cell);
       FEValues<dim> fe_values (this->get_mapping(),
-    		  this->get_dof_handler().get_fe(),
+                               this->get_fe(),
                                quadrature,
                                update_quadrature_points | update_values);
       std::vector<double> pressure_values(quadrature.size());
@@ -141,22 +141,22 @@
             // for each temperature dof, write into the output
             // vector the density. note that quadrature points and
             // dofs are enumerated in the same order
-            for (unsigned int i=0; i<this->get_dof_handler().get_fe().base_element(2).dofs_per_cell; ++i)
+            for (unsigned int i=0; i<this->get_fe().base_element(2).dofs_per_cell; ++i)
               {
                 const unsigned int system_local_dof
-                  = this->get_dof_handler().get_fe().component_to_system_index(/*temperature component=*/dim+1,
+                  = this->get_fe().component_to_system_index(/*temperature component=*/dim+1,
                                                                                        /*dof index within component=*/i);
 
                 vec_distributed(local_dof_indices[system_local_dof])
                   = this->get_material_model().density( temperature_values[i],
-                                             pressure_values[i],
-                                             composition_values[i],
-                                             fe_values.quadrature_point(i))
+                                                        pressure_values[i],
+                                                        composition_values[i],
+                                                        fe_values.quadrature_point(i))
                     * temperature_values[i]
                     * this->get_material_model().specific_heat(temperature_values[i],
-                                                        pressure_values[i],
-                                                        composition_values[i],
-                                                        fe_values.quadrature_point(i));
+                                                               pressure_values[i],
+                                                               composition_values[i],
+                                                               fe_values.quadrature_point(i));
               }
           }
 //...

Modified: trunk/aspect/source/mesh_refinement/temperature.cc
===================================================================
--- trunk/aspect/source/mesh_refinement/temperature.cc	2012-12-01 06:36:48 UTC (rev 1406)
+++ trunk/aspect/source/mesh_refinement/temperature.cc	2012-12-01 13:33:08 UTC (rev 1407)
@@ -45,7 +45,7 @@
                                           typename FunctionMap<dim>::type(),
                                           this->get_solution(),
                                           indicators,
-                                          this->get_dof_handler().get_fe().component_mask(temperature),
+                                          this->get_fe().component_mask(temperature),
                                           0,
                                           0,
                                           this->get_triangulation().locally_owned_subdomain());

Modified: trunk/aspect/source/postprocess/composition_statistics.cc
===================================================================
--- trunk/aspect/source/postprocess/composition_statistics.cc	2012-12-01 06:36:48 UTC (rev 1406)
+++ trunk/aspect/source/postprocess/composition_statistics.cc	2012-12-01 13:33:08 UTC (rev 1407)
@@ -44,13 +44,13 @@
       // create a quadrature formula based on the compositional element alone.
       // be defensive about determining that what we think is the temperature
       // element is it in fact
-      Assert (this->get_dof_handler().get_fe().n_base_elements() == 4,
+      Assert (this->get_fe().n_base_elements() == 4,
               ExcNotImplemented());
-      const QGauss<dim> quadrature_formula (this->get_dof_handler().get_fe().base_element(3).degree+1);
+      const QGauss<dim> quadrature_formula (this->get_fe().base_element(3).degree+1);
       const unsigned int n_q_points = quadrature_formula.size();
 
       FEValues<dim> fe_values (this->get_mapping(),
-                               this->get_dof_handler().get_fe(),
+                               this->get_fe(),
                                quadrature_formula,
                                update_values   |
                                update_quadrature_points |

Modified: trunk/aspect/source/postprocess/duretz_et_al.cc
===================================================================
--- trunk/aspect/source/postprocess/duretz_et_al.cc	2012-12-01 06:36:48 UTC (rev 1406)
+++ trunk/aspect/source/postprocess/duretz_et_al.cc	2012-12-01 13:33:08 UTC (rev 1407)
@@ -3014,7 +3014,7 @@
                       ExcMessage("Postprocessor DuretzEtAl only works with the material model SolCx, SolKz, and Inclusion."));
         }
 
-      const QGauss<dim> quadrature_formula (this->get_dof_handler().get_fe().base_element(0).degree+2);
+      const QGauss<dim> quadrature_formula (this->get_fe().base_element(0).degree+2);
 
       Vector<float> cellwise_errors_u (this->get_triangulation().n_active_cells());
       Vector<float> cellwise_errors_p (this->get_triangulation().n_active_cells());

Modified: trunk/aspect/source/postprocess/heat_flux_statistics.cc
===================================================================
--- trunk/aspect/source/postprocess/heat_flux_statistics.cc	2012-12-01 06:36:48 UTC (rev 1406)
+++ trunk/aspect/source/postprocess/heat_flux_statistics.cc	2012-12-01 13:33:08 UTC (rev 1407)
@@ -40,12 +40,12 @@
       // create a quadrature formula based on the temperature element alone.
       // be defensive about determining that what we think is the temperature
       // element, is it in fact
-      Assert (this->get_dof_handler().get_fe().n_base_elements() == 3+(this->n_compositional_fields()>0 ? 1 : 0),
+      Assert (this->get_fe().n_base_elements() == 3+(this->n_compositional_fields()>0 ? 1 : 0),
               ExcNotImplemented());
-      const QGauss<dim-1> quadrature_formula (this->get_dof_handler().get_fe().base_element(2).degree+1);
+      const QGauss<dim-1> quadrature_formula (this->get_fe().base_element(2).degree+1);
 
       FEFaceValues<dim> fe_face_values (this->get_mapping(),
-                                        this->get_dof_handler().get_fe(),
+                                        this->get_fe(),
                                         quadrature_formula,
                                         update_gradients      | update_values |
                                         update_normal_vectors |

Modified: trunk/aspect/source/postprocess/table_heat_flux_statistics.cc
===================================================================
--- trunk/aspect/source/postprocess/table_heat_flux_statistics.cc	2012-12-01 06:36:48 UTC (rev 1406)
+++ trunk/aspect/source/postprocess/table_heat_flux_statistics.cc	2012-12-01 13:33:08 UTC (rev 1407)
@@ -40,12 +40,12 @@
       // create a quadrature formula based on the temperature element alone.
       // be defensive about determining that what we think is the temperature
       // element is it in fact
-      Assert (this->get_dof_handler().get_fe().n_base_elements() == 3,
+      Assert (this->get_fe().n_base_elements() == 3,
               ExcNotImplemented());
-      const QGauss<dim-1> quadrature_formula (this->get_dof_handler().get_fe().base_element(2).degree+1);
+      const QGauss<dim-1> quadrature_formula (this->get_fe().base_element(2).degree+1);
 
       FEFaceValues<dim> fe_face_values (this->get_mapping(),
-                                        this->get_dof_handler().get_fe(),
+                                        this->get_fe(),
                                         quadrature_formula,
                                         update_gradients      | update_values |
                                         update_normal_vectors |

Modified: trunk/aspect/source/postprocess/table_velocity_statistics.cc
===================================================================
--- trunk/aspect/source/postprocess/table_velocity_statistics.cc	2012-12-01 06:36:48 UTC (rev 1406)
+++ trunk/aspect/source/postprocess/table_velocity_statistics.cc	2012-12-01 13:33:08 UTC (rev 1407)
@@ -51,12 +51,12 @@
       material_model
         = dynamic_cast<const MaterialModel::Table<dim> &>(this->get_material_model());
 
-      const QGauss<dim> quadrature_formula (this->get_dof_handler().get_fe()
+      const QGauss<dim> quadrature_formula (this->get_fe()
                                             .base_element(0).degree+1);
       const unsigned int n_q_points = quadrature_formula.size();
 
       FEValues<dim> fe_values (this->get_mapping(),
-                               this->get_dof_handler().get_fe(),
+                               this->get_fe(),
                                quadrature_formula,
                                update_values   |
                                update_quadrature_points |

Modified: trunk/aspect/source/postprocess/tan_gurnis.cc
===================================================================
--- trunk/aspect/source/postprocess/tan_gurnis.cc	2012-12-01 06:36:48 UTC (rev 1406)
+++ trunk/aspect/source/postprocess/tan_gurnis.cc	2012-12-01 13:33:08 UTC (rev 1407)
@@ -63,10 +63,10 @@
       f << std::scientific;
 
 
-      const QGauss<dim> quadrature_formula (this->get_dof_handler().get_fe().base_element(0).degree+2);
+      const QGauss<dim> quadrature_formula (this->get_fe().base_element(0).degree+2);
 
       const unsigned int n_q_points =  quadrature_formula.size();
-      FEValues<dim> fe_values (this->get_mapping(), this->get_dof_handler().get_fe(),  quadrature_formula,
+      FEValues<dim> fe_values (this->get_mapping(), this->get_fe(),  quadrature_formula,
                                update_JxW_values | update_values | update_quadrature_points);
 
       const unsigned int dofs_per_cell = fe_values.get_fe().dofs_per_cell;

Modified: trunk/aspect/source/postprocess/temperature_statistics.cc
===================================================================
--- trunk/aspect/source/postprocess/temperature_statistics.cc	2012-12-01 06:36:48 UTC (rev 1406)
+++ trunk/aspect/source/postprocess/temperature_statistics.cc	2012-12-01 13:33:08 UTC (rev 1407)
@@ -41,13 +41,13 @@
       // create a quadrature formula based on the temperature element alone.
       // be defensive about determining that what we think is the temperature
       // element is it in fact
-      Assert (this->get_dof_handler().get_fe().n_base_elements() == 3+(this->n_compositional_fields()>0 ? 1 : 0),
+      Assert (this->get_fe().n_base_elements() == 3+(this->n_compositional_fields()>0 ? 1 : 0),
               ExcNotImplemented());
-      const QGauss<dim> quadrature_formula (this->get_dof_handler().get_fe().base_element(2).degree+1);
+      const QGauss<dim> quadrature_formula (this->get_fe().base_element(2).degree+1);
       const unsigned int n_q_points = quadrature_formula.size();
 
       FEValues<dim> fe_values (this->get_mapping(),
-                               this->get_dof_handler().get_fe(),
+                               this->get_fe(),
                                quadrature_formula,
                                update_values   |
                                update_quadrature_points |

Modified: trunk/aspect/source/postprocess/velocity_statistics.cc
===================================================================
--- trunk/aspect/source/postprocess/velocity_statistics.cc	2012-12-01 06:36:48 UTC (rev 1406)
+++ trunk/aspect/source/postprocess/velocity_statistics.cc	2012-12-01 13:33:08 UTC (rev 1407)
@@ -41,12 +41,12 @@
     std::pair<std::string,std::string>
     VelocityStatistics<dim>::execute (TableHandler &statistics)
     {
-      const QGauss<dim> quadrature_formula (this->get_dof_handler().get_fe()
+      const QGauss<dim> quadrature_formula (this->get_fe()
                                             .base_element(0).degree+1);
       const unsigned int n_q_points = quadrature_formula.size();
 
       FEValues<dim> fe_values (this->get_mapping(),
-                               this->get_dof_handler().get_fe(),
+                               this->get_fe(),
                                quadrature_formula,
                                update_values   |
                                update_quadrature_points |

Modified: trunk/aspect/source/simulator/assembly.cc
===================================================================
--- trunk/aspect/source/simulator/assembly.cc	2012-12-01 06:36:48 UTC (rev 1406)
+++ trunk/aspect/source/simulator/assembly.cc	2012-12-01 13:33:08 UTC (rev 1407)
@@ -1256,7 +1256,7 @@
           }
 
         const double density_c_P              = (index == 0 ? scratch.material_model_outputs.densities[q] *
-                                            scratch.material_model_outputs.specific_heat[q] : 1.0);
+                                                 scratch.material_model_outputs.specific_heat[q] : 1.0);
         const double conductivity = (index == 0 ? scratch.material_model_outputs.thermal_conductivities[q] : 0.0);
         const double gamma = compute_heating_term(scratch,scratch.material_model_inputs,scratch.material_model_outputs,index,q);
 

Modified: trunk/aspect/source/simulator/simulator_access.cc
===================================================================
--- trunk/aspect/source/simulator/simulator_access.cc	2012-12-01 06:36:48 UTC (rev 1406)
+++ trunk/aspect/source/simulator/simulator_access.cc	2012-12-01 13:33:08 UTC (rev 1407)
@@ -182,6 +182,15 @@
 
 
   template <int dim>
+  const FiniteElement<dim> &
+  SimulatorAccess<dim>::get_fe () const
+  {
+    return simulator->dof_handler.get_fe();
+  }
+
+
+
+  template <int dim>
   void
   SimulatorAccess<dim>::get_depth_average_temperature(std::vector<double> &values) const
   {



More information about the CIG-COMMITS mailing list