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

initialization species UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 25, 2009, 05:19
Default initialization species UDF
  #1
New Member
 
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 17
louiza is on a distinguished road
Hello everyone,
this UDF syntax of the initialization of different-density of species is it correct?
thank you for your answer

///////////////////////////////////////////
DEFINE_INIT(udf_init_temp, domain)
{
cell_t c,c0,c1,c2,c3,c4;
Thread *t,*t0, *t1, *t2,*t3, *t4;
real coord[ND_ND];

thread_loop_c(t,domain)
{
begin_c_loop_all(c,t)
{
C_CENTROID(coord,c,t);
if (coord[1] < 0.0005)
C_T(c,t) = 10000.0;
C_R(c0,t0)= 1E24; /* densiy of Ar */
C_R(c1,t1)= 2E22; /* density of Ar+ */
C_R(c2,t2)= 1E2; /* density of Ar2+ */
C_R(c3,t3)= 1E2; /* density of Ar3+ */
C_R(c4,t4)= 2E22; /* density of electrons */

}
end_c_loop_all(c,t)
}
}
louiza is offline   Reply With Quote

Old   November 25, 2009, 07:25
Default It needs modifications
  #2
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
Hi Louiza,
Your udf lacks correct values for c0, c1, c2, c3, c4, t0, t1, t2, t3, t4. It should give you segmentation fault.
First of all, I don't think you can set the density for species, but the mass fraction. In your case, the modification should be as following:
Code:
///////////////////////////////////////////
DEFINE_INIT(udf_init_temp, domain)
{
   cell_t c;
   Thread *t;
   real coord[ND_ND];

   thread_loop_c(t,domain)
   {
      begin_c_loop_all(c,t)
      {
         C_CENTROID(coord,c,t);
         if (coord[1] < 0.0005) 
         C_T(c,t) = 10000.0;
         C_YI(c,t,0)= 1E24; /* mass fraction of Ar */ 
         C_YI(c,t,1)= 2E22; /* mass fraction of Ar+ */
         C_YI(c,t,2)= 1E2; /* mass fraction of Ar2+ */ 
         C_YI(c,t,3)= 1E2; /* mass fraction of Ar3+ */
         C_YI(c,t,4)= 2E22; /* mass fraction of electrons */

      }
      end_c_loop_all(c,t)
   }
}

Last edited by dmoroian; November 25, 2009 at 09:27.
dmoroian is offline   Reply With Quote

Old   November 25, 2009, 09:13
Smile
  #3
New Member
 
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 17
louiza is on a distinguished road
Hi Dragos Moroianu

Thank you for your relpy, exactely with this UDF, i receive message error "segmentation violation".
louiza is offline   Reply With Quote

Old   November 25, 2009, 09:19
Default
  #4
New Member
 
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 17
louiza is on a distinguished road
I have just the density of species, how i can calculate mass fraction, have you any idea?
thank you
louiza is offline   Reply With Quote

Old   November 25, 2009, 09:53
Default
  #5
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
Hello Louiza,
The udf I posted should not crash if you have defined 5 species!

density = mass/volume => mass = density*volume

Dragos
dmoroian is offline   Reply With Quote

Old   November 25, 2009, 10:55
Default
  #6
New Member
 
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 17
louiza is on a distinguished road
Hi Dragos

Your UDF works fine without error, i have another question please, i need to initialize the mass fraction of species in temperature 10000 K trought UDF, and this same species in 1000 k in the pannel solve>initialize.

can i initialize all species at 1000 and 10 000k througt UDF?

my second question:

mass=density/volume, i 'm very bad in kinetic law how a calculate a volume, can i use pv = nRT?

Thank you dragos
louiza is offline   Reply With Quote

Old   November 26, 2009, 04:05
Default
  #7
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
Hi Louiza,
I suspect you have one number for each species, representing the average density of that species in the entire computational domain. It this is the case, then the volume we are talking about is ... the entire domain.
In this approach (transport species), the temperature is defined only for the mixture, not for each species individually. Otherwise, you have to take another approach (Euler/Euler maybe).

Dragos
dmoroian is offline   Reply With Quote

Old   November 26, 2009, 04:56
Smile
  #8
New Member
 
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 17
louiza is on a distinguished road
Hi Dragos

Thank you for your answer.
Good day

louiza
louiza 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
UDF species equations louiza FLUENT 4 March 10, 2010 02:20
PB: Saving mass fraction of species on two points with an udf biget.a FLUENT 2 July 23, 2009 04:06
UDF for species mass fractions MRR FLUENT 0 December 29, 2005 08:14
Retrieving species in UDF Fernando FLUENT 0 September 3, 2004 09:22
UDF reading species data of pdf simulations Jamiro FLUENT 0 June 20, 2001 18:15


All times are GMT -4. The time now is 12:09.