How to solve partial differential algebraic equations

Hi all,

I am quite new to Julia and programming in general. I am currently doing a modelling PhD and I have a set of couple Partial Differential Algebraic Equations (PDAE). I tried solving them on comsol but it is extremely cumbersome trying to rewrite the equations into a format that comsol accepts. So I was wondering if there is a PDAE solver in Julia since I want to eventually shift to a Julia solver for my PhD. Any help will be appreciated thanks in advance.

1 Like

Here is a guide to the pde ecosystem in Julia: GitHub - JuliaPDE/SurveyofPDEPackages: Survey of the packages of the Julia ecosystem for solving partial differential equations

EconPDEs.jl for example solves pdaes, but a very specific type that arise in economics (from HJBs with nonlinear concave objective functions)…
I don’t think there is a general package yet

what kind of PDE do you have?

Hi Chris,

Thank you for replying.


The equations are a set of equations for modelling a battery but unfortunately I cannot use existing packages such as JuBatt since the configuration is very different than them. The solver needs to solve for 7 dependent variables - 5 concentration terms C_OH, C_Zn, C_ZnO, C_H20, C_K and two potential variables phi_l and phi_s. So as you can see the equation 5 is the problematic term here since it is an algebraic equation so I am not sure how to write it in a PDE solver in Julia.

Also on top of that, the exponent adds non linearity to the equations so I am not to able to right away start solving this by direct discretization.

PS Apologies for the handwritten equations. Please let me know if you do not understand something in there.

What assumptions are you making about this system? Is this within a single section of the cell, such as the electrode? Are the diffusivities and conductivities constant? I would check out MethodOfLines.jl for simulating coupled PDAEs. It handles the discretizations, boundary conditions, algebraic equations, and fully supports nonlinear terms such as the BV kinetics.

1 Like

Thank you for your reply @MarcBerliner. I will check MOL package first to look at the possibility.
The diffusivities and conductivities are actually functions of concentration but now for the sake of simplicity to get started i am assuming them to be constant. The model is for a spherical coordinate system.

@Anish_Kumar , I also solve similar equations for my research. I can see that you are solving, non-linear convection-diffusion-reaction problem. The usual procedure for solving such problems is this:

  1. convert the differential-equations (time-independent- in your case i think it is 5,6 and 7) to difference equations. MethodOfLines.jl must surely be of help. Or if you are good at FEA coding, you can construct and load the sparse-stiffness matrix into julia. Even if youre good at FEA, its a good idea to use julia inbuit poisson solvers in case youre working with higher dimensions 3D problem.
  2. I can see that you have 5 species, give appropriate initial conditions, and use [differentialEquations.jl] package to solve the ODEs. In case you are using your own FEA routine, In the ODE function definition -remember to include solution to potential (Phi = InvK*F, ) using this command:
    prob = LinearProblem(K_stiffness , Force);
    @time sol = solve(prob,LinearSolve.KrylovJL_CG(),maxiter = 1000);
    Code the other dynamics appropriatey, look into differentialEquations.jl documentation for the same.
1 Like