For one of our projects, we would like to compute the aerodynamic forces using OpenFOAM and transfer them to CacluliX structural analysis. Since I have no experience running OpenFOAM and I really would not like to spend a lot of time studying it, I am wondering if someone can help me.
What I would need to integrate the transfer of OpenFOAM computed forces to PrePoMax are some examples of OpenFOAM results - forces. The geometry of the examples is not important. As far as I understand in FSI simulations the surface conditions from CFD are transferred via forces to account for both, the normal and sheer forces which are computed in the CFD cell centres.
So I think I would need not only the file with the surface cell forces but also the surface cell geometry in a separate file if this is possible. Otherwise, I would need to read the whole CFD mesh.
I know there is a toolbox called preCICE that has this integrated but I think it is overpowered for this simple case.
FreeCAD has a great add-on module for preprocessing OpenFOAM simulations. It’s called CfdOF. Now I’m trying to add the output of forces to it (which requires editing the solver control file). When I succeed, I will share all the necessary files.
This project has similar goals, may it can be elaborate with PrePoMax. as new comer CFD is interesting me also, however i’m thinking Dolfyn as solver instead of OpenFOAM.
can be useful to study wind flow and pressure distribution on the model part (e.g vehicle, bridge/building). it seems PrePoMax required to display both of speed as vector arrow and surface pressure contour gradient.
I investigated this topic. Unfortunately, it seems that OpenFOAM can’t output force distribution for surfaces. It can only calculate total forces. Thus, it’s necessary to postprocess the pressure output to obtain the forces. Here’s a video showing how part of it can be done in ParaView: How to calculate aerodynamic forces with Paraview - YouTube
We have such a function in our GUI, but unfortunately it is not open-source, as it is based on a commercial CAD import and meshing technology.
However, the way is quite simple:
In our experience, it is easier and usually sufficient to map only the pressure and neglect the shear forces. You can check this by placing a force monitor on the patch and comparing pressure and shear forces in the output.
Mapping the pressure is easier because you don’t have to integrate over different element surfaces to stay force-conserving.
If the mapping of the pressure is sufficient, OpenFOAM has with the “sample” function quite extensive possibilities to transfer results to points (of another grid). In this case you can use the patch cloud, which only interpolates results on a patch and not in the volume.
You only have to convert the data (coordinates and IDs) of the element faces between the OpenFOAM format and the CalculiX output a little.
I was just asking myself if it is necessary to account for shear forces since in this project we will be mostly working with air (and I saw that people mostly compute the lift and drag forces from only pressure data). I wanted to get some info from the guys that do CFD since I have zero experience in this field. And I hoped it would be easier to map only the pressure. So thank you for giving me this information it is really helpful to know that this is a viable path.
I am reading the Sampling data of the OpenFOAM and the definition of the patch cloud. And I am wondering if this post-processing routine must be defined before CFD analysis or can be also done later, after the analysis completes (probably a newbie question).
I have limited experience with OpenFOAM but from what I know, functions like that are defined in controlDict before the analysis. However, modifications to this file can be made also during the simulation and are applied in the next iteration.
type sets;
libs (“libsampling.so”);
setFormat raw;
surfaceFormat raw;
interpolationScheme cellPatchConstrained;
fields ( p );
sets
(
somePatchPoints
{
type patchCloud;
axis xyz;
points (
(0.0175000042037 -0.006 -0.00177543035311)
(0.0195000042037 -0.006 -0.00177546514192)
(0.0185000042037 -0.006 -0.00066436575815)
(0.0195000033347 -0.006 -0.00499994580848)
…
(0.0 0.00153131909922 -0.003645586016)
(0.0 0.000825833854377 -0.00506086583899)
);
maxDistance 0.1;
patches (forces);
}
);
Then you can call the function via a post-process function to map from patch “forces” in OpenFOAM.
postProcess -latestTime -noFunctionObjects -func sampleDict
In the postprocessing folder you will find a file with the printout for each sample point:
0.0175000042 -0.006 -0.00177543035 -0.00489009335
0.0195000042 -0.006 -0.00177546514 -0.0062506332
0.0185000042 -0.006 -0.000664365758 -0.0062506332
0.0195000033 -0.006 -0.00499994581 -0.00598500398
But be careful: With the incompressible OpenFOAM solvers (simpleFOAM/pimpleFOAM) you have to multiply the pressure by the density to get a pressure in [Pa].
Thank you @ulli. I think I will have to install OpenFOAM first and start testing things.
For our case, there will be one CFD analysis and then we will probably have to make multiple structural FEM analyses with different meshes that are not known beforehand.
So I will have to output the pressure from OpenFOAM based on the CDF mesh and then do the scalar mapping inside PrePoMax. I think I can use OpenFOAM surface patches to output the pressure on the selected surfaces - or will I get only the average or mean or some other integrated value? The ideal thing (for scalar mapping in PrePoMax) would be to also get the mesh of only the surface patch with the pressure. I think I saw some possibility to output it in various formats.
And thank you for the reminder about the kinematic pressure.
Some updates on the issue. I have successfully developed an OpenFOAM boundary mesh reader that can read scalar values from the OpenFOAM, and created a user interface that allows the user to select from which folder/from which time the scalar results will be read. And then added a simple mesh-to-mesh interpolation based on the closest nodes. So now the results from the OpenFOAM mesh can be applied to the PrePoMax mesh. The last step is to include a more advanced results interpolator.
On the left are the results from the OpenFOAM mesh read into PrePoMax and on the right are the same results interpolated on the PrePoMax mesh of the same geometry.
Very interesting, @Matej. Do you plan to use it for dynamic FSI? Or for static thermal/structural analysis only?
I am looking forward to doing some tests on this new feature.
Hello @Matej, is this force importing feature included in v1.3.4? Didn’t find any information about it, so I think not. Is there any prediction of adding it?
It’s already in the source code and should be available in the next regular release (1.3.5). The 1.3.4 version was an additional release adding only a fix for a nasty bug with hydrostatic pressure.