|
[Sponsors] |
November 25, 2016, 06:25 |
UDF Turbulent Viscosity Damping Function
|
#1 |
New Member
Martijn
Join Date: Nov 2016
Posts: 13
Rep Power: 10 |
Dear all,
My thesis project is about a CFD analysis of a Wing-in-Ground effect vehicle. In order to improve my results I want to implement a UDF to damp the turbulent viscosity in the buffer region of the boundary layer. The basic idea is described in more detail in: "T. Chitsomboon, C. Thamyhae - Adjustment of k-w SST turbulence model for an improved prediction of stalls on wind turbine blades, Wind Energy Applications, 2011". Although the procedure is fairly straightforward, I struggle with the implementation. I should note that I have no experience with writing UDF's or programming in C for that matter. Nevertheless, I believe the error (parse error line 36) is because I cant find a way to access the yplus value of the cells. I searched the forums (and Google) but I do not find a solution. This part is giving me headaches: ... real F3(wall_d_bc, t, i) { real yPlus = C_STORAGE_R(f,t,SV_WALL_YPLUS_UTAU); real A = 10; real B = 200; if (A<yPlus<B) F3 = 0.1+(1-0.1*tanh(pow((0.03*yPlus), 4)))*(0.9+0.1*tanh(pow((0.005*yPlus),8))); else { F3=1; } return F3; } ... I attached the full code in a separate file. Could anyone help me out to implement this UDF? Your help is much appreciated! |
|
November 25, 2016, 09:20 |
|
#2 |
Member
KirMaks
Join Date: Aug 2016
Posts: 34
Rep Power: 10 |
Hallo,
I'm not sure, but shouldn't You provide the types of variables in the definition of the function F3 (as You have made it for F2)? It is also a good praxis to divide the code in small blocks and increase its complexity in small steps to see when exactly the error comes out. Best regards, Maks |
|
November 25, 2016, 10:04 |
|
#3 |
New Member
Martijn
Join Date: Nov 2016
Posts: 13
Rep Power: 10 |
Thank you very much for your reply Maks, much appreciated!
You are correct about the input of F3, as I do not need the properties of the walls themselves. It now gives some other errors, but I will try to resolve them first. I'll keep you posted! Thanks again. P.S. When I comment the F3 part and set it as a constant, the code will run flawlessly |
|
November 25, 2016, 11:15 |
|
#4 |
New Member
Martijn
Join Date: Nov 2016
Posts: 13
Rep Power: 10 |
The UDF can now be interpreted without any errors, however the solver gives the following error when applying the UDF:
"mpi application rank 0 exited before mpi_finalize() with status 2" If I understand it correctly this has something to do with parallel processing. is that correct? I do run Fluent in parallel mode on a 12 core machine. Do I need to take specific measures to parallel the code? The updated code is attached. Any suggestions are welcome! |
|
November 26, 2016, 07:39 |
|
#5 |
New Member
Martijn
Join Date: Nov 2016
Posts: 13
Rep Power: 10 |
Another update:
I found out that the problem isn't related to Fluent parallel mode or memory allocation. Instead, it appears that the line: real yPlus = C_STORAGE_R(c,t,SV_WALL_YPLUS_UTAU); ,is giving me the error. When I replace yplus with a constant value I can run the simulation without any problems. Hence, it appears that I will need to find a different way to access or calculate the yplus of the cell. However I am not sure how to do this. I have noticed that Fluent only stores the yplus value of the wall adjacent cells, which could be an explanation for the above error. Nevertheless, I need to be able to define a specific range of Yplus where the eddy viscosity is modified by the described damping function. Any suggestions? |
|
November 28, 2016, 02:59 |
|
#6 |
Member
KirMaks
Join Date: Aug 2016
Posts: 34
Rep Power: 10 |
Hallo,
there may be several things: 1. may be the temporary memory should be keept during iterations: try to set it through /solve/set/expert 2. this variable may not be initialised during the first iteration, so You sould check for it, there are some examples in the forum, I saw several different recently, but couldn't find them, try to put something like: Code:
if ( NULL != ...here should be check for data availability...) { } Good Luck and best regards, Maks. |
|
February 17, 2017, 11:22 |
|
#7 |
New Member
Martijn
Join Date: Nov 2016
Posts: 13
Rep Power: 10 |
Although the UDF function did not improve my results, I will share the final version that I have used.
I decided to bypass the yplus problem by inserting a fixed empirical relation for yplus based on the wall distance y. The relation was obtained by using the Yplus calculator. For a proof of concept, it was good enough as the variation in yplus was very small. Nevertheless, I am very aware that this a rough approximation. The eddy viscosity function was indeed successfully damped, however it did not improve my results in a significant way. The boundary layer remained fairly insensitive to the adverse pressure gradient, compared to the experimental data. In the end, the UDF proved to be most useful for explaining an artefact in the velocity profile of the boundary layer in certain cases. The wall distance y is not calculated correctly at the transition between the prism layer and tetrahedral mesh, causing a discontinuity in the blending function F2 of the SST model. This was resolved by increasing the prism layer thickness. |
|
February 28, 2017, 17:06 |
|
#8 | |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 18 |
Quote:
I am using C_WALL_DIST(c,t) in fluent 16.2 but I am receiving segmentation error on that. have you had similar experience? Do you know how to fix this? |
||
February 28, 2017, 17:20 |
|
#9 | |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 18 |
Quote:
What version of Fluent are you using? I am using 16.2 and am constantly getting segmentation error whenever I use C_WALL_DIST(c,t). |
||
March 1, 2017, 04:30 |
|
#10 |
New Member
Martijn
Join Date: Nov 2016
Posts: 13
Rep Power: 10 |
I have used Fluent 16.1. What is the error message that you get?
|
|
March 1, 2017, 13:17 |
|
#11 |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 18 |
I use 16.2
I receive a generic segmentation error whenever I try to use the C_WALL_DIST macro. If I replace that with some constant value the error will disappear and solver starts solving. Do I have include some libraries in order to use C_WALL_DIST macro? Thanks, Ali |
|
July 12, 2017, 15:40 |
|
#12 |
Member
Vedamt Chittlangia
Join Date: Feb 2016
Posts: 64
Rep Power: 9 |
if you use C_WALL_DIST() then the original model that has to be selected should use yPlus.
So, either select Spalart-Allarmus model or k-e with enhanced wall treatment and then turn off turbulence while solving. This should solve the problem. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] refineWallLayer Error | Yuby | OpenFOAM Meshing & Mesh Conversion | 2 | November 11, 2021 12:04 |
wrong results after use UDF turbulent viscosity | lehoanganh07 | Fluent UDF and Scheme Programming | 0 | July 21, 2014 12:12 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
UDF of Turbulent viscosity | justin | FLUENT | 0 | November 24, 2006 07:36 |
RNG k-e and turbulent viscosity UDF! | ROOZBEH | FLUENT | 0 | January 28, 2004 03:56 |