Force post processing with the force functionObject

Hello,

I’m running FSI simulations using OpenFOAM and preCICE. The FSI benchmarks (as in this post) require the evaluation of interface forces. I use the force functionObject of OpenFOAM in the following way,

forces
    {
        type                forces;
        libs                ( "libforces.so" );
        patches             (cylinder flap);
        rho                 rhoInf;
        log                 true;
        rhoInf              1000;
        CofR                (0 0 0);
    }

because the quantity of interest is the force on the cylinder and the flap, where the cylinder is not part of the coupled system.
Using an implicit coupling, OpenFOAM writes an entry in the force.dat file for each implicit iteration. I use a script to extract the last entry (converged system) in each iteration, so far so good.
I had a discussion with @uekerman whether the last entry is really the right one or maybe the entry before the last entry (might also depend on the coupling scheme). During some evaluations, I noticed that the actual entry is for every coupling iteration is exactly the same (have of course not checked every time window explicitly, but rather at specific spots). For example: Performing 100 iterations in the first time-window results exactly in the same 100 entries in the force.dat file.
This post is more intended as a discussion: do you think this is realistic? In my opinion it is not realistic. Assuming that it is not realistic, what could be the reason? Is the force maybe always calculated according to the previous converged solution so that the same values are used for the actual calculation?

I don’t see how this could be related to the coupling. What happens if you run the same fluid simulation with rigid walls? Do you get the same values?

The two function objects should work together and maybe the order you define the in your controlDict plays some role. But the adapter does not directly modify any values of the forces function object. We also know that the adapter does compute different forces across time windows and it should also behave the same during one time window.

Your case makes it a bit difficult to see such effects: you are refering only to the first time window, maybe this is not the case later on. Have you also tried with the perpendicular flap? There the effect should be easier to observe.

So in general, it could be related to the adapter, though I don’t wanted to make the impression here. I think it is still a relevant topic associated to the adapter and preCICE. If we reload our fields before we start to compute the forces in the functionObject, the result would be associated to the wrong data (of the previous time step). However, the data should vary in this case for the last iteration, where the fields are not reloaded.

I don’t understand what you want to get here. If I run the same setup without any motion, then I expect the values to be the same for all iterations. So, the force values are the same across iterations, not across time windows.

I think the order point is interesting and might be the key. Let me try.

No, I checked it for various time steps (arbitrarily), not only for the first one. I just wanted to point out that I haven’t checked it for all 10.000 time steps explicitly.

Indeed, as mentioned by @MakisH, the order of the functionObjects is important for the values. We need first the force functionObject and afterwards the preCICE adapter functionObject. Since we get now the actual forces in each iteration, we could evaluate them at any iteration.

2 Likes