Edit me

The following is a data assimilation case for the turbulent flow over a 2D cylinder using DARhoJSTFoam. A steady RANS solver cannot capture the vortex shedding behind the cylinder, so its wake differs from the time-averaged unsteady flow. We add a cellwise momentum source (fvSource) to the steady equations and optimize it so that the steady flow matches the time-averaged unsteady RANS (URANS) flow.

Case: Cylinder data assimilation
Geometry: 2D cylinder (D = 1 m)
Objective function: Mean-square errors of U and p, plus the squared CD error, with respect to the time-averaged URANS reference
Design variables: fvSource (x and y components) in all cells (20,296)
Mach number: 0.2 (68 m/s)
Reynolds number: 0.1 million
Turbulence model: Spalart-Allmaras
Mesh cells: ~10,000
Solver: DARhoJSTFoam

The case has two steps.

  • “preProcessing.sh” generates the mesh with snappyHexMesh and calls “runUnsteady.sh” to generate the URANS reference using dual time stepping with BDF2 and a time step of 5e-4 s. The flow develops for 0.4 s, then runs for another 1.0 s. “writeRefData.py” averages the second half of that run to produce the reference fields (0/UData and 0/pData) and mean CD (refData.json).

  • “runScript.py” runs the steady data assimilation. ANK alone converges the steady primal. We set “secondOrdSwitchTol”: 1e-2 so that ANK switches to the full Jacobian near convergence.

To run this case, first download tutorials and untar it. Then go to tutorials-main/DARhoJSTFoam/Cylinder_Data_Assimilation and run the following commands:

./preProcessing.sh
mpirun -np 8 python runScript.py 2>&1 | tee log_opt.txt

With 8 CPU cores, the URANS reference took about 9 minutes and the data assimilation (100 iterations) took about 18 minutes. The objective function reduced from 0.2125 to 0.000739. The CD is 0.6018 for the baseline steady flow, 0.6548 after data assimilation, and 0.6546 for the URANS reference. The rms velocity error (relative to U0) reduced from 0.0645 to 0.0018.

To plot the comparison, reconstruct the baseline (0.0001) and the last iteration (0.0101), write the cell centers, and run “compareFields.py”:

reconstructPar -time '0.0001,0.0101' -fields '(U p)'
postProcess -func writeCellCentres -time 0.0101
python compareFields.py -baseline 0.0001 -latest 0.0101

The steady flow after data assimilation matches the time-averaged URANS flow, including the shorter recirculation region and the faster wake recovery.

Fig. 1. Ux and Cp for the reference (URANS mean), baseline (fvSource = 0), and data assimilation, and the wake centerline velocity