On Jul 31, 2008, at 10:57 AM, Igor Telezhinsky wrote:
Apparently, I guess there should be two ways of solving this
equation in fipy
Really only one advisable way.
1. Using the ConvectionTerm with the convection coefficient
(ConvCoeff) equal to function L(E), where the DiffusionTerm used to
generate the ConvectionTerm equals zero. This I do by equating
diffusion coefficient (DiffCoeff) to zero.
eqI = TransientTerm() == diffTermI +
PowerLawConvectionTerm(coeff=ConvCoeff, diffusionTerm=diffTermI)
You can just omit the diffusion term altogether and write
eqI = TransientTerm() == PowerLawConvectionTerm(coeff=ConvCoeff)
This way I'm not sure as ConvCoeff must be vector and function L(E)
is a scalar.
But L(E) isn't a scalar. This is a danger, in my opinion, of thinking
of your problem in 1D. L(E) must be a 1D vector to make sense in this
governing equation for the scalar \phi(E,t).
To see that, consider your second form:
2. Using the AdvectionEquation, though some analytical operations
must be done:
a) rewrite the right-hand side of the equation (***) as
L(E) * \frac{\partial}{\partial E}\phi(E,t) + \phi(E,t) *
\frac{\partial}{\partial E}L(E)
\phi(E,t) is a scalar, so \frac{\partial}{\partial E}\phi(E,t) is a
vector along the "E" direction. In order to make sense in a scalar
PDE, then
L(E) * \frac{\partial}{\partial E}\phi(E,t)
must represent
\vec{L}(E) \cdot \nabla_E \phi(E,t)
or a vector dotted with a vector.
Likewise
\phi(E,t) * \frac{\partial}{\partial E}L(E)
must represent
\phi(E,t) * \nabla_E \cdot \vec{L}(E)
or a scalar multiplied by the divergence of a vector.
In the first way:
a) the solution is insensitive to the dependence of ConvCoeff on a
variable.
What variable? L(E) seems to be only a function of space (E).
b) the solution doesn't seem physical to me concerning the problem
I'm solving (electrons cooling and their spectrum deformation).
In the second way:
a) the solution first seems physical, although with time very large
negative numbers appear.
b) the solution is insensitive to the boundary conditions
As Daniel said, don't use the AdvectionEquation this way. Even if it
worked, turning an implicit convection term into an explicit source
and an explicit advection is numerically a bad idea.
What is the proper way to introduce equation (***) to the fipy?
Treat L(E) as a vector field and use a ConvectionTerm.
Are you sure about the scaling of your problem? I find that I need to
change L to 10. or even 1. to see anything, and then need to
substantially increase the time steps to see the profile change at all.