[deal.II] Adding inhomogeneity to Periodic BC

2021-10-22 Thread Raghunandan Pratoori
Hello,

I have a cube with periodicity in all 3 directions. I want to add 
inhomogeneity in addition to Periodic BC on one face. Below is what I have 
done -

{
IndexSet selected_dofs_z;
std::set boundary_ids_z = std::set();
boundary_ids_x.insert(4);
DoFTools::extract_boundary_dofs(dof_handler, fe.component_mask(z
_displacement),
selected_dofs_z, boundary_ids_z
);
unsigned int nb_dofs_face_z = selected_dofs_z.n_elements();
IndexSet::ElementIterator dofs_z = selected_dofs_z.begin();

double relative_displacement_z = 1e-5;

for(unsigned int i = 0; i < nb_dofs_face_z; i++)
{
constraints.add_line(*dofs_z);
constraints.set_inhomogeneity(*dofs_z, 
relative_displacement_z));
dofs_z++;
}
}
When I do this on single 8 noded element, I get the constraints as -
2 = 0.001
3 0:  1
4 1:  1
5 = 0.002
6 0:  1
7 1:  1
8 = 0.002
9 0:  1
10 1:  1
11 = 0.003
12 0:  1
13 1:  1
14 = 0.001
15 0:  1
16 1:  1
17 = 0.001
18 0:  1
19 1:  1
20 = 0.001
21 0:  1
22 1:  1
23 = 0.001
When I should be getting -
2 = 0.001
3 0:  1
4 1:  1
5 = 0.001
6 0:  1
7 1:  1
8 = 0.001
9 0:  1
10 1:  1
11 = 0.001
12 0:  1
13 1:  1
14 = 0.001
15 0:  1
16 1:  1
17 = 0.001
18 0:  1
19 1:  1
20 = 0.001
21 0:  1
22 1:  1
23 = 0.001
Is there a mistake in how I am using set_inhomogeneity?

Thanks in advance,
Raghunandan.

-- 
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/5a1b58d8-114f-4398-b3fe-12ea7d474e2dn%40googlegroups.com.


Re: [deal.II] Re: Trilinos AMG ML .reinit() ... how to?

2021-10-22 Thread Wolfgang Bangerth

On 10/22/21 2:53 AM, richard@gmail.com wrote:


I think I know what it is: the ML guide on p 16 says in footnote 11:
"Note that the hierarchy produced by ReComputePreconditioner() can differ from 
that produced by ComputePreconditioner() for non-zero threshold values."
So when the matrix changes too much, the const double aggregation_threshold in 
PreconditionAMG::AdditionalData would lead to different matrix entries being 
considered.
That is why it was also working for (constant) Laplace and (almost constant 
Hyper-) Elasticity, but not so well for Navier-Stokes, since I initialized the 
AMG in the first timestep, where convective terms are completely zero starting 
from the quiescent state.
Hope someone finds this in the future and updates their AMG every few 
timesteps as well!


Richard -- I cannot recall who implemented the AMG preconditioner, but suspect 
that that parameter was simply never used. I don't think we use it in ASPECT, 
for example.


Since you figured out how to use it, is there a place where one could add a 
paragraph that describes what you found out and how one would use this 
feature? You might know this one piece of the library better than anyone else 
at this time :-) It would be nice to write your experience down in the place 
where others might look for it.


Best
 Wolfgang

--

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 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/2ae2c842-9d59-0d27-cf45-8b034d4114f3%40colostate.edu.


Re: [deal.II] Efficient Matrix-based Calculation

2021-10-22 Thread Jean-Paul Pelteret
Dear Masoud,

> As you mentioned, we expect this to be slower than the equivalent code in 
> step-8; however, it is very slower than the same code that I wrote before in 
> Matlab.

A quick question: are you sure that you’re running your problem in release 
mode, rather than debug mode? I had a colleague who adopted this BDB approach 
that you’ve described, and he never mentioned performance issues to the degree 
that you’re seeing here.

Best,
Jean-Paul

