Re: [deal.II] MatrixTools::apply_boundary_values for BlockSparseMatrix> and BlockVector> entries

2021-09-17 Thread Мария Бронзова
Dear Daniel,

Thank you a lot for the solution ways! I was trying to modify the 
/dealii-9.3.1/source/numerics/matrix_tools.inst.in as follows:

// -
//
// Copyright (C) 2010 - 2018 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE.md at
// the top level directory of deal.II.
//
// -

for (number : REAL_SCALARS)
  {
template void MatrixTools::local_apply_boundary_values(
  const std::map &boundary_values,
  const std::vector & local_dof_indices,
  FullMatrix & local_matrix,
  Vector & local_rhs,
  const bool   eliminate_columns);

template void MatrixTools::apply_boundary_values(
  const std::map &boundary_values,
  SparseMatrix &   matrix,
  Vector & solution,
  Vector & right_hand_side,
  const bool   eliminate_columns);

template void MatrixTools::apply_boundary_values(
  const std::map &boundary_values,
  BlockSparseMatrix &  matrix,
  BlockVector &solution,
  BlockVector &right_hand_side,
  const bool   eliminate_columns);
  }

for (number : COMPLEX_SCALARS)
  {
template void MatrixTools::apply_boundary_values(
  const std::map &boundary_values,
  SparseMatrix &   matrix,
  Vector & solution,
  Vector & right_hand_side,
  const bool   eliminate_columns);
  
*template void MatrixTools::apply_boundary_values(*
*  const std::map &boundary_values,*
*  BlockSparseMatrix &  matrix,*
*  BlockVector &solution,*
*  BlockVector &right_hand_side,*
*  const bool   eliminate_columns);*
  }

Then I recompiled everything and got the error:  

/home/mariia/Downloads/dealii-9.3.1/source/numerics/matrix_tools.cc:364:49: 
*error*: no match for ‘operator!=’ (operand types are ‘std::complex’ 
and ‘double’)
  364 |   .diag_element(block_index.second) != 0.0)
In file included from 
/home/mariia/Downloads/dealii-9.3.1/include/deal.II/base/parallel.h:23,
 from 
/home/mariia/Downloads/dealii-9.3.1/include/deal.II/base/aligned_vector.h:25,
 from 
/home/mariia/Downloads/dealii-9.3.1/include/deal.II/base/table.h:21,
 from 
/home/mariia/Downloads/dealii-9.3.1/include/deal.II/lac/block_sparsity_pattern.h:25,
 from 
/home/mariia/Downloads/dealii-9.3.1/include/deal.II/lac/sparsity_tools.h:24,
 from 
/home/mariia/Downloads/dealii-9.3.1/include/deal.II/base/graph_coloring.h:25,
 from 
/home/mariia/Downloads/dealii-9.3.1/include/deal.II/base/work_stream.h:22,
 from 
/home/mariia/Downloads/dealii-9.3.1/source/numerics/matrix_tools.cc:19:
..
make[2]: *** 
[source/numerics/CMakeFiles/obj_numerics_release.dir/build.make:188: 
source/numerics/CMakeFiles/obj_numerics_release.dir/matrix_tools.cc.o] 
Error 1
make[1]: *** [CMakeFiles/Makefile2:3269: 
source/numerics/CMakeFiles/obj_numerics_release.dir/all] Error 2
make: *** [Makefile:136: all] Error 2


I am a bit confused, what else needs to be adjusted may be in the 
matrix_tools.cc. I would greatly appreciate help here.

Thank you for your time!

With kind regards,
Mariia


среда, 15 сентября 2021 г. в 16:56:41 UTC+2, d.arnd...@gmail.com: 

> Mariia,
>
> That's a problem a little more complicated to solve. Basically, we are not 
> instantiating the template for complex and BlockSparseMatrix. 
> If you are OK with recompiling deal.II, you should modify source/numerics/
> matrix_tools.inst.in so that all overloads are also compiled for complex 
> numbers.
> Otherwise, copy 
> https://github.com/dealii/dealii/blob/7439f2b0b4d210d237e8df53f12f47c242cfac3f/source/numerics/matrix_tools.cc#L240-L499
>  
> somewhere in your source code.
>
> Best,
> Daniel
>
> Am Mi., 15. Sept. 2021 um 09:10 Uhr schrieb Мария Бронзова <
> masia...@gmail.com>:
>
>> Dear Daniel, 
>>
>> Thank you a lot for the hint, it makes perfect sense! I also correctted 
>> the* interpolate_boundary_values* call as follow

