On Apr 30, 2007, at 1:33 PM, Elizabeth Tseng wrote:


\frac{\partial C}{\partial t} = A * C + B - C


eq_C = ImplicitSourceTerm(coeff = <some coeff> * A) + <some coeff> * B - <some coeff> * C

eq_C is missing a TransientTerm in what you've written here. Do you have it in your actual code?


Also, you should be able to roll the "- <some coeff> * C" into your ImplicitSourceTerm, although you may know that's undesirable based on its sign.



What I did is increment the time variable by dt at each time step, and sweep for a number of times. Obviously I've listed something wrong because some of the values I get are negative....Also I noticed that the residual from the sweeping doesn't converge.....

Other than the missing TransientTerm above, I don't see anything obviously wrong with what you're describing. You've implemented your time-dependent boundary condition the way I would do it.


One possibility (it just bit me a couple of weeks ago) is that when you are sweeping, you need to do two things:

1) Declare each of your CellVariables A, B, and C with "hasOld=1".
2) Be sure to call A.updateOld(), B.updateOld(), C.updateOld() at the begging of each time step (not each sweep).

These two steps are easy to forget (which says our design is bad), and the results can be really confusing.


Other than that, I don't see any obvious problems from the snippets you've posted here.

- Jon


--
Jonathan E. Guyer, PhD
Metallurgy Division
National Institute of Standards and Technology
<http://www.metallurgy.nist.gov/>



Reply via email to