> On 20. Oct 2021, at 14:08, Masoud Ahmadi  wrote:
> 
> Dear Prof. Bangerth,
> 
> Thanks for your answer. 
> Indeed, I took the declaration of matrices out of the loop; but still, as I 
> mentioned, the part that is substantially reducing the speed is the product 
> between the matrices. 
> As you mentioned, we expect this to be slower than the equivalent code in 
> step-8; however, it is very slower than the same code that I wrote before in 
> Matlab. 
> My question is, I want to be sure that "FullMatrix" is the most efficient and 
> fast way in dealii to evaluate such like matrix calculations (the products). 
> Or should I be looking for alternatives?
> 
> Best regards
> 
> On Tuesday, 19 October 2021 at 19:24:11 UTC+1 Wolfgang Bangerth wrote:
> 
> Masoud, 
> 
> > Here is a part of the tutorial code for example 8 to calculate stiffness 
> > matrix of an element: 
> > Screenshot 2021-10-15 at 12.48.39.png 
> > 
> > And here is my equivalent code for the same purpose with a matrix-based 
> > viewpoint: 
> > Screenshot 2021-10-15 at 23.12.13.png 
> > 
> > it is based on the following formulation for a 3D elastic problem: 
> > thumbnail_image.png 
> > By "slow", I mean in comparison with the same code in tutorial (example 8). 
> > I 
> > measured the lines of the code, and I am sure the difference is for the 
> > mentioned part of the code. To be more accurate: the operations on 
> > matrices, 
> > as follow in the second image: 
> > B[I].Tmmult(tmpM,D); 
> > tmpM.mmult(BDB,B[J]); 
> 
> You could probably make the code substantially faster already if you moved 
> the 
> declaration of the B, tmpM, and BDB matrices out of the loop over the 
> quadrature points, and simply set them to zero inside the loop. Creating 
> these 
> variables requires allocating memory every time you do one iteration over the 
> quadrature points, which is expensive. 
> 
> But in the end, compare what work you are doing in your loop with what the 
> equivalent code in step-8 is doing, and you shouldn't be surprised by your 
> observation. step-8 only does 2 (and if i==j, then 3) tensor contractions for 
> each index i,j,q. You are allocating and releasing memory, and doing two 
> products between 6x3 and 3x3 matrices, plus a lot of index work. It does not 
> surprise me that this is slow. 
> 
> Best 
> W. 
> 
> -- 
>  
> 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/00c2608c-7489-4538-8bd7-09c989d844c4n%40googlegroups.com
>  
> .

-- 
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/E3BA93D2-831E-453F-9CD6-1818587CC00D%40gmail.com.


Re: [deal.II] Missing (block_sparse_matrix)

2021-10-22 Thread Daniel Arndt
Ahmed,

The file and the respective classes were deleted in
https://github.com/dealii/dealii/pull/9761 and deprecated in
https://github.com/dealii/dealii/pull/5352.
If you need to replace BlockMatrixArray, you should have a look at the
documentation in the latter pull request to use BlockLinearOperator(
https://www.dealii.org/current/doxygen/deal.II/classBlockLinearOperator.html)
instead.

Best,
Daniel

Am Fr., 22. Okt. 2021 um 04:29 Uhr schrieb Ahmed Galal <
ahmed.galal8...@gmail.com>:

> I am trying to compile a deal.ii code but it failed because of
> missing .
>
> I do not know how to include it in the recent dealii version. I found it
> available deal.ii 8.5.0.
>
> Thanks in advance!
>
>
> --
> 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/442d1ff2-fa5d-4d09-bbd1-c188f0d467bbn%40googlegroups.com
> 
> .
>

-- 
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/CAOYDWbKPxE8sPVUWHX_bjuJNztsYSBxzdwfDTu0rL2aLoDHxYQ%40mail.gmail.com.


[deal.II] Re: Trilinos AMG ML .reinit() ... how to?

2021-10-22 Thread richard....@gmail.com
HA!
I think I know what it is: the ML guide on p 16 says in footnote 11: 
"Note that the hierarchy produced by ReComputePreconditioner() can differ 
from that produced by ComputePreconditioner() for non-zero threshold 
values."
So when the matrix changes too much, the const double aggregation_threshold 
in PreconditionAMG::AdditionalData would lead to different matrix entries 
being considered.
That is why it was also working for (constant) Laplace and (almost constant 
Hyper-) Elasticity, but not so well for Navier-Stokes, since I initialized 
the AMG in the first timestep, where convective terms are completely zero 
starting from the quiescent state.
Hope someone finds this in the future and updates their AMG every few 
timesteps as well!
Best
Richard

-- 
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/042a1a0e-debf-484c-8cc6-b259aab15e5en%40googlegroups.com.


[deal.II] Missing (block_sparse_matrix)

2021-10-22 Thread Ahmed Galal
I am trying to compile a deal.ii code but it failed because of 
missing .

I do not know how to include it in the recent dealii version. I found it 
available deal.ii 8.5.0.

Thanks in advance!


-- 
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/442d1ff2-fa5d-4d09-bbd1-c188f0d467bbn%40googlegroups.com.