← Back to team overview

yade-users team mailing list archive

Re: Probably of using YADE as a shared library


Feng, Chen said:     (by the date of Fri, 21 Jul 2006 16:56:51 -0400)

> Hi, all, especially experienced Linux programmers:
> Currently I am trying to do simulate particle-fluid interaction using either 
> of the two ways:
> 1) Use YADE as the main program, incorporate fluid module into YADE, the fluid 
> module is from OpenFOAM (http://www.openfoam.org), however, the OpenFOAM uses 
> wmake compile system, I am not very sure if it is possible to make module from 
> OpenFOAM into a shared library and then make it linkable to YADE which is 
> compiled by KDevelop.
> 2) Use OpenFOAM as the main program, incorporate YADE into it, in this way the 
> YADE should be treated as a shared library, because lack of confidence writing 
> shared libraries within Linux, I just wonder if it is possible to compile YADE 
> into a xxx.so file under KDevelop, then link to the main program compiled by 
> wmake? I think the main problem is not to let YADE be compiled again, since 
> there would be two compile systems, although both of them use g++.
> I hope I have made my problem clear, if anybody is interested, any kind of 
> discussion is welcome!

You are going wrong way. Trying to 'couple' particles with fluids is not
by 'linking' one code with another,

First you should take a sheet of paper and a pencil, then write down the
formulas that you want to use to couple particles with fuilds. When you
have them succesfully derived, you should write a small test program,
that does exactly that - calculates forces between coupled particles anf
fluid. Without fancy graphics or anything unnecessary - it justs prints
out forces (or positions) of your elements - there should be only few of
them, so that you should be able to verify the results manually.

Then you can think about implementing this coupling mechanism either
into yade or openfoam. If you have done succefully the last example
with hollow cylinder (which I have explained in great depth):


After doing that cylinder, implementing this coupling into yade should
be easy for you :)

Also, to put particles into openfoam, or fluid into yade - you must
write a plugin by yourself (probably copying some code will work, but
you will have to change something for sure). This plugin must adhere to
framework design, be it openfoam framework or yade framework.

Alternatively you can try to write an interface between openfoam and
yade, that will make all necessary data structure conversions so that
they can talk to each other, but this solution is much more difficult.

Linking will not work. Even if you manage to do it without any linker
errors (which is impossible btw). wmake or qmake absolutely make no
difference in this aspect.

Janek Kozicki                                                         |
Yade-users mailing list