joshmccraney said:
Attached is the finite difference technique along with how we arrived. Please review it, especially the end, and let me know what you think. The conclusion doesn't look right. EDIT: the limits should be from the left, but you get the idea.
Corrections:
Eqn. 16 should be the derivative of h
3, not h.
In Eqn. 25, there should be a 2 in the numerator, not a 4. I would also prefer to see a 4 in the denominator, but I can't strongly argue against the 4.
Eqn. 26 is incorrect. The second derivative of h
3 with respect to Z has been evaluated incorrectly.
I didn't check Eqns. 28 and 29.
Josh,
I've had a huge amount of practical experience with numerical analysis, particularly on problems like this one. And that practical experience involved many situations in which a lot of money was riding on the outcome of the correct numerical solution of the equations. Based on this experience, I am very strongly urging you to solve this problem numerically in terms of y rather than in terms of h, for the following reasons:
1. There are many fewer mathematical operations involved in solving it this way
2. There is much less of a chance of making a coding error
3. The finite difference equations that result in this approach
automatically conserve volume, unlike the scheme involving h, in which volume is conserved only in the limit of vanishing ##\Delta Z##
If I were coding this problem, starting from the beginning of each time step (so that y is known at all grid points at time t), I would carry out the following sequence of steps:
1. Calculate y
3/2 at all the grid points
2. Calculate √y at the grid point adjacent to the right boundary. This is h at that location.
3. Calculate L
2(t+Δt) and (1/L)dL/dt
4. Evaluate the right hand side of the main differential equation at each grid point
5. Execute a time step at each grid point
Chet