Hi Matt,

I worked up some small diffusion problems in FiPy. These snippets of code may answer your question from your original e-mail. Yes? If not, do you mean anisotropic diffusion? If so, then
the second snippet may answer your question.

Best,
Dan Lewis

**Snippet 1**

eqn1 = TransientTerm() == ImplicitDiffusionTerm(D11) + D12*c2.getFaceGrad().getDivergence() eqn2 = TransientTerm() == ImplicitDiffusionTerm(D22) + D21*c1.getFaceGrad().getDivergence()

boundaryConditions=(FixedFlux(mesh.getFacesLeft(),0.0),
                    FixedFlux(mesh.getFacesRight(),0.0))


** Snippet 2**

# To build of off diagonal terms we need a vector pointing in the "j" direction with magnitude # of the gradient of "c" in the "i" direction. This python code does this exactly.
dcdydx = c.getFaceGrad()._take((1, 0), axis = 1)

# NOTE: If you want a transient solution you build your equation this way: eqn1 = TransientTerm() == ImplicitDiffusionTerm(D) + (D12 + D12) *dcdydx.getDivergence()



Dan Lewis
Assistant Professor
Materials Research Center, Room 110
Rensselaer Polytechnic Institute
110 8th Street
Troy, NY 12180
[EMAIL PROTECTED]
518-276-2297

http://www.rpi.edu/~lewisd2

Reply via email to