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

Can't get data from OpenFoam to external solver using externalCoupled

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By perry
  • 1 Post By perry

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 23, 2014, 05:06
Question Can't get data from OpenFoam to external solver using externalCoupled
  #1
New Member
 
Join Date: Apr 2014
Posts: 3
Rep Power: 12
perry is on a distinguished road
Hi guys,

and thanks for reading this :-).

I need to couple OpenFoam with an external solver and I am currently trying to do this by means of the "externalCoupledMixedFvPatchField"-boundary as described here:

http://foam.sourceforge.net/docs/cpp/a00682.html

The data is communicated via files, where the external solver should write e.g. the file "data.in" containing <value>, <gradient> and <valueFraction> for each cell face to be read by OpenFoam.
OpenFoam reads in the data, performs a simulation step and writes the file "data.out" containing <magSf>, <value> and <snGrad>.

I've also had a look at the source code here:

https://github.com/OpenFOAM/OpenFOAM...FvPatchField.C

As far as I understand the procedure roughly works as follows (from OpenFoam point of view):

1. write data.out
2. remove lock file, signaling the external solver to take over
3. wait until lock file is re-created by external solver
4. read data.in
5. repeat

I have succeeded in transferring data from the external solver to OpenFoam. Specifically I've tested this with OpenFoam version 2.2.2 and scalarTransportFoam where I set the temperature at an inlet from the external solver.

What I'm still having problems with is getting data from OpenFoam back to the external solver, e.g. temperature at an outlet patch.

I know there are several ways to accomplish this but I would like to use the above mentioned externalCoupled boundary because then I can avoid having to compile any code and have a nice, consistent and flexible interface to all kinds of OpenFoam-models.

For data transfer from the external solver to OpenFoam I'm writing the file data.in to contain e.g. <value> 0 1, which means that it is set to fixedValue (because valueFraction == 1).

For data transfer from OpenFoam to the external solver I write the file data.in to contain e.g. 0 0 0, meaning zero gradient. The problem is that the returned file data.out always contains a value 0 for the outlet-patch. I tried all kinds of combinations and it seems to me that data.out always contains the value that I supply via data.in when in fact I would like to not specify any value in data.in because I'm actually waiting for OpenFoam to give me its value.

I hope this makes sense and sorry for the long story :-)...

Right now, I can't think of anything more to try so if no one knows what I'm doing wrong, I'll try something like using the writeRegisteredObject-function-object instead. Using the externalCoupled-boundary for input and output would be more consistent, though...

Anyway, help will be greatly appreciated, thank you!

Regards,
Perry
Nostradamus likes this.
perry is offline   Reply With Quote

Old   April 23, 2014, 11:47
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
I guess you know this
https://github.com/OpenFOAM/OpenFOAM...lCoupledCavity
and it didn't help?
jherb is offline   Reply With Quote

Old   April 24, 2014, 03:12
Default
  #3
New Member
 
Join Date: Apr 2014
Posts: 3
Rep Power: 12
perry is on a distinguished road
Hello jherb,

thanks for your reply.

Yes, I know the externalCoupledCavity-tutorial. It helped me in the beginning to see how to set the value at the boundary from an external source.

What it doesn't show (as far as I understand) is how to get the value at a boundary as calculated by OpenFoam without setting it from an external source first (like an output-signal).
perry is offline   Reply With Quote

Old   May 20, 2014, 08:00
Default
  #4
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
Hello Perry,

did you solve your problem. I looked at the source code and also did not understand, how it should work.
jherb is offline   Reply With Quote

Old   May 26, 2014, 08:09
Default
  #5
New Member
 
Join Date: Apr 2014
Posts: 3
Rep Power: 12
perry is on a distinguished road
Hello jherb,

no I didn't solve the problem, yet. I'm currently implementing the part from external-solver to OpenFoam.

I'll probably try out the writeRegisteredObject-function-object and extracting the data I need from the time directories.

Thanks for having a look at the code.
Nostradamus likes this.
perry is offline   Reply With Quote

Reply

Tags
boundary, coupled, coupling, external, mixed


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
Memory protection in OpenFOAM / combinig with FORTRAN botp OpenFOAM Programming & Development 2 February 15, 2016 12:25
OpenCL linear solver for OpenFoam 1.7 (alpha) will come out very soon qinmaple OpenFOAM Announcements from Other Sources 4 August 10, 2012 11:00
Building a custom solver on OpenFOAM 2.0 wschosta OpenFOAM Programming & Development 1 July 8, 2011 15:07
Steady Solver in OpenFoam wwwjuventuscom OpenFOAM 2 January 4, 2011 19:01
How to update polyPatchbs localPoints liu OpenFOAM Running, Solving & CFD 6 December 30, 2005 17:27


All times are GMT -4. The time now is 17:37.