Skip to main content
edited tags
Link
user21
  • 40.7k
  • 8
  • 114
  • 170
edited tags
Link
AhWee
  • 123
  • 5
deleted 6 characters in body
Source Link
AhWee
  • 123
  • 5

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: enter image description here

(*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,t]NT*u[x])/(K1 + u[x,t]u[x])
r = NT - R
RL = (d1*R) - (k1*u[x,t]*rk1*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.

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: enter image description here

(*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,t])/(K1 + u[x,t])
r = NT - R
RL = (d1*R) - (k1*u[x,t]*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.

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: enter image description here

(*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.

Formatted code
Source Link
MarcoB
  • 67.7k
  • 18
  • 96
  • 198
Loading
Source Link
AhWee
  • 123
  • 5
Loading