Re: [petsc-users] Auxiliary fields for multigrid

2017-11-19 Thread Jed Brown
"zakaryah ."  writes:

> Ok, thanks for the suggestions.
> ​I'd like to check that I understand the approach.
>
> I create one DMDA for the variables to be solved by the SNES.  That DMDA
> will be coarsened and refined by the options I pass to e.g. FAS.  In my
> user context struct, I can have a second DMDA for the auxiliary fields.  At
> each coarsening or refinement of the solution variable DMDA, I add a hook
> to simultaneously coarsen or refine the auxiliary fields.  I suppose I can
> store the results of those operations in a third DMDA in the user context
> struct, because I'll need to access them from the SNES Function and
> Jacobian routines.  Does that sound right?​

Basically, please look at the example.


Re: [petsc-users] Auxiliary fields for multigrid

2017-11-19 Thread Matthew Knepley
On Sun, Nov 19, 2017 at 12:40 AM, zakaryah .  wrote:

> Ok, thanks for the suggestions.
> ​I'd like to check that I understand the approach.
>
> I create one DMDA for the variables to be solved by the SNES.  That DMDA
> will be coarsened and refined by the options I pass to e.g. FAS.  In my
> user context struct, I can have a second DMDA for the auxiliary fields.  At
> each coarsening or refinement of the solution variable DMDA, I add a hook
> to simultaneously coarsen or refine the auxiliary fields.
>

That sounds right. I do not understand needing a 3rd DM.

  Thanks,

 Matt


> I suppose I can store the results of those operations in a third DMDA in
> the user context struct, because I'll need to access them from the SNES
> Function and Jacobian routines.  Does that sound right?​
>



-- 
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

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] Auxiliary fields for multigrid

2017-11-18 Thread zakaryah .
Ok, thanks for the suggestions.
​I'd like to check that I understand the approach.

I create one DMDA for the variables to be solved by the SNES.  That DMDA
will be coarsened and refined by the options I pass to e.g. FAS.  In my
user context struct, I can have a second DMDA for the auxiliary fields.  At
each coarsening or refinement of the solution variable DMDA, I add a hook
to simultaneously coarsen or refine the auxiliary fields.  I suppose I can
store the results of those operations in a third DMDA in the user context
struct, because I'll need to access them from the SNES Function and
Jacobian routines.  Does that sound right?​


Re: [petsc-users] Auxiliary fields for multigrid

2017-11-17 Thread Jed Brown
Dave May  writes:

> Are there PETSc examples that do this?
>>
>
> Not that I'm aware off. Most use Galerkin or rediscretize the operator on
> the coarser levels.

src/snes/examples/tutorials/ex48.c


Re: [petsc-users] Auxiliary fields for multigrid

2017-11-17 Thread Matthew Knepley
On Thu, Nov 16, 2017 at 10:25 PM, zakaryah .  wrote:

> I have equations which depend on some external data.  I'm not sure about
> the approach for making this compatible with multigrid - i.e. making sure
> those external fields are properly refined/coarsened.  Are there PETSc
> examples that do this?
>

There are no examples, but there are hooks (DMRefineHookAdd,
DMCoarsenHookAdd) for this purpose.

  Thanks,

 Matt

-- 
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

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] Auxiliary fields for multigrid

2017-11-17 Thread Dave May
On Fri, 17 Nov 2017 at 04:26, zakaryah .  wrote:

> I have equations which depend on some external data.  I'm not sure about
> the approach for making this compatible with multigrid - i.e. making sure
> those external fields are properly refined/coarsened.
>

Multi grid does not strictly require you to restrict your external data.
For example (I) algebraic mg (PCGAMG) only requires only the fine level
operator: (I) you can define coarse level operators with geometric mg using
Galerkin projection. The latter only requires one to specify how to
interpolate your DM fields from fine to coarse (which PLEX and DA provide).

Why not try these out for your problem first?


Are there PETSc examples that do this?
>

Not that I'm aware off. Most use Galerkin or rediscretize the operator on
the coarser levels.

Thanks,
  Dave

>


[petsc-users] Auxiliary fields for multigrid

2017-11-16 Thread zakaryah .
I have equations which depend on some external data.  I'm not sure about
the approach for making this compatible with multigrid - i.e. making sure
those external fields are properly refined/coarsened.  Are there PETSc
examples that do this?