Re: [deal.II] Building p4est with no system-wide zlib

2021-09-17 Thread Michał Wichrowski
@Wolfgang:
I commented out that lines, compiled deal.II and it looks OK, at least 
`make test` passes and  step-37 works in both release and debug mode. 

@Marc
I had the same idea, but there was nothing in `configure --help` to put 
custom zlib patch.

Thank you for the answers. For reference, I was using p4est-2.3.2 

piątek, 17 września 2021 o 08:36:09 UTC+2 mafe...@gmail.com napisał(a):

> Hi Michał,
>
> maybe it will help to invoke `configure --help` on the source of your 
> p4est tarball. Hopefully there will be instructions on how to connect 
> custom zlib libraries -- I couldn't find anything in their README :(
>
> Best,
> Marc
>
> On Thursday, September 16, 2021 at 6:26:23 PM UTC-6 Wolfgang Bangerth 
> wrote:
>
>>
>> > I am trying to set up deal.II on a computer with no system-wide zlib. I 
>> > do not have sudo privileges, thus I cannot just install, so I compiled 
>> > it from the source and installed in my home directory. Now I am trying 
>> > to build p4est using it. According to the message thrown by the scrip 
>> > (https://www.dealii.org/current/external-libs/p4est.html) I should 
>> > export CPPFLAGS="-DSC_LOG_PRIORITY=SC_LP_ESSENTIAL 
>> > -I/export/home/mwichro/lib/zlib/include/" 
>> > export LDFLAGS="-L/export/home/mwichro/lib/zlib/lib/" 
>> > Apparently setting those does not resolve the problem, the script still 
>> > complains about zlib. 
>> > 
>> > By going through what the script really does, I think the following 
>> line 
>> > triggers an error: 
>> > grep -q 'P4EST_HAVE_ZLIB *1' "$BUILD_FAST/src/p4est_config.h" \ || bdie 
>> > "$MISSING_ZLIB_MESSAGE" 
>> > 
>> > As far as I understood, it looks 
>> > into p4est-build/FAST/src/p4est_config.h . That file on my system does 
>> > not exist. I also went through the config.log, it looks like it 
>> contains: 
>> > #define LIBS "  -lz -lm   " 
>> > so I guess it links with zlib? 
>>
>> Michal: I don't know whether anyone still remembers how that 
>> installation script came about. What happens if you just remove the line 
>> that causes the script to abort? 
>>
>>
>> > By the way, I moved to Heidelberg and I am happy to continue my work 
>> > with deal.II library. 
>> Nice, glad to hear you landed in a good place a lot of us have good 
>> memories of! 
>>
>> Best 
>> Wolfgang 
>>
>> -- 
>>  
>> Wolfgang Bangerth email: bang...@colostate.edu 
>> www: http://www.math.colostate.edu/~bangerth/ 
>>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/f49c5d4b-f9fa-40dc-ad12-c64481a32540n%40googlegroups.com.


Re: [deal.II] MatrixTools::apply_boundary_values for BlockSparseMatrix> and BlockVector> entries

2021-09-17 Thread Daniel Arndt
Mariia,

I also tried fixing this within deal.II and discovered that some more
changes are necessary, see https://github.com/dealii/dealii/pull/12761.
Would you mind checking if the changes proposed there work for you?

Best,
Daniel

Am Fr., 17. Sept. 2021 um 06:25 Uhr schrieb Мария Бронзова <
masianic...@gmail.com>:

> Dear Daniel,
>
> Thank you a lot for the solution ways! I was trying to modify the
> /dealii-9.3.1/source/numerics/matrix_tools.inst.in as follows:
>
> // -
> //
> // Copyright (C) 2010 - 2018 by the deal.II authors
> //
> // This file is part of the deal.II library.
> //
> // The deal.II library is free software; you can use it, redistribute
> // it, and/or modify it under the terms of the GNU Lesser General
> // Public License as published by the Free Software Foundation; either
> // version 2.1 of the License, or (at your option) any later version.
> // The full text of the license can be found in the file LICENSE.md at
> // the top level directory of deal.II.
> //
> // -
>
> for (number : REAL_SCALARS)
>   {
> template void MatrixTools::local_apply_boundary_values(
>   const std::map &boundary_values,
>   const std::vector & local_dof_indices,
>   FullMatrix & local_matrix,
>   Vector & local_rhs,
>   const bool   eliminate_columns);
>
> template void MatrixTools::apply_boundary_values(
>   const std::map &boundary_values,
>   SparseMatrix &   matrix,
>   Vector & solution,
>   Vector & right_hand_side,
>   const bool   eliminate_columns);
>
> template void MatrixTools::apply_boundary_values(
>   const std::map &boundary_values,
>   BlockSparseMatrix &  matrix,
>   BlockVector &solution,
>   BlockVector &right_hand_side,
>   const bool   eliminate_columns);
>   }
>
> for (number : COMPLEX_SCALARS)
>   {
> template void MatrixTools::apply_boundary_values(
>   const std::map &boundary_values,
>   SparseMatrix &   matrix,
>   Vector & solution,
>   Vector & right_hand_side,
>   const bool   eliminate_columns);
>
> *template void MatrixTools::apply_boundary_values(*
> *  const std::map &boundary_values,*
> *  BlockSparseMatrix &  matrix,*
> *  BlockVector &solution,*
> *  BlockVector &right_hand_side,*
> *  const bool
>  eliminate_columns);*
>   }
>
> Then I recompiled everything and got the error:
>
> /home/mariia/Downloads/dealii-9.3.1/source/numerics/matrix_tools.cc:364:49:
> *error*: no match for ‘operator!=’ (operand types are
> ‘std::complex’ and ‘double’)
>   364 |   .diag_element(block_index.second) != 0.0)
> In file included from
> /home/mariia/Downloads/dealii-9.3.1/include/deal.II/base/parallel.h:23,
>  from
> /home/mariia/Downloads/dealii-9.3.1/include/deal.II/base/aligned_vector.h:25,
>  from
> /home/mariia/Downloads/dealii-9.3.1/include/deal.II/base/table.h:21,
>  from
> /home/mariia/Downloads/dealii-9.3.1/include/deal.II/lac/block_sparsity_pattern.h:25,
>  from
> /home/mariia/Downloads/dealii-9.3.1/include/deal.II/lac/sparsity_tools.h:24,
>  from
> /home/mariia/Downloads/dealii-9.3.1/include/deal.II/base/graph_coloring.h:25,
>  from
> /home/mariia/Downloads/dealii-9.3.1/include/deal.II/base/work_stream.h:22,
>  from
> /home/mariia/Downloads/dealii-9.3.1/source/numerics/matrix_tools.cc:19:
> ..
> make[2]: ***
> [source/numerics/CMakeFiles/obj_numerics_release.dir/build.make:188:
> source/numerics/CMakeFiles/obj_numerics_release.dir/matrix_tools.cc.o]
> Error 1
> make[1]: *** [CMakeFiles/Makefile2:3269:
> source/numerics/CMakeFiles/obj_numerics_release.dir/all] Error 2
> make: *** [Makefile:136: all] Error 2
>
>
> I am a bit confused, what else needs to be adjusted may be in the
> matrix_tools.cc. I would greatly appreciate help here.
>
> Thank you for your time!
>
> With kind regards,
> Mariia
>
>
> среда, 15 сентября 2021 г. в 16:56:41 UTC+2, d.arnd...@gmail.com:
>
>> Mariia,
>>
>> That's a problem a little more complicated to solve. Basically, we are
>> not instantiating the template for complex and BlockSparseMatrix.
>> If you are OK with recompiling deal.II, you should modify source/numerics/
>> matrix_tools.inst.in so that all overloads are also compiled for

