Closed Yifath7 closed 2 years ago
Hello, I have a few questions:
- I need to implement the simplest ODE -
dR/dt = const for 0 < t < 100 dR/dt = 0 for t > 100
How can I do that? can I stop R.updateOld() after t reaches 100 or should I define the equation differently somehow?
You can stop evaluating the equation altogether, but I would change the value of the RHS to be a FiPy Variable:
const = Variable(const_value)
eq = TransientTerm(var=R) == const
t = 0
for step in range(steps):
R.updateOld()
if t > 100:
const.value = 0
eq.solve(dt=dt)
t += dt
- ... My implementation is as follows:
# Eq 1: eqn_P = TransientTerm(var=P) == DiffusionTerm(coeff=1, var=P) + lambda * A - alpha * P
Eq 2:
eqn_M = TransientTerm(var=M) == -DiffusionTerm(coeff=M, var=A) + alpha M + lambda A
Should be
eqn_P = TransientTerm(var=P) == DiffusionTerm(coeff=DP, var=P) + lambda * A - alpha * P
but otherwise fine. Presumably you have a third equation?
Thanks a lot! I have 18 coupled PDEs, just wanted to make sure I implement the different equation types correctly.
Hello, I have a few questions:
How can I do that? can I stop R.updateOld() after t reaches 100 or should I define the equation differently somehow?
where in the first equation the nabla represents the Laplacian operator. A,M,P are variables, alpha and lambda are constants. My implementation is as follows:
Thanks in advance, Yifat