<div dir="ltr"><div dir="ltr">On Wed, Apr 14, 2021 at 5:39 AM Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com">thibault.bridelbertomeu@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello Matthew, <br></div><div><br></div><div>Sorry for the late answer !</div><div><br></div><div>Unfortunately, I couldn't find any elegant way to add a source term with a TS+DM+PetscFV ... The only thing I could find was to write completely my own RHS function that i pass to DMTSSetRHSFunctionLocal. That way I have full control over everything, but it's not as elegant as using the DMPlexTSComputeRHSFunctionFVM that is already in PETSc.</div><div><br></div><div>I added you to the project on Gitlab where i do this (I have not been continuing with this code but with another, also based on PETSc, that's why there are no updates recently) so you can see what I coded, if it can be of any help for a future release / for the people in the other project you mention. What I am talking about is in timeDiscretization_PETSc.c & fluxCalculation.c, mostly. (I did not expect to share that work so it might be a bit poor comments-wise, sorry).<br></div><div>Feel free to share the code if you feel it can be useful, as long as the headers in the source files stay as they are ;)</div></div></blockquote><div><br></div><div>Thanks! It seems I have to figure this out now, so I will do something. Looking at your code will be a huge help.</div><div>What are you working on now?</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><div><div><div><div>Thibault<br></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 12 avr. 2021 à 16:38, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Mon, Jul 20, 2020 at 11:04 AM Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank">thibault.bridelbertomeu@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Thank you Mark, Jed and Matthew for your quick answers !<br></div><div dir="ltr"><div><br></div><div>I see now where I should be more accurate in my question.</div><div><br></div><div>Mark, I mentioned the hyperbolicity because I would like to keep using the PetscDSSetRiemannSolver and the DMTSSetBoundaryLocal<font color="#000000"> and </font>DMTSSetRHSFunctionLocal with DMPlexTSComputeRHSFunctionFVM that are quite automatic and nice and efficient wrappers. Now aside from those which deal specifically with the hyperbolic part of the PDE, i would like to add the diffusive terms. I would rather stay in the FVM world, but if it is easier in the FEM world then I am open to it.</div><div><br></div><div>Jed, as for the discretization let us say indeed that the mesh can be either cartesian or not, and the discretization should therefore be independent of the nature of the mesh - any unstructured mesh (i handle it with DMPlex in my case). I saw indeed that FV has gradient reconstruction, with or without a limiter, which is great. However I have not quite understood what function to use to get the gradient of any variable, be it in the context (e.g. for N-S, ro, rou, rov, etc...) or an auxiliary variable (e.g. the components of the strain tensor). I also agree that the diffusive part is usually the one that strongly limits the time step in explicit computations, but for now I would like to set up a fully explicit system.</div><div><br></div><div>Matthew, I'll take a look at ex 18, thanks, I missed that one.</div><div><br></div><div>So basically if I wanted to summarize, I want to keep the Riemann Solver capability from the DS, and use the "automatic" DMPlexTSComputeRHSFunctionFVM for the hyperbolic part and add on top of it a discretization of the diffusive terms. I was thinking maybe one way to go would be to hack the DMTSSetForcingFunction but</div><div>1/ I still am not sure what this function should return exactly, is it a Vec for the flux on all faces ?</div><div>2/ I still do not know how to compute all the derivatives involved in the diffusive terms of the N-S using the gradient reconstruction from PetscFV</div><div><br></div><div>Thank you for your help, I hope I am clear enough in where I want to go !</div></div></div></blockquote><div><br></div><div>Hi Thibault,</div><div><br></div><div>Did anything happen on this front? I have another project where people want to do that same thing.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Thibault</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 20 juil. 2020 à 16:10, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Mon, Jul 20, 2020 at 9:36 AM Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">How would you like to discretize the diffusive terms? The example has a type of gradient reconstruction so you can have cellwise gradients, but there are many techniques for discretizing diffusive terms in FV. It's simpler if you use an orthogonal grid, but I doubt that you are.<br>
<br>
As for terminology, the diffusive part is usually stiff and thus must be treated implicitly. In TS terminology, this would be part of the IFunction, not the RHSFunction.<br></blockquote><div><br></div><div>At a high level, I would say that this is doable, but complicated. You can see me trying to do something much easier (advection + visco-elasticity) in TS ex18,</div><div>where I want to discretize the elliptic part with FEM and the advective part with FVM. I assume that is why Jed wants to know how you want to handle the</div><div>elliptic terms, since this has a large impact on how you would implement.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank">thibault.bridelbertomeu@gmail.com</a>> writes:<br>
<br>
> Dear all,<br>
><br>
> I have been studying ex11.c from ts/tutorials to understand how to solve an<br>
> hyperbolic system of equations using PETSCFV. I first worked on the Euler<br>
> equations for inviscid fluids and based on what ex11.c presents, I was able<br>
> to add the right PETSc instructions in an already existing in-house code<br>
> with different gas models to solve the problems in parallel (MPI) and with<br>
> the AMR capabilities offered by P4EST.<br>
><br>
> Now my goal is to move to Navier-Stokes equations. Theoretically the system<br>
> is not completely hyperbolic and can be seen as one with an hyperbolic part<br>
> (identical to the Euler equations) and a parabolic part coming from the RHS<br>
> diffusion terms.<br>
> I have been looking into the manual and also the sources of PETSc around<br>
> the DM, DMPlex, DS and FV classes but I could not find anything that speaks<br>
> to me as "adding a RHS to an hyperbolic system of equations" or "adding a<br>
> source term to an hyperbolic system of equations". What's more, that source<br>
> term depends on the derivatives of the context variables ...<br>
><br>
> I wanted to know if anyone maybe had a suggestion regarding this issue ?<br>
><br>
> Thank you very much in advance,<br>
><br>
> Thibault Bridel-Bertomeu<br>
> —<br>
> Eng, MSc, PhD<br>
> Research Engineer<br>
> CEA/CESTA<br>
> 33114 LE BARP<br>
> Tel.: (+33)557046924<br>
> Mob.: (+33)611025322<br>
> Mail: <a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank">thibault.bridelbertomeu@gmail.com</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>