How can I define a convection term that includes an independent variable? #956
-
My equations are as shown in the figure, and while the equations themselves aren't particularly complex, I'm having trouble figuring out how to define them in FiPy. I've tried some code, but I keep getting errors. How can I define the second term in the second equation and the second term in the third equation? The code for the first version is as follows:
According the comments from jeguyer, the code for the second version is as follows:
The above code can run but can not convergence. However, if I use the jeguyer told me that |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
That's not what I said your equations should look like. Specifically, you have |
Beta Was this translation helpful? Give feedback.
self.g
is a float, thenself.g * [[1]]
is attempting to multiply a float by a list. Python doesn't know how to do that. The reason thatself.u * [[1]]
works is becauseself.u
is a FiPyCellVariable
. ACellVariable
"knows" that when it's multiplied with a list, that it should try to interpret that list as a vector. You could get the same behavior withself.g
if you wrote(self.g * self.h.arithmeticFaceValue).divergence
represents(self.…