How to start Partial Differential Equation (PDE) Solving in Julia for modified Wave Equation

I completely forgot, but here’s a whole article and a JuliaCon workshop that goes through how to do this stuff “by hand” with loops, ApproxFun, DiffEqOperators, etc. It does a lot on heat equations, but it should be clear that what you get out of the spatial discretizations is second order ODEs which you can either do implicitly like the spatial parts or just solve the second order ODE:

You can then grab something like Allen–Cahn equation - Wikipedia and make sense of it as a discretization in a way like https://benchmarks.sciml.ai/html/MOLPDE/allen_cahn_fdm_wpd.html

10 Likes

Ok thanks, the pull/250 article is interesting, though I didn’t see anything with double time derivatives, Dtt, that looks like a wave equation.

All I can do now is read through all these package descriptions, if there’s any further info or developments, please let me know; code sample suggestions always welcome.

The article & video look interesting, I’ll check them out.

Sorry, bad handwriting. That actually is F_X. eta is the test function, which is one of the basis functions of the expansion F( X) = \sum_i N_i(X) F_i.
Once that expansion is plugged into the integrals, the formulation resolves into a system of coupled ordinary differential equations.

So, what about it? What does the PDE problem look like?

What are the boundary conditions? I feel your PDE has an analytical solution

Rveltz, I would dearly love for there to be an analytical solution, but the function G(t,x) is non-separable in t & z, so how is that possible?

In addition to terms dependent upon t alone, G(t,x) it has terms like Exp[Sin(t-x)], which cannot be separated. So how can one derive an analytical solution?

I am guessing this is a convolution in x?

No. It is a function G times a function F.
G(t,x) is known, F(t,x) is the function to be solved for in the differential equation.

What about the BCs? And ICs?

I think you have no choice here but to really learn something about numerical methods for PDEs. Method of Lines would probably be a good starting point since your equations are likely to be quite stiff (since your coefficient G varies by 10 orders of magnitude), you are in 1+1 dimensions, and it lets you exploit an ODE solver in time so you only need to understand spatial discretization. The fundamental thing to realize here is that solving PDEs is not just a small step up from solving ODEs.

For ODEs, there are “cookie-cutter” methods that handle 99% of problems well — you write a function for your right-hand-solver, throw it blindly at an generic adaptive-stepsize routine using one of the common algorithm choices, maybe try a couple of different algorithm choices to see which is faster, and you’re done. Most people don’t really need to know how the methods work internally, because they are so robust.

For PDEs, there are a lot more choices, a lot less automation, and much less robustness, so you really need to know something about how the methods work in order to use them effectively. We can give you a few pointers (e.g. try ApproxFun, try finite differences in x with MOL in t, …), but you will need to go and read something about how those methods work. You can also try the literature in your field — mimic how other people solve the same equations.

18 Likes

Stevengi, those are good points, and I’m doing all of those things, while simultaneously asking for help on this discussion board. Learning the mathematical methods doesn’t provide concrete examples for how to code them in Julia.

How about you give us the info I asked for? Then we might be able to help you…

1 Like

PetrKrys, the Initial and Boundary Conditions are whatever you want them to be. You don’t need them to either find analytical solutions or to construct numerical solution algorithms. Those are applied at the end. That’s how differential equations work.

As for the equation itself, you have that in my very first post, with all the information needed to address my questions. I am not yet publishing the full form of G(t,x), that is not needed to answer my questions.

The boundary conditions are absolutely critical. For instance, is your domain bounded? One-sided or extending to infinity on both sides? If the domain is infinite, what is the boundary condition at infinity? F=0?

The form of G is obviously of crucial importance. If it is rapidly varying, that will determine the method that can be applied to solve the ODEs. The method may have to be adaptive in order to capture rapid transitions in the behavior.

3 Likes

I have to say I don’t get it: you want help, but you won’t answer questions, and you’re pretty sparing with information.

PetrKrysUCSD,

t > 0 .
-Infinity < x < +Infinity.
As explained above, I will only be modelling a small range in both.

I do not know the boundary conditions because I haven’t figured out yet what makes sense. I still do not know how that is relevant to constructing analytical or numerical solutions in general. They are applied at the end.

I have given tons of information about G(t,x), more than enough to address the problem, I am not publishing the full function yet.

PetrKrysUCSD, every single time you have responded to a post of mine on this discussion board, you have sent me on a wild goose chase. Please do not feel the need to respond to my future posts.

I remain grateful to everyone else for their suggestions.

I may be wrong, but I would say that ApproxFun is your first best bet in x=1d, the least technical on the numerical side. You can write you pde very closely to the mathematical formulation. It will be slow but the result will be super precise.

Then if you want speed, finite elements would be good or the MOL as many suggested before.

Rveltz, thanks, I’m reading whatever documentation I can find on ApproxFun. (I’m reading about ten different things simultaneously after all the suggestions, plus still doing calculations on paper to figure out the initial conditions, so it’s taking me time to catch up to the discussion and have more precise questions to ask.)

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

4 Likes