[petsc-users] Unstructured mesh

Karthikeyan Chockalingam - STFC UKRI karthikeyan.chockalingam at stfc.ac.uk
Fri Dec 10 12:11:20 CST 2021

```Thank you that worked. I have attached the output of the run

./ex56 -cells 2,2,1 -max_conv_its 2 -lx 1. -alpha .01 -petscspace_degree 1 -ksp_type cg -ksp_monitor -ksp_rtol 1.e-8 -pc_type asm -snes_monitor -use_mat_nearnullspace true -snes_rtol 1.e-10 -ex56_dm_view

Below is the mesh information I get before the solve.
Not sure how to interpret them – is ‘18’ say number of elements in certain direction?
How does ‘18’ come about – given cells 2,2,1 as input?
Sorry, bit lost what markers and other labels represent.

Mesh in 3 dimensions:
0-cells: 18
1-cells: 33
2-cells: 20
3-cells: 4
Labels:
marker: 1 strata with value/size (1 (48))
Face Sets: 6 strata with value/size (6 (2), 5 (2), 3 (2), 4 (2), 1 (4), 2 (4))
depth: 4 strata with value/size (0 (18), 1 (33), 2 (20), 3 (4))
boundary: 1 strata with value/size (1 (66))
celltype: 4 strata with value/size (7 (4), 0 (18), 4 (20), 1 (33))

I am more puzzled as the mesh information changes after the solve?

Mesh in 3 dimensions:

0-cells: 75

1-cells: 170

2-cells: 128

3-cells: 32

Labels:

celltype: 4 strata with value/size (0 (75), 1 (170), 4 (128), 7 (32))

depth: 4 strata with value/size (0 (75), 1 (170), 2 (128), 3 (32))

marker: 1 strata with value/size (1 (240))

Face Sets: 6 strata with value/size (6 (18), 5 (18), 3 (18), 4 (18), 1 (36), 2 (36))

boundary: 1 strata with value/size (1 (258))

Best,
Karthik.

From: Matthew Knepley <knepley at gmail.com>
Date: Friday, 10 December 2021 at 16:17
To: "Chockalingam, Karthikeyan (STFC,DL,HC)" <karthikeyan.chockalingam at stfc.ac.uk>
Cc: "petsc-users at mcs.anl.gov" <petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] Unstructured mesh

On Fri, Dec 10, 2021 at 10:49 AM Karthikeyan Chockalingam - STFC UKRI <karthikeyan.chockalingam at stfc.ac.uk<mailto:karthikeyan.chockalingam at stfc.ac.uk>> wrote:
I tried using the flag -dm_view to get mesh information.
I was hoping it might create a output file with mesh information but it didn’t create any.
What should I expect with -dm_view?

-dm_view prints the Plex information to the screen (by default), but it responds to the normal viewer options.
However, it looks like Mark changes the prefix on the mesh, so I think you need

-ex56_dm_view

Thanks,

Matt

Best,
Karthik.

From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Date: Friday, 10 December 2021 at 13:04
To: "Chockalingam, Karthikeyan (STFC,DL,HC)" <karthikeyan.chockalingam at stfc.ac.uk<mailto:karthikeyan.chockalingam at stfc.ac.uk>>
Cc: "petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>" <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [petsc-users] Unstructured mesh

On Fri, Dec 10, 2021 at 7:42 AM Karthikeyan Chockalingam - STFC UKRI <karthikeyan.chockalingam at stfc.ac.uk<mailto:karthikeyan.chockalingam at stfc.ac.uk>> wrote:
Hi Matt,

I intend to perform a scaling study – I have a few more questions from ex56
3D, tri-quadratic hexahedra (Q1), displacement finite element formulation.

i)                    What makes the problem non-linear? I believe SNES are used to solve non-linear problems.
It is a linear problem. We use SNES because it is easier to use it for everything.

ii)                   2,2,1 does it present the number of elements used in each direction?
You can use -dm_view to show the mesh information actually used in the run.

iii)                 What makes the problem unstructured? I believe the geometry is a cube or cuboid – is it because it uses DMPlex?
Yes.

iv)                 Do any external FEM package with an unstructured problem domain has to use DMPlex mat type?
DMPlex is not a Mat type, but rather a DM type. I do not understand the question. For example, LibMesh uses PETSc solvers but has
its own mesh types.

v)                   What about -mat_type (not _dm_mat_type) ajicusparse – will it work with unstructured FEM discretised domains?
dm_mat_type is just a way of setting the MatType that the DM creates. You can set it to whatever type you want. Since it uses MatSetValues()
there may be overhead in converting to that matrix type, but it should work.

I tried to run two problems of ex56 with two different domain size ( - attached you find the log_view outputs of both on gpus) using _pc_type asm:

./ex56 -cells 2,2,1 -max_conv_its 2 -lx 1. -alpha .01 -petscspace_degree 1 -ksp_type cg -ksp_monitor -ksp_rtol 1.e-8 -pc_type asm -snes_monitor -use_mat_nearnullspace true  -snes_rtol 1.e-10 > output_221.txt

./ex56 -cells 10,10,5 -max_conv_its 2 -lx 1. -alpha .01 -petscspace_degree 1 -ksp_type cg -ksp_monitor -ksp_rtol 1.e-8 -pc_type asm -snes_monitor -use_mat_nearnullspace true  -snes_rtol 1.e-10 > output_221.txt

Below is the SNES iteration for problem with 2,2,1 cells which converges after two non-linear iterations:

0 SNES Function norm 0.000000000000e+00
0 SNES Function norm 7.529825940191e+01
1 SNES Function norm 4.734810707002e-08
2 SNES Function norm 1.382827243108e-14

Your KSP tolerance is too high, so it takes another iterate. Use -ksp_rtol 1e-10.

Below is the SNES iteration for problem with 10,10,5 cells– why does it first decrease and then increase to 0 SNES Function norm 1.085975028558e+01 and finally converge?

0 SNES Function norm 2.892801019593e+01
1 SNES Function norm 5.361683383932e-07
2 SNES Function norm 1.726814199132e-14
0 SNES Function norm 1.085975028558e+01
1 SNES Function norm 2.294074693590e-07
2 SNES Function norm 2.491900236077e-14

You are solving the problem twice, probably because ex56 is in its refinement loop.

Thanks,

Matt

Kind regards,
Karthik.

From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Date: Thursday, 2 December 2021 at 10:57
To: "Chockalingam, Karthikeyan (STFC,DL,HC)" <karthikeyan.chockalingam at stfc.ac.uk<mailto:karthikeyan.chockalingam at stfc.ac.uk>>
Cc: "petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>" <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [petsc-users] Unstructured mesh

On Thu, Dec 2, 2021 at 3:33 AM Karthikeyan Chockalingam - STFC UKRI <karthikeyan.chockalingam at stfc.ac.uk<mailto:karthikeyan.chockalingam at stfc.ac.uk>> wrote:
Hello,

Are there example tutorials on unstructured mesh in ksp? Can some of them run on gpus?

There are many unstructured grid examples, e.g. SNES ex13, ex17, ex56. The solver can run on the GPU, but the vector/matrix
FEM assembly does not. I am working on that now.

Thanks,

Matt

Kind regards,
Karthik.

This email and any attachments are intended solely for the use of the named recipients. If you are not the intended recipient you must not use, disclose, copy or distribute this email or any of its attachments and should notify the sender immediately and delete this email from your system. UK Research and Innovation (UKRI) has taken every reasonable precaution to minimise risk of this email or any attachments containing viruses or malware but the recipient should carry out its own virus and malware checks before opening the attachments. UKRI does not accept any liability for any losses or damages which the recipient may sustain due to presence of any viruses.

--
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/<http://www.cse.buffalo.edu/~knepley/>

--
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/<http://www.cse.buffalo.edu/~knepley/>

--
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/<http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211210/133b4499/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mesh_out.txt
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211210/133b4499/attachment-0001.txt>
```