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

Re: Output forces on surface

Post by trilbytim »

Setup and run solver log. The mesh is too large to attach, but it's simply a fluid domain with a wing subtracted from it, there's an inlet an outlet, symmetry conditions and a wall for the wing surface. The faces are labelled with names that are these. All I would like to do is for those to be preserved in the output so that I can query them, for example to read the lift, drag and moment of the wing.
Attachments
Screenshot from 2023-11-22 11-24-28.png
preprocessor.log
(7.07 KiB) Downloaded 428 times
setup.xml
(7.92 KiB) Downloaded 417 times
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Output forces on surface

Post by Yvan Fournier »

Hello,

The selection criteria for the postprocessing mesh is incorrect. You must either:

- Use "wing.Wing_surf".
or
- Switch the mesh type from "boundary faces" to "boundary zone," and keep the "wing" selection.

Best regards,

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

Re: Output forces on surface

Post by trilbytim »

Thank you for this, I can now output the wing as a separate result. However I cannot get the pressure distribution of the surface from this. I need to get the total force and moment on the wing.

The wing result has a field called "Stress", but I'm not sure what this is? Possibly the viscous component? It definitely doesn't look right for the pressure. Is there no simple way of outputting the overall force and moment on a surface?
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Output forces on surface

Post by Yvan Fournier »

Hello,

The stress should contain both the viscous and pressure components, with pressure usually dominant. It might also conttain the hydrostatic component of the pressure if you have non-zero gravity. If that still does not explain the results I would need to check on a small case.

Best regards,

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

Re: Output forces on surface

Post by trilbytim »

Ah, thank you, yes I hadn't noticed that the stress had x, y and z components. Now by integrating them on the wing surface I do get figures for lift and drag. Unfortunately they don't seem right! I've been using Siemens Star CCM+ at work but am looking for something that I can use for my own non-work projects, so I've been trying to learn Code Saturne and also OpenFOAM (through the FreeCAD gui). This elliptical wing case is one that I have a semi analytical solution, also have modelled using a Vortex Lattice method. The analytical solution gives a L/D of about 20, the VLM is giving 18 and both OpenFOAM and Star CCM+ are giving about 19. However Code Saturne is giving 9.6! This is both due to the lift being too low (358 as opposed to 485N) AND the drag being too high (37 as opposed to 25N) compared to all the other solutions. I'm using the mesh that was generated in Star CCM+ and I believe that I've set all the physical constants the same and I'm using the same turbulence model. I've attached the setup and the mesh is on the link below. Can you see anything obviously wrong with this that could be making the L/D so bad and so different to running what should be an identical simulation in different software?
Thanks,
https://drive.google.com/file/d/1d_ZxKu ... sp=sharing
Attachments
setup.xml
(7.79 KiB) Downloaded 481 times
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Output forces on surface

Post by Yvan Fournier »

Hello,

Thanks for the test case. I'll try to give it a look, but will probably need help from colleagues who know some of the numerical aspects better.

Regarding the drag, a colleague pointed out to me a few days ago that there is a turbulence model related term which is added in all cases and should be only added in one case (I need to check which). So it might be interesting to compare results between k-epsilon and k-omega, in case one of the 2 is buggy.

But most importantly, you used a rough wall instead of a smooth wall law, which might make a significant difference (there are actually 2 models in code_saturne, and I think this option least to the older one). So using a smooth wall will probably improve the drag.

I'll keep you informed, though I don't guarantee it will be before a couple of weeks.

Best regards,

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

Re: Output forces on surface

Post by Yvan Fournier »

Hello,

Are you sure your computation is converged ? Using your setup and an smooth wall, I have divergence right away. With a smaller reference time step and local time step, I can get results, but have not checked for convergence or looked in detail yet.

Regards,

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

Re: Output forces on surface

Post by trilbytim »

Hi there, I've tried it with kε, kωSST and with rough (height 0.0001m) and smooth walls. All do seem to converge for me within the 500 steps of 0.05s. Here's the plot of kε with a smooth wall:
K-e.png
kωSST does seem to converge quicker for the smooth wall case:
K-om-SST-smooth.png
However for the rough wall then there are some odd jumps:
k-om-SST-rough.png
However, none of these give numbers that are anywhere close to the results from my other sofware (although they are all quite consistent with each other). I would assume this is my fault with setting up the model rather than a bug, but it seems very odd.

Turb Wall L D CL CD L/D
kε Smooth 408 33 0.81 0.07 12.4
kε Rough 358 37 0.71 0.07 9.7
kωSST Smooth 386 33 0.77 0.07 11.8
kωSST Rough 373 34 0.74 0.07 10.9


The correct CL should be 0.97, CD 0.05 and L/D = 20
trilbytim
Posts: 32
Joined: Thu Jan 05, 2023 11:52 am

Re: Output forces on surface

Post by trilbytim »

Sorry, can't work out how to format a table to post here. Here are the results in a bit more readable way:
Screenshot from 2023-11-29 15-52-21.png
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Output forces on surface

Post by Yvan Fournier »

Hello,

Yes, this seems strange, especially as code_saturne may be a bit less robust than Star-CCM+ regarding some meshes, but usually gives results quite similar to OpenFoam, FLUENT, or Star-CCM in most comparisons to date.

If you have a second (even coarser) mesh, comparing results with that mesh could be interesting.

But adding a postprocessing output directly into the code (see attached file) seems to provide results closer to your expectations, so I suspect something in the integration by ParaView is incorrect (i.e. not weighted correctly).

If you add the attached file in your SRC directory, and look at the "lift_and_drag.txt" file produced, things may be closer to what you expect. Can you try this ? The fist couple of values is computed using the stresses, the second simply by integrating the pressure forces on the adjacent cells (you will see they are very close).

With smooth wall k-epslion and default wall law, I get 460 lift, 25 drag.

Best regards,

Yvan
Attachments
cs_user_extra_operations.c
(4.3 KiB) Downloaded 456 times
Post Reply