Step-17 and Step-18 combined with a complex PETSC-installation

42 views
Skip to first unread message

Maxi Miller

unread,
Aug 21, 2018, 9:08:01 AM8/21/18
to deal.II User Group
I wanted to try the combination of deal.II with complex values (according to github the integration should be done, if I remember correctly), thus I compiled PETSC with complex values. Now deal.II told me that step-17 and step-18 (among others) will not work. Based on my knowledge of the math, both examples should work regardless if the scalars are complex or real. Nevertheless, when compiling (and skipping the complex-check) I get the following error:
[ 50%] Building CXX object CMakeFiles/step-17.dir/step-17.cc.o
~/Downloads/dealii/examples/step-17/step-17.cc:173:22: warning: using ConstraintMatrix = class dealii::AffineConstraints<double> is deprecated [-Wdeprecated-declarations]
     
ConstraintMatrix hanging_node_constraints;
                     
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/Downloads/dealii/examples/step-17/step-17.cc:31:
/opt/dealii/include/deal.II/lac/affine_constraints.h:65:70: note: declared here
 
using ConstraintMatrix DEAL_II_DEPRECATED = AffineConstraints<double>;
                                                                     
^
~/Downloads/dealii/examples/step-17/step-17.cc: In member function void Step17::ElasticProblem<dim>::assemble_system()’:
~/Downloads/dealii/examples/step-17/step-17.cc:615:66: error: no matching function for call to apply_boundary_values(std::map<unsigned int, double>&, dealii::PETScWrappers::MPI::SparseMatrix&, dealii::PETScWrappers::MPI::Vector&, dealii::PETScWrappers::MPI::Vector&, bool)’
       boundary_values
, system_matrix, solution, system_rhs, false);
                                                                 
^
In file included from ~/Downloads/dealii/examples/step-17/step-17.cc:46:
/opt/dealii/include/deal.II/numerics/matrix_tools.h:834:3: note: candidate: template<class number> void dealii::MatrixTools::apply_boundary_values(const std::map<unsigned int, T>&, dealii::SparseMatrix<Number>&, dealii::Vector<OtherNumber>&, dealii::Vector<OtherNumber>&, bool)’
   apply_boundary_values
(
   
^~~~~~~~~~~~~~~~~~~~~
/opt/dealii/include/deal.II/numerics/matrix_tools.h:834:3: note:   template argument deduction/substitution failed:
~/Downloads/dealii/examples/step-17/step-17.cc:615:66: note:   dealii::PETScWrappers::MPI::SparseMatrix is not derived from dealii::SparseMatrix<Number>’
       boundary_values
, system_matrix, solution, system_rhs, false);
                                                                 
^
In file included from ~/Downloads/dealii/examples/step-17/step-17.cc:46:
/opt/dealii/include/deal.II/numerics/matrix_tools.h:848:3: note: candidate: template<class number> void dealii::MatrixTools::apply_boundary_values(const std::map<unsigned int, T>&, dealii::BlockSparseMatrix<number>&, dealii::BlockVector<Number>&, dealii::BlockVector<Number>&, bool)’
   apply_boundary_values
(
   
^~~~~~~~~~~~~~~~~~~~~
/opt/dealii/include/deal.II/numerics/matrix_tools.h:848:3: note:   template argument deduction/substitution failed:
~/Downloads/dealii/examples/step-17/step-17.cc:615:66: note:   dealii::PETScWrappers::MPI::SparseMatrix is not derived from dealii::BlockSparseMatrix<number>
       boundary_values
, system_matrix, solution, system_rhs, false);
                                                                 
^
In file included from ~/Downloads/dealii/examples/step-17/step-17.cc:46:
/opt/dealii/include/deal.II/numerics/matrix_tools.h:892:3: note: candidate: void dealii::MatrixTools::apply_boundary_values(const std::map<unsigned int, std::complex<double> >&, dealii::PETScWrappers::MatrixBase&, dealii::PETScWrappers::VectorBase&, dealii::PETScWrappers::VectorBase&, bool)’
   apply_boundary_values
