On Wed, Mar 20, 2013 at 6:06 PM, Jason Furtney <[email protected]> wrote:

> Hi,
>
> Thanks again for the great software. I have been looking at linear
> advection problems with FiPy and I ran into a couple issues.
>
> The FiPy VanLeerConvectionTerm seems to implement the MinMod slope
> limiter as described in "Finite Volume Methods for Hyperbolic
> Problems" by R. LeVeque. There are two strange things about FiPy's
> implementation:
>

Jason, You may be interested to know that I've been hacking away on a
"Riemann" branch. See http://matforge.org/fipy/browser/fipy/?rev=3ba0cc448b1and
http://matforge.org/fipy/browser/fipy/fipy/terms/baseRoeConvectionTerm.py?rev=3ba0cc448bif
you're interested. I was working on a few examples before I got
sidetracked. They are in
http://matforge.org/fipy/browser/fipy/examples/riemann?rev=3ba0cc448b. I
was basically trying to reproduce some of the examples in CLAWPACK. I
should probably finalize this stuff and merge it back at some point.



>
> (1) In VanLeerConvectionTerm.__getGradient() the limited slope is
> defined as the minimum modulus of the two upwind gradients and the
> average of the upwind gradients. Unless I am missing something, the
> average is never the minimum modulus. There seems to be a factor of
> two missing which would make this method the "monotonized central
> difference limiter (MC limiter)" described in the LeVeque book. The
> MinMod limiter is the most diffusive of the slope limiter methods and
> the MC limiter is recommended as a starting point for most problems.
> Here is a patch, this makes the advection of discontinuities sharper.
>
> --- a/vanLeerConvectionTerm.py
> +++ b/vanLeerConvectionTerm.py
> @@ -50,7 +50,8 @@ class
> VanLeerConvectionTerm(ExplicitUpwindConvectionTerm):
>          gradUpUpwind = -gradUpwind + 2 * normalGradient
>
>          avg = 0.5 * (abs(gradUpwind) + abs(gradUpUpwind))
> -        min3 = numerix.minimum(numerix.minimum(abs(gradUpwind),
> abs(gradUpUpwind)), avg)
> +        min3 = numerix.minimum(numerix.minimum(abs(2 * gradUpwind),
> +                                              abs(2 * gradUpUpwind)), avg)
>
>          grad = numerix.where(gradUpwind * gradUpUpwind < 0.,
>                               0.,
>
>
Thanks for this. I'll go ahead and fix this on the "develop" branch and you
can update from that.


> (2) The leading double underscore in the
> VanLeerConvectionTerm.__getGradient() method invokes Python's name
> mangler so I was unable to override this function in a derived class.
>
>
I'll fix this too and possibly create a common base class so you don't have
to inherit directly from VanLeer.

If you would prefer to take care of these changes then just let me know.

Thanks.

-- 
Daniel Wheeler
_______________________________________________
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