]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
A few cosmetic changes. Simplify computation of one tensor.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 4 May 2005 19:42:46 +0000 (19:42 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 4 May 2005 19:42:46 +0000 (19:42 +0000)
git-svn-id: https://svn.dealii.org/trunk@10648 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 448b766ffdeccfbee97c41d9458bbbf11076530b..e1a757a80742ed50b3f7c30965cc22f9e11ee9d3 100644 (file)
@@ -308,7 +308,16 @@ namespace QuasiStaticElasticity
                                   // have to reconstruct the
                                   // (symmetric) strain tensor by
                                   // transforming the data storage
-                                  // format and symmetrization.
+                                  // format and symmetrization. We do
+                                  // this in the same way as above,
+                                  // i.e. we avoid a few computations
+                                  // by filling first the diagonal
+                                  // and then only one half of the
+                                  // symmetric tensor (the
+                                  // ``SymmetricTensor'' class makes
+                                  // sure that it is sufficient to
+                                  // write only one of the two
+                                  // symmetric components).
                                   //
                                   // Before we do this, though, we
                                   // make sure that the input has the
@@ -328,10 +337,14 @@ namespace QuasiStaticElasticity
   {
     Assert (grad.size() == dim, ExcInternalError());
 
-    Tensor<2,dim> strain;
+    SymmetricTensor<2,dim> strain;
     for (unsigned int i=0; i<dim; ++i)
-      for (unsigned int j=0; j<dim; ++j)
+      strain[i][i] = grad[i][i];
+    
+    for (unsigned int i=0; i<dim; ++i)
+      for (unsigned int j=i+1; j<dim; ++j)
        strain[i][j] = (grad[i][j] + grad[j][i]) / 2;
+    
     return strain;
   }
 
@@ -1040,7 +1053,7 @@ namespace QuasiStaticElasticity
   const SymmetricTensor<4,dim>
   TopLevel<dim>::stress_strain_tensor
   = get_stress_strain_tensor<dim> (/*lambda = */ 9.695e10,
-                                  /*mu     = */ 7.617e10);      
+                                  /*mu     = */ 7.617e10);
   
 
 
@@ -1533,7 +1546,7 @@ namespace QuasiStaticElasticity
                  cell_matrix(i,j) 
                    += (eps_phi_i * stress_strain_tensor * eps_phi_j
                         *
-                        fe_values.JxW(q_point));
+                        fe_values.JxW (q_point));
                }
 
 
@@ -1573,12 +1586,12 @@ namespace QuasiStaticElasticity
                  const SymmetricTensor<2,dim> &old_stress
                    = local_quadrature_points_data[q_point].old_stress;
                
-                 cell_rhs(i) += (fe_values.shape_value(i,q_point) *
+                 cell_rhs(i) += (fe_values.shape_value (i,q_point) *
                                  body_force_values[q_point](component_i)
                                  -
-                                 get_strain(fe_values,i,q_point) *
+                                 get_strain (fe_values,i,q_point) *
                                  old_stress) *
-                                fe_values.JxW(q_point);
+                                fe_values.JxW (q_point);
                }
            }
 

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.