CONES

CONES (Coupling OpenFOAM with Numerical EnvironmentS) is an application aiming to couple the CFD software OpenFOAM with open-source code.

Installation

Download CONES with:

git clone https://gitlab.ensam.eu/pe431/cones-dev

Get the latest OpenFOAM-dev version:

git clone https://github.com/OpenFOAM/OpenFOAM-13.git

Apply the CONES patch (this adds the conesFoam solver to OpenFOAM):

./conesPatch path/to/OpenFOAM-13

Install the Python dependencies of conesToolBox (a virtual environment is recommended):

python3 -m venv pyCones
source pyCones/bin/activate
pip install -r src/conesToolBox/requirements.txt

Every new terminal session needs both OpenFOAM and the Python environment sourced before running CONES:

source path/to/OpenFOAM-13/etc/bashrc
source path/to/pyCones/bin/activate

Usage

Two main elements constitutes CONES:

  1. Ensemble of \(m\) simulations in OpenFOAM.

  2. Code with the Data Assimilation (DA) algorithm.

Schematic representation of CONES for online sequential data assimilation

Schematic representation of CONES for online sequential data assimilation

Setting up your own case follows the same pattern the tutorial below walks through end to end:

  1. Set up a reference simulation in a folder named “case_orig”.

    1. Generate the mesh and decompose it.

    2. Set up a topoSetDict that encompasses the regions of your domain where DA has to be performed.

    3. Run the topoSet OpenFOAM utility.

  2. Use foamCloneCase to clone the reference simulation settings to generate the ensemble members

    1. Modify the ensemble members according to the initial distribution wanted

    2. Name each ensemble member folder as “en” followed by the id number of the ensemble member

  3. Launch CONES with mpirun, as described in Running CONES.

Tutorial: your first CONES run (lid-driven cavity)

This tutorial runs the smallest complete example shipped with CONES, tests/cavityCones: a 2D lid-driven cavity where CONES estimates the moving wall’s velocity from 5 synthetic velocity observations. It assumes the installation steps above are already done and sourced in your terminal.

  1. Move into the test case:

    cd tests/cavityCones
    

    The case contains:

    • case_orig/: the reference (undecomposed) OpenFOAM case. Its system/conesDict (see the full reference) configures the DA problem — here, a classic EnKF estimating the movingWall boundary velocity (parameterVar "u", numberParameters 1) from u,v,w velocity observations stored in conesObservations/observation_database.nc (generated with the genConesObs.py script next to it — see The observation database for what such a file must contain).

    • Allrun: builds the ensemble and launches CONES.

  2. Launch the run with 2 ensemble members, 2 processors each:

    ./Allrun 2 2
    

    This script:

    1. Runs topoSet on case_orig to mark the DA region (see its system/topoSetDict), then decomposes it into 2 subdomains.

    2. For each ensemble member, draws a moving-wall velocity from tests/cavity_priors/prior_mu1_s5.txt, writes it into 0/U, re-decomposes and clones the result into its own en0/, en1/, … folder with foamCloneCase.

    3. Launches everything with a single mpirun command: one conesFoam -parallel group per ensemble member, plus main_EnKF running the DA cycle on the last 2 ranks — exactly the pattern described in Running CONES.

    With endTime 0.06 and deltaT 0.005 in system/controlDict and observationWindow 10 in conesDict, this case performs a single, fast assimilation cycle — a few seconds on a laptop.

  3. Check the result: the estimated parameter’s ensemble mean and standard deviation at each DA cycle are appended to par.log (columns: cycle, time, mean, std), and per-phase timings/peak memory to performance_report_journal.csv:

    column -t par.log
    

    utils/live_graph.py can plot par.log live while a run is going, but it compares against a ground-truth value and a LaTeX rendering setup that are hardcoded for a different case — see the script before reusing it here.

From here, adapting the tutorial to your own case means: put your reference simulation in case_orig, add a system/conesDict (see the cavity one as a template, and the The conesDict reference for what each option means), and reuse the same three-step Allrun pattern.