# OpenFOAM® v3.0+: New Solution Control Functionality

13/01/2016

## Co-simulation

OpenFOAM includes a set of boundary conditions for communicating between OpenFOAM and external codes using file-based data transfer. In previous versions the control between OpenFOAM and the external code was performed inside the boundary conditions itself.

In this version, the control logic has been moved to a special function object, externalCoupled, which controls the coupling of all regions at every time step. The control between OpenFOAM and the external code employs a lock file whereby the existence of the lock file instructs the external code to wait, and either read or write the boundary values.

The default file format is currently hard-coded to be a text based format with one line per boundary face, but this can be overridden inside the boundary condition.

The special settings in this functionObject are the definition of the directory to use for the file exchange, and the fields to read/write per region, per patch. For the patch, either a single patch name can be used or a patch group. The patch group enables multiple patches to be collated into one coupling interface.

commsDir "$FOAM_CASE/comms"; // Does external process start first initByExternal true; // Additional output log true; regions { // Region name region0 { // Patch or patchGroup coupleGroup { // Fields to output in commsDir writeFields (T); // Fields to read from commsDir readFields (T); } } } } Examples multi-region case:$FOAM_TUTORIALS/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater