Couple with external program
I want to couple OpenFOAM with another scientific simulation software. OpenFOAM will solve turbulence with pisoFoam and the other software computes flow in a porous medium.
As a first step I want to grab the matrix from OpenFOAM and include it in the matrix from my other program to solve it there. Over the coupling surface the pressure should be constant.
- How can I couple the both models? Do I have to set some boundary conditions in OpenFOAM?
- Where can I get access to the matrix?
- Has anyone done this before? Are there already interfaces for this?
Later I want to exchange more than only pressure. And I assume that some Schwarz domain decomposition method would be necessary. But before I invest to much time I'll have to investigate whether my approach works and who it performs.
Thanks for any hint.
If you have access to the source code of the other application, you can set up a combined
(hybrid) solver, using the parts from OF and the other application. Or you can set up an interprocess communication between the both, using the facilities provided by the OS, e.g., shared memory, pipes etc. In both cases, you'll have to modify the sources accordingly and compile. If you cannot modify the other applications, then you can write a driver program (shell script might be sufficient, or maybe some higher level language) that runs both OF and other app and exchanges data between them. It can run OF solver for certain number of time steps, then take its output and prepare input for the other app, then take the other app's output and prepare input for the next steps of OF solver, and so on until the final solution. This might be the only solution available if the other app cannot be modified, but this approach will also probably work much slower than modified solvers. Domain distribution among the different solvers is another matter, but in any case you'll have to exchange data between them.
More presice questions
Thanks for your answer r08n!
The external software is open source, too. Any modification in this part seems feasible to me because I know the software or know at least some people who now it well. I have some thoughts about the communication but want to start simple with file I/O.
I would like to get some hints on how I should start. I imagine that there should be a matrix class or some sort of solver where the matrix is stored. I need to export the matrix to my external program where I could add the matrix part from the external program and solve it there. But what class do I search?
I don't know the boundary condition for OpenFoam where the domain adjoins to the external-program-calculated domain. Neither Neumann nor Dirichlet seems appropriate because I don't know them in advance. Can I set a kind of unknown boundary condition?
BC: There is always the possibility to write your own boundary condition. The material for the Advanced Course of the OpenFOAM training contains an example or you can just google and find eg this: http://www.tfd.chalmers.se/~hani/kur...yCondition.pdf
OpenFOAM is a huge library of tools and it supports porous zones. Maybe your complete problem can be solved in OpenFOAM. Before thinking of methods of coupling OF with "the other scientific" tool I would rather check, how OF could solve your problem or how OF needs to be modified to satisfy your needs.
Example of a Matrix equation for convective scalar transport
|All times are GMT -4. The time now is 12:56.|