Re: [deal.II] Impose values inside a material/ not on the boundary

2022-02-17 Thread Wolfgang Bangerth

On 2/15/22 07:32, 'Markus Mehnert' via deal.II User Group wrote:


Thank you for your response. I identified the correct dofs by trial and error 
which worked (9 dofs for a scalar quantity with quadratic polyorder).  
However, when I use /"fe_face.system_to_base_index().first.first" /to 
identify, which base element these dofs belong to, it does not at all fit the 
theory as they should all belong to base 1, i.e. the electric potential (I 
copied the output from my terminal)


The base group of dof 3 is: 1
The base group of dof 10 is: 1
The base group of dof 17 is: 1
The base group of dof 24 is: 1
The base group of dof 31 is: 1
The base group of dof 41 is: 2
The base group of dof 51 is: 0
The base group of dof 61 is: 2
The base group of dof 71 is: 2

This explains, why my former code did not work, however it raises the 
question, why the dofs do not belong to the (correct) base element. Do you 
have any idea?


Markus -- I have to admit that I'm not sure I can follow the details. Can you 
create a small program that only creates the element and outputs what you are 
interested in, along with an explanation of what you *think* it should output?


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/d1d8e87b-9897-e2f7-375a-0cc731f7af96%40colostate.edu.


Re: [deal.II] Impose values inside a material/ not on the boundary

2022-02-15 Thread 'Markus Mehnert' via deal.II User Group
Dear Wolfgang,

Thank you for your response. I identified the correct dofs by trial and 
error which worked (9 dofs for a scalar quantity with quadratic 
polyorder).  However, when I use *"fe_face.system_to_base_index().first.first" 
*to identify, which base element these dofs belong to, it does not at all 
fit the theory as they should all belong to base 1, i.e. the electric 
potential (I copied the output from my terminal)

The base group of dof 3 is: 1
The base group of dof 10 is: 1
The base group of dof 17 is: 1
The base group of dof 24 is: 1
The base group of dof 31 is: 1
The base group of dof 41 is: 2
The base group of dof 51 is: 0
The base group of dof 61 is: 2
The base group of dof 71 is: 2

This explains, why my former code did not work, however it raises the 
question, why the dofs do not belong to the (correct) base element. Do you 
have any idea?

Thank you and kind regards,
Markus



Wolfgang Bangerth schrieb am Dienstag, 15. Februar 2022 um 04:32:09 UTC+1:

> On 2/11/22 12:12, 'Markus Mehnert' via deal.II User Group wrote:
> > *** Caution: EXTERNAL Sender ***
> > 
> > Dear Wolfgang,
> > 
> > Thank you for your quick response. The dofs per face are defined as /
> > /
> > /
> > /
> > /const unsigned int dofs_per_face = fe_cell.dofs_per_face;/
> > /
> > /
> > where fe_cell is the/FESystem/ that consists of
> > 
> > fe_cell(FE_Q (poly_order), dim,  //Displacement
> >  FE_Q (poly_order), 1,  //Electric Potential
> >  FE_Q (poly_order+1), dim, //Vectorial Electronic order 
> > parameter
> >  FE_DGPMonomial(poly_order - 1), 1,  // Dilatation
> >  FE_DGPMonomial(poly_order - 1), 1),  // Pressure
> > 
> >  I checked the number of dofs and it seems to be correct.
>
> Then it's time to count how many constraints you expect (on a piece of 
> paper), 
> how many you actually enter into the constraint object, and how many the 
> constraints object actually holds :-)
>
> 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/106f344a-45f5-4b19-81bf-8e92463dbb24n%40googlegroups.com.


Re: [deal.II] Impose values inside a material/ not on the boundary

2022-02-14 Thread Wolfgang Bangerth

On 2/11/22 12:12, 'Markus Mehnert' via deal.II User Group wrote:

*** Caution: EXTERNAL Sender ***

Dear Wolfgang,

Thank you for your quick response. The dofs per face are defined as /
/
/
/
/const unsigned int dofs_per_face = fe_cell.dofs_per_face;/
/
/
where fe_cell is the/FESystem/ that consists of

fe_cell(FE_Q (poly_order), dim,  //Displacement
              FE_Q (poly_order), 1,  //Electric Potential
              FE_Q (poly_order+1), dim, //Vectorial Electronic order 
parameter

              FE_DGPMonomial(poly_order - 1), 1,  // Dilatation
              FE_DGPMonomial(poly_order - 1), 1),  // Pressure

  I checked the number of dofs and it seems to be correct.


Then it's time to count how many constraints you expect (on a piece of paper), 
how many you actually enter into the constraint object, and how many the 
constraints object actually holds :-)


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/554ac709-be38-eb34-3c0c-1ef69a9b1c6d%40colostate.edu.


