I have a series of functions defined in my notebook, and then want to use this to solve a diffusion-reaction type equation. At the moment, something like this works:
eqn = D[Ef[r, t], t] - Def5*( D[Ef[r, t], r, r] + (2/(r )) D[Ef[r, t], r]) + q[r ] Ef[r, t];
ic = {Ef[r, 0] == kd, Ef[rn, t] == kd, Ef[ro, t] == kd};
s = NDSolve[{eqn == 0}~Join~ic, Ef, {r, rn, ro}, {t, 0, 60}];
Plot3D[Evaluate[Ef[r, t] /. s], {r, rn, ro}, {t, 0, 60},
AxesLabel -> Automatic, MaxRecursion -> 8, PlotPoints -> 32]
q[r] is a predefined function, and rn and ro are boundaries. Now, the above code works, BUT the boundary conditions are wrong and inconsistent; I want to change them to Neumann-type conditions so that $d(Ef)/dr = 0$ at both ro and rn, but I am having trouble implementing this; any ideas? All help appreciated! This is probably very simple but I'm new to Mathematica and sometimes screw up syntax...
DRG
D[Ef[r,t],r]==0should work – Szabolcs Apr 23 '13 at 13:52D[Ef[{rn, t}, r]]whereas you should haveD[Ef[rn, t], r]as @Szabolcs has written. – Jonathan Shock Apr 24 '13 at 02:56Efis not defined when you are trying to solve the equation. Start withClear[Ef]. – Szabolcs Apr 24 '13 at 12:42