I am trying to model/solve a specific instance of a 1D diffusion equation in which I have a nonlinear Neumann boundary condition at x=1 (length of unit 1). My equations that I have are:
D[u[x,t],t] == D[u[x,t], x, x] for the general diffusion equation;
D[u[1,t],x] == 10 - Log[u[1, t]+1] for a flux at boundary x=1 that begins at 10 and decreases as a function of Log of concentration at the boundary;
D[u[0,t],x] == 0 for a no flux boundary at x=0;
u[x,0] == 0 for an initial concentration of 0 everywhere in the rod.
What I am trying to see occur is a function where the heat spreads across the rod and smoothes out across the rod to a steady-state/equilibrium; additionally, the goal is to have the flux approach zero and remain at zero (which represents the difference in chemical potentials between the domain and an external source approaching zero).
Upon further reconsideration, I was able to use NDSolve to find a plot that looks somewhat like what my goal is. However, I want the diffusion to continue across the domain until it smoothes out. Here is my code:
NDSolve[{D[c[x,t],t]==D[c[x,t],x,x],D[c[1,t],x]==10-Log[c[1,t]+1],c[x,0]==0},c,{t,0,10},{x,0,1}]
This gives a decent solution as said but results in two errors.
NDSolve: Warning: boundary and initial conditions are inconsistent.
NDSolve: Warning: an insufficient number of boundary conditions have been specified for the direction of independent variable x. Artificial boundary effects may be present in the solution.
My three questions are as follows:
- Should I address this warnings if it still gives a close enough solution?
- How do I get a curve where the concentration smoothes out over the domain (and as time moves forward)?
- Is there a way to get a 2D list line plot that shows the curves as lines where each line represents a different time?
Sorry if that is too much to ask. If you can help tackle any of these questions, that will be greatly appreciated. Thank you!
NDSolve[{D[c[x, t], t] == D[c[x, t], x, x],D[c[1, t], x] == 10 - Log[c[1, t] + 1], c[x, 0] == 0}, c, {t, 0, 10}, {x, 0, 1}, Method -> "FiniteElement"]
) which doesn' t work in this case . The error message is explicit : "The dependent variable in the boundary condition needs to be linear." $\endgroup$D[c[1,t],x]
is wrong. One possible correction isD[c[x, t], x]/. x->1
. 2. Thebcart
warning is a serious problem. See this post for more info: mathematica.stackexchange.com/q/73961/1871 Notice you've forgotten the b.c.D[u[x,t],x]==0/.x->0
. 3. Theibcinc
warning is a serious problem in this case, you needMethod->{"MethodOfLines","DifferentiateBoundaryConditions"->{True,"ScaleFactor"->100}}
, check this post for more info: mathematica.stackexchange.com/a/127411/1871 $\endgroup$