|
[Sponsors] |
November 7, 2020, 18:01 |
Function Hooks
|
#1 |
New Member
Italia
Join Date: Oct 2020
Posts: 19
Rep Power: 6 |
Hi. This is my UDF:
#include "udf.h" #define uinf 1.75 #define d 6 DEFINE_ADJUST(uu, domain) { Thread *t; cell_t c; thread_loop_c(t, domain) { begin_c_loop(c, t) { real mu_t = C_MU_T(c, t); /*Eddy Viscosity*/ real k = C_K(c, t); /*Turbulence Kinetic Energy*/ real ux = C_U_G(c, t)[0]; /*du/dx*/ C_UDSI(c, t, 0) = 2 * mu_t*ux - (2 / 3)*k; C_UDMI(c, t, 3) = -C_UDSI_G(c, t, 0)[0] / (uinf*uinf*d); } end_c_loop(c, t) } } I have to get the contours of the UDM, so I put "uu" in "User-Defined Function Hooks" but Fluent crash. If I don't put "uu" in "User-Defined Function Hooks" Fluent run the calculation but the value of my UDM is 0. How can I solve it? |
|
November 9, 2020, 01:21 |
|
#2 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
you should put "uu" in "User-Defined Function Hooks" to make it executed.
why do you use scalar in your code? C_UDSI(c, t, 0) most likely, you didn't allocate memories for user defined scalars and/or for user defined memory also Quote:
Code:
#include "udf.h" #define uinf 1.75 #define d 6 DEFINE_ADJUST(uu, domain) { Thread *t; cell_t c; real mu_t; /*Eddy Viscosity*/ real k; /*Turbulence Kinetic Energy*/ real ux; /*du/dx*/ thread_loop_c(t, domain) { begin_c_loop(c, t) { mu_t = C_MU_T(c, t); /*Eddy Viscosity*/ k = C_K(c, t); /*Turbulence Kinetic Energy*/ ux = C_U_G(c, t)[0]; /*du/dx*/ C_UDMI(c, t, 0) = 2 * mu_t*ux - (2 / 3)*k; C_UDMI(c, t, 1) = (2 * mu_t*ux - (2 / 3)*k) / (uinf*uinf*d); } end_c_loop(c, t) } }
__________________
best regards ****************************** press LIKE if this message was helpful |
||
November 9, 2020, 04:23 |
|
#3 |
New Member
Italia
Join Date: Oct 2020
Posts: 19
Rep Power: 6 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] refineWallLayer Error | Yuby | OpenFOAM Meshing & Mesh Conversion | 2 | November 11, 2021 12:04 |
[blockMesh] non-orthogonal faces and incorrect orientation? | nennbs | OpenFOAM Meshing & Mesh Conversion | 7 | April 17, 2013 06:42 |
channelFoam for a 3D pipe | AlmostSurelyRob | OpenFOAM | 3 | June 24, 2011 14:06 |
latest OpenFOAM-1.6.x from git failed to compile | phsieh2005 | OpenFOAM Bugs | 25 | February 9, 2010 05:37 |
Problem with compile the setParabolicInlet | ivanyao | OpenFOAM Running, Solving & CFD | 6 | September 5, 2008 21:50 |