CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Accessing OpenFOAM shared memory

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

Like Tree1Likes
  • 1 Post By gkarlsen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 17, 2016, 05:42
Default Accessing OpenFOAM shared memory
  #1
New Member
 
James Bridgwater Court
Join Date: Jan 2016
Posts: 14
Rep Power: 10
jbcourt is on a distinguished road
I'm working to develop a two-way co-simulation between OF and another program, and I think that I've identified the use of shared memory as the best (most economical) means of communication between the two at run time. The other program simulates a system (with losses) that takes force and position output from the OF simulation and applies a user-identified control strategy to establish the resistance that the external system applies to any motion - this is then fed back to OF for the next time step. EDIT: The OF simulation is a numerical wave tank, with motion being calculated from wave-structure interaction.

What I wanted to ask is what would be the best way of implementing this from the OpenFOAM side? Should I be looking to customise a solver to include interaction with the external model; using the shared memory to provide information on the OF simulation to the external program and then using the output of that to update the OF simulation parameters (it would be a restraint in dynamicMeshDict that it would edit at each time step); or something else?

I've already managed to get a non-continuous version of this working, at least in principle, by using OF's system.call run-time function object to trigger execution of the external model - reading the necessary OF run-time postProcessing output - with a duration of the time step length and then using the output to write a restraint for #include-ing in dynamicMeshDict, but there are transient effects in the external model that are left unaccounted for between time steps by this approach.

This is my first post on here, so sorry if it's at all vague or confusing. I should point out that I'm still learning cpp and am relatively new to OF, so it could well be the case that there's something obvious that I'm missing.
Thanks in advance for your advice!

Last edited by jbcourt; June 17, 2016 at 11:02.
jbcourt is offline   Reply With Quote

Old   June 19, 2016, 03:51
Default
  #2
Member
 
Geir Karlsen
Join Date: Nov 2013
Location: Norway
Posts: 59
Rep Power: 13
gkarlsen is on a distinguished road
There is new functionality for co-simulation in OpenFoam 3.0. It sounds like that would be suitable for your case?

http://openfoam.com/version-v3.0+/so...-co-simulation

Unfortunately, I have never used it myself... but maybe you will find some usefull pointers in the tutorial they refer to?
elvis likes this.
gkarlsen is offline   Reply With Quote

Old   June 20, 2016, 05:43
Default
  #3
New Member
 
James Bridgwater Court
Join Date: Jan 2016
Posts: 14
Rep Power: 10
jbcourt is on a distinguished road
Thanks Geir, I've had a bit of a look at the externalCoupled boundary condition mentioned on that link: it seems to me that it would work well for passing temperatures at a boundary/patch (as done in the tutorial that is used there). Similarly that would work well if I wanted the other model to take, as an input, the pressure or a velocity component at a patch. However, I'm looking to use the force on a body within the simulation as the information transferred between the two - since OF already calculates the force on that body due to the pressure difference between two patches I'm loath to get my external model to replicate that postprocessing itself.

That being said, one very good thing that I've noticed about the externalCoupled BC is that it gets OF to write a lock file while it's calculating, so I could use that functionality to make the other model wait for OF to finish doing its bit before running. That would at least allow me to get a form of synchronised interaction going, with the other application reading the forces.dat postprocessing file that OF produces to sort out the input that it needs.
Thanks again for your suggestion.
jbcourt is offline   Reply With Quote

Reply

Tags
co-simulation, coupling

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Started with OpenFOAM wyldckat OpenFOAM 25 August 14, 2022 13:55
Map of the OpenFOAM Forum - Understanding where to post your questions! wyldckat OpenFOAM 10 September 2, 2021 05:29
OpenFOAM v3.0+ ?? SBusch OpenFOAM 22 December 26, 2016 14:24
twoPhaseEulerFoam error: "new cannot satisfy memory request." basiratshamsa OpenFOAM Running, Solving & CFD 1 November 7, 2015 14:52
OpenFOAM virtual memory error spoon OpenFOAM Running, Solving & CFD 1 July 12, 2013 07:24


All times are GMT -4. The time now is 05:55.