CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

Couple with external program

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By r08n

LinkBack Thread Tools Display Modes
Old   September 22, 2011, 12:16
Default Couple with external program
New Member
Join Date: Sep 2011
Location: Germany
Posts: 7
Rep Power: 8
mathletic is on a distinguished road
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.
mathletic is offline   Reply With Quote

Old   September 27, 2011, 09:05
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 53
Rep Power: 10
r08n is on a distinguished road
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.
dupeng likes this.
r08n is offline   Reply With Quote

Old   September 27, 2011, 09:44
Default More presice questions
New Member
Join Date: Sep 2011
Location: Germany
Posts: 7
Rep Power: 8
mathletic is on a distinguished road
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?
mathletic is offline   Reply With Quote

Old   September 28, 2011, 07:43
New Member
Join Date: Oct 2010
Posts: 13
Rep Power: 9
moritzhoefert is on a distinguished road
@ mathletic:
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:

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
            (   fvm::ddt(T) 
                + fvm::div(phi,T) 
// fvm::-objects are matrix equations including the right hand side
// fvc::-returns just a field. eg fvc::interpolate(U_) & mesh.Sf() returns the flux through faces
moritzhoefert is offline   Reply With Quote


couple, export matrix, external programm, link

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
CGNS Compiling Diego Main CFD Forum 17 December 21, 2014 02:40
Update boundary conditions calculated by an external program CedricVH OpenFOAM 2 January 15, 2010 12:55
Postprocessing in external program Willem Haverkort FLUENT 1 February 5, 2008 11:45
Couple error Yehia Siemens 3 January 25, 2007 04:58
Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 July 15, 2005 04:15

All times are GMT -4. The time now is 22:12.