CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to implement a new limiter function? (https://www.cfd-online.com/Forums/openfoam-programming-development/112852-how-implement-new-limiter-function.html)

lichmaster February 6, 2013 10: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...

Thanks

wyldckat February 10, 2013 06:46

Greetings Lorenzo,

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

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

Best regards,
Bruno

anishtain4 February 12, 2013 06: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 08: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 libNULL.so 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 08:24

Hi Mahdi,

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

Best regards,
Bruno

lichmaster February 20, 2013 03: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

Code:

myLimiterSourceCode.C

EXE = $(FOAM_USER_LIBBIN)/libMyLimiter

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

Code:

EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude

LIB_LIBS = \
    -lfiniteVolume \
    -lmeshTools

When I compiled it with wmake libso I got a new libNULL.so 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 libNULL.so into my platforms/Linux64GCCDPOpt/lib and renamed it as libMyLimiter.so

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

Code:

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

anishtain4 February 21, 2013 02:47

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

anishtain4 February 21, 2013 03: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 15:53.