# Solve decoupled PDE's with NDSolve?

**URL:** <https://community.wolfram.com/t/solve-decoupled-pdes-with-ndsolve/12019>\
**Category:** Questions\
**Tags:** equation-solving, numerical-computation\
**Created:** [February 26, 2018, 11:19pm UTC](https://community.wolfram.com/t/solve-decoupled-pdes-with-ndsolve/12019 "2018-02-26T23:19:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericsmith](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ericsmith/32/2637_2.png) [@ericsmith](https://community.wolfram.com/u/ericsmith)\
**Post date:** [February 26, 2018, 11:19pm UTC](https://community.wolfram.com/t/solve-decoupled-pdes-with-ndsolve/12019/1 "2018-02-26T23:19:41Z")

</div>

I have one NDSolve with a system of equations that solves just fine

```
NDSolve[eqns1, depVars1, {z,0,zf}, {t,0,tf}]

```

I have another completely decoupled NDSolve that solves

```
NDSolve[eqns2, depVars2, {z,0,zf}, {t,0,tf}]

```

But when I put them together…

```
NDSolve[Join@@{eqns1,eqns2},Join@@{depVar1,depVar2},{z,0,zf},{t,0,tf}]

```

even when they’re completely decoupled, I get the error “The given initial conditions were not consistent with the differential-algebraic equations.” Anyone know why?

---

<div class="post-metadata">

**Author:** ![mroge02](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mroge02/32/28775_2.png) [@mroge02](https://community.wolfram.com/u/mroge02)\
**Post date:** [February 27, 2018, 3:16am UTC](https://community.wolfram.com/t/solve-decoupled-pdes-with-ndsolve/12019/2 "2018-02-27T03:16:36Z")

</div>

Works for me on my example. I guess it has to do with your code. Generally speaking, except for very common errors, problems with code require the code for the problem to be diagnosed.

---

<div class="post-metadata">

**Author:** ![ericsmith](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ericsmith/32/2637_2.png) [@ericsmith](https://community.wolfram.com/u/ericsmith)\
**Post date:** [February 27, 2018, 3:03pm UTC](https://community.wolfram.com/t/solve-decoupled-pdes-with-ndsolve/12019/3 "2018-02-27T15:03:41Z")

</div>

Yeah, sorry about not including the code, it’s a bit involved, difficult to simplify, and I was in a rush. Here’s the best I can do to simplify it:

Equations to solve:

```
eqns = {{x[Nonacosane][z, 0] == 0.04365546804923613, x[Triacontane][z, 0] == 
   0.06241482157451062, s[Nonacosane][z, 0] == 0, s[Triacontane][z, 0] == 0}, 
 {DirichletCondition[x[Nonacosane][z, t] == 0.04365546804923613, z <= 0], 
  DirichletCondition[x[Triacontane][z, t] == 0.06241482157451062, z <= 0]}, 
 {3138.4698592919644*Derivative[0, 1][s[Nonacosane]][z, t] == 
   -0.00635626711262017*(0.0028844741322105526*s[Nonacosane][z, t] - 
     x[Nonacosane][z, t]), 3138.4698592919644*Derivative[0, 1][s[Triacontane]][
     z, t] == -0.007114201335734374*
    (0.0019632116886399483*s[Triacontane][z, t] - x[Triacontane][z, t])}, 
 {3138.4698592919644*Derivative[0, 1][x[Nonacosane]][z, t] + 
    999.0059837024828*Derivative[1, 0][x[Nonacosane]][z, t] == 
   NeumannValue[0, z >= 100] + 0.00635626711262017*
     (0.0028844741322105526*s[Nonacosane][z, t] - x[Nonacosane][z, t]), 
  3138.4698592919644*Derivative[0, 1][x[Triacontane]][z, t] + 
    999.0059837024828*Derivative[1, 0][x[Triacontane]][z, t] == 
   NeumannValue[0, z >= 100] + 0.007114201335734374*
     (0.0019632116886399483*s[Triacontane][z, t] - x[Triacontane][z, t])}}

```

The dependent variables

```
depVars = {x[Nonacosane][z, t], s[Nonacosane][z, t], x[Triacontane][z, t], 
 s[Triacontane][z, t]}

NDSolve[eqns,depVars,{z,0,1000},{t,0,5000}]

```

In these equations, a reaction is taking place between two states “s” and “x”. It solves without a problem.

I want to calculate the accumulated rates by saying D[m[z,t],t]=Sum(rates[z,t]). I do that by adding “D[sArea[z,t],t]=Sum(rates)” and “sArea[z,0]=0” to the equations

```
{-9.27269625879322*^-9*s[Nonacosane][z, t] - 7.574037191466946*^-9*
    s[Triacontane][z, t] + 3.214692118485727*^-6*x[Nonacosane][z, t] + 
   3.857982934440454*^-6*x[Triacontane][z, t] == Derivative[0, 1][sArea][z, t], 
 sArea[z, 0] == 0}

```

This fails. I tried a completely random equation that solves in NDSolve but when added to the equation list, it fails.

---

<div class="post-metadata">

**Author:** ![christospapahristodoulou](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/christospapahristodoulou/32/20809_2.png) [@christospapahristodoulou](https://community.wolfram.com/u/christospapahristodoulou)\
**Post date:** [February 28, 2018, 1:24pm UTC](https://community.wolfram.com/t/solve-decoupled-pdes-with-ndsolve/12019/4 "2018-02-28T13:24:09Z")

</div>

Hi!  
Just a grammatic error in equations…eons =;  
Correct it to eqns  
and you get the solutions (Interpolating functions)!

---

<div class="post-metadata">

**Author:** ![ericsmith](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ericsmith/32/2637_2.png) [@ericsmith](https://community.wolfram.com/u/ericsmith)\
**Post date:** [February 28, 2018, 1:28pm UTC](https://community.wolfram.com/t/solve-decoupled-pdes-with-ndsolve/12019/5 "2018-02-28T13:28:30Z")

</div>

Thanks, but this is a copy-paste of some code. I added eons (should have been eqns) for this post. Did you happen to try the code? It fails for me

Update: original typo fixed

---

<div class="post-metadata">

**Author:** ![christospapahristodoulou](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/christospapahristodoulou/32/20809_2.png) [@christospapahristodoulou](https://community.wolfram.com/u/christospapahristodoulou)\
**Post date:** [February 28, 2018, 1:31pm UTC](https://community.wolfram.com/t/solve-decoupled-pdes-with-ndsolve/12019/6 "2018-02-28T13:31:38Z")

</div>

Check the attached file. It works (gives the interpolating functions), but they look similar!

---

<div class="post-metadata">

**Author:** ![ericsmith](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ericsmith/32/2637_2.png) [@ericsmith](https://community.wolfram.com/u/ericsmith)\
**Post date:** [February 28, 2018, 3:17pm UTC](https://community.wolfram.com/t/solve-decoupled-pdes-with-ndsolve/12019/7 "2018-02-28T15:17:56Z")

</div>

That’s right, the first set of equations solves fine. My question is when adding another equation (given in post) it fails. I’m adding to the notebook and will send it back in a few minutes

---

<div class="post-metadata">

**Author:** ![ericsmith](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ericsmith/32/2637_2.png) [@ericsmith](https://community.wolfram.com/u/ericsmith)\
**Post date:** [February 28, 2018, 3:25pm UTC](https://community.wolfram.com/t/solve-decoupled-pdes-with-ndsolve/12019/8 "2018-02-28T15:25:40Z")

</div>

I replied to the wrong thread. Anyway, I’ve updated your notebook with the problem I’m seeing. I appreciate the help; I can’t figure this one out.
