<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Nov 25, 2016 at 9:09 AM, leejearl <span dir="ltr"><<a href="mailto:leejearl@126.com" target="_blank">leejearl@126.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
Hi, Matt:<br>
Thank you for your kind reply, and I can not make it.<br>
I replace the code in the routine SetInitialCondition in ex11.c as <br>
<br>
#undef __FUNCT__<br>
#define __FUNCT__ "SetInitialCondition"<br>
PetscErrorCode SetInitialCondition(DM dm, Vec X, User user)<br>
{<br>
DM dmCell;<br>
Model mod = user->model;<br>
Vec cellgeom;<br>
const PetscScalar *cgeom;<br>
PetscScalar *x;<br>
PetscInt cStart, cEnd, cEndInterior, c;<br>
PetscErrorCode ierr;<br>
<br>
PetscFunctionBeginUser;<br>
ierr = DMPlexGetHybridBounds(dm, &cEndInterior, NULL, NULL,
NULL);CHKERRQ(ierr);<br>
ierr = DMPlexTSGetGeometryFVM(dm, NULL, &cellgeom,
NULL);CHKERRQ(ierr);<br>
ierr = VecGetDM(cellgeom, &dmCell);CHKERRQ(ierr);<br>
ierr = DMPlexGetHeightStratum(dm, 0, &cStart,
&cEnd);CHKERRQ(ierr);<br>
ierr = VecGetArrayRead(cellgeom, &cgeom);CHKERRQ(ierr);<br>
ierr = VecGetArray(X, &x);CHKERRQ(ierr);<br>
for (c = cStart; c < cEndInterior; ++c) {<br>
const PetscFVCellGeom *cg;<br>
PetscScalar *xc;<br>
<br>
ierr =
DMPlexPointLocalRead(dmCell,c,<wbr>cgeom,&cg);CHKERRQ(ierr);<br>
ierr = DMPlexPointGlobalRef(dm,c,x,&<wbr>xc);CHKERRQ(ierr);<br>
/*if (xc) {ierr =
(*mod->solution)(mod,0.0,cg-><wbr>centroid,xc,mod->solutionctx);<wbr>CHKERRQ(ierr);}*/<br>
xc[0] = =1.0;<br>
xc[1] = =2.0;<br>
xc[2] = =3.0;<br>
xc[3] = =4.0;<br>
}<br>
ierr = VecRestoreArrayRead(cellgeom, &cgeom);CHKERRQ(ierr);<br>
ierr = VecRestoreArray(X, &x);CHKERRQ(ierr);<br>
PetscFunctionReturn(0);<br>
}<br>
<br>
I find it works in serial computation. Can you tell me whether I
have a wrong use of the xc in the routine?<br></div></blockquote><div><br></div><div>If you want to initialize 4 fields to the constants 1, 2, 3, 4 then this should work.</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"><div>
Thanks<br>
<br>
leejearl<br>
<br>
<div class="m_-8799614374710068008moz-cite-prefix">On 2016年11月25日 22:53, Matthew Knepley
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Fri, Nov 25, 2016 at 8:43 AM,
leejearl <span dir="ltr"><<a href="mailto:leejearl@126.com" target="_blank">leejearl@126.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,
Petsc developer:<br>
<br>
I find two files ex11.c and ex11_sa.c in the directory
of "/petsc/src/ts/examples/tutori<wbr>als".<br>
<br>
Can you tell me what are the differences between them?
What is the meaning of the “suffix”?<br>
</blockquote>
<div><br>
</div>
<div>I think Jed wanted his original version, but I don'y
know what _sa means.</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">
Thanks!<span class="m_-8799614374710068008HOEnZb"><font color="#888888"><br>
<br>
leejearl<br>
<br>
<br>
<br>
</font></span></blockquote>
</div>
<br>
<br clear="all"><span class="HOEnZb"><font color="#888888">
<div><br>
</div>
-- <br>
<div class="m_-8799614374710068008gmail_signature" data-smartmail="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>
</font></span></div>
</div>
</blockquote>
<br>
</div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="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>