[petsc-users] dm_view of high-order geometry/solution
Duan Junming
junming.duan at epfl.ch
Mon Jun 12 13:26:05 CDT 2023
Dear Jed,
Thank you for your help!
Now I moved the line using "DMViewFromOptions" after the function "PetscDSSetObjective",
and it works for "-dm_coord_petscspace_degree 3 -petscspace_degree 3".
But when I tried degree 4:
./ex33 -dm_plex_simplex 0 -dm_plex_box_faces 1,1 -mesh_transform annulus -dm_coord_space 0 -dm_coord_petscspace_degree 4 -petscspace_degree 4 -dm_refine 1 -dm_view cgns:test.cgns
Paraview gives an empty render.
Using degree 5:
./ex33 -dm_plex_simplex 0 -dm_plex_box_faces 1,1 -mesh_transform annulus -dm_coord_space 0 -dm_coord_petscspace_degree 5 -petscspace_degree 5 -dm_refine 1 -dm_view cgns:test.cgns
it reports:
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: No support for this operation for this object type
[0]PETSC ERROR: Cell type quadrilateral with closure size 36
[0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.19.2, unknown
[0]PETSC ERROR: ./ex33 on a arch-darwin-c-debug named JunmingMacBook-Pro.local by Junming Mon Jun 12 20:23:04 2023
[0]PETSC ERROR: Configure options --download-cgns --download-hdf5 --download-openmpi --download-triangle --with-fc=0 PETSC_ARCH=arch-darwin-c-debug --download-cgns
[0]PETSC ERROR: #1 DMPlexCGNSGetPermutation_Internal() at /Users/Junming/Packages/petsc/src/dm/impls/plex/cgns/plexcgns2.c:533
[0]PETSC ERROR: #2 DMView_PlexCGNS() at /Users/Junming/Packages/petsc/src/dm/impls/plex/cgns/plexcgns2.c:769
[0]PETSC ERROR: #3 DMView_Plex() at /Users/Junming/Packages/petsc/src/dm/impls/plex/plex.c:1801
[0]PETSC ERROR: #4 DMView() at /Users/Junming/Packages/petsc/src/dm/interface/dm.c:996
[0]PETSC ERROR: #5 PetscObjectView() at /Users/Junming/Packages/petsc/src/sys/objects/destroy.c:78
[0]PETSC ERROR: #6 PetscObjectViewFromOptions() at /Users/Junming/Packages/petsc/src/sys/objects/destroy.c:128
[0]PETSC ERROR: #7 DMViewFromOptions() at /Users/Junming/Packages/petsc/src/dm/interface/dm.c:940
[0]PETSC ERROR: #8 CreateDiscretization() at ex33.c:232
[0]PETSC ERROR: #9 main() at ex33.c:263
[0]PETSC ERROR: PETSc Option Table entries:
[0]PETSC ERROR: -dm_coord_petscspace_degree 5 (source: command line)
[0]PETSC ERROR: -dm_coord_space 0 (source: command line)
[0]PETSC ERROR: -dm_plex_box_faces 1,1 (source: command line)
[0]PETSC ERROR: -dm_plex_simplex 0 (source: command line)
[0]PETSC ERROR: -dm_refine 1 (source: command line)
[0]PETSC ERROR: -dm_view cgns:test.cgns (source: command line)
[0]PETSC ERROR: -mesh_transform annulus (source: command line)
[0]PETSC ERROR: -petscspace_degree 5 (source: command line)
[0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint at mcs.anl.gov----------
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_SELF
with errorcode 56.
Does cgns work for degree >= 4?
Junming
________________________________
From: Jed Brown <jed at jedbrown.org>
Sent: Monday, June 12, 2023 19:07
To: Duan Junming; Matthew Knepley
Cc: petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] dm_view of high-order geometry/solution
And here's an MR to do what you want without any code/arg changes.
https://gitlab.com/petsc/petsc/-/merge_requests/6588
Jed Brown <jed at jedbrown.org> writes:
> Duan Junming <junming.duan at epfl.ch> writes:
>
>> Dear Jed,
>>
>>
>> Thank you for the suggestion.
>>
>> When I run tests/ex33.c with
>>
>> ./ex33 -dm_plex_simplex 0 -dm_plex_box_faces 1,1 -mesh_transform annulus -dm_coord_space 0 -dm_coord_petscspace_degree 3 -dm_refine 1 -dm_view cgns:test.cgns
>>
>> and load it using Paraview,
>>
>> the mesh is still with straight lines.
>
> Ah, the viewer is keyed on the field (since the CGNS as supported by Paraview specifies coordinates and fields in the same space). That doesn't exist in your case. If you apply this patch and add `-petscspace_degre 3` to your command, you'll see that high order information is present. Paraview doesn't render as curves in all views, but it has the data.
>
> diff --git i/src/dm/impls/plex/tests/ex33.c w/src/dm/impls/plex/tests/ex33.c
> index 803095bc082..590facfa4f4 100644
> --- i/src/dm/impls/plex/tests/ex33.c
> +++ w/src/dm/impls/plex/tests/ex33.c
> @@ -198,7 +198,6 @@ PetscErrorCode CreateMesh(MPI_Comm comm, AppCtx *ctx, DM *dm)
> default:
> SETERRQ(comm, PETSC_ERR_ARG_OUTOFRANGE, "Unknown mesh transform %d", ctx->meshTransform);
> }
> - PetscCall(DMViewFromOptions(*dm, NULL, "-dm_view"));
> PetscFunctionReturn(PETSC_SUCCESS);
> }
>
> @@ -227,6 +226,7 @@ static PetscErrorCode CreateDiscretization(DM dm, AppCtx *ctx)
> PetscCall(DMCreateDS(dm));
> PetscCall(DMGetDS(dm, &ds));
> PetscCall(PetscDSSetObjective(ds, 0, volume));
> + PetscCall(DMViewFromOptions(dm, NULL, "-dm_view"));
> PetscFunctionReturn(PETSC_SUCCESS);
> }
>
>
> I can update the viewer to handle the degenerate case of no field (all my models have fields).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230612/d772e45a/attachment.html>
More information about the petsc-users
mailing list