On Apr 12, 2007, at 2:15 PM, Elizabeth Tseng wrote:
I should've been more explicit. I'm actually solving 3 PDEs, in
which all variables influence one another. I have three variables
to solve, A (which was the PHI in the last email), B, and C.
\frac{\partial A}{\partial t} = (D_1 / (r^2)) \frac{\partial}
{\partial r} (r^2 \frac{\partial A}{\partial r}) - D_2 * A * C +
D_3 * B
\frac{\partial B}{\partial t} = A * C - B
\frac{\partial C}{\partial t} = A * C + B - C
For the last two equations, I omitted the coefficients since
they're constant.
OK. This is a bit more complicated, but I don't think it changes the
fundamental approach, as far as the spherical Laplacian goes.
The boundary constraint is on A, which is dependent on time t. I
think from the fipy manual I can figure out how to do that.
Boundary constraint? All of your equations will need boundary
conditions, defined on both your inner and outer boundaries, but the
default (\nabla A \cdot n = 0, etc.) is probably acceptable for most
of these. Do you have an explicit boundary condition on A?
So since A is actually one diffusion term and two external source
terms, how do I make this happen? If I multiply the first equation,
as you suggested, on both sides by r**2, then I get:
\frac{\partial r2 PHI}{\partial t} = \frac{\partial}{\partial r}
(D_1 r2 \frac{\partial PHI}{\partial r}) + D_2 * r^2 * A * C + D_3
* r^2 * B
That seems right.
How would I be able to represent the r^2 in term A*C and B then?
You can just use the r2 variable that I defined before.
Also, how do I solve three variables at each time step?
You'll need to sweep all three equations at each timestep (see FAQ
6.5). Examples 9.2, 9.3, and following show different treatments of
solving more than one equation. Balancing the number of sweeps, the
size of the timesteps, and the allowed residuals is going to take
some experimentation on your part. Every problem is different.
Good luck,
Jon