|
[Sponsors] |
UDF Parse Error - Initializing VOF for Multiphase Simulation |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 25, 2018, 02:07 |
UDF Parse Error - Initializing VOF for Multiphase Simulation
|
#1 |
New Member
Brandon Johnson
Join Date: Jul 2017
Posts: 6
Rep Power: 9 |
I'm having a hard time writing a UDF for patching the volume fraction for a phase in my domain at the start of a solution.
Big picture: I am running a 2-way coupled transient FSI simulation that has a transient frame motion angular velocity UDF. To make things more complex, the simulation is also multiphase (water & air). Ordinarily, I'd just patch the air region using by marking the cells; but this does not seem to save the initialization state for system coupling and I get errors. I've been looking into solving this problem that initializes the VOF from a UDF at the start of the solution process. But if somebody has a more elegant solution, I'm all ears. I have little experience in C (I prefer python) so I'm quite irritated by what I think is probably a very simple error. The following UDF is taken from: https://www.sharcnet.ca/Software/Flu...udf/node98.htm Code:
/***************************************************************** UDF for initializing phase volume fraction ******************************************************************/ #include "udf.h" /* domain pointer that is passed by INIT function is mixture domain */ DEFINE_INIT(patch_vof, mixture_domain) { int phase_domain_index; cell_t cell; Thread *cell_thread; Domain *subdomain; real xc[ND_ND]; /* loop over all subdomains (phases) in the superdomain (mixture) */ sub_domain_loop(subdomain, mixture_domain, phase_domain_index) { /* loop if secondary phase */ if (DOMAIN_ID(subdomain) == 3) /* loop over all cell threads in the secondary phase domain */ thread_loop_c (cell_thread,subdomain) { /* loop over all cells in secondary phase cell threads */ begin_c_loop_all (cell,cell_thread) { C_CENTROID(xc,cell,cell_thread); if -0.35<NODE_X(xc[0])<0.35 && 0.0<NODE_Y(xc[1])<0.2 && -0.05<NODE_Z(xc[2])<0.05 C_VOF(cell,cell_thread) = 1.; else C_VOF(cell,cell_thread) = 0.; } end_c_loop_all (cell,cell_thread) } } } I found a thread: patch region with UDF That claims to have a working UDF, but I've tested it and it does not work. It makes use of ND_SUM and sqrt, but the "if" statement doesn't seem to be evaluating anything (just a sqrt of a sum). I really don't know what to do; but I feel that it should be extremely simple to an experienced UDF programmer. Thanks |
|
Tags |
initialization, multiphase, user defined functions, volume of fluid |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Huge file sizes when Running VOF simulation | aarratia | FLUENT | 0 | May 8, 2014 12:27 |
Simulation with UDF for species mass fraction and velocity profile | virgy | Fluent UDF and Scheme Programming | 8 | February 7, 2012 04:30 |
parse error with interpreting UDF | ivanbuz | Fluent UDF and Scheme Programming | 2 | August 13, 2009 18:29 |
UDF parse error at profile function line | Wiggy | Fluent UDF and Scheme Programming | 1 | July 27, 2009 15:59 |
Difficult BCs about Freesurface Simulation by VOF | Yongguang Cheng | FLUENT | 0 | September 19, 2003 07:39 |