<div class="gmail_quote">On Thu, Jul 21, 2011 at 14:48, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
<br>
Whoever wrote the DMGetInterpolation_DA_Q1() for when coordinates are provided in DA<br>
<br>
1) it is completely broken for the periodic case!<br></blockquote><div><br></div><div>There is a serious semantic problem with periodic non-regular coordinates: we don't know how big the wrap element is. There is no way to determine this automatically, and there is no way to store it.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
2) it doesn't actually use the coordinates provided by the user in the DA ; it uses uniform coordinates it cooks up on the fly<br>
<br>
/* compute local coordinate arrays */<br>
nxi = ratioi + 1;<br>
neta = ratioj + 1;<br>
ierr = PetscMalloc(sizeof(PetscScalar)*nxi,&xi);CHKERRQ(ierr);<br>
ierr = PetscMalloc(sizeof(PetscScalar)*neta,&eta);CHKERRQ(ierr);<br>
for (li=0; li<nxi; li++) {<br>
xi[li] = -1.0 + (PetscScalar)li*(2.0/(PetscScalar)(nxi-1));<br>
}<br>
for (lj=0; lj<neta; lj++) {<br>
eta[lj] = -1.0 + (PetscScalar)lj*(2.0/(PetscScalar)(neta-1));<br>
}<br></blockquote><div><br></div><div>These are reference coordinates. They get mapped using a Q1 local coordinate mapping. Dave wrote this code, but it was tested to give second order accuracy for non-uniform mapped grids.</div>
<div><br></div><div>Are you using non-uniform periodic grids? If you have regular periodic grids, but you still want to store coordinates explicitly, then we could write some special case to detect that you set coordinates that happened to be uniform, therefore we can guess that the wrap cell should also be uniform, and the code for no provided coordinates would be correct. What do you want to do?</div>
</div>