On May 22, 2009, at 5:55 PM, A.S.Reeve wrote:

'rech' represents a simple source applied only to the top-most face
(or cells abutting the top most face) of the model. Its rainfall that
recharges water in the subsurface. Probably the best way to account
for this would be with a FixedGrad boundary condition along these
faces, but I'm under the impression that this boundary condition
doesn't work in FiPy, at least not for all conditions.

A distinction that can be exceedingly important in some applications is that the boundary condition is FixedFlux, not FixedGrad. It is commonly assumed that zero gradient and zero flux are synonymous, but for problems that have both diffusion and convection (say due to counter-diffusion or electromigration), the flux and the field gradient may have very little to do with one another. In any case, it's crucial to get it right to make the units work out.

So, I would say that a FixedFlux boundary condition is probably the best way to account for this, but you are correct that the FiPy FixedFlux bc is temperamental. We have shown a few times on the list, though, that the same effect can be achieved by taking the divergence of a flux that is only non-zero on the inlet faces and adding that divergence as a source to your equation. E.g.,

TransientTerm() == DiffusionTerm() + (flux * (Z == Z.max())).getDivergence()

Where flux must be a vector, like 1.5e-8 * [[0.], [-1.]] to have 1.5e-8 inches per year raining "down" (which doesn't seem like very much at all).

Typically, this data is available with units of length per time (eg.
inches per year). My understanding is the source terms in FiPy need to
be expressed in units of per time, at least for what I'm doing,

Source are in the same units as the TransientTerm, so they are a rate. If your solution variable is mol/m^3, then sources need to be mol/m^3/ s. If your solution variable is dimensionless, then sources are in units of s^-1. What units is your field variable in? That will determine what conversions (if any) you need to apply to your L/T rainfall.



Reply via email to