how tp launch Yade by C++ script

Asked by Carrie

Hello everyone,

I want to couple yade with other programs.
And now I need to launch yade example by some command in c++ script.
To be more specific, I want to write a run.cpp file and a makefile for it, after compiling it into a executable file, I can use ./run to start the example, maybe trunk-1.11.0/examples/FluidCouplingLBM/buoyancy.py

Could anyone give me some tips or examples about this case?
Thanks a lot for any help~!

Carrie

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#1

Hello,
You could embed python in c++ (https://docs.python.org/2/extending/embedding.html) and hope that no problem will happen in relation with ipython, rendering or other things (I would not bet on that). I'm eager to know if it will work immediatly.
Alternatively, you could tell us why you want to do that, and we may have other suggestions.

Bruno

Revision history for this message
Carrie (shoppingwei) said :
#2

Dear Bruno,
Thank you for your reference!
I am doing this for simulation of the small particles moving in the water and another simulation is particles drop from air to the water. So I would like to use yade with palabos to solve this problem.
Do you have some suggestions?

Thanks again!
Carrie

Revision history for this message
Anton Gladky (gladky-anton) said :
#3

2014-11-20 4:31 GMT+01:00 Carrie <email address hidden>:
> I am doing this for simulation of the small particles moving in the water and another simulation is particles drop from air to the water. So I would like to use yade with palabos to solve this problem.

FYI I have started to package palabos to couple it directly with Yade.
But for the moment it is not a first-priority task for me. I will let you
know when (if) it is ready.

Cheers

Anton

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#4

FYI, I started playing with Palabos with exactly the objective in mind...
We should definitely talk to each other!

Back to the question. I think your approach can work but it is maybe not the best option.
If I can show your concept with a graph, it looks like this:

YADE -> C++ -> Python -> C++
                                                |
PALABOS -----------------> C++

Actually, it is better to have python at the last level, because it is much more flexible.
Palabos stopped maintaining the python wrapping, too bad, but it is not a big deal to write our own thin wrapper for a specific type of things.

Therefore, I would go for this type of code coupling:
YADE ------> C++ -> Python
                                             |
PALABOS -> C++ -> Python

From a user point of view, it is completely different. Now the coupled code is interactive. You can run a few timesteps, stop, inspect or change some values, run more timesteps. There is also no need to recompile to define a different simulation..

Revision history for this message
Anton Gladky (gladky-anton) said :
#5

2014-11-20 12:16 GMT+01:00 Bruno Chareyre
<email address hidden>:
> Palabos stopped maintaining the python wrapping, too bad, but it is not a big deal to write our own thin wrapper for a specific type of things.
>
> Therefore, I would go for this type of code coupling:
> YADE ------> C++ -> Python
> |
> PALABOS -> C++ -> Python

Short update.

Palabos packages for Ubuntu are available here [1].
Debian users should wait till it will be accepted by FTP-maintainers.

In Cmake palabos can be found as follows:

find_package(Palabos)
include_directories(${PALABOS_INCLUDE_DIR})
target_link_libraries(demo ${PALABOS_LIBRARIES})

[1] https://launchpad.net/~palabos-packaging/+archive/ubuntu/ppa

Cheers

Anton

Can you help with this problem?

Provide an answer of your own, or ask Carrie for more information if necessary.

To post a message you must log in.