|
[Sponsors] |
Can't get data from OpenFoam to external solver using externalCoupled |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 23, 2014, 06:06 |
Can't get data from OpenFoam to external solver using externalCoupled
|
#1 |
New Member
Join Date: Apr 2014
Posts: 3
Rep Power: 12 |
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 |
|
April 23, 2014, 12:47 |
|
#2 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
||
April 24, 2014, 04:12 |
|
#3 |
New Member
Join Date: Apr 2014
Posts: 3
Rep Power: 12 |
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). |
|
May 20, 2014, 09:00 |
|
#4 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
Hello Perry,
did you solve your problem. I looked at the source code and also did not understand, how it should work. |
|
May 26, 2014, 09:09 |
|
#5 |
New Member
Join Date: Apr 2014
Posts: 3
Rep Power: 12 |
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. |
|
Tags |
boundary, coupled, coupling, external, mixed |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Memory protection in OpenFOAM / combinig with FORTRAN | botp | OpenFOAM Programming & Development | 2 | February 15, 2016 13:25 |
OpenCL linear solver for OpenFoam 1.7 (alpha) will come out very soon | qinmaple | OpenFOAM Announcements from Other Sources | 4 | August 10, 2012 12:00 |
Building a custom solver on OpenFOAM 2.0 | wschosta | OpenFOAM Programming & Development | 1 | July 8, 2011 16:07 |
Steady Solver in OpenFoam | wwwjuventuscom | OpenFOAM | 2 | January 4, 2011 20:01 |
How to update polyPatchbs localPoints | liu | OpenFOAM Running, Solving & CFD | 6 | December 30, 2005 18:27 |