CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Define new turbulence model in Fluent (https://www.cfd-online.com/Forums/fluent-udf/113720-define-new-turbulence-model-fluent.html)

Kanarya November 20, 2014 11:19

I am using damping function, not wall function ,but I think You should save it in face memory....
Quote:

Originally Posted by behest (Post 520144)
Hello,
May I ask you about that how you consider y+ and wall shear stress near the wall in your UDF? Did you get them from Fluent by these expressions? C_UDMI(c0,t0,0)=C_STORAGE_R(f,t,SV_WALL_YPLUS_UTAU ); /* Y+*/
C_UDMI(c0,t0,2)=C_STORAGE_R(f,t,SV_WALL_SHEAR); /* wall shear */ C_UDMI(c0,t0,3)=C_STORAGE_R(f,t,SV_WALL_YPLUS); /* Ystar */

and did you save them in C_UDMI or in F_UDMI?

thanks alot for your consideration.


behest November 20, 2014 11:40

I do not use wall function, too. But, you need to calculate shear stress on the wall boundary.
Here, you can find my UDF and my Fluent case/data files. May I ask you to glimpse them,
https://www.dropbox.com/sh/rg87mkr95...MyjuKLP-a?dl=0

It would be appreciated if you let me know about your idea.

Quote:

Originally Posted by Kanarya (Post 520219)
I am using damping function, not wall function ,but I think You should save it in face memory....


Kanarya November 20, 2014 12:39

you said that you running the code but you did not compile it at all and the code is not hooked as well how do you know that code is not working?
are you a student?
Quote:

Originally Posted by behest (Post 520224)
I do not use wall function, too. But, you need to calculate shear stress on the wall boundary.
Here, you can find my UDF and my Fluent case/data files. May I ask you to glimpse them,
https://www.dropbox.com/sh/rg87mkr95...MyjuKLP-a?dl=0

It would be appreciated if you let me know about your idea.


behest November 20, 2014 14:03

Actually, I just sent the case/data files and UDF code without compiling. In this case/data file, I did not compile the UDF, this is my solution without adding UDF. I just sent this case/data files to see the SST results obtained by Fluent. If you compile the UDF and start runnig, you'll find different answer.

For compiling, I have done these steps:
1-go to define/user-defined/functions/compile and add the UDF and then bottom "Build" and "Load"
2-go to define/user-defined/scalars and put 2 UDS
3-go to model/viscous and hook Turbulent viscosity
4-go to "Fluid" and click on "Source terms" and hook two source terms for two UDS
4-go to Boundary conditions and select "plate" as wall and then select "fixed value" for both UDS, put zero for UDS1 (as turbulent kinitic energy) and select wall UDF for UDS2 (as specific dissipation rate)
5-go to pressure outlet boundary condition and click on "UDS" tap, then put the value of UDS1 and 2. I do the same procedure for velocity inlet boundary, too
6-go to solution control/equations, and select User Scalar 0" and "User Scalar 1". Moreover, I uncheck "Turbulence"
7-start calculation
These are the whole works that I have done.

I am student and really need to write an UDF for SST model and valid it with Fluent results. Please help me,

Quote:

Originally Posted by Kanarya (Post 520233)
you said that you running the code but you did not compile it at all and the code is not hooked as well how do you know that code is not working?
are you a student?


behest December 2, 2014 08:02

Hello my friend,
what do you think about my steps for running UDF? Are those steps correct?
May I know your comment?


Quote:

Originally Posted by Kanarya (Post 520233)
you said that you running the code but you did not compile it at all and the code is not hooked as well how do you know that code is not working?
are you a student?


Kanarya December 2, 2014 10:58

everything is correct…If your code is correct then maybe the BC or mesh is wrong…I am not familiar with k-omega SST but you should check BC and mesh
What is the mesh size, you are using near the plate?
Quote:

Originally Posted by behest (Post 522071)
Hello my friend,
what do you think about my steps for running UDF? Are those steps correct?
May I know your comment?


behest December 2, 2014 11:37

Y+ is less than 1 and I use velocity inlet, pressure outlet and wall as boundary condition

Quote:

Originally Posted by Kanarya (Post 522124)
everything is correct…If your code is correct then maybe the BC or mesh is wrong…I am not familiar with k-omega SST but you should check BC and mesh
What is the mesh size, you are using near the plate?


Kanarya December 2, 2014 13:08

did you try y+ 10?
are u using first order or second order scheme ?
what is the relaxation factors for UDSI terms?

behest December 2, 2014 13:14

I have not tried with y+=10 yet.
I use first order for UDSI themes and the relaxation factor is 0.01

Quote:

Originally Posted by Kanarya (Post 522147)
did you try y+ 10?
are u using first order or second order scheme ?
what is the relaxation factors for UDSI terms?


Kanarya December 2, 2014 13:54

fine.. what did you use for omega in boundary of the plate?
where are u from by the way?
Quote:

Originally Posted by Kanarya (Post 522147)
did you try y+ 10?
are u using first order or second order scheme ?
what is the relaxation factors for UDSI terms?


behest December 2, 2014 14:57

In wall boundary condition, I fix k=0 and Omgea is obtained as bellow:

/*==============Wall boundary=======================*/
DEFINE_PROFILE(wall_d_bc,t,i)
{
Thread *t0;
face_t f;
cell_t c, c0;
double F_x,area,A[ND_ND],yplus,wshear;

begin_f_loop(f,t)
{
c0 = F_C0(f,t);
t0 = THREAD_T0(t);

yplus = C_STORAGE_R(f,t,SV_WALL_YPLUS_UTAU); /* Y+*/

F_x = F_STORAGE_R_N3V(f,t,SV_WALL_SHEAR)[0];
F_AREA(A, f, t);
area = NV_MAG(A);
wshear=-1*F_x/area;
F_PROFILE(f,t,i) = 6.*wshear/(0.075*C_MU_L(c0,t0)*SQR(yplus));
}

To put them, I go to Define/boundary condition/wall and then select "edit". A new window for the plate will be opened. I select UDS tab and then put fixed value of k=0 and a fixed value of Omega according to the "wall_d_bc" UDF

I put a fixed value of k and omega at inner and outer boundary conditions.

Anyway, I have a question about the initialization, as you see in my UDF, I have not initialized any UDS. How do you initialize them in your code?
Did you add the turbulence contributions to momentum equation as sources?

Quote:

Originally Posted by Kanarya (Post 522151)
fine.. what did you use for omega in boundary of the plate?
where are u from by the way?


m zahid December 6, 2014 20:14

hi
 
i want ot modify the Production term of k. i have UDF but i don't know how can i add my UDF. please help me .
thanks

behest December 7, 2014 07:20

If you would like to modify production term of k, you may need an UDF for the turbulence model. It is not possible to write an UDF and change production trem. Fluent does not allow us to access this term.

Quote:

Originally Posted by m zahid (Post 522764)
i want ot modify the Production term of k. i have UDF but i don't know how can i add my UDF. please help me .
thanks


m zahid December 7, 2014 18:08

hi
 
hi behest, thanks for the answer, you mean i need full turbulence model UDF instead of one term UDF just for production term of k.
regards,

alinik October 26, 2016 20:09

Quote:

Originally Posted by msaeedsadeghi (Post 410081)
It is an scalar equation. I have written so many scalars for fluent. for k-omega you should define at least two UDS. Then write sources and diffusion fluxes that needed for each equation.

Hi,

I am struggling with implementing a new intermittency transport equation that I have derived in fluent and you seem to be a very knowledgable person in this regard.

I understand that I have to use UDS. But I am not sure how I should change the value of intermittency inside the UDF? I am guessing that I have to use DEFINE_ADJUST for that reason but then again I do not know how to access (read) the value of intermittency from the solver.

Also two other problems:
1) For adding source terms to intermittency can I simply add it through the sources tab in the fluids window or it has to be done through UDF as well.

2) Diffusion term: This is the part that I literally do not have any clue about. Any help is much appreciated.