[deal.II] Compiling error regarding #include

2021-09-17 Thread Jau-Uei Chen
Dear all,

Currently, I encounter a fatal error when compiling my code built upon 
dealii library.

The error message reads:
[ 12%] Building CXX object 
CMakeFiles/current/folder/mmult_Trilinos_test.cc.o 
In file included from 
/home1/apps/gcc7_1/impi18_0/dealii/9.1.1/include/deal.II/base/index_set.h:23:0,
from 
/my/folder/mmult_Trilinos_test.cc:1:/home1/apps/gcc7_1/impi18_0/dealii/9.1.1/include/deal.II/base/utilities.h:45:10:
 
fatal error: boost/archive/binary_iarchive.hpp: No such file or directory
#include 

I am compiling it on Stampede2 and the modules I loaded are:
1) git/2.24.1 6) python2/2.7.14   11) boost/1.64  16) petsc/3.11
2) cmake/3.16.1   7) mkl/17.0.4   12) dealii/9.1.117) slepc/3.11
3) xalt/2.10.28) autotools/1.113) p4est/2.0   18) 
trilinos/12.18.1
4) TACC   9) libfabric/1.7.0  14) hdf5/1.10.4
5) gcc/7.1.0 10) impi/18.0.0  15) parmetis_petsc/4.0

