]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix some failing AD tests. 8018/head
authorJean-Paul Pelteret <jppelteret@gmail.com>
Mon, 6 May 2019 19:24:23 +0000 (21:24 +0200)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Mon, 6 May 2019 21:09:40 +0000 (23:09 +0200)
This targets issues picked up by compiling with -Werror

tests/ad_common_tests/physics_functions_03.h
tests/ad_common_tests/step-44-helper_res_lin_01.h
tests/ad_common_tests/step-44-helper_scalar_01.h
tests/ad_common_tests/step-44-helper_var_form_01.h
tests/ad_common_tests/step-44-helper_vector_01.h
tests/ad_common_tests/symmetric_tensor_functions_01.h
tests/ad_common_tests/tensor_functions_01.h
tests/adolc/prm/parameters-step-44.prm
tests/sacado/prm/parameters-step-44.prm

index e2dd5a0d3311451672b9752ae47fea3fa66084df..17da5488c187ed83973bb0edb0d0fb31b709eae1 100644 (file)
@@ -48,12 +48,12 @@ test_physics()
   Tensor<2, dim, ADNumberType>       grad_u;
   const Tensor<2, dim, ADNumberType> F =
     Physics::Elasticity::Kinematics::F(grad_u);
-  const Tensor<1, dim, ADNumberType>          N;
-  const Tensor<1, dim, ADNumberType>          V;
-  const Tensor<2, dim, ADNumberType>          T1;
-  const SymmetricTensor<2, dim, ADNumberType> T2;
-  const Tensor<4, dim, ADNumberType>          TT1;
-  const SymmetricTensor<4, dim, ADNumberType> TT2;
+  const Tensor<1, dim, ADNumberType>          N{};
+  const Tensor<1, dim, ADNumberType>          V{};
+  const Tensor<2, dim, ADNumberType>          T1{};
+  const SymmetricTensor<2, dim, ADNumberType> T2{};
+  const Tensor<4, dim, ADNumberType>          TT1{};
+  const SymmetricTensor<4, dim, ADNumberType> TT2{};
 
   const Tensor<1, dim, ADNumberType> ddet_F_dC =
     Physics::Transformations::nansons_formula(N, F);
index b0059c1c7c99eca321d21dcd15965a5298ca02c4..32dd901bdda0113f77ac2eac9dd967e0f9499c70 100644 (file)
@@ -184,7 +184,6 @@ namespace Step44
     {
       std::string type_lin;
       double      tol_lin;
-      double      max_iterations_lin;
       bool        use_static_condensation;
       std::string preconditioner_type;
       double      preconditioner_relaxation;
@@ -206,11 +205,6 @@ namespace Step44
                           "1e-6",
                           Patterns::Double(0.0),
                           "Linear solver residual (scaled by residual norm)");
