SciML / MethodOfLines.jl

Automatic Finite Difference PDE solving with Julia SciML
https://docs.sciml.ai/MethodOfLines/stable/
MIT License
157 stars 27 forks source link

inplement finite difference WENO schemes #102

Closed YichengDWu closed 2 years ago

YichengDWu commented 2 years ago

Hi,

I'm wondering if it is possible to add finite volumes for conservative PDEs in the future?

Thank you for your great work btw

ChrisRackauckas commented 2 years ago

It would be good to parse the equation and send it to Trixi.jl for semidiscretization when possible.

YichengDWu commented 2 years ago

It would be good to parse the equation and send it to Trixi.jl for semidiscretization when possible.

That is a great package, thanks for the info!

I am trying to use WENO methods, however. I don't think that is available in Trixi.jl.

ChrisRackauckas commented 2 years ago

I wonder what @ranocha thinks of a comparison WENO methods.

ranocha commented 2 years ago

I like WENO methods in general and it would be great if they were available in Julia. Indeed, we do not have WENO methods (neither finite volume nor finite difference variants) in Trixi.jl since we focus on discontinuous Galerkin methods. That's just the background of our core developers. If someone wanted to implement WENO-type methods, I could give some advice (if desired). Some aspects to think about

xtalax commented 2 years ago

Sending to Trixi might have to wait until after we have solution interfaces, as it would affect the way solution retrieval is done in a way that would be confusing, unless there is a way to manually assign observed variables to elements of the u array. So that

    grid = get_discrete(pdesys, discretization)
    solu = [map(d -> sol[d][ti], grid[u(x, y, t)]) for ti in sol[t]]

still works, the current recommended practice.

Unless we make dispatch to Trixie a kwarg option which warns and falls back on MOL when a suitable form is not found.

YichengDWu commented 2 years ago

A good start would be finite difference WENO methods. Then we can move on to reconstruction.

YichengDWu commented 2 years ago

A good reference is Section 2.3.4 in

C.-W. Shu, High order weighted essentially non-oscillatory schemes for convection dominated problems, SIAM Review, 51:82-126, 2009.

Finite volumes should be dealt with separately at first. Then apply WENO methods there.

xtalax commented 2 years ago

Looking at using the scheme presented here

See page 8:

Here a scheme is given for h_i+1/2 , to obtain the scheme for h_i-1/2 I assume that I reverse the weights and stencils, but what of the \beta_j and \gamma_j coefficients?

@ranocha @ChrisRackauckas Do you have an intuition for this?

ranocha commented 2 years ago

Make it symmetric - you can look at my (finite volume) WENO code at https://github.com/ranocha/HyperbolicDiffEq.jl/blob/84c2d882e0c8956457c7d662bf7f18e3c27cfa3d/src/finite_volumes/weno_jiang_shu.jl. There, I compute finite volume WENO reconstructions at the boundaries.

YichengDWu commented 2 years ago

Here is another implementation that might be useful https://github.com/tiagopereira/WENO4.jl

xtalax commented 2 years ago

Thanks both! I've made a start here.

I have a question about WENO, it is my understanding that there is nothing special about the interpolation weights used, and that others may be substituted as long as they are valid. We have a function in MOL that will generate Lagrange interpolations, automatically adjusting for a nonuniform grid. Would it be valid to use these as long as I calculated the correct form of the beta parameters?

Going further, I don't see anything forbidding extending this idea to say 3rd order derivatives, if points at i+3/2/i-3/2 were also used following the same idea - is this worth persuing?

ranocha commented 2 years ago

I have never tried that but it sounds okay to me