Output forces on surface

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
trilbytim
Posts: 32
Joined: Thu Jan 05, 2023 11:52 am

Output forces on surface

Post by trilbytim »

I have a simple model of a wing in a fluid domain. I want to output the overall resultant force and moment on the wing (which is a surface called 'wing' in the mesh). In OpenFOAM I can simply define a Reporting Function on the wing surface. I can't see a way in GUI to do this. Monitoring points seems to be just 1 point, I can't see a way to assign to a group.
Also my surface groups (Inlet, Outlet, wing, etc) don't seem to be preserved in the analysis, so when I open the results then I have a results file for the fluid domain and a result for Boundary case, but these both just contain a single block, I can't split out into my defined surfaces to get the force on just one surface (e.g. the wing), so I can't get the force that way either.
daniele
Posts: 149
Joined: Wed Feb 01, 2017 11:42 am

Re: Output forces on surface

Post by daniele »

Hello,

In v7 or earlier versions, the simplest way is to create your surface in the mesh, then you can post-process the force using for example the "cs_user_extra_operations.f90" routine.
If you want the total x-force on the surface, for example, you simply have to write something as:

Code: Select all

! get the force vector
call field_get_val_v(iforbr, bfprp_for)

! get the surface where you want to post-process the force
call getfbr("surface_name", nlelt, lstelt)
xfor = 0.d0
do ilelt = 1, nlelt
          ifac = lstelt(ilelt)
          xfor = xfor + bfprp_for(1, ifac)
enddo

If you want to visualize the force in Paraview on every face of the surface, you can do the same and add a user-defined field (in the GUI) to store xfor(j,i_fac).

Hope this helps.
Best regards,
Daniele
trilbytim
Posts: 32
Joined: Thu Jan 05, 2023 11:52 am

Re: Output forces on surface

Post by trilbytim »

Thank you for your reply
I'm using v8.0 beta.
I already have the surface defined in my mesh as "wing". Where should I put that test, I can't find a file called "cs_user_extra_operations.f90" in my case directory
When you say add user defined fields in the GUI, do you mean something like in the attached screenshots?
Attachments
Screenshot from 2023-10-25 16-13-34.png
Screenshot from 2023-10-25 16-13-20.png
daniele
Posts: 149
Joined: Wed Feb 01, 2017 11:42 am

Re: Output forces on surface

Post by daniele »

Hello,

It is a user routine that you need to add in the SRC directory. I suggest you to have a look at the examples of such routines on the webiste or in the GUI.
Anyway, I have not used v8 yet, but I think they removed all fortran routines, so you will need to switch to C. The procedure remains the same, but I don't know exactly the variable name for the force in C, I am sorry...
You should be able to find it in the documentation online I guess.

Best regards,
Daniele
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Output forces on surface

Post by Yvan Fournier »

Hello,

In addition to this, using the GUI, you can generate postprocessing sub-meshes matching your surface groups, and associate them to the same or separate writers (don not forget that step). This allows you to visualize/sum/plot the results on these filtered groups.

Best regards,

Yvan
trilbytim
Posts: 32
Joined: Thu Jan 05, 2023 11:52 am

Re: Output forces on surface

Post by trilbytim »

Thank you Yvan, I'm trying to do it using the GUI. My face of interest is called 'wing' so I have set it up as shown in the screenshot below. However this gives me the error:

Code: Select all

Error parsing expression:
[wing]
 ^
Expected operator instead of operand.
How should I express the selection criteria to just include the boundary face called wing?

Screenshot from 2023-11-21 20-41-42.png
trilbytim
Posts: 32
Joined: Thu Jan 05, 2023 11:52 am

Re: Output forces on surface

Post by trilbytim »

Ah, so it looks like just having wing without the square brackets works.....
trilbytim
Posts: 32
Joined: Thu Jan 05, 2023 11:52 am

Re: Output forces on surface

Post by trilbytim »

No, that still doesn't seem to be working, there doesn't seem to be any data when I open RESULTS_WING.case in Paraview.
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Output forces on surface

Post by Yvan Fournier »

Hello,

Could you post at least the log files mentioned in the forum usage recommendations ?

Regards,

Yvan
trilbytim
Posts: 32
Joined: Thu Jan 05, 2023 11:52 am

Re: Output forces on surface

Post by trilbytim »

Sorry so the details are:
version: 8.0-beta-09cdc7d58
Setup, complie and run_solver logs attached
Attachments
setup.log
(27.63 KiB) Downloaded 432 times
compile.log
(2.55 KiB) Downloaded 411 times
run_solver.log
(560.63 KiB) Downloaded 404 times
Post Reply