[petsc-users] Output data using ExodusIIViewer

David Andrs andrsd at gmail.com
Fri Dec 3 17:59:15 CST 2021


      
In case, somebody finds this thread in future, attached file produces an ExodusII file that I was able to open in paraview 5.9
  
​
  
​David
  
On Dec 2 2021, at 8:02 AM, David Andrs  <andrsd at gmail.com>  wrote:
  
>   
> Blaise,
>   
>>   
> ​thank you very much for you help. This helps a lot.
>   
>>   
> ​By the way, I was not able to open the produced file in paraview 5.9.1 (failed with "EX_INQ_TIME failed"). However, ncdump seems correct. At least, I do not immediately see anything wrong there. I will try to look into this problem myself, now that I know it is ok to do direct exodusII calls.
>   
>>   
> Thank you again,​
>   
>>   
> ​David
>   
>>   
> On Dec 1 2021, at 12:48 PM, Blaise Bourdin  <bourdin at mcmaster.ca>  wrote:
>   
> >   
> >   
> > David,
> >   
> >
> >   
> > Here is a modified example.
> >   
> > Exodus needs some additional work prior to saving fields. See the attached modified example.
> >   
> >
> >   
> > Blaise
> >   
> >
> >     
> >   
> >   
> >
> >   
> > >   
> > > On Dec 1, 2021, at 1:54 PM, Blaise Bourdin  <bourdin at mcmaster.ca (mailto:bourdin at mcmaster.ca)>  wrote:
> > >   
> > >   
> > >   
> > >   
> > > OK, let me have a look.
> > >   
> > > Blaise
> > >   
> > >
> > >   
> > >
> > >   
> > > >   
> > > > On Nov 30, 2021, at 7:31 PM, David Andrs  <andrsd at gmail.com (mailto:andrsd at gmail.com)>  wrote:
> > > >   
> > > >   
> > > >   
> > > > I see. I added a "Cell Sets" label like so:
> > > >   
> > > > ​
> > > >   
> > > > ​        DMCreateLabel(dm, "Cell Sets");
> > > >   
> > > >        DMLabel cs_label;
> > > >   
> > > >        DMGetLabel(dm, "Cell Sets",  &cs_label);
> > > >   
> > > >        DMLabelAddStratum(cs_label, 0);
> > > >   
> > > >        PetscInt idxs[] = { 1 };
> > > >   
> > > >        IS is;
> > > >   
> > > >        ISCreateGeneral(comm, 1, idxs, PETSC_COPY_VALUES,  &is);
> > > >   
> > > >        DMLabelSetStratumIS(cs_label, 0, is);
> > > >   
> > > >        ISDestroy(&is);
> > > >   
> > > >   
> > > > Note, that I have only a single element (Quad4) in the mesh and I am just trying to get this working, so I understand what needs to happen for larger meshes.
> > > >   
> > > > ​
> > > >   
> > > > ​This got me past the segfault, but now I see:
> > > >   
> > > > ​
> > > >   
> > > > [​0]PETSC ERROR: Argument out of range
> > > >   
> > > > [0]PETSC ERROR: Number of vertices 1 in dimension 2 has no ExodusII type
> > > >   
> > > >   
> > > > So, I assume I need to do something ​more to make it work.
> > > >   
> > > > ​
> > > >   
> > > > ​David
> > > >   
> > > > ​​
> > > >   
> > > > On Nov 30 2021, at 11:39 AM, Blaise Bourdin  <bourdin at mcmaster.ca (mailto:bourdin at mcmaster.ca)>  wrote:
> > > >   
> > > > >   
> > > > > It looks like your DM cannot be saved in exodus format as such. The exodus format requires that all cells be part of a single block (defined by ‘Cell Set’ labels), and that the cell sets consists of sequentially numbered cells.
> > > > >   
> > > > > Can you see if that is enough? If not, I will go through your example
> > > > >   
> > > > >
> > > > >   
> > > > > Blaise
> > > > >   
> > > > >
> > > > >   
> > > > >   
> > > > > >   
> > > > > > On Nov 30, 2021, at 9:50 AM, David Andrs  <andrsd at gmail.com (mailto:andrsd at gmail.com)>  wrote:
> > > > > >   
> > > > > >   
> > > > > >   
> > > > > >   
> > > > > > Hello!
> > > > > >   
> > > > > >
> > > > > >   
> > > > > > I am trying to store data into an ExodusII file using the ExodusIIViewer, but running into a segfault inside PETSc. Attached is a minimal example showing the problem. It can very much be that I am missing something obvious. However, if I change the code to VTKViewer I get the desired output file.
> > > > > >   
> > > > > >
> > > > > >   
> > > > > > Machine: MacBook Pro 2019
> > > > > >   
> > > > > > OS version/type:   Darwin notak.local 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64 x86_64
> > > > > >   
> > > > > > PETSc:   Petsc Release Version 3.16.1, Nov 01, 2021
> > > > > >   
> > > > > > MPI: MPICH 3.4.2
> > > > > >   
> > > > > > Compiler: clang-12
> > > > > >   
> > > > > >
> > > > > >   
> > > > > > Call stack (not sure how relevant that is since it is from opt version):
> > > > > >   
> > > > > >
> > > > > >   
> > > > > > * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xc)
> > > > > >   
> > > > > >        frame #0: 0x0000000102303ba9 libpetsc.3.16.dylib`DMView_PlexExodusII(dm=<unavailable>, viewer=<unavailable>) at plexexodusii.c:457:45 [opt]
> > > > > >   
> > > > > >       454                else if (degree == 2) nodes[cs] = nodesHexP2;
> > > > > >   
> > > > > >       455            }
> > > > > >   
> > > > > >       456            /* Compute the number of cells not in the connectivity table */
> > > > > >   
> > > > > > ->  457            cellsNotInConnectivity -= nodes[cs][3]*csSize;
> > > > > >   
> > > > > >       458
> > > > > >   
> > > > > >       459            ierr = ISRestoreIndices(stratumIS,  &cells);CHKERRQ(ierr);
> > > > > >   
> > > > > >       460            ierr = ISDestroy(&stratumIS);CHKERRQ(ierr);
> > > > > >   
> > > > > >   
> > > > > >
> > > > > >   
> > > > > >   
> > > > > > With regards,
> > > > > >   
> > > > > >   
> > > > > >
> > > > > >   
> > > > > > David Andrs
> > > > > >   
> > > > > >   
> > > > > > <exo2.c>
> > > > > >   
> > > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > > --   
> > > > >   
> > > > > Professor, Department of Mathematics  &   Statistics
> > > > >   
> > > > > Hamilton Hall room 409A, McMaster   University
> > > > >   
> > > > > 1280 Main Street West, Hamilton,   Ontario L8S 4K1, Canada   
> > > > >   
> > > > > Tel. +1 (905) 525 9140 ext. 27243
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > > >   
> > > >   
> > > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > > --   
> > >   
> > > Professor, Department of Mathematics  &   Statistics
> > >   
> > > Hamilton Hall room 409A, McMaster   University
> > >   
> > > 1280 Main Street West, Hamilton,   Ontario L8S 4K1, Canada   
> > >   
> > > Tel. +1 (905) 525 9140 ext. 27243
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >   
> > >           
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> > --   
> >   
> > Professor, Department of Mathematics  &   Statistics
> >   
> > Hamilton Hall room 409A, McMaster   University
> >   
> > 1280 Main Street West, Hamilton,   Ontario L8S 4K1, Canada   
> >   
> > Tel. +1 (905) 525 9140 ext. 27243
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> >   
> >   
>   
     
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211203/eb74b319/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: exo2.c
Type: application/octet-stream
Size: 2645 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211203/eb74b319/attachment.obj>


More information about the petsc-users mailing list