CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Function object combination: "Sample" on .stl surface and then "sum" on that surface

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By Agavi
  • 1 Post By Svetlana

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 23, 2026, 09:58
Default Function object combination: "Sample" on .stl surface and then "sum" on that surface
  #1
New Member
 
Join Date: Aug 2020
Posts: 23
Rep Power: 7
Agavi is on a distinguished road
Hi all,

Been stuck on this problem :

I'm trying to get the force distribution on a wind turbine blade. The total force and moment are calculated well using the "forces" function object from library "forces". However I need the spanwise distribution.

When I tried to use bins aligned with the blade using the "binField" function object from libraray "fieldFunctionObjects" I got a 'STEPPY', rugged distribution. This happens because I reckon 'binField' bins the cells based on some distance and integrates the force on those cells. However, my cells are not aligned with the separating surfaces of the bins and I think this is why I get a quite odd distribution. (see sketch attached)

I really need to get a clear picture of the integrated force in a single section, and therefore integrate within the right areas that might be cutting some of the faces. This is also why I wouldnt be able to use a facezone for this job.

What I decided to attempt is the following: (1) Make STL surfaces of the various blade sections (from the hub r~0 to r=Rmax radius). I can do this by chopping the initial blade using snappy and features and so on. (2) Then I'd want to map the "force" field from the "BLADE" patch to the section*.stl. (3) then I'd want to perform the "sum" operation using the "surfaceFieldValue" function object from "fieldFunctionObjects" library and operation "sum".

To check if steps (2) and (3) would work, if I could map a field from the patch to an stl and then perform summation on the stl, I use the blade.stl surface ( I know its not a section but I wouldnt go ahead doing step (1) before I'm sure steps (2) and (3) work here).

So basically I thought something like this should work :

forces1
{
type forces;
libs (forces);
writeControl timeStep;
writeInterval 1;
exectueControl timeStep;
executeInterval 1;
writeFields yes;
log yes;
porosity false;

region region0;
patches (BLADE);
pName p;
UName U;
rhoName rhoInf;
rho rhoInf;
rhoInf 1;
CofR (0 0 0); // Origin for moment calculations
}


totalForceInStl
{
type surfaceFieldValue;
libs (fieldFunctionObjects);

writeControl timeStep;
writeInterval 1;

writeFields true;
surfaceFormat none;

regionType sampledSurface;
name sampledTriSurface;

operation sum;
fields (force); % I've tried with U too just to see if the force field is not transferred but I get the same error.

sampledSurfaceDict
{
type sampledTriSurfaceMesh;
store true;
surface blade0.stl;
source boundaryFaces;
}

}

The last message from the solver is :

surfaceFieldValue totalForceInStl write:
total faces = 72368
total area = 0.045134908

(so it does run the FO and recognise the surface; the stl does have 72368 faces indeed and area is fine).

Sadly, right after, I get the following error:

Lists have different sizes: 0 != 6270

(I don't know what list has size 6270 in my simulation, the blade patch has many faces ~400,000!)

I'd expect to get a result that's the total force of the blade, that should also match the result of the 'forces' function object as a validation..

Any help would be much apppreciated

Many thanks

PS: This same thing is done in the sqareBend tutorial in of 2212, where UI3 is calculated on a sampled plane.
Attached Images
File Type: png ofSampling.png (70.8 KB, 6 views)
Svetlana likes this.
Agavi is offline   Reply With Quote

Old   February 5, 2026, 00:07
Default
  #2
Senior Member
 
Svetlana Tkachenko
Join Date: Oct 2013
Location: Australia, Sydney
Posts: 430
Rep Power: 16
Svetlana is on a distinguished road
Hello,

Sorry, this is a pyvista suggested solution, not function object:

1. read openfoam case
2. read stl file
3. resample openfoam data to the stl
4. do the average or sum or whatever you wanted

1. https://docs.pyvista.org/examples/99.../openfoam.html
2. https://docs.pyvista.org/api/readers...ista.stlreader
3. https://docs.pyvista.org/api/core/_a...Filters.sample
4. numpy ?
Agavi likes this.
Svetlana is offline   Reply With Quote

Old   February 5, 2026, 12:44
Default
  #3
New Member
 
Join Date: Aug 2020
Posts: 23
Rep Power: 7
Agavi is on a distinguished road
Thank you!! This looks like a great solution. Ended up following this tecplot tutorial: https://www.youtube.com/watch?v=dfpTj7hmPaE and got the smooth force distributions I needed.

Eventually should give a go to the pyvista solution so that I can keep my analysis independent of licensed software.

Many thanks
Agavi is offline   Reply With Quote

Reply

Tags
field function object, function objects, integration, sampling

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 04:17.