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

What the macro of concentration in species model?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 9, 2019, 09:12
Default What the macro of concentration in species model?
  #1
Senior Member
 
kbaker's Avatar
 
Khalid Baker
Join Date: Mar 2009
Location: IRAQ
Posts: 168
Rep Power: 17
kbaker is on a distinguished road
Hello I am using the transport species model and I want to define the density of mixture as a UDF in terms of temperature and concentration as the definition on the picture, but I do not know how I can write the macro of concentrations may somebody help with it I am so grateful for that?

Khalid
Attached Images
File Type: jpg d.jpg (4.0 KB, 41 views)
kbaker is offline   Reply With Quote

Old   October 9, 2019, 22:25
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by kbaker View Post
Hello I am using the transport species model and I want to define the density of mixture as a UDF in terms of temperature and concentration as the definition on the picture, but I do not know how I can write the macro of concentrations may somebody help with it I am so grateful for that?

Khalid
C_YI can get the mass fraction of a species. C_R gets the mixture density. So C_R(c,t)*C_YI(c,t,iSpecies) is just the concentration of iSpecies, unit is kg/m3.
gearboy is offline   Reply With Quote

Old   October 10, 2019, 04:49
Default
  #3
Senior Member
 
kbaker's Avatar
 
Khalid Baker
Join Date: Mar 2009
Location: IRAQ
Posts: 168
Rep Power: 17
kbaker is on a distinguished road
Thanks a lot gearboy for the reply. Actually I am little confused about your answer, the UDF I want to use is for the mixture density (i.e. C_R(c,t)? so how I can use it again as C_R(c,t)*C_YI(c,t,iSpecies) inside the definition?

Khalid
kbaker is offline   Reply With Quote

Old   October 10, 2019, 06:41
Default
  #4
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by kbaker View Post
Thanks a lot gearboy for the reply. Actually I am little confused about your answer, the UDF I want to use is for the mixture density (i.e. C_R(c,t)? so how I can use it again as C_R(c,t)*C_YI(c,t,iSpecies) inside the definition?

Khalid
I mean the value of C_R(c,t) is the mixture density (kg/m3). C_YI(c,t,i) is the mass fraction of species index i in the mixture (kg/kg mixture).
gearboy is offline   Reply With Quote

Old   October 10, 2019, 07:20
Default
  #5
Senior Member
 
kbaker's Avatar
 
Khalid Baker
Join Date: Mar 2009
Location: IRAQ
Posts: 168
Rep Power: 17
kbaker is on a distinguished road
Yes I aware that but I cannot imagine how to define the density of mixture as C_R(c,t) then used the same macro inside the same definition? Can you please write to me the definition I sent and send me it here? I am so grateful for that?


Khalid
kbaker is offline   Reply With Quote

Old   October 10, 2019, 21:53
Default
  #6
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by kbaker View Post
Yes I aware that but I cannot imagine how to define the density of mixture as C_R(c,t) then used the same macro inside the same definition? Can you please write to me the definition I sent and send me it here? I am so grateful for that?


Khalid
C_R(c,t) is a read-only value that gets the mixture density in Fluent, not defined by yourself.
gearboy is offline   Reply With Quote

Old   October 11, 2019, 04:57
Default
  #7
Senior Member
 
kbaker's Avatar
 
Khalid Baker
Join Date: Mar 2009
Location: IRAQ
Posts: 168
Rep Power: 17
kbaker is on a distinguished road
Quote:
Originally Posted by gearboy View Post
C_R(c,t) is a read-only value that gets the mixture density in Fluent, not defined by yourself.
I wrote the UDF for the definition for density of mixture? but some errors appeared to me while I interpreted it as below :

D:\\Kolsi\\den.C:15: macro `C_YI' used with only 2 args
temp definition shadows previous definition
Error: D:\\Kolsi\\den.C: line 11: parse error.
Error: D:\\Kolsi\\den.C: line 12: parse error.
Error: D:\\Kolsi\\den.C: line 13: m_t: undeclared variable

Here is the UDF


#include "udf.h"
DEFINE_PROPERTY(cell_density, cell, thread)
{
real rhm,rho,To,Co,betaT,betaC;
real temp = C_T(cell, thread);
rho= 1.16;
Co=0.35;
To=300;
betaT=3.33e-3;
betaC=-0.34;
cell_t cell;
Thread *m_t; /*mixture thread*/
begin_c_loop_all (cell,m_t)
{
rhm = rho*(betaT*(temp-To)-betaC*(C(R,T)*C_YI(c,m_t)-Co)); /* density of mixture */
}
end_c_loop_all (cell,m_t)
return rhm;
}

Last edited by kbaker; October 11, 2019 at 11:24.
kbaker is offline   Reply With Quote

Old   October 12, 2019, 02:49
Default
  #8
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by kbaker View Post
I wrote the UDF for the definition for density of mixture? but some errors appeared to me while I interpreted it as below :

D:\\Kolsi\\den.C:15: macro `C_YI' used with only 2 args
temp definition shadows previous definition
Error: D:\\Kolsi\\den.C: line 11: parse error.
Error: D:\\Kolsi\\den.C: line 12: parse error.
Error: D:\\Kolsi\\den.C: line 13: m_t: undeclared variable

Here is the UDF


#include "udf.h"
DEFINE_PROPERTY(cell_density, cell, thread)
{
real rhm,rho,To,Co,betaT,betaC;
real temp = C_T(cell, thread);
rho= 1.16;
Co=0.35;
To=300;
betaT=3.33e-3;
betaC=-0.34;
cell_t cell;
Thread *m_t; /*mixture thread*/
begin_c_loop_all (cell,m_t)
{
rhm = rho*(betaT*(temp-To)-betaC*(C(R,T)*C_YI(c,m_t)-Co)); /* density of mixture */
}
end_c_loop_all (cell,m_t)
return rhm;
}
Put all variable definition before any operation. At least I found you defined "Thread *m_t" after "betaT=3.33e-3;" It's not allowed in pure C programming. And change "temp" to another name.
gearboy is offline   Reply With Quote

Old   October 12, 2019, 03:31
Default
  #9
Senior Member
 
kbaker's Avatar
 
Khalid Baker
Join Date: Mar 2009
Location: IRAQ
Posts: 168
Rep Power: 17
kbaker is on a distinguished road
I did that and also correct the mass fraction macro to C_R(c,t) it mentioned incorrectly but there is still error sticky with me:
Error: D:\Kolsi\\density.txt: line 14: t: undeclared variable

Here is the UDF
#include "udf.h"
DEFINE_PROPERTY(cell_density, cell, thread)
{
Thread *m_t; /*mixture thread*/
real rhm,rho,To,Co,betaT,betaC;
real T= C_T(cell, thread);
rho= 1.16;
Co=0.35;
To=300;
betaT=3.33e-3;
betaC=-0.34;
begin_c_loop_all (cell,m_t)
{
rhm = rho*(betaT*(T-To)-betaC*(C_R(c,t)*C_YI(c,t,0)-Co)); /* density of mixture */
}
end_c_loop_all (cell,m_t)
return rhm;
}
kbaker is offline   Reply With Quote

Old   October 14, 2019, 06:42
Default
  #10
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
"m_t" and "t" has no value in your code. Use "thread" from FLUENT instead.

Please read UDF manual carefully. Your basic concepts are not clear.




Quote:
Originally Posted by kbaker View Post
I did that and also correct the mass fraction macro to C_R(c,t) it mentioned incorrectly but there is still error sticky with me:
Error: D:\Kolsi\\density.txt: line 14: t: undeclared variable

Here is the UDF
#include "udf.h"
DEFINE_PROPERTY(cell_density, cell, thread)
{
Thread *m_t; /*mixture thread*/
real rhm,rho,To,Co,betaT,betaC;
real T= C_T(cell, thread);
rho= 1.16;
Co=0.35;
To=300;
betaT=3.33e-3;
betaC=-0.34;
begin_c_loop_all (cell,m_t)
{
rhm = rho*(betaT*(T-To)-betaC*(C_R(c,t)*C_YI(c,t,0)-Co)); /* density of mixture */
}
end_c_loop_all (cell,m_t)
return rhm;
}
gearboy 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
How to simulate the entire cooling system at a single run in Macro model ? nareshzeeda1994 FLUENT 0 March 14, 2018 03:39
Species transport model of platelets and other activating factors Nadun19 FLUENT 0 April 21, 2017 22:18
Inlet gas species concentration Deependra FLUENT 0 August 13, 2015 13:22
Concentration of species aalansari FLUENT 0 August 23, 2014 10:18
negative species concentration again Andrew Garrard FLUENT 0 March 22, 2005 12:36


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