Re: [petsc-users] Gmsh 8-noded quadrilateral

2022-02-11 Thread Jed Brown
Sounds good. Note that if you use direct solvers, that extra node is basically 
free because the vertex separators are unchanged. It's a marginal cost in the 
storage of assembled matrices and the length of state vectors. And in 3D, even 
less significant.


Susanne Claus  writes:

> Dear Matthew and Jed,
>
> Brilliant. Thank you so much!
>
> Your changes work like a charm Matthew (I tested your branch on the gmsh 
> file I sent) and thank you so much for your advice Jed. The loss of one 
> order of convergence for an inf-sup stable pressure discretization seems 
> indeed a very high price to pay for the moderate increase in efficiency 
> by elimination of the interior modes. You have given me food for thought 
> and I will probably personally not use 8-node quadrilaterals. 
> Nevertheless, for our code it will be important to support 8-node 
> quadrilaterals as it is still an element widely used in solid mechanics 
> simulations. LibCEED looks very interesting.
>
> Thank you so much again.
>
> Best wishes from Paris,
> Susanne
>
> On 11.02.2022 20:27, Matthew Knepley wrote:
>
>> Jed is right about the numerics. However, this does not look hard. Here 
>> is my try at it:
>> 
>> https://gitlab.com/petsc/petsc/-/merge_requests/4838
>> 
>> Please tell me if this works and I will make a test and merge.
>> 
>> Thanks,
>> 
>> Matt
>> 
>> On Thu, Feb 10, 2022 at 6:47 PM Jed Brown  wrote:
>> 
>>> Susanne, do you want PetscFE to make the serendipity (8-node) finite 
>>> element space or do you just want to read these meshes? I.e., would it 
>>> be okay with you if the coordinates were placed in a Q_2 (9-node, 
>>> biquadratic) finite element space?
>>> 
>>> This won't matter if you're traversing the dofs per edge manually, but 
>>> there are some efficiency benefits of using the Q_2 space (especially 
>>> if your code can use the tensor product, perhaps via a library like 
>>> libCEED). Note that Q_2 spaces have better stability properties. For 
>>> example, the Q_2 space is inf-sup stable with P_1 discontinuous 
>>> pressure (gives third order L^2 and second order H^1 convergence), but 
>>> serendipity (8-node) is only stable with piecewise constant pressure 
>>> (gives second order L^2 and first order H^1 convergence).
>>> 
>>> Susanne Claus  writes:
>>> 
 Dear Matthew,
 
 Thank you so much.
 I have a attached a small 8-noded quadrilateral mesh file (Version 4
 ASCII) generated with gmsh 4.8.4.
 
 Best wishes,
 Susanne
 
 On 10.02.2022 16:23, Matthew Knepley wrote:
 
