On Oct 9, 2006, at 11:04 AM, hzhatlboro wrote:
Hi Daniel,
Attached please find the first program I have done in FiPy. I am a beginner in both FiPy and Python and please help to get this program running in FiPy. Please refer to the email I sent to you on 28 Sep. 2006 for some details of this model.
I know that this version is far away from the final version. In particular, the formulations of the equations and the choice of proper solvers for those equations may need major revisions. I have tried to solve this model in a FEM software package and I got the "convergence" problem that I have not solved yet. I think we need "sweep" the solution to convergence for such non-linear and time dependent PDEs but not sure yet how to do that...
You will almost certainly have to do that.
Shall we start from this version and gradually build up a solution? The first problem I met is in line 123. I am not sure what is the problem there.
The error is:
Traceback (most recent call last):
File "pf2dtest.py", line 123, in ?
c.equation=TransientTerm()==ImplicitDiffusionTerm(coeff=(Dphi(phases)*sumPhases(phases)))
File "pf2dtest.py", line 120, in sumPhases
sumPhasesValue+=phii
UnboundLocalError: local variable 'sumPhasesValue' referenced before assignment
You just need to initialize the variable:
sumPhasesValue = 0
before the loop.
Shouldn't I set a function as the coefficient for the ImplicitDiffusionTerm?
A function is not required. Either an integer, float, CellVariable or FaceVariable object is required. If your
function returns one of these objects then you are fine.
Thanks and regards,
hzhatlboro
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.<pf2dtest.py>