-        prm.declare_entry(
-          "Max iteration multiplier",
-          "1",
-          Patterns::Double(0.0),
-          "Linear solver iterations (multiples of the system matrix size)");
         prm.declare_entry("Use static condensation",
                           "true",
                           Patterns::Bool(),
@@ -233,7 +227,6 @@ namespace Step44
       {
         type_lin                  = prm.get("Solver type");
         tol_lin                   = prm.get_double("Residual");
-        max_iterations_lin        = prm.get_double("Max iteration multiplier");
         use_static_condensation   = prm.get_bool("Use static condensation");
         preconditioner_type       = prm.get("Preconditioner type");
         preconditioner_relaxation = prm.get_double("Preconditioner relaxation");
@@ -1574,9 +1567,7 @@ namespace Step44
           std::cout << " SLV " << std::flush;
           if (parameters.type_lin == "CG")
             {
-              const auto solver_its = static_cast<unsigned int>(
-                tangent_matrix.block(u_dof, u_dof).m() *
-                parameters.max_iterations_lin);
+              const auto   solver_its = tangent_matrix.block(u_dof, u_dof).m();
               const double tol_sol =
                 parameters.tol_lin * system_rhs.block(u_dof).l2_norm();
               SolverControl solver_control(solver_its, tol_sol, false, false);
@@ -1657,8 +1648,7 @@ namespace Step44
             preconditioner_K_Jp_inv.use_matrix(
               tangent_matrix.block(J_dof, p_dof));
             ReductionControl solver_control_K_Jp_inv(
-              static_cast<unsigned int>(tangent_matrix.block(J_dof, p_dof).m() *
-                                        parameters.max_iterations_lin),
+              tangent_matrix.block(J_dof, p_dof).m(),
               1.0e-30,
               parameters.tol_lin);
             SolverSelector<Vector<double>> solver_K_Jp_inv;
@@ -1676,8 +1666,7 @@ namespace Step44
             preconditioner_K_con_inv.use_matrix(
               tangent_matrix.block(u_dof, u_dof));
             ReductionControl solver_control_K_con_inv(
-              static_cast<unsigned int>(tangent_matrix.block(u_dof, u_dof).m() *
-                                        parameters.max_iterations_lin),
+              tangent_matrix.block(u_dof, u_dof).m(),
               1.0e-30,
               parameters.tol_lin);
             SolverSelector<Vector<double>> solver_K_con_inv;
index 4e80e4372dcd1e30546cc2c0ed20e72207839b3b..5d2949238ddd437361f9c35760868e7cddcc842f 100644 (file)
@@ -186,7 +186,6 @@ namespace Step44
     {
       std::string type_lin;
       double      tol_lin;
-      double      max_iterations_lin;
       bool        use_static_condensation;
       std::string preconditioner_type;
       double      preconditioner_relaxation;
@@ -208,11 +207,6 @@ namespace Step44
                           "1e-6",
                           Patterns::Double(0.0),
                           "Linear solver residual (scaled by residual norm)");
-        prm.declare_entry(
-          "Max iteration multiplier",
-          "1",
-          Patterns::Double(0.0),
-          "Linear solver iterations (multiples of the system matrix size)");
         prm.declare_entry("Use static condensation",
                           "true",
                           Patterns::Bool(),
@@ -235,7 +229,6 @@ namespace Step44
       {
         type_lin                  = prm.get("Solver type");
         tol_lin                   = prm.get_double("Residual");
-        max_iterations_lin        = prm.get_double("Max iteration multiplier");
         use_static_condensation   = prm.get_bool("Use static condensation");
         preconditioner_type       = prm.get("Preconditioner type");
         preconditioner_relaxation = prm.get_double("Preconditioner relaxation");
@@ -2107,8 +2100,8 @@ namespace Step44
           std::cout << " SLV " << std::flush;
           if (parameters.type_lin == "CG")
             {
-              const int solver_its = tangent_matrix.block(u_dof, u_dof).m() *
-                                     parameters.max_iterations_lin;
+              const unsigned int solver_its =
+                tangent_matrix.block(u_dof, u_dof).m();
               const double tol_sol =
                 parameters.tol_lin * system_rhs.block(u_dof).l2_norm();
               SolverControl solver_control(solver_its, tol_sol, false, false);
@@ -2189,8 +2182,7 @@ namespace Step44
             preconditioner_K_Jp_inv.use_matrix(
               tangent_matrix.block(J_dof, p_dof));
             ReductionControl solver_control_K_Jp_inv(
-              tangent_matrix.block(J_dof, p_dof).m() *
-                parameters.max_iterations_lin,
+              tangent_matrix.block(J_dof, p_dof).m(),
               1.0e-30,
               parameters.tol_lin);
             SolverSelector<Vector<double>> solver_K_Jp_inv;
@@ -2208,8 +2200,7 @@ namespace Step44
             preconditioner_K_con_inv.use_matrix(
               tangent_matrix.block(u_dof, u_dof));
             ReductionControl solver_control_K_con_inv(
-              tangent_matrix.block(u_dof, u_dof).m() *
-                parameters.max_iterations_lin,
+              tangent_matrix.block(u_dof, u_dof).m(),
               1.0e-30,
               parameters.tol_lin);
             SolverSelector<Vector<double>> solver_K_con_inv;
index 8e2da6205be3a0aefbaa577ce8a3a9934f302dce..302053e0d91ec04c5784c0500a341567e23afe22 100644 (file)
@@ -184,7 +184,6 @@ namespace Step44
     {
       std::string type_lin;
       double      tol_lin;
-      double      max_iterations_lin;
       bool        use_static_condensation;
       std::string preconditioner_type;
       double      preconditioner_relaxation;
@@ -206,11 +205,6 @@ namespace Step44
                           "1e-6",
                           Patterns::Double(0.0),
                           "Linear solver residual (scaled by residual norm)");
-        prm.declare_entry(
-          "Max iteration multiplier",
-          "1",
-          Patterns::Double(0.0),
-          "Linear solver iterations (multiples of the system matrix size)");
         prm.declare_entry("Use static condensation",
                           "true",
                           Patterns::Bool(),
@@ -233,7 +227,6 @@ namespace Step44
       {
         type_lin                  = prm.get("Solver type");
         tol_lin                   = prm.get_double("Residual");
-        max_iterations_lin        = prm.get_double("Max iteration multiplier");
         use_static_condensation   = prm.get_bool("Use static condensation");
         preconditioner_type       = prm.get("Preconditioner type");
         preconditioner_relaxation = prm.get_double("Preconditioner relaxation");
@@ -1500,9 +1493,8 @@ namespace Step44
           std::cout << " SLV " << std::flush;
           if (parameters.type_lin == "CG")
             {
-              const auto solver_its = static_cast<unsigned int>(
-                tangent_matrix.block(u_dof, u_dof).m() *
-                parameters.max_iterations_lin);
+              const unsigned int solver_its =
+                tangent_matrix.block(u_dof, u_dof).m();
               const double tol_sol =
                 parameters.tol_lin * system_rhs.block(u_dof).l2_norm();
               SolverControl solver_control(solver_its, tol_sol, false, false);
@@ -1583,8 +1575,7 @@ namespace Step44
             preconditioner_K_Jp_inv.use_matrix(
               tangent_matrix.block(J_dof, p_dof));
             ReductionControl solver_control_K_Jp_inv(
-              static_cast<unsigned int>(tangent_matrix.block(J_dof, p_dof).m() *
-                                        parameters.max_iterations_lin),
+              tangent_matrix.block(J_dof, p_dof).m(),
               1.0e-30,
               parameters.tol_lin);
             SolverSelector<Vector<double>> solver_K_Jp_inv;
@@ -1602,8 +1593,7 @@ namespace Step44
             preconditioner_K_con_inv.use_matrix(
               tangent_matrix.block(u_dof, u_dof));
             ReductionControl solver_control_K_con_inv(
-              static_cast<unsigned int>(tangent_matrix.block(u_dof, u_dof).m() *
-                                        parameters.max_iterations_lin),
+              tangent_matrix.block(u_dof, u_dof).m(),
               1.0e-30,
               parameters.tol_lin);
             SolverSelector<Vector<double>> solver_K_con_inv;
index a011e3145ff784bb4566ff8f77403b262c30676e..546c449b9759e9a92ca5b0c5957b2bd85dd585c8 100644 (file)
@@ -186,7 +186,6 @@ namespace Step44
     {
       std::string type_lin;
       double      tol_lin;
-      double      max_iterations_lin;
       bool        use_static_condensation;
       std::string preconditioner_type;
       double      preconditioner_relaxation;
@@ -208,11 +207,6 @@ namespace Step44
                           "1e-6",
                           Patterns::Double(0.0),
                           "Linear solver residual (scaled by residual norm)");
-        prm.declare_entry(
-          "Max iteration multiplier",
-          "1",
-          Patterns::Double(0.0),
-          "Linear solver iterations (multiples of the system matrix size)");
         prm.declare_entry("Use static condensation",
                           "true",
                           Patterns::Bool(),
@@ -235,7 +229,6 @@ namespace Step44
       {
         type_lin                  = prm.get("Solver type");
         tol_lin                   = prm.get_double("Residual");
-        max_iterations_lin        = prm.get_double("Max iteration multiplier");
         use_static_condensation   = prm.get_bool("Use static condensation");
         preconditioner_type       = prm.get("Preconditioner type");
         preconditioner_relaxation = prm.get_double("Preconditioner relaxation");
@@ -1594,8 +1587,8 @@ namespace Step44
           std::cout << " SLV " << std::flush;
           if (parameters.type_lin == "CG")
             {
-              const int solver_its = tangent_matrix.block(u_dof, u_dof).m() *
-                                     parameters.max_iterations_lin;
+              const unsigned int solver_its =
+                tangent_matrix.block(u_dof, u_dof).m();
               const double tol_sol =
                 parameters.tol_lin * system_rhs.block(u_dof).l2_norm();
               SolverControl solver_control(solver_its, tol_sol, false, false);
@@ -1676,8 +1669,7 @@ namespace Step44
             preconditioner_K_Jp_inv.use_matrix(
               tangent_matrix.block(J_dof, p_dof));
             ReductionControl solver_control_K_Jp_inv(
-              tangent_matrix.block(J_dof, p_dof).m() *
-                parameters.max_iterations_lin,
+              tangent_matrix.block(J_dof, p_dof).m(),
               1.0e-30,
               parameters.tol_lin);
             SolverSelector<Vector<double>> solver_K_Jp_inv;
@@ -1695,8 +1687,7 @@ namespace Step44
             preconditioner_K_con_inv.use_matrix(
               tangent_matrix.block(u_dof, u_dof));
             ReductionControl solver_control_K_con_inv(
-              tangent_matrix.block(u_dof, u_dof).m() *
-                parameters.max_iterations_lin,
+              tangent_matrix.block(u_dof, u_dof).m(),
               1.0e-30,
               parameters.tol_lin);
             SolverSelector<Vector<double>> solver_K_con_inv;
index c88c077bf26b9fe00a9f184a9316827d9bb511f3..4a0bf316fefd5de9ce8423daf8ce6d50652e3899 100644 (file)
@@ -42,7 +42,7 @@ test_symmetric_tensor()
             << "Type code: " << static_cast<int>(ad_type_code) << std::endl;
 
   const ADNumberType                          a = 1.0;
-  const Tensor<1, dim, ADNumberType>          v;
+  const Tensor<1, dim, ADNumberType>          v{};
   const SymmetricTensor<2, dim, ADNumberType> A(
     unit_symmetric_tensor<dim, ADNumberType>());
   const SymmetricTensor<2, dim, ADNumberType> B(
index 4b4c819dca911f858a81b6c45afc8b01740a1070..9a81bb4094f6f415b56110e5c844b78a78cff7b3 100644 (file)
@@ -41,8 +41,8 @@ test_tensor()
             << "Type code: " << static_cast<int>(ad_type_code) << std::endl;
 
   const ADNumberType                 a = 1.0;
-  const Tensor<1, dim, ADNumberType> v1;
-  const Tensor<1, dim, ADNumberType> v2;
+  const Tensor<1, dim, ADNumberType> v1{};
+  const Tensor<1, dim, ADNumberType> v2{};
   const Tensor<2, dim, ADNumberType> A(
     unit_symmetric_tensor<dim, ADNumberType>());
   const Tensor<2, dim, ADNumberType> B(
index db26cc15720191651dc5b2b32f27a99f4813e2b4..de1fa049f6e1c59922b622c0749d7d1c60fcc60d 100644 (file)
@@ -22,10 +22,6 @@ end
 
 
 subsection Linear solver
-  # Linear solver iterations (multiples of the system matrix size)
-  # In 2-d, this value is best set at 2. In 3-d, a value of 1 work fine.
-  set Max iteration multiplier = 2
-
   # Linear solver residual (scaled by residual norm)
   set Residual                 = 1e-6
 
index db26cc15720191651dc5b2b32f27a99f4813e2b4..de1fa049f6e1c59922b622c0749d7d1c60fcc60d 100644 (file)
@@ -22,10 +22,6 @@ end
 
 
 subsection Linear solver
-  # Linear solver iterations (multiples of the system matrix size)
-  # In 2-d, this value is best set at 2. In 3-d, a value of 1 work fine.
-  set Max iteration multiplier = 2
-
   # Linear solver residual (scaled by residual norm)
   set Residual                 = 1e-6
 

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.