[petsc-users] questions

Matthew Knepley knepley at gmail.com
Fri Nov 11 12:13:15 CST 2011


On Fri, Nov 11, 2011 at 6:06 PM, xiaohl <xiaohl at ices.utexas.edu> wrote:

>
> Hi
>
> I am going to use user defined context for this function call
> DMDASetLocalFunction(da,(**DMDALocalFunction1) FormFunctionLocal);
>
> But How can I pass the "ctx" to the function FormFunctionLocal;
>
> PetscErrorCode FormFunctionLocal(**DMDALocalInfo *info, PetscScalar ***u,
>                                 PetscScalar ***f, void * ctx){
> }
>
> I look at the example
> /petsc-3.2-p2/src/snes/**examples/tutorials/ex19.c.html
>
> I think you intialize the "user" context  by
> DMMGCreate(comm,nlevels,&user,**&dmmg);
> for DMMG
>
> Do you have the similar routine for DMDA?
>

If you use SNES, then you can pass it as the last argument to


http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/SNES/SNESSetFunction.html

If you use SNESetDM() which sets this automatically, then it will use the
one given to


http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/DM/DMSetApplicationContext.html

Barry: Where should this be documented?

    Matt

Hailong
>
> On Wed, 2 Nov 2011 15:53:27 -0500, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
>> On Nov 2, 2011, at 3:42 PM, Matthew Knepley wrote:
>>
>>  On Wed, Nov 2, 2011 at 8:38 PM, xiaohl <xiaohl at ices.utexas.edu> wrote:
>>> Hi
>>>
>>> I am going to implement cell center difference method for
>>> u = - K grad p
>>> div u = f
>>> where p is the pressure , u is the velocity, f is the source term.
>>>
>>> my goal is to assemble the matrix and test the performance of different
>>> linear solvers in parallel.
>>>
>>> my question is how can I read the input file for K where K is n*n tensor.
>>>
>>> MatLoad()
>>>
>>
>>   Hm, I think you should use a DMDA with n*n size dof and then use
>> VecLoad() to load the entries of K.
>>
>>   Barry
>>
>>
>>> second one is that do you have any similar examples?
>>>
>>> Nothing with the mixed-discretization of the Laplacian.
>>>
>>>   Matt
>>>
>>> Hailong
>>>
>>>
>>>
>>> --
>>> 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
>>>
>>
>


-- 
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-users/attachments/20111111/760dd466/attachment.htm>


More information about the petsc-users mailing list