Hello! I'm trying to solve a diffusion equation where the coefficient of
the diffusion term depends on both x and the variable to solve
(temperature) in the following way:
D(x,T) = a(x)*T + b(x)
where a(x) and b(x) are fermi-like functions. My approach was to set
a(x) and b(x) as CellVariables depending on CellCenters 'x', T being
also a CellVariable:

mesh = fp.Grid1D(dx,n)
x = mesh.cellCenters[0]
a = CellVariable(mesh=mesh, value=f(x) )
b = CellVariable(mesh=mesh, value=g(x) )
T = CellVariable(name="temperature", mesh=mesh, value=T0)
one = CellVariable(mesh=mesh, value=1.0)

DiffusionTerm(var=T,coeff=a*T + b*one)

I put the 'one' variable there to make b a BinOp type since otherwise
seems incompatible with a*T. But it has not worked either so far. It
returns an error

raise TypeError, str(self) + ' and ' + str(other) + ' are incompatible.'

Any tips on how can the equation be stated would be highly appreciated.

Thank you in advance,
Gerard


_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to