]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix a bug in the deviator.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 28 May 2005 19:05:24 +0000 (19:05 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 28 May 2005 19:05:24 +0000 (19:05 +0000)
git-svn-id: https://svn.dealii.org/trunk@10771 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/symmetric_tensor.h

index 97fd8c4ec84bf6040e8c9b00418c9f64e6c4cab4..68f93150e21ed71c534dd2aaf2845afd2ca1af1c 100644 (file)
@@ -2050,12 +2050,22 @@ SymmetricTensor<4,dim>
 deviator_tensor () 
 {
   SymmetricTensor<4,dim> tmp;
+  
+                                   // fill the elements treating the diagonal
   for (unsigned int i=0; i<dim; ++i)
     for (unsigned int j=0; j<dim; ++j)
       tmp.data[i][j] = (i==j ? 1 : 0) - 1./dim;
+
+                                   // then fill the ones that copy over the
+                                   // non-diagonal elements. note that during
+                                   // the double-contraction, we handle the
+                                   // off-diagonal elements twice, so simply
+                                   // copying requires a weight of 1/2
   for (unsigned int i=dim;
-       i<internal::SymmetricTensorAccessors::StorageType<4,dim>::n_rank2_components; ++i)
-    tmp.data[i][i] = 1;
+       i<internal::SymmetricTensorAccessors::StorageType<4,dim>
+                      ::n_rank2_components;
+       ++i)
+    tmp.data[i][i] = 0.5;
   
   return tmp;
 }

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.