Hi Ben,
I looked into this and it seems that the anisotropic off diagonal
values are added as a source term rather than to the matrix. See
these two lines in abstractDiffusionTerm.py.
-
https://github.com/usnistgov/fipy/blob/master/fipy/terms/abstractDiffusionTerm.py#L118
and
-
https://github.com/usnistgov/fipy/blob/master/fipy/terms/abstractDiffusionTerm.py#L412
I can't remember fully why it is implemented this way. It is likely a
simpler implementation than using a fully implicit method.
The following code is your code reworked to show something on the RHS
vector. It has large values in the RHS vector. If the diffusion term
coeff is set to zero then there are only tiny values on the RHS vector
demonstrating that at least something is changing due to the non-zero
off diagonal diffusion coefficient values.
~~~~
from fipy import Variable, FaceVariable, CellVariable, Grid1D,
ExplicitDiffusionTerm, TransientTerm, DiffusionTerm, Viewer,
AdvectionTerm, PowerLawConvectionTerm, VanLeerConvectionTerm, Grid2D
from fipy.tools import numerix
import numpy as np
nx = 3
ny = 3
dx = 1.
dy = 1.
mesh = Grid2D(dx=dx, dy=dy, nx=nx, ny=ny)
W = CellVariable(name=r'$W$', mesh=mesh)
W[:] = np.random.random(9)
print('W:',W)
coeff = FaceVariable(mesh=mesh, rank=2, value=0.0)
coeff[0, 0] = 0.
coeff[0, 1] = 1.
coeff[1, 1] = 0.
coeff[1, 0] = 1.
eq = (TransientTerm(1e-9) == DiffusionTerm([[[0, 1], [1, 0]]]))
eq.cacheMatrix()
eq.cacheRHSvector()
eq.solve(W, dt=1.0)
matrix = eq._matrix.matrix
print(matrix)
print(eq._RHSvector)
~~~~
> --
> To unsubscribe from this group, send email to
fipy+uns...@list.nist.gov
>
> View this message at
https://list.nist.gov/fipy
> ---
> To unsubscribe from this group and stop receiving emails from it, send an email to
fipy+uns...@list.nist.gov.
--
Daniel Wheeler