1
$\begingroup$

I've tinkered with Matlab's PDE toolbox for a while but was wondering whether anyone here has used Julia to build a PDE solver. If so, what are the advantages and limitations of Julia for PDEs? I'm mostly interested in simple PDEs with constant coefficients but am also thinking of variable coefficients for modeling purposes.

Any documentation that you could point me to would be much appreciated.

$\endgroup$
  • $\begingroup$ Have you read Julia's documentation? They have some PDE solvers already. $\endgroup$ – nicoguaro Apr 12 at 15:02
  • 3
    $\begingroup$ I agree this isn't the best SO question, and kind of goes against the guidelines of what should be asked, but I thought it was worthwhile to answer the user's question anyways. But just for future reference to the user, the downvotes are likely because this is a "list" question, asking just for a bunch of personal references, and a software one, rather than something concrete and mathematical about numerical methods which is what this SO is about. Hopefully you're set in the right direction though. $\endgroup$ – Chris Rackauckas Apr 12 at 15:16
  • $\begingroup$ I see that you deleted your comment. I think that this question has been asked already on this site. I suggest that you look around. If you don't find an answer, I suggest you ask a question asking if creating your own PDE solver is the right thing to do. $\endgroup$ – nicoguaro Apr 13 at 1:56
  • $\begingroup$ Are you asking whether anyone has produced a package in Julia comparable to the PDE Toolbox in MATLAB that can solve a wide variety of PDE's by finite element methods? $\endgroup$ – Brian Borchers Apr 13 at 3:25
  • $\begingroup$ @brianborchers nope, I mean building a solver to numerically solve a very specific set of equations, say, for a strong PhD thesis. Maybe starting with a pde in one space dimension and then augmenting the solver down the road (2 years later?) to consider solutions in two space dimensions etc. It seems that Matlab, Python and even Fortran are the main languages to build PDE solvers, according to my classmates who've started their theses. I wanted to know a bit about Julia for this purpose. $\endgroup$ – user35614 Apr 13 at 3:39
8
$\begingroup$

Yes, lots of people have. Automatic Jacobian sparsity handling shows up in the second tutorial of DifferentialEquations.jl, where it's able to run sparsity detection on normal Julia code to get the sparse form and perform coloring to then specialize the matrix computations. Then the tutorial ends by showing how you can swap out linear solvers for Newton-Krylov methods and add preconditioners. There's a lot more in the DifferentialEquations.jl documentation which you might find useful for time-dependent PDEs, such as GPU support, so dig around there.

Additionally there are a lot of other repos around. Oceananigans.jl is a CPU and GPU-based fluid dynamics library. CLIMA is a full climate model which uses a discrete Galerkin discretization method. NeuralNetDiffEq.jl has backwards SDE approaches for efficiently solving 1,000+ dimensional parabolic PDEs. DiffEqOperators.jl has methods for automatically constructing higher order finite difference methods with matrix-free operators. etc. Then there's things like DiffEqFlux.jl for automatically fitting models, which we used to showcase automatic discovery of PDEs.

Some of the advantages that are highlighted here is the fact that multiple dispatch and Julia's well-structured AST makes integrating compiler approaches with the solver methods quite straight forward, which means you can get arbitrary functions from the user directly in Julia code and, not only will it be fast (since it's a Julia function they're giving you), you can modify and analyze it. You can figure out its sparsity patterns, you can change their code to be more efficient for parallelism, you can reorder the equations in their code, you can replace parts by neural networks, and then throw it into traditional numerical methods. This is the kind of stuff we are doing with DifferentialEquations.jl, and I'll be putting out more resources soon on how this is being used throughout different PDE solver components and packages to improve the backend numerical methods with what are traditionally thought of as more symbolic or modeling DSL features. This is then matched with structured matrix libraries, like BlockBandedMatrices.jl, which can recompile the internals of another library to specialize the computations on not a "sparse" matrix but on structure like BlockBandedMatrices (from high dimensional PDEs), which then further improves the speed over libraries that have to treat everything as just a big unstructured sparse problem.

Those are the ones that come to mind from the top of my head. For a more comprehensive list, see the recent Survey of PDE packages.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ This answer completely misses the point of my question. You also have a tendency to write a lot but say very little. Too much self-indulgence and a lack of focus in answering the question that's asked. $\endgroup$ – user35614 Apr 13 at 21:07
  • 2
    $\begingroup$ Sorry, your question was quite vague. But if your question was "I mean building a solver to numerically solve a very specific set of equations, say, for a strong PhD thesis.", then did you look at Oceanangians? That's an example of solving a very specific set of equations very fast. So is CLIMA. And if you want more, QuantumOptics.jl is another good one. EconPDEs.jl. These are all listed in the survey of packages as well. You could be a little nicer to someone who's trying to help you. $\endgroup$ – Chris Rackauckas Apr 13 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.