> On Thu, Feb 10, 2022 at 10:12 AM Susanne Claus 
> 
> wrote:
> 
>> Hello,
>> 
>> I am using DMPlex for the mesh structure of a solid mechanics 
>> finite
>> element code. I mainly use gmsh as input file format. When I try to
>> read in 8-noded Quadrilaterals (Element type 16 in gmsh) DMPlex 
>> tells
>> me that this element type is unknown. However a 9-noded 
>> Quadrilateral
>> can be read without problem. On inspecting the plexgmsh.c source 
>> code
>> I can see that 8-noded quadrilaterals are deactivated:
>> 
>> #if 0
>> 146:   {20, GMSH_TRI, 2, 3, 3,  9, NULL},
>> 147:   {16, GMSH_QUA, 2, 2, 4,  8, NULL},
>> 
>> For our application these 8-noded quadrilateral are very important.
>> 
>> Is there any reason why they have not been implemented/deactivated 
>> in
>> the dmplex gmsh reader?
> 
> No, we can handle them in the same way I think. Let me look at it.
> Hopefully it is easy.
> 
> Thanks,
> 
> Matt
> 
>> Thank you for all the great work you are doing. PETSc is amazing.
>> 
>> Best wishes,
>> Susanne Claus
> 
> --
> 
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which
> their experiments lead.
> -- Norbert Wiener
> 
> https://www.cse.buffalo.edu/~knepley/ [1]
 
 --
 
 Susanne Claus
 Ingénieur Chercheur
 Applied Mathematics and Scientific Computing Group
 DTIS
 
 ONERA - The French Aerospace Lab
 6 Chemin de la Vauve aux Granges, 91120 Palaiseau
 
 Links:
 --
 [1] http://www.cse.buffalo.edu/~knepley/
 $MeshFormat
 4.1 0 8
 $EndMeshFormat
 $PhysicalNames
 2
 1 2 "Neumann"
 2 1 "Domain"
 $EndPhysicalNames
 $Entities
 4 4 1 0
 1 0 0 0 0
 2 1 0 0 0
 3 1 1 0 0
 4 0 1 0 0
 1 -9.4736442e-08 -1e-07 -1e-07 1.001 1e-07 1e-07 0 2 1 -2
 2 0.9991 -9.4736442e-08 -1e-07 1.001 
 1.001 1e-07 1 2 2 2 -3
 3 -9.4736442e-08 0.9991 -1e-07 1.001 
 1.001 1e-07 0 2 3 -4
 4 -1e-07 -9.4736442e-08 -1e-07 1e-07 1.001 1e-07 0 2 4 -1
 1 -9.4736442e-08 -9.4736442e-08 -1e-07 1.001 
 1.001 1e-07 1 1 4 1 2 3 4
 

Re: [petsc-users] Gmsh 8-noded quadrilateral

2022-02-11 Thread Susanne Claus

Dear Matthew and Jed,

Brilliant. Thank you so much!

Your changes work like a charm Matthew (I tested your branch on the gmsh 
file I sent) and thank you so much for your advice Jed. The loss of one 
order of convergence for an inf-sup stable pressure discretization seems 
indeed a very high price to pay for the moderate increase in efficiency 
by elimination of the interior modes. You have given me food for thought 
and I will probably personally not use 8-node quadrilaterals. 
Nevertheless, for our code it will be important to support 8-node 
quadrilaterals as it is still an element widely used in solid mechanics 
simulations. LibCEED looks very interesting.


Thank you so much again.

Best wishes from Paris,
Susanne

On 11.02.2022 20:27, Matthew Knepley wrote:

Jed is right about the numerics. However, this does not look hard. Here 
is my try at it:


https://gitlab.com/petsc/petsc/-/merge_requests/4838

Please tell me if this works and I will make a test and merge.

Thanks,

Matt

On Thu, Feb 10, 2022 at 6:47 PM Jed Brown  wrote:

Susanne, do you want PetscFE to make the serendipity (8-node) finite 
element space or do you just want to read these meshes? I.e., would it 
be okay with you if the coordinates were placed in a Q_2 (9-node, 
biquadratic) finite element space?


This won't matter if you're traversing the dofs per edge manually, but 
there are some efficiency benefits of using the Q_2 space (especially 
if your code can use the tensor product, perhaps via a library like 
libCEED). Note that Q_2 spaces have better stability properties. For 
example, the Q_2 space is inf-sup stable with P_1 discontinuous 
pressure (gives third order L^2 and second order H^1 convergence), but 
serendipity (8-node) is only stable with piecewise constant pressure 
(gives second order L^2 and first order H^1 convergence).


Susanne Claus  writes:


Dear Matthew,

Thank you so much.
I have a attached a small 8-noded quadrilateral mesh file (Version 4
ASCII) generated with gmsh 4.8.4.

Best wishes,
Susanne

On 10.02.2022 16:23, Matthew Knepley wrote:

On Thu, Feb 10, 2022 at 10:12 AM Susanne Claus 


wrote:


Hello,

I am using DMPlex for the mesh structure of a solid mechanics 
finite

element code. I mainly use gmsh as input file format. When I try to
read in 8-noded Quadrilaterals (Element type 16 in gmsh) DMPlex 
tells
me that this element type is unknown. However a 9-noded 
Quadrilateral
can be read without problem. On inspecting the plexgmsh.c source 
code

