[petsc-users] Looking for PETSc Example: Poisson Equation in 2D using FEM - scale upto 1000 procs

Mark Adams mfadams at lbl.gov
Mon Sep 18 14:03:56 CDT 2023


Well, I think you can do Neumann problems with ex13 with a small code
change:

** run on a unit cube/square with: -dm_plex_box_upper 1,1,1
 -dm_plex_box_lower 0,0,0
** use a svd coarse grid solver: -mg_coarse_pc_type svd
** change one line in this example to get a Neumann problem on around 97
you comment this out: //PetscCall(DMAddBoundary(dm, DM_BC_ESSENTIAL,
"wall", label, 1, &id, 0, 0, NULL, (void (*)(void))trig_u, NULL, user,
NULL));

This is what I see and the solution :

(new_py-env) 14:46 86 adams/gamg-fast-filter *=
~/Codes/petsc/src/snes/tests$ ./ex13 -dm_plex_dim 2 -benchmark_it 0
-dm_plex_simplex 1 -dm_plex_box_faces 2,2,1 -dm_refine 2
-petscpartitioner_simple_node_grid 1,1,1
-petscpartitioner_simple_process_grid 2,2,1 -potential_petscspace_degree 2
-petscpartitioner_type simple -snes_type ksponly -dm_view -ksp_type cg
-ksp_rtol 1e-12 -snes_lag_jacobian -2 -dm_plex_box_upper 1,1
-dm_plex_box_lower 0,0 -pc_type gamg -pc_gamg_process_eq_limit 200
-pc_gamg_coarse_eq_limit 1000 -pc_gamg_esteig_ksp_type cg
-mg_levels_ksp_chebyshev_esteig 0,0.2,0,1.05 -pc_gamg_reuse_interpolation
true -pc_gamg_aggressive_square_graph true -pc_gamg_threshold 0.04
-pc_gamg_threshold_scale .25 -pc_gamg_aggressive_coarsening 2
-pc_gamg_mis_k_minimum_degree_ordering true -ksp_monitor -ksp_norm_type
unpreconditioned -dm_view hdf5:sol.h5 -potential_view hdf5:sol.h5::append
-ksp_converged_reason -mg_coarse_pc_type svd
Number equations N = 289
    0 KSP Residual norm 2.775536542048e+00
    1 KSP Residual norm 2.631487127409e+00
    2 KSP Residual norm 5.145745091100e-01
    3 KSP Residual norm 9.031411480985e-02
    4 KSP Residual norm 1.120911726117e-02
    5 KSP Residual norm 1.869571597808e-03
    6 KSP Residual norm 2.861476924898e-04
    7 KSP Residual norm 6.168949367531e-05
    8 KSP Residual norm 1.098972695713e-05
    9 KSP Residual norm 1.510979924319e-06
   10 KSP Residual norm 1.958281010810e-07
   11 KSP Residual norm 2.648997408740e-08
   12 KSP Residual norm 3.191829696292e-09
   13 KSP Residual norm 4.003245254269e-10
   14 KSP Residual norm 6.645229161624e-11
   15 KSP Residual norm 1.055754552827e-11
   16 KSP Residual norm 9.104749948055e-13
  Linear solve converged due to CONVERGED_RTOL iterations 16


On Mon, Sep 18, 2023 at 12:38 PM Mark Adams <mfadams at lbl.gov> wrote:

> There are several but I am updating *src/snes/tests/ex13.c *
> <https://gitlab.com/petsc/petsc/-/merge_requests/6875/diffs#diff-content-5a7dc636e85ce214f0a7dcf710f45f1e6800c0d4> now, in
> branch adams/gamg-fast-filter
> <https://gitlab.com/petsc/petsc/-/tree/adams/gamg-fast-filter>. but main
> is fine (it should get merged very soon).
> It does what you want scales forever, but it does not have Neumann BCs.
> I might be able to add that, but not today.
>
> Mark
>
> On Mon, Sep 18, 2023 at 11:16 AM Khurana, Parv <p.khurana22 at imperial.ac.uk>
> wrote:
>
>> Hello PETSc users,
>>
>>
>>
>> Thank you for this very active community of users and the mailing list.
>>
>>
>>
>> I am looking for a PETSc example which solves the Poisson equation on a
>> 2D domain using FEM (or HO-FEM if possible). I would like the following:
>>
>>    1. The example should be formulated fully on PETSc, and to be solved
>>    with KSP objects in PETSc.
>>    2. The problem should scale up to a few hundred processors (ideally
>>    1000 procs).
>>    3. Ideally on a unit square with either Square or Triangle element
>>    discretization.
>>    4. There should be an option to specify Dirichlet/Neumann-type BCs on
>>    the boundaries.
>>
>>
>>
>> I was wondering if someone could point me to such an example as I am
>> relatively new to PETSc – and I am trying to avoid reinventing the wheel. I
>> have had a look at Examples 29,32,50 and 66 in the PETSc tutorials – while
>> they are very close to what I need I am not sure if they scale to a few
>> hundred processors. Furthermore, I am aware that I can formulate such a
>> problem with FENICS/Firedrake with relative ease and these software
>> interfaces with PETSc quite well. However, I am just trying to see if such
>> an application already exists purely in PETSc.
>>
>>
>>
>> Thanks, and Best
>>
>> Parv
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230918/cd662d54/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2023-09-18 at 3.03.44 PM.png
Type: image/png
Size: 238805 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230918/cd662d54/attachment-0001.png>


More information about the petsc-users mailing list