Calculate integral values with Watchpoint (or with OpenFOAM)

Hi
Unlike perp_flap and cylinderFlap tutorial cases where the displacement of a coordinate is tracked at different time steps, is it possible to calculate Drag Coefficients and Lift Coefficients over a surface?

Is there a tutorial which already does this? Please let me know if anyone has any ideas regarding this.

Thank you.

Hi!

In preCICE, this is not yet possible, but we are working on such a feature.

But I guess that you can also extract this information directly from OpenFOAM. Here, my expertise is, however, limited.
Maybe somebody else knows the answer?

My apologies.
I figured it out after posting it here.
I’ll post the code to find force coefficients over a moving mesh patch in openfoam ASAP.

@nithinadidela could you describe how you solved this?

My sincere apologies,

Let me describe how post-processing is done for a simple fluid flow case in which one wishes to find forces over a patch named “flatplate”
One needs to add this patch in functions in the controlDict file

forces
{
type forceCoeffs;
libs (“libforces.so”);
log yes;
writeControl timeStep;
writeInterval 20;
patches
(
flatplate
);
rho rhoInf;
p p;
U U;
rhoInf 1;
CofR (0 0 0);
liftDir (0 1 0);
dragDir (1 0 0);
pitchAxis (0 0 1);
magUInf 1;
lRef 1;
Aref 1;
}

I have attached the txt file of controlDict files for a normal fluid simulation case for your perusal.controlDict-rigid.txt (4.3 KB)
For more information, refer to the guide

Now, let us say, we have an FSI case in which we divide this “flatplate” into two patches named “fixed” (rigid), and “flap” (flexible). The new mesh positions will be updated to “flap” by the help of preCICE. We need to communicate it to OpenFOAM post-processing functionality by modifying the above code to

forces
{
type forceCoeffs;
libs (“libforces.so”);
log yes;
writeControl timeStep;
writeInterval 10;
patches
(
"fixed.* "
"flap.* "
);
rho rhoInf;
p p;
U U;
rhoInf 1;
CofR (0 0 0);
liftDir (0 1 0);
dragDir (1 0 0);
pitchAxis (0 0 1);
magUInf 1;
lRef 1;
Aref 1;
}

The asterisk indicates that the updated mesh position is to be used to calculate forces.

I have attached the txt file an FSI simulation case here for your perusal. controlDict-FSI.txt (2.3 KB)

For both cases, you can find the calculated forces in a file named forceCoeffs.dat in Fluid/postProcessing/forces/0/

I have validated this using several cases and I believe that this feature is reliable

1 Like

Thank you very much, this will be really useful for future readers! :smiley:

Hey @MakisH. Can you please open the post for edits? My friend pointed out that there’s a typo in the code in the blockquotes. The attachment is good. I need to edit my previous comment’s blockquote.

I am not sure how to do that, but I found the very nice option “Make Wiki”, which should allow anyone to edit. Can you try editing again?

Hello @MakisH

I just unchecked the Solution box and I could edit. Please delete the last 3 messages (including this one) to avoid any confusion for the readers.

Please delete the last 3 messages (including this one) to avoid any confusion for the readers.

It’s ok, let’s keep it like this, to remember how we solved this meta-topic. :wink: I would mark it again as the solution, I understand that it was meant as the solution.