Re: [deal.II] Extracting element solution in step-40

2023-04-07 Thread Daniel Arndt
Wasim,

step-40 uses Q2 elements which means that you have 9 dofs/cell in 2D and
for 32 cells in each direction (33+32)^2=65^2=4225 dofs.

Best,
Daniel



On Fri, Apr 7, 2023 at 5:47 AM Wasim Niyaz Munshi ce21d400 <
ce21d...@smail.iitm.ac.in> wrote:

> Thank You, Prof. Bangerth.
> I have one more doubt about the output of step-40.
> For cycle 0, there are 1024 cells (32*32 mesh). So, we have 33 nodes each,
> along x and y. So, shouldn't the number of DOFs be 1089 instead of 4225?
>
> Regards
> Wasim
>
> On Thursday, April 6, 2023 at 11:27:32 PM UTC+5:30 Wolfgang Bangerth wrote:
>
>> On 4/6/23 10:18, Wasim Niyaz Munshi ce21d400 wrote:
>> > How do I get the no.of cells owned by the processor?
>>
>> Triangulation::n_locally_owned_active_cells().
>>
>> 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/2b5174fe-2358-40b3-b404-1bcdfc332e62n%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/CAOYDWb%2BWiZ8b1fkgCwctSVqQaBo9LZ6Rdj%2Bv5dAdPA0oaimXVA%40mail.gmail.com.


Re: [deal.II] Extracting element solution in step-40

2023-04-07 Thread Wasim Niyaz Munshi ce21d400
Thank You, Prof. Bangerth. 
I have one more doubt about the output of step-40.
For cycle 0, there are 1024 cells (32*32 mesh). So, we have 33 nodes each, 
along x and y. So, shouldn't the number of DOFs be 1089 instead of 4225?

Regards 
Wasim

On Thursday, April 6, 2023 at 11:27:32 PM UTC+5:30 Wolfgang Bangerth wrote:

> On 4/6/23 10:18, Wasim Niyaz Munshi ce21d400 wrote:
> > How do I get the no.of cells owned by the processor?
>
> Triangulation::n_locally_owned_active_cells().
>
> 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/2b5174fe-2358-40b3-b404-1bcdfc332e62n%40googlegroups.com.


Re: [deal.II] Extracting element solution in step-40

2023-04-06 Thread Wolfgang Bangerth

On 4/6/23 10:18, Wasim Niyaz Munshi ce21d400 wrote:

How do I get the no.of cells owned by the processor?


Triangulation::n_locally_owned_active_cells().

Best
 W.

--

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/12bfea7e-6b92-9af1-d6fa-6d4db1e99f10%40colostate.edu.


Re: [deal.II] Extracting element solution in step-40

2023-04-06 Thread Wasim Niyaz Munshi ce21d400
I appreciate the clarification. I thought that global indexing was no 
longer present as the solution vector is distributed.
I have one more doubt. I want to create a vector (H_vector) that stores 
some value for each Gauss point in the domain.
For a serial problem, I was doing something like this:* H_vector = 
Vector (8*(triangulation.n_active_cells()));*

*8 because the problem is in 3d, so I have 8 Gauss points per cell.*
Now, for a MPI code, this H_vector would also be  *LA::MPI::Vector*, and 
its size should be* 8*no. of cells owned by the processor.*
How do I get the no.of cells owned by the processor?

Thanks and regards
Wasim

On Thursday, April 6, 2023 at 9:24:14 PM UTC+5:30 Wolfgang Bangerth wrote:

> On 4/6/23 06:02, Wasim Niyaz Munshi ce21d400 wrote:
> > 
> > I don't have a solution_vector for a parallel code, but a 
> > locally_relevant_solution. I want to know that, given this 
> > locally_relevant_solution and the cell, how do I get the element_sol?
> > The global_dof will not be helpful here, as the solution_vector is 
> > distributed across a number of processors.
>
> Daniel's question is correct, but to this specific point: A distributed 
> vector (and it's locally relevant incarnation) is still a global vector, 
> indexed by global degree of freedom numbers, and so the code remains 
> correct.
>
> 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/afbbd383-46a9-40cc-9a02-d2b4347898b3n%40googlegroups.com.


Re: [deal.II] Extracting element solution in step-40

2023-04-06 Thread Wolfgang Bangerth

On 4/6/23 06:02, Wasim Niyaz Munshi ce21d400 wrote:


I don't have a solution_vector for a parallel code, but a 
locally_relevant_solution. I want to know that, given this 
locally_relevant_solution and the cell, how do I get the element_sol?
The global_dof will not be helpful here, as the solution_vector is 
distributed across a number of processors.


Daniel's question is correct, but to this specific point: A distributed 
vector (and it's locally relevant incarnation) is still a global vector, 
indexed by global degree of freedom numbers, and so the code remains 
correct.


Best
 W.

--

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/23dfeb3b-001e-7cf0-e56e-fdbeb52edd78%40colostate.edu.


Re: [deal.II] Extracting element solution in step-40

2023-04-06 Thread Daniel Arndt
Wasim,

The answer depends very much on what you actually want to do with that
solution vector.
Do you want a representation of the solution (assuming you are using Q1?
nodal elements) on a single process/all processes
or are you just interested in the partial solution on every process
separately?
What you are doing looks quite similar to what DataOut would give you for
visualizing solutions.

Best,
Daniel

On Thu, Apr 6, 2023 at 8:02 AM Wasim Niyaz Munshi ce21d400 <
ce21d...@smail.iitm.ac.in> wrote:

> Hello everyone.
> I want to extract the element solution vector from the global solution
> once the problem is solved in step-40. For a serial code, I would do
> something like this:
>
> *int i=0;*
>
>
>
> *for (const auto vertex : cell->vertex_indices()) { int a =
> (cell->vertex_dof_index(vertex, 0)); element_sol[i] =  solution_vector[a];*
>
> *  i=i+1; }*
>
> I don't have a solution_vector for a parallel code, but a
> locally_relevant_solution. I want to know that, given this
> locally_relevant_solution and the cell, how do I get the element_sol?
> The global_dof will not be helpful here, as the solution_vector is
> distributed across a number of processors.
>
> Thanks and regards
> Wasim
>
>
> --
> 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/b2834b5b-f4f2-4931-9c5e-3f40d91b0648n%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/CAOYDWb%2BCgOgk6%2BWr%2BMZBXaRwtK9OQgDFs-JkcuGeRCtRWb8nAg%40mail.gmail.com.


[deal.II] Extracting element solution in step-40

2023-04-06 Thread Wasim Niyaz Munshi ce21d400
Hello everyone.
I want to extract the element solution vector from the global solution once 
the problem is solved in step-40. For a serial code, I would do something 
like this:

*int i=0;*



*for (const auto vertex : cell->vertex_indices()) { int a = 
(cell->vertex_dof_index(vertex, 0)); element_sol[i] =  solution_vector[a];*

*  i=i+1; }*

I don't have a solution_vector for a parallel code, but a 
locally_relevant_solution. I want to know that, given this 
locally_relevant_solution and the cell, how do I get the element_sol?
The global_dof will not be helpful here, as the solution_vector is 
distributed across a number of processors.

Thanks and regards
Wasim


-- 
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/b2834b5b-f4f2-4931-9c5e-3f40d91b0648n%40googlegroups.com.