[petsc-users] Getting nodal coordinates from a FEM computation
Abisheik Panneerselvam
a.panneerselvam at mpie.de
Thu Jun 24 03:43:55 CDT 2021
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.
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
-------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210624/a9a43c10/attachment.html>
More information about the petsc-users
mailing list