I am trying to solve for a 1D steady-state diffusion equation (Fick's Second Law/Heat Equation) with a reaction term. I wanted to compare using both DSolve
and NDSolve
.
However, when running the code, I get multiple errors:
(*L+rUnderoverscript[\[Equilibrium], d1, k1]R*)
k1 = 0.00193
d1 = 0.00700
K1 = d1/k1
NT = 1.7
(*Total Receptors(NT) = r+R*)
R = (NT*u[x])/(K1 + u[x])
r = NT - R
RL = (d1*R) - (k1*u[x]*r)
diffCo = 0.0001; (*Diffusion coefficient*)
bc = {DirichletCondition[u[x] == 1, x == 0], DirichletCondition[u[x] == 0, x == 100]};
eqn = diffCo*u''[x] + RL == 0;
solDSolve = u[x] /. First@DSolve[{eqn, bc}, u[x], {x, 0, 100}]
solNDSolve =
NDSolve[{eqn, bc}, u, {x, 0, 100},
Method -> {"FiniteElement", MeshOptions -> MaxCellMeasure -> 0.001}]
Am I setting something up incorrectly? Thank you.
u[x, t]
in the definitions, and you mix that withu[x]
in thee equations and boundary conditions. Please amend the code to show exactly what you used. $\endgroup$NDSolve
seems to work fine if you remove theMethod
specifications. Do you have to / want to use FEM specifically? $\endgroup$