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

using one uds in other uds

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 18, 2018, 18:01
Default using one uds in other uds
  #1
New Member
 
Animesh Sahoo
Join Date: May 2018
Posts: 20
Rep Power: 8
sahoo is on a distinguished road
hello everyone,
Actually I am trying to code the following equation :-
[∇α(T)]TJ=-∇UDS2 T/ρ(T) ∇UDS0
So, I need to use UDS0 & UDS2 in third UDS, for which I made the following code :-
Quote:
#include "udf.h"
#include "math.h"

enum
{
teg4,
N_REQUIRED_UDS
};

real k_function(real T)
{
return -1.097 + 1.234e-2*T - 3.736e-5*pow(T,2.) + 3.75e-8*pow(T,3.);
}
real rho_function(real T)
{
return -3.982e-5 + 2.98e-7*T - 4.685*e-10*pow(T,2.) + 2.51e-12*pow(T,3.)
}

DEFINE_DIFFUSIVITY(teg4_diffusivity, cell, thread, i)
{
C_UDSI(c,t,teg4) = k_function(C_T(c,t));
return C_UDSI(c,t,teg4);
}

DEFINE_SOURCE(energy_source, c, t, dS, eqn)
{
dS[eqn] = C_UDSI(c,t,teg2)*(T/rho_function(C_T(c,t)))*C_UDSI(c,t,teg);
return C_UDSI_G(c,t,teg2)*(T/rho_function(C_T(c,t)))*C_UDSI_G(c,t,teg);
}
I am getting errors like teg, teg2 not declared.
Can anyone suggest whether the code is wrong or there is some other way to do it?
sahoo is offline   Reply With Quote

Old   June 18, 2018, 20:15
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Quote:
Originally Posted by sahoo View Post
I am getting errors like teg, teg2 not declared.
Because you have not declared these variables. Add these entries to the enum:

Code:
enum
{
	teg,
	teg1,
	teg4,
	N_REQUIRED_UDS
};
Note that this replaces "teg" with "0", "teg1" with "1" and "teg4" with "2", such that C_UDSI(c,t,teg4) calls the cell value of the third UDS defined.

Quote:
Originally Posted by sahoo View Post
Can anyone suggest whether the code is wrong or there is some other way to do it?
As previously suggested, perhaps write out the equations you are trying to solve in full and compare these with the UDS transport equations in Fluent. Explicitly, start with writing out the equations you are solving for in each spatial direction (considering the variables are vectors with gradients). Next, find the transport equations used by Fluent for the UDS in the theory guide (note: they are scalars, not vectors). Lastly, match these two sets of equations and determine which scalar terms are appropriate for allocating to UDS.
`e` is offline   Reply With Quote

Old   June 19, 2018, 04:40
Default
  #3
New Member
 
Animesh Sahoo
Join Date: May 2018
Posts: 20
Rep Power: 8
sahoo is on a distinguished road
Thanks for your advice, I am going to follow the procedure as described by you.
sahoo 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
Mass transfer UDS between two phases rarnaunot FLUENT 1 June 25, 2018 08:22
Can you explain me how to use UDS? Tleja Fluent UDF and Scheme Programming 0 July 14, 2015 02:52
Set UDS on wall... fivos Fluent UDF and Scheme Programming 2 July 25, 2014 06:57
Calculate UDS flux through the wall ananth_01 FLUENT 0 August 5, 2013 08:33
Doubts UDS Flux, UDS Unsteady for VOF model kel85uk FLUENT 0 March 17, 2010 09:53


All times are GMT -4. The time now is 13:55.