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

calculate dot product of two gradient vector in UDF

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 28, 2014, 09:49
Default calculate dot product of two gradient vector in UDF
  #1
Member
 
Ali.E
Join Date: Sep 2010
Location: Lisboa
Posts: 83
Rep Power: 15
behest is on a distinguished road
Hello all,
I would like to calculate this k.w (k is gradient of the kinetic energy and w is the gradient of the specific dissipation rate) for each cell. Can you tell me how should write it in UDF?
I used several ways to compute the dot product multipler like as:
#include "udf.h"
#include "math.h"

DEFINE_ON_DEMAND(grad)
{
Domain *domain=Get_Domain(ROOT_DOMAIN_ID);

cell_t c;
Thread *t;
real s7;

thread_loop_c(t,domain) /*loops over all cell threads in domain*/
{
begin_c_loop(c,t) /* loops over cells in a cell thread */
{
s7=C_K_G(c,t)[0]*C_O_G(c,t)[0]+C_K_G(c,t)[1]*C_O_G(c,t)[1]+C_K_G(c,t)[2]*C_O_G(c,t)[2];
Message("Gradient of k and w in a cell are: (%f) \n", s7);
}
end_c_loop(c,t)
}
}
behest is offline   Reply With Quote

Old   February 28, 2014, 14:32
Default
  #2
Member
 
Ali.E
Join Date: Sep 2010
Location: Lisboa
Posts: 83
Rep Power: 15
behest is on a distinguished road
The problem is solved now. Actually, it needs to active solve/se/expert and let to software to save all gradient data.
Thanks all
Quote:
Originally Posted by behest View Post
Hello all,
I would like to calculate this k.w (k is gradient of the kinetic energy and w is the gradient of the specific dissipation rate) for each cell. Can you tell me how should write it in UDF?
I used several ways to compute the dot product multipler like as:
#include "udf.h"
#include "math.h"

DEFINE_ON_DEMAND(grad)
{
Domain *domain=Get_Domain(ROOT_DOMAIN_ID);

cell_t c;
Thread *t;
real s7;

thread_loop_c(t,domain) /*loops over all cell threads in domain*/
{
begin_c_loop(c,t) /* loops over cells in a cell thread */
{
s7=C_K_G(c,t)[0]*C_O_G(c,t)[0]+C_K_G(c,t)[1]*C_O_G(c,t)[1]+C_K_G(c,t)[2]*C_O_G(c,t)[2];
Message("Gradient of k and w in a cell are: (%f) \n", s7);
}
end_c_loop(c,t)
}
}
behest is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
UDF for time-mean temperature gradient nenazarian Fluent UDF and Scheme Programming 1 November 12, 2012 04:30
The gradient of void fraction in UDF summer FLUENT 2 May 20, 2011 04:34
Possible Bug in double dot product ampamp operator david_h OpenFOAM Bugs 1 September 14, 2007 16:58
UDF sample for velocity gradient J.Y.Shin FLUENT 2 January 19, 2007 19:04
how to calculate two vectors's product when using xqy Phoenics 0 August 23, 2002 04:05


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