OK. FiPy's units capabilities are not widely used (much to my chagrin). Please let us know of any further problems you run into.
- Jon On Mar 4, 2016, at 3:37 AM, Gerard Salvatella <[email protected]> wrote: > Hello, thanks for the fast answer. I just found that the problem was the > units (i forgot to add proper units to b). Now it works normally. Sorry > for the inconvenience. You may erase the thread if you wish. > > Regards, > Gerard > > > > On 03/02/2016 09:29 PM, Guyer, Jonathan E. Dr. (Fed) wrote: >> Please post the entire traceback. That one error line is not enough to tell >> what's going on. >> >> On Mar 2, 2016, at 12:50 PM, Gerard Salvatella <[email protected]> >> wrote: >> >>> 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 ] >> >> _______________________________________________ >> fipy mailing list >> [email protected] >> http://www.ctcms.nist.gov/fipy >> [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > _______________________________________________ > fipy mailing list > [email protected] > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
