|
[Sponsors] |
November 4, 2016, 19:47 |
VOF pulsating boundary condition UDF
|
#1 |
New Member
Join Date: Nov 2016
Posts: 1
Rep Power: 0 |
Hey all!
Im currently attempting to write a udf for a velocity inlet to turn on and off the volume fraction as a function of time (starting on and pulsing every 5 seconds). Ive tried to cobble together a code from other similar things but I am very inexperienced with C and really am unsure what a lot of the macros and such really mean. Below is what I have for the UDF but I get parsing errors when I try to interpret it and "Error: received a fatal signal (Segmentation fault)." when I tried running it at one point. Any help would be great and thanks ahead of time! #include"udf.h" DEFINE_PROFILE(volume_fraction, t, mixture_domain) { int phase_domain_index; cell_t cell; Thread *cell_thread; Domain *subdomain; real time; time = CURRENT_TIME; sub_domain_loop(subdomain, mixture_domain, phase_domain_index) { thread_loop_c(cell_thread,subdomain) { begin_c_loop(cell, t) if (DOMAIN_ID(subdomain) == 2) { if((time=>0) && (time<5)) { C_VOF(cell,time)=1; } if((time=>5) && (time<10)) { C_VOF(cell,time)=0; } if((time=>10) && (time<15)) { C_VOF(cell,time)=1; } if((time=>15) && (time<20)) { C_VOF(cell,time)=0; } if((time=>20) && (time<25)) { C_VOF(cell,time)=1; } } end_c_loop(cell, time) } } } |
|
November 7, 2016, 17:35 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
The segmentation fault is caused by your variables which are not initialised (including subdomain, mixture_domain and phase_domain_index). Regardless, you shouldn't need to specify domain and thread loops for boundary UDFs, instead these are applied at a certain boundary from the GUI. Try following the logic of this UDF; note that you can use a conditional statement to alternate between on/off instead of specifying all time periods.
|
|
Tags |
transient, udf, vof |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
sliding mesh problem in CFX | Saima | CFX | 46 | September 11, 2021 08:38 |
write a UDF to give a velocity boundary condition at an interior face | Tharanga | Fluent UDF and Scheme Programming | 19 | August 5, 2018 05:29 |
Basic Nozzle-Expander Design | karmavatar | CFX | 20 | March 20, 2016 09:44 |
Phase-dependent boundary condition for two-phase flow simulation using the VOF method | Rui_27 | Fluent UDF and Scheme Programming | 0 | February 4, 2016 12:04 |
VOF Outlet boundary condition in cfd - ace | JM | Main CFD Forum | 0 | December 15, 2006 09:07 |