Dear group, I encountered an interesting problem when I tried to vary the convection coefficient as a function of time steps. Intuitively, what I hope to accomplish should be scripted as
c = place_holder_num > eq = TransientTerm() == DiffusionTerm(coeff = D) + ConvectionTerm(coeff=c) > for steps in range(steps): > if steps < num: > c = 2. > else: > c = 0. > eq.solve(var=phi, dt=dt) The plot then would be expected to show an initial convection-diffusion process followed by pure diffusion after steps = num. However, what I discovered is that the convection coefficient stayed fixed at c=place_holder_num. I've also tried the WHILE loop with the same result. So far I was only able to come up with one solution: c1 = 2. > c2 = 0. > eq1 = TransientTerm() == DiffusionTerm(coeff = D) + > ConvectionTerm(coeff=c1) > eq2 = TransientTerm() == DiffusionTerm(coeff = D) + > ConvectionTerm(coeff=c2) > for steps in range(steps): > if steps < num: > eq1.solve(var=phi, dt=dt) > else: > eq2.solve(var=phi, dt=dt) There must be a better way to varying the coefficient. I've spent days testing out dynamics under seasonal convection strength (c = F(dx*steps)) only to realize that the steady-states I kept getting have all been due to the coefficient not feeding through. Thank you all for your generous help! Yun -- Graduate Group of Ecology Doctoral Candidate Department of Environmental Science and Policy Center for Population Biology University of California, Davis
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
