<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Jul 19, 2015 at 11:46 PM, Adrian Croucher <span dir="ltr"><<a href="mailto:a.croucher@auckland.ac.nz" target="_blank">a.croucher@auckland.ac.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hi<br>
<br>
I am testing out the new DMSetUseNatural(), DMPlexNaturalToGlobalBegin() etc. functions- along the lines of src/dm/impls/plex/examples/tests/ex15.c, but kinda the other way around.<br>
<br>
What I want to do is set initial conditions in vector on a distributed DM representing a finite volume mesh. If I just do this using VecSetValues() they all end up in the wrong places on the mesh- in the global order rather than the natural order, with results dependent on number of processors.<br>
<br>
So I'm trying:<br>
<br>
- calling DMSetUseNatural(dm, PETSC_TRUE) before distributing the DM<br>
- creating a separate 'natural' vector, and using VecSetValues() to set its values from the program input<br>
- using DMPlexNaturalToGlobalBegin() / DMPlexNaturalToGlobalEnd() to fill my 'global' vector from the natural one<br>
- viewing the final global vector with a VTK viewer to make sure the values are ending up in the right physical locations on the mesh.<br>
<br>
It is all working ok until I also put in a DMPlexConstructGhostCells() (just after distributing) to fill the 'ghost' label on the DM. If I do that, when it gets to the DMPlexNaturalToGlobalBegin() call, it errors out with the following:<br>
<br>
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br>
[0]PETSC ERROR: Object is in wrong state<br>
[0]PETSC ERROR: DM global to natural SF was not created.<br>
You must call DMPlexSetUseNaturalSF() before DMPlexDistribute().<br>
<br>
[0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.<br>
[0]PETSC ERROR: Petsc Development GIT revision: v3.6-512-g8d76ee9  GIT Date: 2015-07-19 12:15:50 -0400<br>
[0]PETSC ERROR: supermodel on a linux-gnu-c-opt named des108 by acro018 Mon Jul 20 16:32:22 2015<br>
[0]PETSC ERROR: Configure options --download-netcdf --download-exodusii --with-hdf5-dir=/usr --download-triangle --download-ptscotch<br>
--download-chaco --download-ctetgen<br>
[0]PETSC ERROR: #1 DMPlexNaturalToGlobalBegin() line 203 in /home/acro018/software/PETSc/code/src/dm/impls/plex/plexnatural.c<br>
--------------------------------------------------------------------------<br>
<br>
So it thinks I haven't called DMSetUseNatural(), but I have. (There is also a typo in the error message- it's saying I should call 'DMPlexSetUseNaturalSF()', but I think it means DMSetUseNatural()).<br>
<br>
It looks a bit like DMPlexConstructGhostCells() might be messing with the DM's sfNatural property? or does this not work the way I think it should?</blockquote><div><br></div><div>Thats a bug. CreateGhostCells() makes an entirely new DM, and the SetNatural is a piece of state which did not get carried over. I will</div><div>fix it.</div><div><br></div><div>I have a question about this strategy. The design philosophy for the PETSc discretization stuff is to make as much</div><div>mesh-independent as possible. I usually think of boundary and initial conditions as analytic functions that are</div><div>applied to a given geometric region on the mesh, and then projected into a function space once I choose my</div><div>discretization. Why doesn't that work in this case?</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888"><br>
- Adrian<br>
<br>
-- <br>
Dr Adrian Croucher<br>
Senior Research Fellow<br>
Department of Engineering Science<br>
University of Auckland, New Zealand<br>
email: <a href="mailto:a.croucher@auckland.ac.nz" target="_blank">a.croucher@auckland.ac.nz</a><br>
tel: +64 (0)9 923 84611<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>