How to couple Yade with other program?

Asked by Wang Yu

Hello

I would like to use Yade coupled with my manual MPM (material point method) program (using C++ including Eigen). I need Yade to interact with MPM for information after a certain time steps of computation.
Specifically, (A) Yade passes particle coordinates, velocity, and radius information to the MPM, and (B) the MPM passes a specified force to each particle in Yade.

I am familiar with the use of Yade and parts of the source code (I've implemented my own constitutive model), but I don't know anything about the conversion from C++ to python and the complete runtime flow of the code. So I am now facing the following problems:

1. For process (A), the easy way I can think of is to extract the vector components of each particle in a python script and generate a list. But since my MPM code uses Eigen::Vector; Eigen::Matrix... , which is the same origin as the data form used in the Yade source code, so is there a quicker alternative? Would it be faster to implement this in C++? and how?

2. For process (B), I guess it would require me to write a new Global_Engine similar to 'NewtonIntegrator' or 'FoamCoupling' and it would need to receive force informations from the MPM. I plan to reserve a parameter in the New_Engine's 'applyForce()' function like 'void applyForce(std::Vector<double> ForceList)' and call it in the 'action()' function (is this right?). This way I just need to re-run the applyForce() function in the python script every several time steps based on the new 'ForceList' calculated by MPM.

3.My manual MPM program is easy to run using Visual Studio (main() function), is there an easy way to integrate it directly into a Yade program? It would eliminate a lot of hassle for coupled use of the two methods.

The above are my rough thoughts and I hope someone can point out my faults and give me some advice.

Actually I've learned something about FoamCoupling, which uses MPI for data exchange between Openfoam and Yade, but I'm not very good at MPI programming, so I'm hoping someone can guide me if possible.

Thanks
Yu

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
Karol Brzezinski (kbrzezinski) said :
#2

Hello Wang,

In my opinion, all the options seem feasible, and the third one is the most tempting if you have your simple code for MPM. I think that in the case of two independently developed programs, some compatibility issues will arise with time.
A simple engine in Yade initializing MPM mesh and controlling its interactions with particles would be the easiest to use (option three). Also, it could be developed into an interface between Yade and the MPM program if you decide on option two.
You can easily find people ready to help integrate your code into Yade in the community, but the code would need to become open at some point.

Cheers,
Karol

Can you help with this problem?

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

To post a message you must log in.