|
[Sponsors] |
Error when trying to simulate with a DEFINE_SOURCE UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 10, 2017, 05:11 |
Error when trying to simulate with a DEFINE_SOURCE UDF
|
#1 |
New Member
Join Date: Apr 2017
Posts: 3
Rep Power: 9 |
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. |
|
May 10, 2017, 07:37 |
|
#2 |
Member
Join Date: Nov 2016
Posts: 73
Rep Power: 10 |
You need to hook the UDF right
|
|
|
|
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 10:39 |
UDF for Wave Generation and UDF Compilation Error | Engrsdm | Fluent UDF and Scheme Programming | 0 | December 19, 2016 01:50 |
how to simulate a "continuous" boundary in 2D fluent using UDF? | aestas | Fluent UDF and Scheme Programming | 0 | April 28, 2016 07:08 |
I need UDF help. | S.Whitney | FLUENT | 0 | October 15, 2007 12:29 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |