0 down vote favorite I am solving the diffusion equation in 1D with derivative boundary conditions. I am pretty new/rusty in mathematica so there may be several problems with the code but I think the main issue is trying to implement the boundary condition that is dependent on the previous timestep solution at x=0. Here is the code:
Clear[x, y, t]
ClearAll["Global`*"];
Ceq = 4.5*10^(-6);
F = 9*10^(-9);
L = 10^(-3);
Dif = 10^(-5);
pde = D[u[x, t], t] == (Dif)*D[u[x, t], x, x]
BC = {(D[u[x, t], x] /.
x -> L) == (L/Dif)*(c[0, t] - Ceq), (D[u[x, t], x] /.
x -> L) == (1/Dif)*F}
IC = c[x, 0] = Ceq
sol = NDSolve[{pde, IC, BC}, {u[x, t]}, {t, 0, 30}, {x, 0,L}];
Plot3D[u[t, x] /. sol, {x, 0, 10^(-3)}, {t, 0, 20}]
I get a laundry list of errors as my output:
(1) NDSolve::deqn: Equation or list of equations expected instead of Ceq in
the
first argument {(u^(0,1))[x,t]==(u^(2,0))[x,t]/100000,Ceq,{(u^(1,0))
[1/1000,t]==100 (-Ceq+c[0,t]),(u^(1,0))[1/1000,t]==9/10000}}.
(2) NDSolve::dsvar: 0.00143` cannot be used as a variable.
(3) ReplaceAll::reps: {NDSolve[{(u^(0,1))[7.15*10^-8,0.00143]==(u^(2,0))
[7.15*10^-8,0.00143]/100000,Ceq,{(u^(1,0))[1/1000,0.00143]==100
(Times[<<2>>]+c[<<2>>]),(u^(1,0))[1/1000,0.00143]==9/10000}},
{u[7.15*10^-8,0.00143]},{0.00143,0,30},{7.15*10^-8,0,1/1000}]} is
neither a list of replacement rules nor a valid dispatch table, and so
cannot be used for replacing.
I am just trying to use mathmatica to double check a portion of a python solver that I wrote but it is turning out to be a huge hassle. Help on any of these error messages is greatly appreciated.enter code here