On Sep 22, 2008, at 2:59 AM, Etienne Rivard wrote:
Jonathan, I think I have found a way to do what I want to do. I
tested it and it works. It probably falls into the "ugly hack"
category, but I like it because it's really simple and seems to work
fine.
I'll need to go back and refresh myself on what you were trying to do,
but thanks for sending this in.
So, what I do is I include the line of code where I define the
equation inside the solution loop along with my self-made and very
basic Runge-Kutta-Fehlberg ODE solver. Which results in something
like:
:
:
This probably won't beat any records of speed, but I'm not after
that for the moment.
Interesting. It won't much (any?) difference in speed, but I'd be
inclined to write this as:
dSdt = Variable()
eq = TransientTerm() \
== ImplicitDiffusionTerm(coeff=K/(c*rho*Snew**2)) \
- ExponentialConvectionTerm(xi/Snew * dSdt) \
- temp / Snew * dSdt
while res > tolRes:
grad = (temp.getHarmonicFaceValue()[-1] -
temp.getHarmonicFaceValue()[-2]) / dx
dSdt.setValue(intRecRate(elapsed, Snew, grad))
res = eq.sweep(var=temp,
boundaryConditions=BCs,
dt=dt,
solver=solver)
grad = (temp.getHarmonicFaceValue()[-1]
- temp.getHarmonicFaceValue()[-2]) / dx
resODE = RKF45(lambda t, S: intRecRate(t, S, grad), 0, S, dt)
Also, the use of french in your answers leads me to believe 2
things. First, you probably guessed my francophone background from
my name (sadly, maybe also my non-native english).
Your name gave you away. Your English is quite fine.
That is very clever! Second, I like to think that you want to learn
some french.
I would like to support this endeavour by correcting a tiny little
mistake. The word "dommage" is masculin. Therefore we say "Quel
dommage!"
Doumo onegaishimasu. While I have no problems with gender in Spanish,
Italian, or Romanian, I pretty much gave up on it when it comes to
French.