CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > CFD Freelancers

Define_source macro fluent udf

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 18, 2017, 01:28
Angry Define_source macro fluent udf
  #1
New Member
 
Ali Shehryar
Join Date: Dec 2016
Posts: 13
Rep Power: 9
Shehryar is on a distinguished road
Hello experts!

Hope you are all fine. i am in need to take guidance regarding a small UDF which i wrote to add a source term. Actually i am working on transient Multiphase Eulerian model with one primary phase and one secondary phae. i have deactivated built in gravity and want to introduce a source term in y-momentum equation of secondary phase. Here is my UDF for the said purpose

#include "udf.h"


DEFINE_SOURCE(gravity_source,c,t,dS,eqn)
{
real gravity;
real source;
real density;
Thread *subthread;
subthread=THREAD_SUB_THREAD(t,1);
gravity = 9.8;
density=1000.0;
source = gravity*density*C_VOF(c,subthread);
dS[eqn] = 0.0;
return source;
}

that is, source=gravity x density x volume fraction of secondary phase.


but when i interpret/compile it with FLUENT i receive "Segmentation fault" error due to the presence of term "C_VOF(c,subthread)"
i run my UDF without this term and it runs fine. but i have to use this term to extract the volume fraction in the cell.

if you know where i am at fault please let me know, much appreciated.
Thanks in anticipation.
Shehryar is offline   Reply With Quote

Old   October 29, 2017, 06:25
Default
  #2
Senior Member
 
Micael
Join Date: Mar 2009
Location: Canada
Posts: 156
Rep Power: 18
Micael is on a distinguished road
This should have been posted in FLUENT UDF forum.

I think your DEFINE_SOURCE is passing the primary phase thread and not the mixture one so that THREAD_SUB_THREAD is not doing what you expect.

Code:
#include "udf.h"

DEFINE_SOURCE(gravity_source,c,t,dS,eqn)
{
   real gravity, source, density;
   Thread *tm, *ts;  /* mixture and secondary thread */

   tm = THREAD_SUPER_THREAD(t);  /* get mixture thread */
   ts = THREAD_SUB_THREAD(tm,1); /* get secondary thread */

   gravity = 9.8;
   density=1000.0;
   source = gravity*density*C_VOF(c,ts);
   dS[eqn] = 0.0;

   return source;
}
Micael 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
Two questions on Fluent UDF Steven Fluent UDF and Scheme Programming 7 March 23, 2018 03:22
Problem running fluent with udf on batch tobi b. Fluent UDF and Scheme Programming 3 April 14, 2016 13:54
Running UDF with Supercomputer roi247 FLUENT 4 October 15, 2015 13:41
How does FLUENT process an UDF!!!!???? Bharadwaj B S Fluent UDF and Scheme Programming 31 March 9, 2015 06:32
fluent udf problem: write specific data for every iteration in a file. nnvoro Fluent UDF and Scheme Programming 1 May 27, 2013 15:26


All times are GMT -4. The time now is 08:40.