[petsc-users] Getting nodal coordinates from a FEM computation
Matthew Knepley
knepley at gmail.com
Thu Jun 24 14:16:29 CDT 2021
On Thu, Jun 24, 2021 at 10:34 AM Abisheik Panneerselvam <
a.panneerselvam at mpie.de> wrote:
> Hello,
>
>
>
> Good Morning. My name is Abisheik Panneerselvam and I am presently working
> in Max-Planck Düsseldorf.
>
> I am working on a FE software development project. The FE computation code
> is already written in Fortran (using Petsc for solving) few years ago. I am
> currently working on post-processing the results of the computation (nodal
> displacements, integration point displacements etc.). I am facing problems
> in getting the coordinates of vertices. I tried the following
>
>
>
> call SNESGetDM(mechanical_snes,dm_local,ierr); CHKERRQ(ierr)
> !Gets the local DM from the SNES solve
>
> call DMGetLocalVector(dm_local,x_local,ierr); CHKERRQ(ierr)
> !Gets the local vector from the DM
>
>
>
> This functions successfully gets the coordinates of all the nodes. This
> works fine for linear elements as there are only nodes on cell vertices.
> But for higher order elements, the local vector (x_local) contains
> additional nodal points (I think its called ghost points in Petsc) on the
> edges. In this case how do I get the coordinates of only the cell vertices?
>
>
>
>
> I tried the below code for getting the vertex coordinates but its giving
> random values.
>
>
>
> call DMPlexGetDepthStratum(dm_local, 0, vStart, vEnd,ierr); CHKERRQ(ierr)
> !Get the vertices
>
> call VecGetArrayF90(x_local, node_coords_local,ierr)
>
> v_count=1
>
> do v=vStart, vEnd-1
>
> call DMPlexGetPointLocal(dm_local, v, x, y, ierr); CHKERRQ(ierr) !Get
> the position of the vertice in the local DM
>
> d_count=1
>
> do d=x,y-1
>
> node_coords(d_count,v_count)=node_coords_local(d)
>
> d_count=d_count+1
>
> end do
>
> v_count = v_count+1
>
> end do
>
>
>
>
>
> It will be really helpful if you could advise me on this.
>
Hi Abisheik,
One question to start off. Are you using DMPlex to describe the grid? It
sounded like your FEM code was in Fortran. If you are only using PETSc
for solving the equations, it will not know the difference between unknowns
on vertices and edges.
Thanks,
Matt
>
>
> Best regards
>
> Abisheik
>
>
> ------------------------------
> -------------------------------------------------
> Max-Planck-Institut für Eisenforschung GmbH
> Max-Planck-Straße 1
> D-40237 Düsseldorf
>
> Handelsregister B 2533
> Amtsgericht Düsseldorf
>
> Geschäftsführung
> Prof. Dr. Gerhard Dehm
> Prof. Dr. Jörg Neugebauer
> Prof. Dr. Dierk Raabe
> Dr. Kai de Weldige
>
> Ust.-Id.-Nr.: DE 11 93 58 514
> Steuernummer: 105 5891 1000
>
>
> Please consider that invitations and e-mails of our institute are
> only valid if they end with …@mpie.de.
> If you are not sure of the validity please contact rco at mpie.de
>
> Bitte beachten Sie, dass Einladungen zu Veranstaltungen und E-Mails
> aus unserem Haus nur mit der Endung …@mpie.de gültig sind.
> In Zweifelsfällen wenden Sie sich bitte an rco at mpie.de
> -------------------------------------------------
>
--
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/20210624/5e5c31b2/attachment.html>
More information about the petsc-users
mailing list