CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

kronecker delta user defined function fluent

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 15, 2014, 08:47
Default kronecker delta user defined function fluent
  #1
Senior Member
 
Join Date: May 2011
Posts: 231
Rep Power: 16
Kanarya is on a distinguished road
Hi,
I would like to define following expresion in UDF:
it is for Eulerian multiphase gas-solid flow..
S_prime_12ij=S_12ij-1/3*S_12mm*kronecker delta_ij;
S_12ij-strain rate tensor.
But I can not define the kronecker delta in udf.
So Is there anybody who had the same problem or do you know how to do it?
Thanks in advance!
Kanarya is offline   Reply With Quote

Old   August 15, 2014, 11:09
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
This is not so difficult. The implementation follows directly from the definition of the Kronecker Delta.

If you write down the definition of the Kronecker Delta in English words, you practically have the code to implement in your udf, only a little of syntax changes...
How would you define the Kronecker Delta?

(I could give you the answer directly, but I prefer to teach you how to solve these problems, this will help you more in the long term.)
pakk is offline   Reply With Quote

Old   August 15, 2014, 11:38
Default
  #3
Senior Member
 
Join Date: May 2011
Posts: 231
Rep Power: 16
Kanarya is on a distinguished road
Hi,
Thanks for the answer!I know that Kronecker Delta is:
δij(Kronecker Delta) =
1, if i = j
0, if i not = j
but in udf there is no indexes in the macros for example for velocity C_U(c,t), C_V(c,t) only we can understand the direction from the letters U and V right?
how we can define a if statement for it?
thanks in advance!

Quote:
Originally Posted by pakk View Post
This is not so difficult. The implementation follows directly from the definition of the Kronecker Delta.

If you write down the definition of the Kronecker Delta in English words, you practically have the code to implement in your udf, only a little of syntax changes...
How would you define the Kronecker Delta?

(I could give you the answer directly, but I prefer to teach you how to solve these problems, this will help you more in the long term.)
Kanarya is offline   Reply With Quote

Old   August 15, 2014, 12:04
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
So the code for kronecker delta:

Code:
if (i==j) kroneckerdelta=1; else kroneckerdelta=0;

But it turns out that the kronecker delta is not really your problem, but how to get the indices of the strain rate tensor...
You are correct, the only way to do this is by explicitly writing out the components. So S11 would be C_DUDX(c,t), etc. The strain rate tensor is not directly defined in Fluent, but you need to use its nine components that are defined. (edit: after you take the symmetric part of course, so S12 would be (C_DUDY(c,t)+C_DVDX(c,t))/2.)

Technically the strain rate tensor is also defined through three vectors, namely C_U_G, C_V_G and C_W_G, which put together also form the strain rate tensor, but I don't think this will help anything.

But, your question started with "I would like to define following expresion in UDF".
What do you want to use that expression for? Plot the result? Use it in a different calculation?
pakk is offline   Reply With Quote

Old   August 15, 2014, 12:19
Default
  #5
Senior Member
 
Join Date: May 2011
Posts: 231
Rep Power: 16
Kanarya is on a distinguished road
thanks a lot!
I would like to use it for calculation of turbulence model..
yes you are right I can not get the indexes!
I defined them as below:
PHP Code:
S11 0.5*( C_DUDX(c,t)+C_DUDX(c,t) );
                
S12 0.5*( C_DUDY(c,t)+C_DVDX(c,t) );
                
S13 0.5*( C_DUDZ(c,t)+C_DWDX(c,t) );
                
S21 0.5*( C_DVDX(c,t)+C_DUDY(c,t) );
                
S22 0.5*( C_DVDY(c,t)+C_DVDY(c,t) );
                
S23 0.5*( C_DVDZ(c,t)+C_DWDY(c,t) );
                
S31 0.5*( C_DWDX(c,t)+C_DUDZ(c,t) );
                
S32 0.5*( C_DWDY(c,t)+C_DVDZ(c,t) );
                
S33 0.5*( C_DWDZ(c,t)+C_DWDZ(c,t) );
                

                
S=S11*S11+S12*S12+S13*S13+S21*S21+S22*S22+S23*S23+S31*S31+S32*S32+S33*S33
but again I can not get the indexes!
thanks again!
Quote:
Originally Posted by pakk View Post
So the code for kronecker delta:

Code:
if (i==j) kroneckerdelta=1; else kroneckerdelta=0;

But it turns out that the kronecker delta is not really your problem, but how to get the indices of the strain rate tensor...
You are correct, the only way to do this is by explicitly writing out the components. So S11 would be C_DUDX(c,t), etc. The strain rate tensor is not directly defined in Fluent, but you need to use its nine components that are defined. (edit: after you take the symmetric part of course, so S12 would be (C_DUDY(c,t)+C_DVDX(c,t))/2.)

Technically the strain rate tensor is also defined through three vectors, namely C_U_G, C_V_G and C_W_G, which put together also form the strain rate tensor, but I don't think this will help anything.

But, your question started with "I would like to define following expresion in UDF".
What do you want to use that expression for? Plot the result? Use it in a different calculation?
Kanarya is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 18:22
The fluent stopped and errors with "Emergency: received SIGHUP signal" yuyuxuan FLUENT 0 December 3, 2013 23:56
[blockMesh] non-orthogonal faces and incorrect orientation? nennbs OpenFOAM Meshing & Mesh Conversion 7 April 17, 2013 06:42
user defined function Thomas Lescot FLUENT 1 May 4, 2007 11:13
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


All times are GMT -4. The time now is 14:02.