[petsc-dev] DMDA_BOUNDARY_GHOSTED

Matthew Knepley knepley at gmail.com
Thu Sep 26 20:17:03 CDT 2013


On Thu, Sep 26, 2013 at 1:15 PM, Mark F. Adams <mfadams at lbl.gov> wrote:

> >
> > We have ghost cells in TS ex11, and I think we do them the correct way
> :) We have a function you register that fills them up, and we
> > loop over them explicitly.
> >
>
> Well damn Matt, this looks like the right way to do FV in PETSc,
> regardless of the nice BC abstraction, but am I going to get be seduced and
> crash into this island and turn into stone?  i.e., can stupid people deal
> with your Sections and Plexes and crap (Barry?).
>

So the important thing here is the organization of the boundary functions.
You call

  ModelBoundaryRegister(bdFunc, bdMarker)

where the function is

  PhysicsBoundary_Advect_Inflow(Model mod, PetscReal time, const PetscReal
*centroid, const PetscReal *normal, const PetscScalar *xInterior,
PetscScalar *xGhost, void *ctx)

Then we loop over all the mesh pieces marked with each boundary marker, and
call the function on those faces. You get the interior
value, and make the ghost accordingly. I think you would do exactly the
same thing in your simple example below. The only optimization
would be in handling the topology, which you do not see anyway (unless you
are a masochist).

   Matt

I'm thinking of a much simpler problem (2D, 9-point stencil, constant
> coefficient Laplacian) and I want to add a convergence study wrapper around
> a code like this.  So have an outer loop that refines grids, gets errors,
> and prints convergence rates.
>
> Perhaps I could morph this example into a simpler example that shows how
> to do FV in the canonically blessed way in PETSc, abstracted BC functions,
> and a convergence test for FMG.  This might be a worthy addition.
>
> I suppose I could keep TS and SNES even though I just plan on looking at a
> linear elliptic solve for now.
>
> Any suggestions?
>
> Mark




-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130926/03c19525/attachment.html>


More information about the petsc-dev mailing list