In addition, I also got warning messages when running cmake. The issue is 
similar to this post 
. I assume 
that it won't pose any significant effect on compilation so I just ignored 
it.

Previously, it could be successfully compiled with deal.ii.9.0.1 and 9.1.1 
that are manually installed on Stampede2. This time I just try to do it 
with modules but run into the trouble I just mentioned.

Any suggestion or comment is greatly appreciated.

Best Regards,
Jau-Uei Chen

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/1af28fdf-a76c-4e31-a331-cce41238e1e4n%40googlegroups.com.


Re: [deal.II] pass depth/position to constructor of point history class

2021-09-17 Thread Wolfgang Bangerth



Sabyasachi,
it took me a while to understand that what you are asking is not actually a 
question about deal.II but about how to do what you are suggesting in C++.


The relevant part of the setup_q_point_data() function in step-18 is this:

quadrature_point_history.resize(
  triangulation.n_locally_owned_active_cells()
   * quadrature_formula.size());

unsigned int history_index = 0;
for (auto &cell : triangulation.active_cell_iterators())
  if (cell->is_locally_owned())
{
  cell->set_user_pointer(&quadrature_point_history[history_index]);
  history_index += quadrature_formula.size();
}

What this is doing is simply allocating enough objects and then setting 
pointers from the cell to the individual objects. In other words, at the time 
where the objects are created (in the resize() call), the history objects are 
not yet associated with individual cells, and so you could not set a depth for 
each object.


You could of course turn the order around and go over cells and on every cell 
you create an object that you then add to the collection via

  quadrature_point_history.push_back(...);
Because you know which cell/q-point each object is associated when you create 
it, you can compute the depth and pass it to the constructor.


Alternatively, you could leave the order in place and set the depth at a later 
time -- i.e., you'd add a "setter function" to your class, and in the body of 
the loop over all cells you'd loop over all quadrature points and set the 
depth for the corresponding history object.


I hope this helps!
Best
 W.


On 9/8/21 2:04 PM, sabyasachi chatterjee wrote:

Hello all,

I defined a class named SCDWrapper inside the point history class which needs 
information about the depth of the gauss point corresponding to the point 
history object's location from the surface when it is created.


```
template 
   class PointHistory
   {
     public:
     PointHistory(double&);
     ~PointHistory();
     SCDWrapper srscd;
   };
```

So I added an argument storing the depth to the constructor of point history 
class which then passes it to the member class.


```
template  PointHistory::PointHistory(double 
&depth_in):srscd(depth_in)

   {
   }
```

My question is how do I initialize the point history objects with this 
argument (which is variable across the gauss points) and pass it to the 
constructor. For example, in Step 18 in the function 
/setup_quadrature_point_history/ where the point history objects are 
initialized, how do I pass the information about this depth variable.


Thanks,
Sabyasachi




--
The deal.II project is located at http://www.dealii.org/ 

For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en 


---
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an 
email to dealii+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/14ce9ef5-57d2-4bbd-bc07-52e5198a5490n%40googlegroups.com 
.



--

Wolfgang Bangerth  email: bange...@colostate.edu
   www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups "deal.II

Re: [deal.II] pass depth/position to constructor of point history class

2021-09-17 Thread Wolfgang Bangerth



Sabyasachi,
it took me a while to understand that what you are asking is not actually a 
question about deal.II but about how to do what you are suggesting in C++.


The relevant part of the setup_q_point_data() function in step-18 is this:

quadrature_point_history.resize(
  triangulation.n_locally_owned_active_cells()
   * quadrature_formula.size());

unsigned int history_index = 0;
for (auto &cell : triangulation.active_cell_iterators())
  if (cell->is_locally_owned())
{
  cell->set_user_pointer(&quadrature_point_history[history_index]);
  history_index += quadrature_formula.size();
}

What this is doing is simply allocating enough objects and then setting 
pointers from the cell to the individual objects. In other words, at the time 
where the objects are created (in the resize() call), the history objects are 
not yet associated with individual cells, and so you could not set a depth for 
each object.


You could of course turn the order around and go over cells and on every cell 
you create an object that you then add to the collection via

  quadrature_point_history.push_back(...);
