Message Boards Message Boards

GROUPS:

Solve a set of coupled heat ode/ conditional initial conditions?

Posted 6 months ago
244 Views
|
0 Replies
|
0 Total Likes
|

Hi Everyone,

I'm trying to solve the following set of coupled heat equation (for kinetic modeling)

dC1/dt = -(Fp)(L)/Vp*(dC1/dx) - PSg/Vp(C1/Wp-C2) + Dp*(dC1/dx2);

dC2/dt = PSg/Visfp(C1/Wp-C2) + Disf*(dC2/dx2);

My boundary conditions are:

C1(t,x)|x=0 = Cin(t)

C2(t,x)|x=0 = 0

Cin(t) is a function of a known form e.g. Cin(t)= exp(-t);

dC1(t,x)/dx|x=0 = 0

dC2(t,x)/dx|x=0 = 0

dC1(t,x)/dx|x=L = 0

dC2(t,x)/dx|x=L = 0

The initial conditions are:

C1(t,x)|t=0 = 0

C2(t,x)|t=0 = 0

I prepared the following code to solve it numerically in Mathematica:

Fp = 0.016666667;

Vp = 0.07;

Wp = 0.94;

Dp = 0.1;

PSg = 0.05;

Visfp = 0.35;

Disf = 0.1;

L = 0.1;

sol = NDSolve[{Derivative[1, 0][C1][t, 
     x] == -Fp*L/Vp*Derivative[0, 1][C1][t, x] - 
     PSg/Vp*(C1[t, x]/Wp - C2[t, x]) + Dp*Derivative[0, 2][C1][t, x], 
   Derivative[1, 0][C2][t, x] == 
    PSg/Visfp*(C1[t, x]/Wp - C2[t, x]) + 
     Disf*Derivative[0, 2][C2][t, x], C1[t, 0] == Exp[-t], 
   C2[t, 0] == 0, C1[t, L] == 0, C2[t, L] == 0, 
   Derivative[0, 1][C1][t, 0] == 0, Derivative[0, 1][C2][t, 0] == 0, 
   Derivative[0, 1][C1][t, L] == 0, Derivative[0, 1][C2][t, L] == 0, 
   C1[0, x] == 0, C2[0, x] == 0}, {C1, C2}, {t, 0, 20}, {x, 0, 0.1}]

I found that the code works ok but I need a specific initial conditions:

when (t=t.min)  {
    C1 = if (x=x.min) 1 else 0
    C2 = 0;

how can I conditionally set C1[0, x] == 1 but only for x=0? (I cover range of x=0:0.1). I've tried to add

(C1[0, x] /. x -> 0) == 1

but this results in an error

NDSolve::bcedge: Boundary condition C1[0,0]==0 is not specified on a single edge of the boundary of the computational domain.

Thank you for any suggestions

POSTED BY: Greg K
Answer
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