- #1
PenguInABox
- 1
- 0
Mathematica: Help with NDSolve Error!
Hello All,
I am attempting to set up a model of an experiment I am running, but I keep getting the following error:
"NDSolve::ibcinc: Warning: Boundary and initial conditions are inconsistent."
However, I have checked all of my boundary conditions, and as far as I can tell they are compatible with the initial conditions. Can you see what I am missing?
Here is my script up to the offending line:
(*Clear Scope*)
ClearAll["Global`*"];
Clear[Derivative];
ClearGlobal[];
Remove["Global`*"];
(*Units:
length - mm
concentration - pmol/mm^3=uM
time - s
*)
(*Define Global Parameters*)
plotPoints=150;
(*Define Time Spans*)
inactiveRunTime=1000;(*time in time units to run model before activating Amplifier*)
activeRunTime=10;(*time in time units to run model after activating Amplifier*)
(*Define Gel Parameters*)
gelWidth=100;(*units:length*)
gelLength=100;(*units:length*)
gelDepth=1;(*units:length*)
sourceX=gelWidth/3;(*units:length*)
sourceY=gelLength/3;(*units:length*)
sourceZ=gelDepth/2;(*units:length*)
sourceWidth=10;(*units:length*)
sourceLength=5;(*units:length*)
sourceDepth=.9*gelDepth;(*units:length*)
(*Define Species Parameters*)
inputConcentration=1;(*units:concentration*)
dW25=150*10^-6;(*units:length^2/time*)
colorW25=(RGBColor[0,0,1]&);
(*Define Utility Functions*)
InputFunction[x_,y_,z_,cx_,cy_,cz_,w_,l_,d_]:=(1-1/(1+x^2))*(1-1/(1+(gelWidth-x)^2))*(1-1/(1+y^2))*(1-1/(1+(gelLength-y)^2))*(1-1/(1+z^2))*(1-1/(1+(gelDepth-z)^2))*Exp[-(x-cx)^2/(2*(w/2)^2)-(y-cy)^2/(2*(l/2)^2)-(z-cz)^2/(2*(d/2)^2)];
(*Construct Inputs*)
W25t0[x_,y_,z_]:=inputConcentration * InputFunction[x,y,z,sourceX,sourceX,sourceZ,sourceWidth,sourceLength,sourceDepth];
Plot3D[W25t0[x,y,sourceZ],{x,0,gelWidth},{y,0,gelLength},PlotRange -> All,PlotPoints -> plotPoints,Mesh->None]
diffuseInputs = NDSolve[{D[W25tA[t,x,y,z],t] == dW25*(D[W25tA[t,x,y,z],x,x]+D[W25tA[t,x,y,z],y,y]+D[W25tA[t,x,y,z],z,z]), W25tA[0,x,y,z]==W25t0[x,y,z],W25tA[t,0,y,z]==0,W25tA[t,gelWidth,y,z]==0,W25tA[t,x,0,z]==0,W25tA[t,x,gelLength,z]==0,Derivative[0,0,0,1][W25tA][t,x,y,0]==0,Derivative[0,0,0,1][W25tA][t,x,y,gelDepth]==0 },{W25tA},{t,0,inactiveRunTime},{x,0,gelWidth},{y,0,gelLength},{z,0,gelDepth}];
Hello All,
I am attempting to set up a model of an experiment I am running, but I keep getting the following error:
"NDSolve::ibcinc: Warning: Boundary and initial conditions are inconsistent."
However, I have checked all of my boundary conditions, and as far as I can tell they are compatible with the initial conditions. Can you see what I am missing?
Here is my script up to the offending line:
(*Clear Scope*)
ClearAll["Global`*"];
Clear[Derivative];
ClearGlobal[];
Remove["Global`*"];
(*Units:
length - mm
concentration - pmol/mm^3=uM
time - s
*)
(*Define Global Parameters*)
plotPoints=150;
(*Define Time Spans*)
inactiveRunTime=1000;(*time in time units to run model before activating Amplifier*)
activeRunTime=10;(*time in time units to run model after activating Amplifier*)
(*Define Gel Parameters*)
gelWidth=100;(*units:length*)
gelLength=100;(*units:length*)
gelDepth=1;(*units:length*)
sourceX=gelWidth/3;(*units:length*)
sourceY=gelLength/3;(*units:length*)
sourceZ=gelDepth/2;(*units:length*)
sourceWidth=10;(*units:length*)
sourceLength=5;(*units:length*)
sourceDepth=.9*gelDepth;(*units:length*)
(*Define Species Parameters*)
inputConcentration=1;(*units:concentration*)
dW25=150*10^-6;(*units:length^2/time*)
colorW25=(RGBColor[0,0,1]&);
(*Define Utility Functions*)
InputFunction[x_,y_,z_,cx_,cy_,cz_,w_,l_,d_]:=(1-1/(1+x^2))*(1-1/(1+(gelWidth-x)^2))*(1-1/(1+y^2))*(1-1/(1+(gelLength-y)^2))*(1-1/(1+z^2))*(1-1/(1+(gelDepth-z)^2))*Exp[-(x-cx)^2/(2*(w/2)^2)-(y-cy)^2/(2*(l/2)^2)-(z-cz)^2/(2*(d/2)^2)];
(*Construct Inputs*)
W25t0[x_,y_,z_]:=inputConcentration * InputFunction[x,y,z,sourceX,sourceX,sourceZ,sourceWidth,sourceLength,sourceDepth];
Plot3D[W25t0[x,y,sourceZ],{x,0,gelWidth},{y,0,gelLength},PlotRange -> All,PlotPoints -> plotPoints,Mesh->None]
diffuseInputs = NDSolve[{D[W25tA[t,x,y,z],t] == dW25*(D[W25tA[t,x,y,z],x,x]+D[W25tA[t,x,y,z],y,y]+D[W25tA[t,x,y,z],z,z]), W25tA[0,x,y,z]==W25t0[x,y,z],W25tA[t,0,y,z]==0,W25tA[t,gelWidth,y,z]==0,W25tA[t,x,0,z]==0,W25tA[t,x,gelLength,z]==0,Derivative[0,0,0,1][W25tA][t,x,y,0]==0,Derivative[0,0,0,1][W25tA][t,x,y,gelDepth]==0 },{W25tA},{t,0,inactiveRunTime},{x,0,gelWidth},{y,0,gelLength},{z,0,gelDepth}];