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

Error when trying to simulate with a DEFINE_SOURCE UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 10, 2017, 04:11
Default Error when trying to simulate with a DEFINE_SOURCE UDF
  #1
New Member
 
Join Date: Apr 2017
Posts: 3
Rep Power: 8
PapaJoz is on a distinguished road
Hi everyone,

I am currently trying to run a simulation using the VOF model that includes an additional source term for the momentum equation. I'm using version 17, with two phases, air and water. I am using two bits of code, the first uses the DEFINE_PROPERTY macro in order to have a surface tension coefficient that varies with temperature,

#include "udf.h"

DEFINE_PROPERTY(variable_surface_tension, c, t)
{
real T = C_T(c,t);

return 73.5 - 0.000214*(T - 26);
}

The second uses the DEFINE_ON_DEMAND macro to allocate memory, and then the DEFINE_SOURCE macro to write a source term to be included in the momentum equation.

#include "udf.h"

DEFINE_ON_DEMAND(alloc_VOF_grad)
{
#if !RP_HOST
Domain*d = Get_Domain(3);

Message0("\nAllocating memory for C_VOF_G in the mixture domain.\n");
Alloc_Storage_Vars(d, SV_VOF_RG, SV_VOF_G, SV_NULL);
Message0("C_VOF_G is now available in all zones\n");
#endif
}

DEFINE_SOURCE(marangoni,c,t,dS,eqn)

{

real vof, dvof_dx, dvof_dy, source;

vof = C_VOF(c, t);

dvof_dx = C_VOF_G(c,t)[0];

dvof_dy = C_VOF_G(c,t)[1];

double surface_grad [2][2];
surface_grad[0,0] = (dvof_dx-(pow(dvof_dx,3)))*0.00083*C_T_G(c,t)[0];
surface_grad[1,0] = -dvof_dx*(pow(dvof_dy,2))*0.00083*C_T_G(c,t)[1];
surface_grad[0,1] = -dvof_dy*(pow(dvof_dx,2))*0.00083*C_T_G(c,t)[0];
surface_grad[1,1] = (dvof_dy-(pow(dvof_dy,3)))*0.00083*C_T_G(c,t)[1];


source = surface_grad *((((998.2 * vof) + (1.225 * (1-vof))) * (dvof_dx + dvof_dy))/(0.5 * (998.2 + 1.225)));

dS[eqn]=0;

Every time I try to run a simulation I get an error that says that the fl process cannot be started. I'm new to programming and maybe I have made an obvious mistake, so any help would be much appreciated.
PapaJoz is offline   Reply With Quote

Old   May 10, 2017, 06:37
Default
  #2
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 9
h0rst is on a distinguished road
You need to hook the UDF right
h0rst 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 for valve closing a pipe using dynamic mesh chem engineer Fluent UDF and Scheme Programming 2 May 13, 2017 09:39
UDF for Wave Generation and UDF Compilation Error Engrsdm Fluent UDF and Scheme Programming 0 December 19, 2016 00:50
how to simulate a "continuous" boundary in 2D fluent using UDF? aestas Fluent UDF and Scheme Programming 0 April 28, 2016 06:08
I need UDF help. S.Whitney FLUENT 0 October 15, 2007 11:29
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 04:01


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