(
   
^~~~~~~~~~~~~~~~~~~~~
/opt/dealii/include/deal.II/numerics/matrix_tools.h:892:3: note:   no known conversion for argument 1 from std::map<unsigned int, double>’ to const std::map<unsigned int, std::complex<double> >&’
/opt/dealii/include/deal.II/numerics/matrix_tools.h:903:3: note: candidate: void dealii::MatrixTools::apply_boundary_values(const std::map<unsigned int, std::complex<double> >&, dealii::PETScWrappers::MPI::BlockSparseMatrix&, dealii::PETScWrappers::MPI::BlockVector&, dealii::PETScWrappers::MPI::BlockVector&, bool)’
   apply_boundary_values
(
   
^~~~~~~~~~~~~~~~~~~~~
/opt/dealii/include/deal.II/numerics/matrix_tools.h:903:3: note:   no known conversion for argument 1 from std::map<unsigned int, double>’ to const std::map<unsigned int, std::complex<double> >&’
/opt/dealii/include/deal.II/numerics/matrix_tools.h:947:3: note: candidate: void dealii::MatrixTools::apply_boundary_values(const std::map<unsigned int, double>&, dealii::TrilinosWrappers::SparseMatrix&, dealii::TrilinosWrappers::MPI::Vector&, dealii::TrilinosWrappers::MPI::Vector&, bool)’
   apply_boundary_values
(
   
^~~~~~~~~~~~~~~~~~~~~
/opt/dealii/include/deal.II/numerics/matrix_tools.h:947:3: note:   no known conversion for argument 2 from dealii::PETScWrappers::MPI::SparseMatrix to dealii::TrilinosWrappers::SparseMatrix&’
/opt/dealii/include/deal.II/numerics/matrix_tools.h:959:3: note: candidate: void dealii::MatrixTools::apply_boundary_values(const std::map<unsigned int, double>&, dealii::TrilinosWrappers::BlockSparseMatrix&, dealii::TrilinosWrappers::MPI::BlockVector&, dealii::TrilinosWrappers::MPI::BlockVector&, bool)’
   apply_boundary_values
(
   
^~~~~~~~~~~~~~~~~~~~~
/opt/dealii/include/deal.II/numerics/matrix_tools.h:959:3: note:   no known conversion for argument 2 from dealii::PETScWrappers::MPI::SparseMatrix to dealii::TrilinosWrappers::BlockSparseMatrix&’
gmake
[6]: *** [CMakeFiles/step-17.dir/build.make:63: CMakeFiles/step-17.dir/step-17.cc.o] Error 1
gmake
[5]: *** [CMakeFiles/Makefile2:169: CMakeFiles/step-17.dir/all] Error 2
gmake
[4]: *** [Makefile:84: all] Error 2
make
[3]: *** [CMakeFiles/release.dir/build.make:59: CMakeFiles/release] Error 2
make
[2]: *** [CMakeFiles/Makefile2:238: CMakeFiles/release.dir/all] Error 2
make
[1]: *** [CMakeFiles/Makefile2:245: CMakeFiles/release.dir/rule] Error 2
make
: *** [Makefile:183: release] Error 2


Is that due to old code, due to incomplete support for complex values, or due to other incompatibilities?
Thanks!

Daniel Arndt

unread,
Aug 22, 2018, 10:38:33 AM8/22/18
to deal.II User Group
Maxi,

there are multiple reasons why you get errors when trying to compile the current version of step-17 with complex PETSc scalar type.
1. We are in te process of updating the example steps and didn't consider this one yet. (This why you have a lot of the deprecations warnings regarding teh use of ConstraintMatrix)
2. The number type for the remaining objects are not matching PetscScalar. We only allow AffineConstraints to bes used when both the corresponding vector and matrix classes use std::complex<> as underlying numer type as well.
You should be able to work your way through this just changing the number type at the appropriate places to PetscScalar.
Sometimes, this is quite tedious especially if you are really only considering real values. Comparing values for example is not uniquely defined.
This is also a reason why it might not make sense to change every program to allow for both real and complex values. This directly leads to the last point:
3. This tutorial program doesn't need complex values, so having the check for complex support is intentional.

There are multiple tests using PETSc with complex scalar. E.g., have a look at tests/petsc_complex/parallel_sparse_matrix_01.cc.

Best,
Daniel
Reply all
Reply to author
Forward
0 new messages