I am an undergraduate researcher. I have been working with Mathematica for roughly a month. I have been assigned a modeling task. My objective is to model the diffusion of ions in solution under the effect of an electric field and ignoring concentration gradient.


The model is to be one dimensional for the time being. In the future it will be translated to 2D and ultimately 3D.

The equation used is as follows.

$\qquad $∂C/∂t = ∂/∂x(D ∂C/∂x - z μ C ∂Φ/∂x)


C : Concentration of ions

D: Diffusion coefficient

z: Charge per molecule

μ: Ion mobillity

Φ: Electric potential

C is a function of time and space, t and x.

Φ is a function of space, x.

All remaining terms are assumed to be constant. (D, z, μ)

The model I am making ignores diffusion caused by concentration gradient (The highlighted term).

∂C/∂t = ∂/∂x(D ∂C/∂x - z μ C ∂Φ/∂x)

The following assumptions are made.

D ∂C/∂x = 0

z = -1

μ = 1

This leaves us with:

∂C/∂t = ∂/∂x(C ∂Φ/∂x)

Finally, performing the product rule gives the final equation.

∂C/∂t = C (∂^2 Φ)/(∂x^2 ) + ∂C/∂x ∂Φ/∂x


DSolve presents a general solution. But despite multiple attempts and combinations of boundary and initial conditions of both the concentration and potential, I can’t get DSolve to present a particular solution. The code is as follows:

h1D Electrodiffusion

The purpose of this program is to model the diffusion of ions under the influence of an electric field only.

The first implementation will use DSolve. Later work will use NDSolve if no prior attempt was successful

The following describes the partial differential equation to be solved

edeqn = D[u[t, x], t] == u[t, x]*D[Φ[x], {x, 2}] + D[u[t, x], x]*D[Φ[x], x]

The following attempts to solve the differential equation.

sol = DSolve[edeqn, u, {t, x}]
Simplify[edeqn /. sol]

This returns the general solution. I have provided a few sample of my attempts to attain a particular solution below.

The following shows the effect of adding an initial condition and a boundary condition for the left and right sides of the channel.

bc = {u[t, 0] == 10, u[t, 2] == 0}
ic = u[0, x] == 8
sol = DSolve[{edeqn, bc, ic}, u, {t, x}]

The following attempts to discern a solution to the differential equation. The solver has been told to solve for u and Φ. Both u and Φ are given as functions of t and x.

edeqn = 
  D[u[t, x], t] == u[t, x]*D[Φ[t, x], {x, 2}] + D[u[t, x], x]*D[Φ[t, x], x]
sol = DSolve[edeqn, {u, Φ}, {t, x}]

Boundary condition. "u". Left side. Boundary condition. "u". Right side. Initial condition. "u". Boundary condition "Φ". Left side. Boundary condition "Φ". Right side. Initial condition. "Φ".

bc = 
  {u[t, 0] == 10, u[t, 2] == 0, Φ[t, 0] == 5, Φ[t, 2] == 0}
ic = {u[0, x] == 8, Φ[0, x] == 0}
edeqn = 
  D[u[t, x], t] == u[t, x]*D[Φ[t, x], {x, 2}] + D[u[t, x], x]*D[Φ[t, x], x]
sol = DSolve[{edeqn, bc, ic}, {u, Φ}, {t, x}]

I apologize for the length of the post. I've never used a forum before.

I do hope you all will consider my dilemma, and are willing and able to provide a solution. I can show the full code of my attempts if necessary.


closed as off-topic by user21, MarcoB, m_goldberg, J. M. is away Jul 30 '17 at 2:20

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – user21, m_goldberg, J. M. is away
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ If $\phi$ is not given, then you need an equation for it. But I assume that $\phi$ is given in some way. $\endgroup$ – user21 Jul 25 '17 at 18:13
  • $\begingroup$ @user21 It was as you said. I had failed to specify ϕ in the code. After giving ϕ a value of a function with only "x", the solver worked just fine. Thank you for your answer, and thank you 'm_goldberg' for editing the post. Much of the work you two have done on StackExchange is the only reason I've gotten this far. It is greatly appreciated. $\endgroup$ – NotDowloadable Jul 28 '17 at 14:38
  • $\begingroup$ Thanks. @m_goldberg, pinging else you will not see the appreciation you got ;-). Other than that should we close the question as it's not going to get an answer, Or Kali are you going to put something there? $\endgroup$ – user21 Jul 28 '17 at 14:53
  • $\begingroup$ Nope. I have another question, but it's probably better suited for a different post. I don't know think I have the ability to close the question. At your leisure, would one of you mind doing it? $\endgroup$ – NotDowloadable Jul 28 '17 at 15:42