# Problem with DifferentialEquations.jl

**URL:** <https://discourse.julialang.org/t/problem-with-differentialequations-jl/127184>\
**Category:** New to Julia\
**Created:** [March 20, 2025, 5:32pm UTC](https://discourse.julialang.org/t/problem-with-differentialequations-jl/127184 "2025-03-20T17:32:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Name\_Family\_Name](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/name_family_name/32/215924_2.png) [@Name\_Family\_Name](https://discourse.julialang.org/u/Name_Family_Name)\
**Post date:** [March 20, 2025, 5:32pm UTC](https://discourse.julialang.org/t/problem-with-differentialequations-jl/127184/1 "2025-03-20T17:32:34Z")

</div>

I’m working on a project, which is basically a simulation model for adsorption process of phosphate in waste water

(2 videos to understand the adsorption process, it’s 15 seconds in total)

So the first is to simulate the evolution of the concentration of phosphate into the column and the evolution of the amount of phosphate adsorbed into the column. To do that, I have to discretize two equations.

I’m using a code that I’ve previously used in class with slighty different equations, and it was working perfectly. However in my case, I keep getting weird plot with excessive time or maxiters error.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/f/cf21cfe06ba302800876734dde7a1de8ae8f031a.png)

---

<div class="post-metadata">

**Author:** ![zdenek\_hurak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zdenek_hurak/32/53118_2.png) [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Post date:** [March 20, 2025, 5:38pm UTC](https://discourse.julialang.org/t/problem-with-differentialequations-jl/127184/2 "2025-03-20T17:38:58Z")

</div>

Hello, welcome to the Julia community. Show us what you have already tried – I am afraid it must be difficult for anyone to help you unless you show us the code you wrote to solve the problem.

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [March 20, 2025, 6:06pm UTC](https://discourse.julialang.org/t/problem-with-differentialequations-jl/127184/3 "2025-03-20T18:06:12Z")

</div>

So you are discretizing (a) PDE(s).

- In your model, should the first term on the RHS (right hand side) of the equation for c\_P [concentration of Phosphate, I guess] be divided by 2\*Delta z? Since the numerator subtracts c\_P[i+1] and c\_P[i-1]? Not a big thing – that is not the reason for you problem.

- I assume that the argument of time differentiation on the LHS (left hand side) of the first equation is c\_P[i]?

- It is not quite clear to me what `q` is. Should this, too, be `q[i]`?

- Is it correct that you have `- ka*(cP[i-1]-cGG[i])` in both equations? Or should one of them change sign? [This depends on the meaning of `q`, etc.]. Normally, with absorption, the material (c\_P) goes out of one phase, and into another, so it it leaves the fluid phase where the concentration is c\_P, it should probably enter the absorbent??

Anyways, since you are discretizing PDE(s), you need boundary conditions. What are these?

In summary, your system seems to be quite simple – it is stable as long as “v” (is that Greek “nu” – strange symbol for velocity) is positive.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [March 20, 2025, 6:46pm UTC](https://discourse.julialang.org/t/problem-with-differentialequations-jl/127184/4 "2025-03-20T18:46:08Z")

</div>

> [@Name\_Family\_Name](#):
>
> However in my case, I keep getting weird plot with excessive time or maxiters error.

Is your case stiff? Are you using an implicit method for that, with sparsity handling?