I can see that 8-noded quadrilaterals are deactivated:

#if 0
146:   {20, GMSH_TRI, 2, 3, 3,  9, NULL},
147:   {16, GMSH_QUA, 2, 2, 4,  8, NULL},

For our application these 8-noded quadrilateral are very important.

Is there any reason why they have not been implemented/deactivated 
in

the dmplex gmsh reader?


No, we can handle them in the same way I think. Let me look at it.
Hopefully it is easy.

Thanks,

Matt


Thank you for all the great work you are doing. PETSc is amazing.

Best wishes,
Susanne Claus


--

What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ [1]


--

Susanne Claus
Ingénieur Chercheur
Applied Mathematics and Scientific Computing Group
DTIS

ONERA - The French Aerospace Lab
6 Chemin de la Vauve aux Granges, 91120 Palaiseau

Links:
--
[1] http://www.cse.buffalo.edu/~knepley/
$MeshFormat
4.1 0 8
$EndMeshFormat
$PhysicalNames
2
1 2 "Neumann"
2 1 "Domain"
$EndPhysicalNames
$Entities
4 4 1 0
1 0 0 0 0
2 1 0 0 0
3 1 1 0 0
4 0 1 0 0
1 -9.4736442e-08 -1e-07 -1e-07 1.001 1e-07 1e-07 0 2 1 -2
2 0.9991 -9.4736442e-08 -1e-07 1.001 
1.001 1e-07 1 2 2 2 -3
3 -9.4736442e-08 0.9991 -1e-07 1.001 
1.001 1e-07 0 2 3 -4

4 -1e-07 -9.4736442e-08 -1e-07 1e-07 1.001 1e-07 0 2 4 -1
1 -9.4736442e-08 -9.4736442e-08 -1e-07 1.001 
1.001 1e-07 1 1 4 1 2 3 4

$EndEntities
$Nodes
9 21 1 46
0 1 0 1
1
0 0 0
0 2 0 1
2
1 0 0
0 3 0 1
3
1 1 0
0 4 0 1
4
0 1 0
1 1 0 3
5
35
36
0.5 0 0
0.25 0 0
0.75 0 0
1 2 0 3
6
37
38
1 0.5 0
1 0.25 0
1 0.75 0
1 3 0 3
7
39
40
0.5 1 0
0.75 1 0
0.25 1 0
1 4 0 3
8
41
42
0 0.5 0
0 0.75 0
0 0.25 0
2 1 0 5
9
43
44
45
46
0.5 0.5 0
0.75 0.5 0
0.5 0.25 0
0.25 0.5 0
0.5 0.75 0
$EndNodes
$Elements
2 6 197 206
1 2 8 2
197 2 6 37
198 6 3 38
2 1 16 4
203 2 6 9 5 37 43 44 36
204 1 5 9 8 35 44 45 42
205 4 8 9 7 41 45 46 40
206 3 7 9 6 39 46 43 38
$EndElements


--

What most experimenters take for granted before they begin their 
experiments is infinitely more interesting than any results to which 
their experiments lead.

-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ [1]


--

Susanne Claus
Ingénieur Chercheur
Applied Mathematics and Scientific Computing Group
DTIS

ONERA - The French Aerospace Lab
6 Chemin de la Vauve aux Granges, 91120 Palaiseau

Links:
--
[1] 

Re: [petsc-users] Gmsh 8-noded quadrilateral

2022-02-11 Thread Matthew Knepley
Jed is right about the numerics. However, this does not look hard. Here is
my try at it:

  https://gitlab.com/petsc/petsc/-/merge_requests/4838

Please tell me if this works and I will make a test and merge.

  Thanks,

Matt

On Thu, Feb 10, 2022 at 6:47 PM Jed Brown  wrote:

