]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Specify scalar operation result type 12217/head
authorJean-Paul Pelteret <jppelteret@gmail.com>
Sun, 16 May 2021 11:37:58 +0000 (13:37 +0200)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Sun, 16 May 2021 17:50:20 +0000 (19:50 +0200)
Fixes issue with Sacado expression templates, where we do not know how to multiply a Sacado math operation result (expression template) with a Tensor or SymmetricTensor.

include/deal.II/physics/elasticity/kinematics.h
include/deal.II/physics/elasticity/standard_tensors.h
tests/ad_common_tests/symmetric_tensor_functions_04.h

index 059cb72ebfad5df8a97bbeb553fe49474f788d87..1f5dcbe454940665e6d99469292ba32d68569dca 100644 (file)
@@ -34,15 +34,14 @@ namespace Physics
     /**
      * A collection of tensor definitions for deformation and strain measures,
      * as well as a few special transformations, that conform to notation used
-     in
-     * standard scientific literature, in particular the books of
+     * in standard scientific literature, in particular the books of
      * Holzapfel (2007) and Wriggers (2008). The citation for these references,
      * as well as other notation used here, can be found in the description for
      * the Physics::Elasticity namespace.
 
-     * @note These hold specifically for the codimension
-     * 0 case, where the metric tensor is the identity tensor.
-*/
+     * @note These hold specifically for the codimension 0 case,
+     * where the metric tensor is the identity tensor.
+     */
     namespace Kinematics
     {
       /**
@@ -289,7 +288,9 @@ template <int dim, typename Number>
 inline Tensor<2, dim, Number>
 Physics::Elasticity::Kinematics::F_iso(const Tensor<2, dim, Number> &F)
 {
-  return std::pow(determinant(F), -1.0 / dim) * F;
+  return internal::NumberType<Number>::value(
+           std::pow(determinant(F), -1.0 / dim)) *
+         F;
 }
 
 
index 8ae642a4ef96f2feb256d040dd85a52d3c116bfb..86b0512e425abe31ee0fb2a41cd649e2b1097c60 100644 (file)
@@ -373,7 +373,8 @@ DEAL_II_CONSTEXPR SymmetricTensor<2, dim, Number>
                   Physics::Elasticity::StandardTensors<dim>::ddet_F_dC(
   const Tensor<2, dim, Number> &F)
 {
-  return Number(0.5) * determinant(F) * symmetrize(invert(transpose(F) * F));
+  return internal::NumberType<Number>::value(0.5 * determinant(F)) *
+         symmetrize(invert(transpose(F) * F));
 }
 
 
index a62d9a8ef43ff6d7cde1f5753d6723ee8b37b04d..6c6739e847112646d7484c3f41626920fb43339e 100644 (file)
@@ -110,7 +110,8 @@ struct IncompressibleNeoHookeanPrincipalStretches
       {
         const NumberType &                lambda_squared = eig_C[d].first;
         const Tensor<1, dim, NumberType> &N              = eig_C[d].second;
-        C_inv += (1.0 / lambda_squared) * symmetrize(outer_product(N, N));
+        C_inv +=
+          NumberType(1.0 / lambda_squared) * symmetrize(outer_product(N, N));
       }
 
     const SymmetricTensor<2, dim, NumberType> I =

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.