Because you know which cell/q-point each object is associated when you create 
it, you can compute the depth and pass it to the constructor.


Alternatively, you could leave the order in place and set the depth at a later 
time -- i.e., you'd add a "setter function" to your class, and in the body of 
the loop over all cells you'd loop over all quadrature points and set the 
depth for the corresponding history object.


I hope this helps!
Best
 W.


On 9/8/21 2:04 PM, sabyasachi chatterjee wrote:

Hello all,

I defined a class named SCDWrapper inside the point history class which needs 
information about the depth of the gauss point corresponding to the point 
history object's location from the surface when it is created.


```
template 
   class PointHistory
   {
     public:
     PointHistory(double&);
     ~PointHistory();
     SCDWrapper srscd;
   };
```

So I added an argument storing the depth to the constructor of point history 
class which then passes it to the member class.


```
template  PointHistory::PointHistory(double 
&depth_in):srscd(depth_in)

   {
   }
```

My question is how do I initialize the point history objects with this 
argument (which is variable across the gauss points) and pass it to the 
constructor. For example, in Step 18 in the function 
/setup_quadrature_point_history/ where the point history objects are 
initialized, how do I pass the information about this depth variable.


Thanks,
Sabyasachi




--
The deal.II project is located at http://www.dealii.org/ 

For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en 


---
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an 
email to dealii+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/14ce9ef5-57d2-4bbd-bc07-52e5198a5490n%40googlegroups.com 
.



--

Wolfgang Bangerth  email: bange...@colostate.edu
   www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups "deal.II

Re: [deal.II] Re: Eigenproblem and creating a preconditioner out of a linear operator, Eigensolver Selection

2021-09-17 Thread Anton Ermakov
Dear Daniel,

I am working on a similar problem (planetary acoustic oscillations). I am 
interested in looking at your tutorial for an electromagnetic cavity, but 
it seems that the pull request was deleted. I wonder if it can be revived.

Thank you,
Anton.

On Monday, July 8, 2019 at 3:51:08 AM UTC-7 Daniel Garcia-Sanchez wrote:

> Hi Andreas,
>
>
> On Sunday, July 7, 2019 at 4:26:39 PM UTC+2, Andreas Hegendörfer wrote:
>>
>> I also tried a spectral transformation with the Arpack solver with the 
>> same result as without spectral transformation. I am interested in the 
>> smallest real eigenvalues. I know from previous calculations with the 
>> Krylov Schur solver form SLEPc that using or not using a spectral 
>> transformation makes a very big difference here. 
>>
>
> Yes, using a spectral transformation makes a huge difference if your 
> eigenvalues are from the interior of the spectrum, although if you are 
> interested in the smallest real eigenvalue, the difference might not be 
> that important.
>
> The drawback of an spectral transformation is that you have to use a 
> direct solver.
>
> You can use an iterative solver with an spectral transformation for very 
> large problems. However, using an iterative linear solver with an spectral 
> transformation makes the overall solution process less robust.
>
> Although the direct solver approach may seem too costly, the factorization 
> is only carried out at the beginning of the eigenvalue calculation and this 
> cost is amortized in each subsequent application of the operator.
>
> I think that the drawback of an iterative solver is that it requires lot 
> of memory and does not scale very well. This figure can give you an idea of 
> the scalability of MUMPS (direct parallel solver).
>
> https://www.researchgate.net/figure/Strong-scalability-of-an-iterative-solver-with-different-preconditioners-versus-MUMPS_fig2_282172435
>  
>
>> I do not want to use SLEPc here because I think handling the PETSc 
>> Matrices and vectors is too uncomfortable for my application. Am I right at 
>> this point? What do you think about using SLEPc here?
>>
>
> I'm writing a tutorial about how to calculate the eigenmodes of an 
> electromagnetic cavity. So far, I've written the code, I'm writing now the 
> documentation. You can take a look. You can find the code in this pull 
> request:
>
> https://github.com/dealii/dealii/pull/8345
>
> The tutorial uses MPI, and SLEPc with std::complex.
>
> The eigenvalues in this tutorial are from the interior of the spectrum, 
> therefore I have to use an spectral transformation with a direct solver.
>
> Note that PETSc has to be compiled with MUMPS if you want to run that 
> tutorial.
>
> Best,
> Daniel
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/5f867abb-b809-4230-994f-e5a920e95336n%40googlegroups.com.