> Susanne, do you want PetscFE to make the serendipity (8-node) finite
> element space or do you just want to read these meshes? I.e., would it be
> okay with you if the coordinates were placed in a Q_2 (9-node, biquadratic)
> finite element space?
>
> This won't matter if you're traversing the dofs per edge manually, but
> there are some efficiency benefits of using the Q_2 space (especially if
> your code can use the tensor product, perhaps via a library like libCEED).
> Note that Q_2 spaces have better stability properties. For example, the Q_2
> space is inf-sup stable with P_1 discontinuous pressure (gives third order
> L^2 and second order H^1 convergence), but serendipity (8-node) is only
> stable with piecewise constant pressure (gives second order L^2 and first
> order H^1 convergence).
>
> Susanne Claus  writes:
>
> > Dear Matthew,
> >
> > Thank you so much.
> > I have a attached a small 8-noded quadrilateral mesh file (Version 4
> > ASCII) generated with gmsh 4.8.4.
> >
> > Best wishes,
> > Susanne
> >
> > On 10.02.2022 16:23, Matthew Knepley wrote:
> >
> >> On Thu, Feb 10, 2022 at 10:12 AM Susanne Claus 
>
> >> wrote:
> >>
> >>> Hello,
> >>>
> >>> I am using DMPlex for the mesh structure of a solid mechanics finite
> >>> element code. I mainly use gmsh as input file format. When I try to
> >>> read in 8-noded Quadrilaterals (Element type 16 in gmsh) DMPlex tells
> >>> me that this element type is unknown. However a 9-noded Quadrilateral
> >>> can be read without problem. On inspecting the plexgmsh.c source code
> >>> I can see that 8-noded quadrilaterals are deactivated:
> >>>
> >>> #if 0
> >>> 146:   {20, GMSH_TRI, 2, 3, 3,  9, NULL},
> >>> 147:   {16, GMSH_QUA, 2, 2, 4,  8, NULL},
> >>>
> >>> For our application these 8-noded quadrilateral are very important.
> >>>
> >>> Is there any reason why they have not been implemented/deactivated in
> >>> the dmplex gmsh reader?
> >>
> >> No, we can handle them in the same way I think. Let me look at it.
> >> Hopefully it is easy.
> >>
> >> Thanks,
> >>
> >> Matt
> >>
> >>> Thank you for all the great work you are doing. PETSc is amazing.
> >>>
> >>> Best wishes,
> >>> Susanne Claus
> >>
> >> --
> >>
> >> What most experimenters take for granted before they begin their
> >> experiments is infinitely more interesting than any results to which
> >> their experiments lead.
> >> -- Norbert Wiener
> >>
> >> https://www.cse.buffalo.edu/~knepley/ [1]
> >
> > --
> >
> > Susanne Claus
> > Ingénieur Chercheur
> > Applied Mathematics and Scientific Computing Group
> > DTIS
> >
> > ONERA - The French Aerospace Lab
> > 6 Chemin de la Vauve aux Granges, 91120 Palaiseau
> >
> > Links:
> > --
> > [1] http://www.cse.buffalo.edu/~knepley/
> > $MeshFormat
> > 4.1 0 8
> > $EndMeshFormat
> > $PhysicalNames
> > 2
> > 1 2 "Neumann"
> > 2 1 "Domain"
> > $EndPhysicalNames
> > $Entities
> > 4 4 1 0
> > 1 0 0 0 0
> > 2 1 0 0 0
> > 3 1 1 0 0
> > 4 0 1 0 0
> > 1 -9.4736442e-08 -1e-07 -1e-07 1.001 1e-07 1e-07 0 2 1 -2
> > 2 0.9991 -9.4736442e-08 -1e-07 1.001 1.001
> 1e-07 1 2 2 2 -3
> > 3 -9.4736442e-08 0.9991 -1e-07 1.001 1.001
> 1e-07 0 2 3 -4
> > 4 -1e-07 -9.4736442e-08 -1e-07 1e-07 1.001 1e-07 0 2 4 -1
> > 1 -9.4736442e-08 -9.4736442e-08 -1e-07 1.001
> 1.001 1e-07 1 1 4 1 2 3 4
> > $EndEntities
> > $Nodes
> > 9 21 1 46
> > 0 1 0 1
> > 1
> > 0 0 0
> > 0 2 0 1
> > 2
> > 1 0 0
> > 0 3 0 1
> > 3
> > 1 1 0
> > 0 4 0 1
> > 4
> > 0 1 0
> > 1 1 0 3
> > 5
> > 35
> > 36
> > 0.5 0 0
> > 0.25 0 0
> > 0.75 0 0
> > 1 2 0 3
> > 6
> > 37
> > 38
> > 1 0.5 0
> > 1 0.25 0
> > 1 0.75 0
> > 1 3 0 3
> > 7
> > 39
> > 40
> > 0.5 1 0
> > 0.75 1 0
> > 0.25 1 0
> > 1 4 0 3
> > 8
> > 41
> > 42
> > 0 0.5 0
> > 0 0.75 0
> > 0 0.25 0
> > 2 1 0 5
> > 9
> > 43
> > 44
> > 45
> > 46
> > 0.5 0.5 0
> > 0.75 0.5 0
> > 0.5 0.25 0
> > 0.25 0.5 0
> > 0.5 0.75 0
> > $EndNodes
> > $Elements
> > 2 6 197 206
> > 1 2 8 2
> > 197 2 6 37
> > 198 6 3 38
> > 2 1 16 4
> > 203 2 6 9 5 37 43 44 36
> > 204 1 5 9 8 35 44 45 42
> > 205 4 8 9 7 41 45 46 40
> > 206 3 7 9 6 39 46 43 38
> > $EndElements
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] Gmsh 8-noded quadrilateral

