First of all: Thank you so much for your help!

> I would use .getFaceGrad() here, not .getFaceGradAverage(). I didn't realize 
> we even had such a function (for five years!), and contrary to its 
> documentation, I think it has to be 1st order accurate, not 2nd. For what 
> it's worth, it doesn't appear that we use it anywhere.
Thanks for the tip, but it didn't seem to change much...

>> So here's my question: Am I on the right track here? Is this the right
>> way to solve my PDE? Is manually updating the variables for each
>> timestep the way to go?
>
> Manually updating phi as a result of your renormalization is probably 
> necessary, although it's possible that you're not doing what you intend. If 
> you show me the code for your update, I can check that it has the effect you 
> want.

I am updating the function H in the following way:

newHValues = [0.0] * len(centers)
for i in range(len(centers)):
        alpha = centers[i]
        newHValues[i] = h(alpha, t)
H.setValue(newHValues)

The normalization is performed the same way:

for value in values:
        normalization += value * dAlpha
for i in range(length):
        newValues[i] = values[i] / normalization
phi.setValue(value=newValues)

Is this slover than using variables?

> Since you are renormalizing \phi, you should sweep the solution at each 
> timestep, as you are effectively introducing a non-linearity, even though 
> your equation is not explicitly non-linear.

How would I combine the renormalization and the sweeping? I tried
something along the lines of:

for step in range(timeSteps):
        #update the H function variable
        for i in range(sweepSteps):
                eq.sweep(var=phi, boundaryConditions=BCs, dt=timeStepDuration)
                normalize(phi, dAlpha)
        phi.updateOld()

Where normalize directly sets the value of phi (as can be seen in the
code I posted earlier). Is this the right way? It doesn't seem to make
any difference...

When compared to a solution that I get from Mathematica, my solution
tends to evolve slower. When convoluting the probability distribution
phi for each timestep with an almost linear weight-function, I always
get a value that is lower than the one Mathematica calculates (see
http://imgur.com/SCzVT ).

Any ideas what the reason could be?

Cheers,
Matej

_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to