<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Dear Matt,<br>
Thanks for your reply on the 1st question and I'm sorry for
the confusion on the 2nd one. <br>
In order to create a non-uniform Cartesian grid, I expected
that the way I was programming can let me freely control the grid
size. In the code attached in the previous E-mail, the
'DMDASetUniformCoordinate' generates a uniform coordinate with
100*48*48 grid number and 0.1*0.1*0.1 grid size. I was trying to
manually double the grid size in the y-direction for the whole
mesh with operations of DMDA in the 'SetNonUniformGrid()', which
follows the method that /src/ksp/ksp/examples/tutorials/ex49.c
used. However, as you can see in the figure attached in the
previous E-mail, only the mesh on z = 0 plane and x = 0 plane has
been changed to dy = 0.2; while I expected all mesh should have dy
= 0.2 after I call 'SetNonUniformGrid()'. <br>
Any idea about this?<br>
<br>
thanks,<br>
Alan<br>
<br>
On 2/28/2013 6:31 PM, Matthew Knepley wrote:<br>
</div>
<blockquote
cite="mid:CAMYG4GmruJOFOeU5znsBD_W_EXzmFXmQGmyJ9pR3vy3zsJBPug@mail.gmail.com"
type="cite">
<div dir="ltr">On Thu, Feb 28, 2013 at 7:19 PM, Zhenglun (Alan)
Wei <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:zhenglun.wei@gmail.com" target="_blank">zhenglun.wei@gmail.com</a>></span>
wrote:<br>
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Dear
folks,<br>
Here are several questions following up my previous
ones:<br>
1, I modified my code based on ex49.c. However, I found
that if I don't call 'DMDASetUniformCoordinates' before
calling 'DMDAVecGetArray', then an error comes up:<br>
[0]PETSC ERROR: Null argument, when expecting valid
pointer!<br>
[0]PETSC ERROR: Null Object: Parameter # 2!<br>
The code do works if I add a call for
'DMDASetUniformCoordinates' in it. However, I feel it is a
waste of calling 'DMDASetUniformCoordinates' since what
follows this calling is to change the coordinate to a
non-uniform gird. Does it have any way to bypass this call
or you think it is fine to keep it here.<br>
</blockquote>
<div><br>
</div>
<div style="">If you do not call it, then you have to create
the coordinate vector yourself. I would just call it.</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
2, Also, if I do by this way, the outputted mesh looks
weird, as shown in the figure.<br>
I was trying to double the dy value manually in the
SetNonUniformGrid(). However, the only mesh changed is
just on the z=0 and x=0 plane. Here I attached my code. Do
I need to do anything else except DMDAVecRestoreArray()
after I modified the coordinate information?<br>
</blockquote>
<div><br>
</div>
<div style="">I do not understand what you want here.</div>
<div style=""><br>
</div>
<div style=""> Matt</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
thanks,<br>
Alan<br>
<br>
<br>
On 2/26/2013 8:46 PM, Barry Smith wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
On Feb 26, 2013, at 4:49 PM, "Zhenglun (Alan) Wei"<<a
moz-do-not-send="true"
href="mailto:zhenglun.wei@gmail.com" target="_blank">zhenglun.wei@gmail.com</a>>
wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear folks,<br>
I have one question for the ex49.<br>
It do show a way to 'get' the 'coord' by the
'DMDAVecGetArray'. Should I just modified the
coordinate on the 'coord' in order to obtain a
non-uniform grid? and then, use DMDAVecRestoreArray to
link the modified 'coord' back to 'cda' so that the
'coord' will be updated to the mesh I want?<br>
</blockquote>
Yes, you can do this.<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
thanks,<br>
Alan<br>
<br>
On 2/22/2013 3:20 PM, Matthew Knepley wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, Feb 22, 2013 at 3:57 PM, Zhenglun (Alan)
Wei<<a moz-do-not-send="true"
href="mailto:zhenglun.wei@gmail.com"
target="_blank">zhenglun.wei@gmail.com</a>>
wrote:<br>
Dear all,<br>
I hope you're having a nice day.<br>
I wonder if anyone could point out a example for me
about the<br>
DMDASetCoordinates(). I found this<br>
(<a moz-do-not-send="true"
href="http://www.mcs.anl.gov/petsc/petsc-current/src/dm/impls/da/dacorn.c.html#DMDASetCoordinates"
target="_blank">http://www.mcs.anl.gov/petsc/petsc-current/src/dm/impls/da/dacorn.c.html#DMDASetCoordinates</a>)<br>
online; however it does not really demonstrate how
to create the<br>
'coordinate vector - c'.<br>
Also, I found that in the petsc sub-folder:<br>
/petsc-dev/src/dm/impls/patch has a patch.c, which I
suppose that it<br>
does a local refinement for mesh. Does this a mature
model that we can<br>
use or just a testing code?<br>
<br>
Look at KSP ex49. In the routine
DMDACoordViewGnuplot2d() it reads out the
coordinates.<br>
You could just as easily set them in this fashion.<br>
<br>
Matt<br>
thanks,<br>
Alan<br>
<br>
On 11/7/2012 6:55 PM, Barry Smith wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
On Nov 7, 2012, at 6:50 PM, Alan<<a
moz-do-not-send="true"
href="mailto:zhenglun.wei@gmail.com"
target="_blank">zhenglun.wei@gmail.com</a>>
wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0
0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
Dear folks,<br>
I hope you're having a nice day.<br>
I'm testing the Poisson solver in
/src/ksp/ksp/examples/tutorials/ex45.<br>
It uses the 'DMDACreate3d' to generate a
Cartisian structured grid and<br>
solve it with uniform grid size. However, I
attempt to modify it to<br>
obtain solution with a Cartsian structured grid
and non-uniform grid (It<br>
is not unstructured local refined mesh). Should
I still use the<br>
'DMDACreate3d' and implement different grid size
in 'ComputeMatrix' and<br>
'ComputeRHS'? In other words, does
'DMDACreate3d' itself include any<br>
mesh size information?<br>
</blockquote>
You can use DMDASetCoordinates() and
DMDAGetCoordinates() (called DMSetCoordinates()
and DMGetCoordinates() in petsc-dev) to keep track
of the coordinates but you are responsible for
generating the correctly scaled entries in the
matrix etc.<br>
<br>
Barry<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0
0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
thanks,<br>
Alan<br>
</blockquote>
</blockquote>
<br>
<span class="HOEnZb"><font color="#888888">
<br>
-- <br>
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<br>
</font></span></blockquote>
</blockquote>
</blockquote>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
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>
</blockquote>
<br>
</body>
</html>