Dear Developers,
I am currently trying to solve a problem that is similar to the 1-D
Diffusion Coupled example. However, I would like to expand the coefficients
of the diffusion term so that it will be a face variable. My intention is
so that each mesh will have different value of diffusion coefficient along
x-axis.
Here is the code that I wrote,
## Import variables and tools
from fipy import CellVariable, FaceVariable, Grid1D, DiffusionTerm, Viewer
from fipy.terms.transientTerm import TransientTerm
from fipy.tools import numerix
m = Grid1D(nx=100, Lx=5.0)
nx = 100
group = 2
v = CellVariable(name="$\phi$", mesh=m, elementshape=(group,))
X = m.faceCenters[0]
D3 = FaceVariable(mesh=m, value=1.0)
D3.setValue(2.0,where=(2.0<=X))
v.constrain([[0], [1]], m.facesLeft)
v.constrain([[1], [0]], m.facesRight)
eqn = TransientTerm([[1, 0],[0, 1]]) == DiffusionTerm([[[D3, -1],[1, D3]]])
vi = Viewer((v[0], v[1]))
from builtins import range
for t in range(1):
eqn.solve(var=v, dt=1.e-3)
vi.plot()
input("Finished")
In this case I just change one of the diffusion tensor component into a
facevariable D3. Is there any better way to represent this condition? Thank
you.
Regards,
Harun
--
To unsubscribe from this group, send email to [email protected]
View this message at https://list.nist.gov/fipy
---
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].