|
[Sponsors] |
July 18, 2017, 02:28 |
Define_source macro fluent udf
|
#1 |
New Member
Ali Shehryar
Join Date: Dec 2016
Posts: 13
Rep Power: 9 |
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. |
|
October 29, 2017, 07:25 |
|
#2 |
Senior Member
Micael
Join Date: Mar 2009
Location: Canada
Posts: 157
Rep Power: 18 |
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; } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Two questions on Fluent UDF | Steven | Fluent UDF and Scheme Programming | 7 | March 23, 2018 04:22 |
Problem running fluent with udf on batch | tobi b. | Fluent UDF and Scheme Programming | 3 | April 14, 2016 14:54 |
Running UDF with Supercomputer | roi247 | FLUENT | 4 | October 15, 2015 14:41 |
How does FLUENT process an UDF!!!!???? | Bharadwaj B S | Fluent UDF and Scheme Programming | 31 | March 9, 2015 07:32 |
fluent udf problem: write specific data for every iteration in a file. | nnvoro | Fluent UDF and Scheme Programming | 1 | May 27, 2013 16:26 |