Puzzled by FiPy's use of "=="

A

André Roberge

In FiPy (a finite volume PDE solver), equations are "magically" set up as

eqX = TransientTerm() == ExplicitDiffusionTerm(coeff=D)

and solved via

eqX.solve(...)

How can eqX be anything than True or False?... This must be via a redefinition of "==" but I can't see how that is done. I did look at many of the source files, thinking that it must be via a redefinition of "__eq__" somewhere but with no luck. Any pointers would be appreciated.
 
R

Robert Kern

In FiPy (a finite volume PDE solver), equations are "magically" set up as

eqX = TransientTerm() == ExplicitDiffusionTerm(coeff=D)

and solved via

eqX.solve(...)

How can eqX be anything than True or False?... This must be via a redefinition of "==" but I can't see how that is done. I did look at many of the source files, thinking that it must be via a redefinition of "__eq__" somewhere but with no luck. Any pointers would be appreciated.

It's in the root base class Term:

http://matforge.org/fipy/browser/trunk/fipy/terms/term.py#L374

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top