I'm building a model for breakthrough/adsorption. I'm not well versed in the mathematica programming and learn best by reverse-engineering an existing code. I learned most of my stuff from this
demonstration.
My code has three major parts. Everything uses a position and time dimension [z,t].
1) An interation loop that makes a table (mytable) where the elements of the table are InterpolatingFunctions calculated and stored during the loop.
2) The Adsorption isotherm equation. This is set up as a "set delay" function, I think its called. This function q[z_,t_] = K*c[z,t] is called up by part 3.
3) The NDSolve section. The main function is solving:
NDSolve[
D[c[z,t],t] = mass balance + D[q[z,t],t].
]
I'm attempting to incorporate the interpolation functions, where the table part is chosen based on a function of z. Therefore part 2 becomes
q[z_,t_] = K*c[z,t] * mytable[[ F(z) ]][c[z,t]]
When I run this program I get an error where it says that F(z) is not a integer/part specification. When I added this part to the code, I'd assumed that the value of z would be "brought in" by the delay mechanism in the same way that q is brought into the NDSolve. It seems instead that z is not a number "yet" and causes the error.
So, my question is: Is it possible to do this in the way I have it set up? Perhaps I have a syntax error or something. OR, if it is not possible with this rough lookup table method, how would I be able to incorporate a FindRoot function within NDSolve where the zeroes depend on the value of c[z,t]? ALSO, is there a good demonstration code which has similar functionality?
I can't provide my code right now, but I may be able to provide a trimmed down and readable version if needed.
Thank you