|
[Sponsors] |
February 22, 2015, 22:12 |
Turbulent Interactions UDF in Eulerian
|
#1 |
New Member
Join Date: Feb 2015
Posts: 3
Rep Power: 11 |
So I am working on a project at the UNI.
I was told to simulate the turbulent interaction by modifying sources in K and epsilon equations. I am using Eulerian model with Per phase turbulence model. The source is of following equation PI_k = 4/3 * C_d * rho_c *alpha / d_b *|U_r|^3 where:
Anyway, I wrote this udf: Code:
DEFINE_SOURCE(PI_E_wat, cell, phase_t, dS, eqn) { Thread *mt; Thread **all_phase_t; Thread *thread_c, *thread_d; const real c1 = 3.0; const real c2 = 4.0; const real g_force = 9.81; real C_drag, Re_b, U_rel_x, U_rel_y, U_rel, U_r; real rho_c, rho_d, delta_rho, alpha_d, PI_k, PI_E; mt = THREAD_SUPER_THREAD(phase_t); all_phase_t = THREAD_SUB_THREADS(mt); thread_c = all_phase_t[0]; /*THREAD_SUB_THREAD(mix_thread, WATER_ID); liquid phase */ thread_d = all_phase_t[1]; /*THREAD_SUB_THREAD(mix_thread, AIR_ID); gas phase */ U_rel_x = C_U(cell, thread_d) - C_U(cell, thread_c); U_rel_y = C_V(cell, thread_d) - C_V(cell, thread_c); U_r = sqrt(U_rel_x*U_rel_x + U_rel_y*U_rel_y); /* relative velocity from udf */ real d = C_PHASE_DIAMETER(cell, thread_d); alpha_d = C_VOF(cell, thread_d); rho_c = C_R(cell, thread_c); /* water density */ rho_d = C_R(cell, thread_d); /* air density */ delta_rho = rho_c - rho_d; /* delta rho */ Re_b = rho_c * fabs(U_rel) * d / C_MU_L(cell, thread_c); /* Reynolds number with relative velocity*/ C_drag = 24 / Re_b*(1 + 0.15*pow(Re_b, 0.687)); /* Drag coefficient */ PI_k = 3.0 / 4.0*C_drag*rho_c*alpha_d / d*pow(fabs(U_r), 3); PI_E = 1.2 * C_D(cell, phase_t) / C_K(cell, phase_t) * PI_k; dS[eqn] = 0; return PI_E / 2; } Without the UDF i was able to run multiphase simulation with all possible 2-phase interaction in fluent, with Coupled pressure-velocity scheme and solution converged for steady state(good job me). Whenever I include (accordingly written) sources for both phases and turbulent equations, I see this Code:
iter continuity u-water u-air v-water v-air k-water k-air eps-water eps-air iac vf-air time/iter # Divergence detected in AMG solver: k -> Decreasing coarsening group size! # Divergence detected in AMG solver: k -> Increasing relaxation sweeps! # Divergence detected in AMG solver: pressure correction -> Turning off correction scaling! # Divergence detected in AMG solver: pressure correction -> Increasing relaxation sweeps! Error: Divergence detected in AMG solver: pressure correction Error: Divergence detected in AMG solver: pressure correction Error Object: #f Error: WorkBench Error: Could not handle event: SolutionStatusUpdate Error Object: #f From other posts I learned that lower URF, or "coarsening" my mesh might help, so far, nothing works. Can't wait for your suggestions, pointing out my mistakes or in general pointing the direction I should take. Regards, Michal |
|
February 23, 2015, 13:04 |
|
#2 |
New Member
Join Date: Feb 2015
Posts: 3
Rep Power: 11 |
Solved the problem, thread can be deleted.
|
|
February 24, 2015, 04:14 |
|
#3 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Good for you! It could be helpful if you give the solution to your problem in a few words, for if somebody else has a similar problem in the future.
|
|
February 24, 2015, 12:02 |
|
#4 |
New Member
Join Date: Feb 2015
Posts: 3
Rep Power: 11 |
Sure, although it wasn't really "fluent related".
In my formula for Reynolds I used "U_rel", but the relative velocity was assigned "U_r". As a result, Re_b became 0, thus drag coefficient became infinite. The moral of this story is if you see error as I saw, check your variables names |
|
November 12, 2018, 03:57 |
define the thread
|
#5 |
New Member
Dali You
Join Date: Nov 2018
Location: Austria
Posts: 2
Rep Power: 0 |
Hello guys,
I would like to define a two phase threads and calculate the relative velocity as you post, while it always appear erros. I tried to fix the problem line by line. I found the problem is the line 'thread_c = all_phase_t[0]' The code is as following: #include "udf.h" #include "sg.h" #include "sg_mphase.h" #include "flow.h" #include "mem.h" #include "metric.h" /* ************************** Memory and scalar description **************** *\ UDM-0: Gb /* ************************************************** ************************* */ DEFINE_SOURCE(Gb, c, phase_t, dS, eqn) { real Cb, U_rel_x, U_rel_y, U_rel, U_r, source; real rho_c, rho_d, delta_rho; const real g_force = 9.81; Thread *thread_c,*thread_d,*mt; Thread **all_phase_t; /*array*/ mt=THREAD_SUPER_THREAD(phase_t); all_phase_t=THREAD_SUB_THREADS(mt); thread_c = all_phase_t[0];/*THREAD_SUB_THREAD(mt, 1); THREAD_SUB_THREAD(mix_thread, WATER_ID); liquid phase */ thread_d = all_phase_t[1]; /*THREAD_SUB_THREAD(mix_thread, AIR_ID); gas phase */ U_rel_x = C_U(c, thread_d) - C_U(c, thread_c); U_rel_y = C_V(c, thread_d) - C_V(c, thread_c); U_r = sqrt(U_rel_x*U_rel_x + U_rel_y*U_rel_y); /* relative velocity from udf */ /* U_r=sqrt(pow(U_rel_x,2.0)+pow(U_rel_y,2.0))*/ Cb= 0.8; rho_c = C_R(c, thread_c); /* water density */ rho_d = C_R(c, thread_d); /* air density */ delta_rho = rho_c - rho_d; /* delta rho */ source= Cb*C_MU_L(c,phase_t)/C_MU_EFF(c,phase_t)*delta_rho*g_force*C_VOF(c,phas e_t)*U_r;*/ dS[eqn]= 0.0; return source; } The error message: 999999 (..\src\mpsystem.c@1172): mpt_read: failed: errno = 10054 999999: mpt_read: error: read failed trying to read 4 bytes: Invalid argument MPI Application rank 0 exited before MPI_Finalize() with status -1073741819 The fl process could not be started. Thanks for your reading and help! Best regards Dali |
|
Tags |
amg solver, multiphase, pressure correction, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Eulerian multiphase model for species trnasport: UDF for reaction rate | harsh | Main CFD Forum | 3 | June 12, 2017 03:24 |
UDF for fully developed turbulent flow at inlet | soroushsaberi | FLUENT | 0 | May 28, 2014 18:00 |
UDF for 3D turbulent fully developed flow | howhs | Fluent UDF and Scheme Programming | 0 | August 1, 2013 12:47 |
UDF - PDF for turbulent reaction calculations | ronen | Fluent UDF and Scheme Programming | 5 | July 10, 2013 11:31 |
UDF for fully developed turbulent pipe flow | Maged | FLUENT | 1 | June 11, 2005 11:37 |