2022-02-10 Thread Jed Brown
Susanne, do you want PetscFE to make the serendipity (8-node) finite element 
space or do you just want to read these meshes? I.e., would it be okay with you 
if the coordinates were placed in a Q_2 (9-node, biquadratic) finite element 
space?

This won't matter if you're traversing the dofs per edge manually, but there 
are some efficiency benefits of using the Q_2 space (especially if your code 
can use the tensor product, perhaps via a library like libCEED). Note that Q_2 
spaces have better stability properties. For example, the Q_2 space is inf-sup 
stable with P_1 discontinuous pressure (gives third order L^2 and second order 
H^1 convergence), but serendipity (8-node) is only stable with piecewise 
constant pressure (gives second order L^2 and first order H^1 convergence).

Susanne Claus  writes:

> Dear Matthew,
>
> Thank you so much.
> I have a attached a small 8-noded quadrilateral mesh file (Version 4 
> ASCII) generated with gmsh 4.8.4.
>
> Best wishes,
> Susanne
>
> On 10.02.2022 16:23, Matthew Knepley wrote:
>
>> On Thu, Feb 10, 2022 at 10:12 AM Susanne Claus  
>> wrote:
>> 
>>> Hello,
>>> 
>>> I am using DMPlex for the mesh structure of a solid mechanics finite 
>>> element code. I mainly use gmsh as input file format. When I try to 
>>> read in 8-noded Quadrilaterals (Element type 16 in gmsh) DMPlex tells 
>>> me that this element type is unknown. However a 9-noded Quadrilateral 
>>> can be read without problem. On inspecting the plexgmsh.c source code 
>>> I can see that 8-noded quadrilaterals are deactivated:
>>> 
>>> #if 0
>>> 146:   {20, GMSH_TRI, 2, 3, 3,  9, NULL},
>>> 147:   {16, GMSH_QUA, 2, 2, 4,  8, NULL},
>>> 
>>> For our application these 8-noded quadrilateral are very important.
>>> 
>>> Is there any reason why they have not been implemented/deactivated in 
>>> the dmplex gmsh reader?
>> 
>> No, we can handle them in the same way I think. Let me look at it. 
>> Hopefully it is easy.
>> 
>> Thanks,
>> 
>> Matt
>> 
>>> Thank you for all the great work you are doing. PETSc is amazing.
>>> 
>>> Best wishes,
>>> Susanne Claus
>> 
>> --
>> 
>> What most experimenters take for granted before they begin their 
>> experiments is infinitely more interesting than any results to which 
>> their experiments lead.
>> -- Norbert Wiener
>> 
>> https://www.cse.buffalo.edu/~knepley/ [1]
>
> -- 
>
> Susanne Claus
> Ingénieur Chercheur
> Applied Mathematics and Scientific Computing Group
> DTIS
>
> ONERA - The French Aerospace Lab
> 6 Chemin de la Vauve aux Granges, 91120 Palaiseau
>
> Links:
> --
> [1] http://www.cse.buffalo.edu/~knepley/
> $MeshFormat
> 4.1 0 8
> $EndMeshFormat
> $PhysicalNames
> 2
> 1 2 "Neumann"
> 2 1 "Domain"
> $EndPhysicalNames
> $Entities
> 4 4 1 0
> 1 0 0 0 0 
> 2 1 0 0 0 
> 3 1 1 0 0 
> 4 0 1 0 0 
> 1 -9.4736442e-08 -1e-07 -1e-07 1.001 1e-07 1e-07 0 2 1 -2 
> 2 0.9991 -9.4736442e-08 -1e-07 1.001 1.001 1e-07 
> 1 2 2 2 -3 
> 3 -9.4736442e-08 0.9991 -1e-07 1.001 1.001 1e-07 
> 0 2 3 -4 
> 4 -1e-07 -9.4736442e-08 -1e-07 1e-07 1.001 1e-07 0 2 4 -1 
> 1 -9.4736442e-08 -9.4736442e-08 -1e-07 1.001 1.001 
> 1e-07 1 1 4 1 2 3 4 
> $EndEntities
> $Nodes
> 9 21 1 46
> 0 1 0 1
> 1
> 0 0 0
> 0 2 0 1
> 2
> 1 0 0
> 0 3 0 1
> 3
> 1 1 0
> 0 4 0 1
> 4
> 0 1 0
> 1 1 0 3
> 5
> 35
> 36
> 0.5 0 0
> 0.25 0 0
> 0.75 0 0
> 1 2 0 3
> 6
> 37
> 38
> 1 0.5 0
> 1 0.25 0
> 1 0.75 0
> 1 3 0 3
> 7
> 39
> 40
> 0.5 1 0
> 0.75 1 0
> 0.25 1 0
> 1 4 0 3
> 8
> 41
> 42
> 0 0.5 0
> 0 0.75 0
> 0 0.25 0
> 2 1 0 5
> 9
> 43
> 44
> 45
> 46
> 0.5 0.5 0
> 0.75 0.5 0
> 0.5 0.25 0
> 0.25 0.5 0
> 0.5 0.75 0
> $EndNodes
> $Elements
> 2 6 197 206
> 1 2 8 2
> 197 2 6 37 
> 198 6 3 38 
> 2 1 16 4
> 203 2 6 9 5 37 43 44 36 
> 204 1 5 9 8 35 44 45 42 
> 205 4 8 9 7 41 45 46 40 
> 206 3 7 9 6 39 46 43 38 
> $EndElements


Re: [petsc-users] Gmsh 8-noded quadrilateral

2022-02-10 Thread Matthew Knepley
On Thu, Feb 10, 2022 at 10:12 AM Susanne Claus 
wrote:

> Hello,
>
> I am using DMPlex for the mesh structure of a solid mechanics finite
> element code. I mainly use gmsh as input file format. When I try to read in
> 8-noded Quadrilaterals (Element type 16 in gmsh) DMPlex tells me that this
> element type is unknown. However a 9-noded Quadrilateral can be read
> without problem. On inspecting the plexgmsh.c source code I can see that
> 8-noded quadrilaterals are deactivated:
>
> #if 0146:   {20, GMSH_TRI, 2, 3, 3,  9, NULL},147:   {16, GMSH_QUA, 2, 2, 4,  
> 8, NULL},
>
> For our application these 8-noded quadrilateral are very important.
>
> Is there any reason why they have not been implemented/deactivated in the 
> dmplex gmsh reader?
>
> No, we can handle them in the same way I think. Let me look at it.
Hopefully it is easy.

  Thanks,

 Matt


> Thank you for all the great work you are doing. PETSc is amazing.
>
> Best wishes,
> Susanne Claus
>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/