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

Fluent UDF for species transport

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 24, 2019, 08:07
Default Fluent UDF for species transport
  #1
New Member
 
Join Date: Apr 2019
Posts: 28
Rep Power: 7
ana86 is on a distinguished road
Dear all,



I want to write an udf to calculate a temperature that depends on the concentration of my material at the interface.

But when I use the macro C_YI(c,t,i) in my code the simulation crashes.

Can you help me, how to use this macro, or does anybody know, what is the best way to take the concentration (or mass fraction) into account?

I use the model "species transport". And I have a mixture-material consisting of two materials.



Thank you for your help!
ana86 is offline   Reply With Quote

Old   September 25, 2019, 02:05
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
show your code, describe in details, how do you start your simulation

best regards
AlexanderZ is offline   Reply With Quote

Old   September 25, 2019, 07:12
Default
  #3
New Member
 
Join Date: Apr 2019
Posts: 28
Rep Power: 7
ana86 is on a distinguished road
Hello Alexander,



for the test I used a simple 2D Case.

The interface motion depends on the temperature and the temperature on the other hand, depends on the concentration at the interface. At the interface I have a "specified mass fraction" boundary condition.



My udf:



#include "udf.h"
#include "sg.h"
#include "mem.h"
#include "stdio.h"
#include "stdlib.h"


DEFINE_GRID_MOTION(interface, domain, dt, time, dtime)
{

Thread *tf = DT_THREAD(dt);
face_t f;
cell_t c;
Node *v;
int n, temp;

int i;

real x[ND_ND];
real T = 1000.;

SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));

begin_f_loop (f, tf)
{
F_CENTROID(x,f,tf);

T = F_T(f,tf);

f_node_loop (f, tf, n)
{
v=F_NODE (f, tf, n);

if (NODE_POS_NEED_UPDATE (v))
{
real TT = T + T * F_YI(f,tf,0);

dispz=(Tm-TT)/1000.0;
NODE_X(v)+=dispz;
NODE_POS_UPDATED (v);
}
}

}
end_f_loop (f, tf)
}



If I use this udf without F_YI(f,t,0) then it works fine.



Thank you und best regards
Ana
Attached Files
File Type: pdf einfachesModell.pdf (82.8 KB, 19 views)
ana86 is offline   Reply With Quote

Old   September 25, 2019, 23:19
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Did you switched on species model?

by the way you had several errors in your code, so I don't know, how it could work

Code:
#include "udf.h"
#include "sg.h"
#include "mem.h"
#include "stdio.h"
#include "stdlib.h"


DEFINE_GRID_MOTION(interface, domain, dt, time, dtime)
{

Thread *tf = DT_THREAD(dt);
face_t f;
cell_t c;
Node *v;
int n, temp;

int i;

real x[ND_ND];
real T = 1000.;
real TT = 0.0;
real dispz = 0.0;
real Tm;

SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));

begin_f_loop (f, tf)
{
F_CENTROID(x,f,tf);

T = F_T(f,tf); 

f_node_loop (f, tf, n)
{
v=F_NODE (f, tf, n);

if (NODE_POS_NEED_UPDATE (v))
{
TT = T + T * F_YI(f,tf,0);

dispz=(Tm-TT)/1000.0;
NODE_X(v)+=dispz;
NODE_POS_UPDATED (v);
}
} 

}
end_f_loop (f, tf)
}
real Tm; is not defined in your code. So dispz=(Tm-TT)/1000.0; can be calculated

best regards

Last edited by AlexanderZ; September 29, 2019 at 22:46.
AlexanderZ is offline   Reply With Quote

Old   September 26, 2019, 02:56
Default
  #5
New Member
 
Join Date: Apr 2019
Posts: 28
Rep Power: 7
ana86 is on a distinguished road
Yes, I switched on the species model, otherwise I couldn't give a mass fraction boundary condition...

The mistakes in the code (e.g. Tm) occurs, because I had to change the code a bit for the forum. I'm not allowed to show the whole code, so it seems that I didn't check the code correctly. But it works fine without F_YI.

I know that I have to set "solve/set/expert" to yes, if I want to use the temperature gradient, maybe there is something equivalent for species transfer?


best regards
ana86 is offline   Reply With Quote

Old   September 26, 2019, 21:05
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
what kind of error do you have?

best regards
AlexanderZ is offline   Reply With Quote

Old   September 27, 2019, 06:44
Default
  #7
New Member
 
Join Date: Apr 2019
Posts: 28
Rep Power: 7
ana86 is on a distinguished road
The error is:

Received signal SIGSEGV


After that, fluent automatically closes.
ana86 is offline   Reply With Quote

Old   September 29, 2019, 22:51
Default
  #8
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
you've mentioned about temperature gradient
but in your code there is no temperature gradient.

all seems to be correct in code above, check parts of code, which you didn't show

best regards
AlexanderZ is offline   Reply With Quote

Old   October 1, 2019, 05:05
Default
  #9
New Member
 
Join Date: Apr 2019
Posts: 28
Rep Power: 7
ana86 is on a distinguished road
I run the simulation with this simple code, with defined Tm and without any temperature gradient. The simulation works, when I did not use the Macro F_YI (I just changed the line TT = T + T*F_YI(f,t,0) to TT = T + T), but when I use the macro fluent crashes. So it seems to be a problem of this macro... I also tried with C_YI(c,t,0), but the same problem occurs...
ana86 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
Compiling UDF in FLuent ekha FLUENT 6 July 3, 2019 04:02
A Problem of Fluent Interpreted UDF: parse error knight Fluent UDF and Scheme Programming 25 August 16, 2018 11:26
Two questions on Fluent UDF Steven Fluent UDF and Scheme Programming 7 March 23, 2018 04:22
How does FLUENT process an UDF!!!!???? Bharadwaj B S Fluent UDF and Scheme Programming 31 March 9, 2015 07:32
Transport mesh from ICEM CFD, to Fluent, to Sysnoise Wieland FLUENT 2 April 15, 2012 07:28


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