CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   How to implement a new limiter function? (

lichmaster February 6, 2013 11:46

How to implement a new limiter function?
Hi foamers,

I'd like to know how to implement a new kind of limiter function (to be used to interpolate from cell center to face center).

The problem is not the implementation of the limiter itself, but how to link it in the standard OF library, so that it becomes available in the standard interpolation list, like the various Van Albada, Van Leer, minmod, etc...

I tried to follow a tutorial for "implementing my turbulence model" and to understand the undelying philosophy, but when i launched "wmake libso" it said that everything was up to date...


wyldckat February 10, 2013 07:46

Greetings Lorenzo,

Try adding to the case's "system/controlDict" this line:

libs ("");
This should forcefully load the missing library at run time.

Best regards,

anishtain4 February 12, 2013 07:16

Limiters you mentioned are already there, take a look at:
$FOAM_SRC\finiteVolume\interpolation\surfaceInterp olation\limitedSchemes
and you see vanAlbada, Minmod
They are not just mentioned in the guide

anishtain4 February 19, 2013 09:11

I need to implement a new limiter, it is not much different from vanLeer so:
1. I copied it to the $WM_PROJECT_USER_DIR
2. changed the files according to what I needed
3. made Make directory and 'file', 'option' files in it
4. Tried 'wmake libso'

but it returns is up to date, and when I want to access my limiter it just complains there is not such a limiter, please let me know what should I do?

wyldckat February 19, 2013 09:24

Hi Mahdi,

What is the content of the file "Make/files" and "Make/options"?

Best regards,

lichmaster February 20, 2013 04:20

[Solved] Implementing and linking your own limiter
I finally managed to implement and link my own limiter.

Just follow the tutorial for "How to implementi your own turbulence model" you can find on the internet, and code your scheme.
Then, create a Make folder, with a "files" and an "options" file inside it.
In the "files" file you have to write, for instance



EXE = $(FOAM_USER_LIBBIN)/libMyLimiter

In your options file you have to link all relevant libraries, for example


    -I$(LIB_SRC)/finiteVolume/lnInclude \

    -lfiniteVolume \

When I compiled it with wmake libso I got a new in my Make/Linux64GCCDPOpt folder (probably I could specify the name of my library, I have to figure it out how to do so).

I copied the into my platforms/Linux64GCCDPOpt/lib and renamed it as

Finally, to make it available, as suggested by wyldckat (thank you very much!), i hard linked it into my ControlDict file like


libs ("");
You will now find it among the available limiters' list, and you will be able to use it :)

anishtain4 February 21, 2013 03:47

What I was missing was to copy it to platform, thanks for the step by step guide

anishtain4 February 21, 2013 04:05

I tired to add this to foamwiki but I couldn't figure out how to do it, any hint?

All times are GMT -4. The time now is 01:16.