- #1

robby991

- 41

- 1

HI, I have solved the diffusion equation using the central difference scheme. Next, I would like to code this diffusion equation with a nonlinear term added to the equation. The full equation is as follows:

Since aS/b+S is a nonlinear term, I need to linearize it. I was thinking using Newton's Method to perform this, where:

Would this be the best way to do this? This will then have to be subtracted from the diffusion term, evaluated using central difference.

I initially thought I did not have to do this, however there is no change at all in the plot when I add, subtract, or remove this function from the central difference interation in my code. This iteration is as follows:

Code:

`dS/dt = Ds * d^2S/dx^2 - aS/b+S`

Since aS/b+S is a nonlinear term, I need to linearize it. I was thinking using Newton's Method to perform this, where:

Code:

`aS/b+S = f(S) = So +f'(So)(S-So)`

Would this be the best way to do this? This will then have to be subtracted from the diffusion term, evaluated using central difference.

I initially thought I did not have to do this, however there is no change at all in the plot when I add, subtract, or remove this function from the central difference interation in my code. This iteration is as follows:

Code:

```
for j=1:numt-1
%2nd Derivative Central Difference Iteration%
for i=2:numx-1
S(j+1,i) = S(j,i) + (dt/dx^2)*Ds*(S(j,i+1) - 2*S(j,i) + S(j,i-1[B]))-((Vmax*dt*S(j,i))/(Km+S(j,i))); [/B]
end
end
```

Last edited: