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

Error Using UDF for Multiphase Mass Transfer Problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 22, 2015, 09:02
Unhappy Error Using UDF for Multiphase Mass Transfer Problem
  #1
New Member
 
Ajinkya Pandit
Join Date: Sep 2011
Posts: 8
Rep Power: 15
Ajinkya is on a distinguished road
Hi,

I am trying to implement a simple UDF to understand bubble growth using a VOF model. The purpose of the UDF is to identify zones where interface lies and put a constant source term. Below is the UDF.

Code:
#include "udf.h"
#include "mem.h"
#include "sg.h"
#include "sg_mphase.h"
#include "sg_vof.h"
#include "flow.h"

DEFINE_MASS_TRANSFER(mass_trnsfr, c, mixture_thread, from_phase_index, from_species_index, to_phase_index, to_species_index)
{
  Thread *tp_l, *tp_v;
  real rate;
  tp_v = THREAD_SUB_THREAD(mixture_thread, to_phase_index);
  tp_l = THREAD_SUB_THREAD(mixture_thread, from_phase_index);
  real EPS;
  EPS = 0.05;
  if ((EPS < C_VOF(c,tp_l))&&(C_VOF(c,tp_l)<1-EPS))
    {
      rate = 0.01;
    }
  else
    {
      rate = 0;
    }
  return rate;

}
So now, while I interpret it, it gives the following error:
Line 7: Syntax error

If I compile it, it successfully gets compiled, but when I go to the Interactions tab to use the UDF, it says:
No user-defined functions have been loaded.

Please let me know.

I am using a linux (Red Hat Enterprise Edition) 64 bit computer. The FLUENT version is 14.0.0.

Thanks,
Ajinkya
Ajinkya is offline   Reply With Quote

Old   May 23, 2015, 07:15
Default
  #2
New Member
 
Ajinkya Pandit
Join Date: Sep 2011
Posts: 8
Rep Power: 15
Ajinkya is on a distinguished road
Found the error. Basically, what I think is happening, is that when you declare a variable (variable EPS is of type real) and when you define a variable (EPS = 1e-3) are two seperate things in C. It is important that all your variable declarations be at the start of the function. (eg. double EPS, tolval, y1, y2; int x1, x2; etc.) and then followed by the respective definitions (eg. x1 = 3; y1= 2.21143; etc.).
Failing to do so, the C comiler detects this as an error. This is not a limitation while using C++. Only C.
Ajinkya is offline   Reply With Quote

Reply

Tags
multiphase, udf, vof


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 model Liquid to Gas mass transfer (Stefan Problem) in Fluent? hasib61 Fluent Multiphase 0 December 24, 2014 18:24
Mass Transfer Boundary Problem CFX bfmoura CFX 1 April 11, 2014 18:26
Multiphase Mass transfer UDF issue therandomestname FLUENT 0 April 21, 2011 15:51
Hooking a DPM Particle Heat and Mass Transfer UDF to FLUENT subhankar_bhandari FLUENT 0 August 19, 2010 04:01
Hooking a DPM Particle Heat and Mass Transfer UDF to FLUENT subhankar_bhandari Main CFD Forum 0 August 19, 2010 04:01


All times are GMT -4. The time now is 00:25.