[petsc-users] Modification to ex11.c

Mark Adams mfadams at lbl.gov
Fri Apr 17 15:27:23 CDT 2020


I appreciate the ambition and this is a pretty basic thing, but I would
suggest not doing anything until more people ask about it.

And with this new example there will be code for people to clone.

THe interface is not clear to me anyway. I could imagine point functions
would work for some and others have the data in some for and its more
natural to stuff the data in yourself.

Just my 2c,
Mark

On Fri, Apr 17, 2020 at 1:04 PM Matthew Knepley <knepley at gmail.com> wrote:

> On Fri, Apr 17, 2020 at 12:52 PM Mark Adams <mfadams at lbl.gov> wrote:
>
>> Just to be clear, you seem to be suggesting adding an interface for this
>> and/or code to clone?
>>
>
> Adding an interface.
>
>   Thanks,
>
>     Matt
>
>
>> On Fri, Apr 17, 2020 at 11:08 AM Matthew Knepley <knepley at gmail.com>
>> wrote:
>>
>>> On Fri, Apr 17, 2020 at 10:58 AM Mark Adams <mfadams at lbl.gov> wrote:
>>>
>>>> Line 1528 of dmplexsnes.c ?
>>>>
>>>
>>> Yes. This is where we add in u_t, so it would make sense to also add in
>>> the source term here. If it were a function of t, s(t), you would
>>> just add vol*s(t).
>>>
>>>   Thanks,
>>>
>>>     Matt
>>>
>>>
>>>> On Fri, Apr 17, 2020 at 10:41 AM Matthew Knepley <knepley at gmail.com>
>>>> wrote:
>>>>
>>>>> Tried it again and works for me.
>>>>>
>>>>>    Matt
>>>>>
>>>>> On Fri, Apr 17, 2020 at 10:39 AM Mark Adams <mfadams at lbl.gov> wrote:
>>>>>
>>>>>> Matt, that kink seems messed up.
>>>>>>
>>>>>> On Fri, Apr 17, 2020 at 9:18 AM Matthew Knepley <knepley at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Mark is right, you could just add in a source term for each cell
>>>>>>> this way.
>>>>>>>
>>>>>>> If you really wanted a lower level interface, it would go here I
>>>>>>> think:
>>>>>>>
>>>>>>>
>>>>>>> https://gitlab.com/petsc/petsc/-/blob/master/src/snes/utils/dmplexsnes.c#L1528
>>>>>>>
>>>>>>> What would you want the interface to look like?
>>>>>>>
>>>>>>>   Thanks,
>>>>>>>
>>>>>>>     Matt
>>>>>>>
>>>>>>> On Fri, Apr 17, 2020 at 7:55 AM Mark Adams <mfadams at lbl.gov> wrote:
>>>>>>>
>>>>>>>> You can write your own DMPlexTSComputeRHSFunctionFVM method like
>>>>>>>> this and give that to the dm.
>>>>>>>>
>>>>>>>> PetscErrorCode foo(DM dm, PetscReal time, Vec locX, Vec F, void *user)
>>>>>>>> {
>>>>>>>>   PetscErrorCode ierr;
>>>>>>>>   PetscFunctionBegin;
>>>>>>>>   ierr = DMPlexTSComputeRHSFunctionFVM(dm, time, locX, F, user);CHKERRQ(ierr);
>>>>>>>> ...
>>>>>>>>
>>>>>>>>   PetscFunctionReturn(0);
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> On Fri, Apr 17, 2020 at 5:28 AM MUKKUND SUNJII <
>>>>>>>> mukkundsunjii at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Greetings,
>>>>>>>>>
>>>>>>>>> I had been working on ts/tutorials/ex11.c as part of my master’s
>>>>>>>>> thesis.
>>>>>>>>>
>>>>>>>>> In ex11.c, there is a 2D Shallow Water Model. I want to modify the
>>>>>>>>> model by adding a source term to the model. This source term would factor
>>>>>>>>> in the effects of bathymetry or bed elevation in addition to water height.
>>>>>>>>>
>>>>>>>>> I know how I will be able to achieve this if just use
>>>>>>>>> TSSetRHSFunction(). However ex11.c makes use of the Riemann Solver for the
>>>>>>>>> computation fluxes at the interfaces (therefore, it uses
>>>>>>>>> DMTSSetRHSFunctionLocal(dm, DMPlexTSComputeRHSFunctionFVM, user)
>>>>>>>>> ).
>>>>>>>>>
>>>>>>>>> Is there a routine that allows me to *add* a source term *for
>>>>>>>>> every cell* to the RHS function?
>>>>>>>>>
>>>>>>>>> Thank you in advance!
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Mukkund
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> 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/
>>>>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> 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/
>>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>>
>>>>
>>>
>>> --
>>> 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/
>>> <http://www.cse.buffalo.edu/~knepley/>
>>>
>>
>
> --
> 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/
> <http://www.cse.buffalo.edu/~knepley/>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200417/8d5af6bc/attachment.html>


More information about the petsc-users mailing list