Re: [deal.II] Impose values inside a material/ not on the boundary

2022-02-11 Thread Wolfgang Bangerth



Markus,
how do you define dofs_per_face? Do you adjust it for the polynomial degree?
Best
 W.


On 2/11/22 10:51, 'Markus Mehnert' via deal.II User Group wrote:

*** Caution: EXTERNAL Sender ***

Hi everyone,

Instead of prescribing classical Dirichlet boundary conditions (i.e. the 
values for the solution field on the boundary) I am trying to impose the 
values for a specific degree of freedom inside my material. My idea was to 
iterate over all cells and their faces. Then I use the location of the center 
of the face to identify the faces, that have the right position. When I loop 
over all degrees of freedom of the face, I can find the DOFs that correspond 
to the correct base element, put these into a "boundary_values" vector and 
then use MatrixTools::apply_boundary_values to apply these values (see the 
following code snippet).


/ typename hp::DoFHandler::active_cell_iterator
cell = dof_handler.begin_active();
for (; cell!=dof_handler.end(); ++cell)
{
         for (unsigned int f = 0; f < GeometryInfo::faces_per_cell; ++f)

                 const Point face_center = cell->face(f)->center();
         if (face_center[2] == 5.0)
         {
                 cell->face(f)->get_dof_indices(local_dof_indices_face,0);
                 for(unsigned int i = 0; i < dofs_per_face; ++i)
                 {
                         const unsigned int i_group     = 
fe_face.system_to_base_index(i).first.first;

                         if (i_group == V_dof)
                         {
                                 boundary_values[local_dof_indices_face[i]]=0;
                         }
                 }

         }
}


MatrixTools::apply_boundary_values (boundary_values,
                 system_matrix,
                 locally_relevant_solution_update,
                 system_rhs,false);/


Here I try to apply the value for the electric potential (a scalar value, 
associated with the V_dof) on the middle plane of a cube with the sidelength 
10 (i.e. /face_center[2] == 5.0/)


This works fine, if the polynomial order of the FE_Q element is 1, however, if 
I increase the order it seems like the value is not applied to the DOFs 
between the vertices of the cell (see attached picture).  When I apply the 
boundary conditions on the surfaces using 
/VectorTools::interpolate_boundary_values /I do not have this issue.

Can anyone give me a tip, what might be the problem?

Thank you,
Markus

--
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/5b935808-c22f-4676-9418-6d7ee30228b9n%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 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 

[deal.II] Impose values inside a material/ not on the boundary

2022-02-11 Thread 'Markus Mehnert' via deal.II User Group
Hi everyone,

Instead of prescribing classical Dirichlet boundary conditions (i.e. the 
values for the solution field on the boundary) I am trying to impose the 
values for a specific degree of freedom inside my material. My idea was to 
iterate over all cells and their faces. Then I use the location of the 
center of the face to identify the faces, that have the right position. 
When I loop over all degrees of freedom of the face, I can find the DOFs 
that correspond to the correct base element, put these into a 
"boundary_values" vector and then use MatrixTools::apply_boundary_values to 
apply these values (see the following code snippet).



























* typename hp::DoFHandler::active_cell_iteratorcell = 
dof_handler.begin_active();for (; cell!=dof_handler.end(); ++cell){
for (unsigned int f = 0; f < GeometryInfo::faces_per_cell; ++f)
const Point face_center = cell->face(f)->center();if 
(face_center[2] == 5.0){
cell->face(f)->get_dof_indices(local_dof_indices_face,0);
for(unsigned int i = 0; i < dofs_per_face; ++i){
const unsigned int i_group = 
fe_face.system_to_base_index(i).first.first;if 
(i_group == V_dof){
boundary_values[local_dof_indices_face[i]]=0;}  
  }}}MatrixTools::apply_boundary_values (boundary_values,  
  system_matrix,
locally_relevant_solution_update,system_rhs,false);*


Here I try to apply the value for the electric potential (a scalar value, 
associated with the V_dof) on the middle plane of a cube with the 
sidelength 10 (i.e. *face_center[2] == 5.0*)

This works fine, if the polynomial order of the FE_Q element is 1, however, 
if I increase the order it seems like the value is not applied to the DOFs 
between the vertices of the cell (see attached picture).  When I apply the 
boundary conditions on the surfaces using 
*VectorTools::interpolate_boundary_values 
*I do not have this issue.
Can anyone give me a tip, what might be the problem?

Thank you,
Markus

-- 
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/5b935808-c22f-4676-9418-6d7ee30228b9n%40googlegroups.com.