Understanding implementation of Forces in OpenFOAM adapter

I am running preCICE 3.1.1 and OpenFOAM v2312 and am working on implementing a custom adapter.
I have a question regarding the implementation of the Forces module. In Forces.C we check whether some other part of OpenFOAM (forces functionObject, solids4Foam) has already calculated the forces, correct?

 // Check if a force field with the requested name exists.
 // If yes (e.g., solids4Foam), bind Force_ to that field.
 // If not (e.g., pimpleFoam without the Forces function object), create it.
 if (mesh_.foundObject<volVectorField>(nameForce))
     Force_ =

nameForce defaults to Force according to FSI.C

    nameForce_ = FSIdict.lookupOrDefault<word>("nameForce", "Force");
    DEBUG(adapterInfo("    force field name : " + nameForce_));

However, in forces.C (from functionObject) the name of the forces volVectorField is force

        forcePtr = new volVectorField
            dimensionedVector(dimForce, Zero)

So it seems to me, like we want to benefit from taking the pre-calculated forces from those sources, but we don’t due to the wrong nameForce.
Am I missing something?


We currently compute the forces independently, indeed (though we would like to offload that the the forces function object: FSI: Delegate the force calculation to the forces function object · Issue #143 · precice/openfoam-adapter · GitHub).

Have you already tried configuring a different name (force) for the coupled variable?

The main target here was to cover the solidForce that the solid solver of solids4Foam uses.

Aaah ok. So the current default is to use the forces calculated by the adapter, but it should be possible to use the forces calculated by either solids4Foam or the forces functionObject by specifying a different name. I haven’t tried using force as a name yet.