Page 1 of 4

Output forces on surface

Posted: Tue Oct 24, 2023 4:47 pm
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.

Re: Output forces on surface

Posted: Wed Oct 25, 2023 3:33 pm
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

Re: Output forces on surface

Posted: Wed Oct 25, 2023 4:58 pm
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?

Re: Output forces on surface

Posted: Wed Oct 25, 2023 9:26 pm
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

Re: Output forces on surface

Posted: Fri Oct 27, 2023 1:37 pm
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

Re: Output forces on surface

Posted: Tue Nov 21, 2023 10:31 pm
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

Re: Output forces on surface

Posted: Tue Nov 21, 2023 10:54 pm
by trilbytim
Ah, so it looks like just having wing without the square brackets works.....

Re: Output forces on surface

Posted: Tue Nov 21, 2023 11:34 pm
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.

Re: Output forces on surface

Posted: Wed Nov 22, 2023 1:02 am
by Yvan Fournier
Hello,

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

Regards,

Yvan

Re: Output forces on surface

Posted: Wed Nov 22, 2023 1:05 pm
by trilbytim
Sorry so the details are:
version: 8.0-beta-09cdc7d58
Setup, complie and run_solver logs attached