I'm trying to solve a set of coupled pde equations of functions C1[t,x], C2[t,x]. all works fine but I need to specify a conditional initial conditions of the form:
when (t=t.min) {
C1 = if (x=x.min) 1 else 0
C2 = 0;
I've tried to set:
C1[0,x]==0, (C1[0, x] /. x -> 0) == 1
or use
WhenEvent
but in either case I got:
NDSolve::bcedge: Boundary condition C1[0,0]==0 is not specified on a single edge of the boundary of the computational domain.
Is there any way around it?
Many thanks,
This question is a part of the post at http://community.wolfram.com/groups/-/m/t/1313375
edited:
Thanks. The code is:
Fp = 0.016666667; Vp = 0.07; Wp = 0.94; Dp =
10^-18; PSg = 0.05; Visfp = 0.35; Disf = 10^-18; 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] == 1, C2[0, x] == 0}, {C1, C2}, {t, 0, 20}, {x, 0, L}]
Plot3D[Evaluate[C1[t, x] /. sol[[1]]], {t, 0, 20}, {x, 0, L}]
I've tried:
\[Phi][x_] := Piecewise[{{1, x == 0.}, {0, x > 0}}];
but it freezes the kernel (calculations never stop).
The solution should look like: