Message Boards Message Boards

0
|
5230 Views
|
7 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Solve decoupled PDE's with NDSolve?

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?

POSTED BY: Eric Smith
7 Replies

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.

POSTED BY: Michael Rogers

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.

POSTED BY: Eric Smith

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

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

POSTED BY: Eric Smith

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

Attachments:

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

POSTED BY: Eric Smith

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.

Attachments:
POSTED BY: Eric Smith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract