Measuring forces

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
bat
Posts: 3
Joined: Mon Mar 24, 2025 12:58 pm

Measuring forces

Post by bat »

Hello,

I'm trying to calculate a drag force on a plate in a 2D mesh. I copied the code from viewtopic.php?p=17551&hilit=drag+force#p17551. For the output file to be filled, I need to add a User Specified Field. I did it manually (on Gui), but do not understand how they work. I do not know what location I should put (boundary gives me only zeros...).

The problem is that when I change the speed from the inlet, the forces do not change, nor vary after the second time step (see boundary_force_table.csv).

Does anyone have some hints to give ?
Thanks !

Bat

Code version : code_saturne 8.3
(I can't manage to insert more files, but I can send them if needed)
Attachments
setup.xml
(8.19 KiB) Downloaded 553 times
setup.log
(32.07 KiB) Downloaded 554 times
cs_user_extra_operations-boundary_forces.c
(6.34 KiB) Downloaded 576 times
bat
Posts: 3
Joined: Mon Mar 24, 2025 12:58 pm

Re: Measuring forces

Post by bat »

In the end, I found why the solution was not being plotted, but there are multiple possible causes :
- in the C file, the field is "boundary_stress", not "boundary_force"
- I had deactivated the postprocessing of the stress in GUI (see screenshot) in the solution control...

With these two changes, it works !
Attachments
Capture d’écran du 2025-03-25 14-26-31.png
Yvan Fournier
Posts: 4206
Joined: Mon Feb 20, 2012 3:25 pm

Re: Measuring forces

Post by Yvan Fournier »

Hello,

Did you try visualizing the boundary stresses ? to check for the sensitivity when you increase the velocity ?

This may help you determine if/where there is a bug (i.e. bug in you code, bug in upstream code_saturne, or no obvious bug but forces in given zone not too sensitive to velocity) ?

Best regards,

Yvan
User avatar
jcharris
Posts: 52
Joined: Tue Apr 16, 2019 7:28 pm

Re: Measuring forces

Post by jcharris »

I confirm that if this is not checked in the GUI (which the hover text makes reference to ipstdv which hasn't existed since v7, it seems), then this hides the boundary stress not just from the output files, but also cs_user_extra_operations (unclear if that is desired behavior or not).

By chance, are there plans on integrating force calculation into the GUI in the future? It seems like a relatively common thing.
Yvan Fournier
Posts: 4206
Joined: Mon Feb 20, 2012 3:25 pm

Re: Measuring forces

Post by Yvan Fournier »

Hello,

I think a colleague had plans for "summation by zone" of selected variables, which would fit here, so yes, there are plans for this in the GUI, though I have no idea on where this sits on the priority list.

Best regards,

Yvan
Post Reply