The issue is that while stepFunc() is a Python function, it is not a Variable
operator expression as far as FiPy is concerned. FiPy Variable operator
expressions tend to be things that can be expressed as arithmetic expressions.
Python conditionals don't work; greater/less-than expressions do.
Your suggestion certainly works and I appreciate the quick response.
However, in general, I would like to define more complicated functions of
time that are best
implemented in a function. So I am still interested in WHY the function
approach doesn't
work. Is there a way to tell FiPy to call that
`time` is a Variable as FiPy understands it, but stepFunc() simply returns an
integer, so eqI is defined with a source that is the integer 0.
I'd try
eqI = fipy.TransientTerm(coeff=1.) == ((time < 0.1) * 0. + (time >= 0.1) * 1.)
> On Feb 1, 2019, at 6:05 AM, Bill Greene wrote:
>
> I am trying
I am trying to solve an equation where the source term is
a discontinuous function of time. I have followed examples
where the source term is a simple, continuous function of time
and these appear to work correctly.
The key parts of my code are shown below:
def stepFunc(t):
if(t.value<.1):