Sorry if my problems sound childish to you. I have been using CFX for quite a while and I know how to work with that but I am quite a newbe in fluent.

I would really really appreciate it if you can help me with that. I am lost and do not have much time. As a thank you I will gladly promote your publications in CFD field in my upcoming papers.

Thanks a lot,

Ali

alinik October 27, 2016 17:25

Quote:

Originally Posted by micro11sl (Post 410496)
Hi all,
I get stuck today. I find there's more work that I expected before.

Question 1:
Because I am implementing a compressible turbulence model, does this imply that I need to define an energy equation as well? Because turbulent kinetic energy should be presented in the energy equation.

Question 2:
After I load the UDF for user defined scalars, when setting the boundary condition tab, is there any difference between the "specific value" and "specific flux" if I am going to use my own boundary condition profile?

Question 3:
How to get the "turbulence intensity" and "viscosity ratio" I set for k-omega based model before for my newly defined model? Do I need to calculate the value of k and omega explicitly and assign them to my UDS? A related question is do I need to write up an udf for the initialization of my UDS? Also udfs for postprocessing?

Question 4:
As I read from many other threads in this forum, I guess some modification should be done before the udf can be run in parallel. Is this guess correct?

Considering from Question 1 to 4, I feel there's lots of work to finish. It seems I can't finish shortly. To simplify, I have a very rough idea. Because the original k-omega model will be selected but not solved (the UDS equations are solved instead), I might transfer the value of the initialized k and omega to my UDS in the beginning, and transfer my UDS back to the original k and omega scalars at the end of one computation. In this way, there's no need to write up udfs to initialize and postprocessing my UDS. But I don't know it's possible or not that Fluent will let me assign values back and forth between UDS and original k and omega transport equations.

Are there any simple approaches? Any comments?

Regards,
Sheng

HI Sheng,

It has been more than 3 years since the last time you updated this post. Just wanted to know if you were successful in solving your problems?
I want to replace the transport equation for intermittency with some other transport equation that we have derived. The problem is I can not find the Macro name for intermittency and do not know how to bypass the default transport equation for intermittency in FLUENT (Langtry-Menter transport equations)

P.S. I want to continue using transitional SST turbulence model and just have fluent use my transport eq. instead if its own


All times are GMT -4. The time now is 01:45.