CFD Online Logo CFD Online URL
Home > Forums > FLUENT

someting wrong with my udf:DEFINE_SOURCE for species

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By classic1573

LinkBack Thread Tools Display Modes
Old   December 28, 2013, 09:25
Post DEFINE_SOURCE for species
New Member
Join Date: Dec 2013
Posts: 5
Rep Power: 5
classic1573 is on a distinguished road
Now, I directly put out my udf problem:

First, I have to describe the physical model:
It is about the simulation of SO2 absorbtion by limestone slurry in desulfurization tower. I choose the Euler--Lagarange model. Of course, the continous phase is gas phase which is put in species transport model, contains two species,one is SO2 and another is air. Limestone slurry droplet is put in DPM modol use droplet particle type.

Second, I treat the SO2 absorbtion process as the SO2 negtive mass source, and use the DEFINE_SOURCE macro to deal with it. In order to access the particle phase,I have to use the Particle *p to get the particle thread. The following is the source code:

#include "udf.h"
#include "dpm.h"
#define Drop_density 1087.56
#define E 10.
#define surface_intense_force 2.3e-2

/* predefine function to calculate the relative velocity */
real urel(Particle *p,cell_t c,Thread *t)
real urelx=abs(C_U(c,t)-p->state.V[0]);
real urely=abs(C_V(c,t)-p->state.V[1]);
real urelz=abs(C_W(c,t)-p->state.V[2]);
real urel=sqrt(urelx*urelx+urely*urely+urelz*urelz);
return urel;

real S_g_so2=0.;
real total_mass=0.,mean_mass=0.;
real total_diam=0.,mean_diam=0.;
real total_urel=0.,mean_urel=0.;
real total_p_temp=0.,mean_p_temp=0.;
real Aint=0.;
int i=0;
real Re,Sc,Sh,k_g_so2,Hso2,D_l_so2,f,k_l_so2,K_G,P_g_so 2;
/* particle index for looping over all particles */
Particle *pi;
/* loop over all particles in the cell to find their mass and weighted mean velocity and diameter */


/* calculation for the so2 source */


/* calculation for the area of mass transfer in per volume unit */

/* calculation for k_g_so2 */

/* calculation for Re */
/* calculation for Sc */
/* calculation for Sh */
/* calculaton for k_g_so2 */

/* calculation for Herry constant */

/* calculation for k_l_so2 */

/* calculation for D_l_so2 */

/* calculation for f */

/* calculation for k_l_so2 */

/* calculation for K_G */

/* calculation for P_g_so2 */

/* calculation for S_g_so2 */
return S_g_so2;

Third,compiling and loading was successful(and without udf, fluent words well), but when I start to calculate, the problem shows as this:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: #f

I think there are two problems:
1 begin_particle_cell_loop(pi,c,t){}end_particle_cel l_loop(pi,c,t) can not been used in DEFINE_SOURCE. When i delete it, the fluent can calculate but the result may not right,because of the second problem that i noticed next;
2 This is a DEFINE_SOURCE for species, so I think that the thread "t" is a "species_lever"(I don't konw if it is right to call it "species_lever" thread, because there are "mixture_lever"and "phase_lever"thread mentioned in udf manual,but never heared a "species_lever"),if we want to find the C_VOF(c,t,i),thread "t" must be a mixture_lever for multiphase or a phase_lever for a single phase(the contnious phase that i used is single phase contains two species), we konw that we can get the mixture_lever thread from phase_lever thread use THREAD_SUPER_THREAD(phase_lever thread), and get the phase_lever thread from mixture_lever thread use THREAD_SUB_THREAD(mixture_lever thread,phase id),but how can we get a phase_lever thread or mixture_lever thread from the so called "species_lever"thread ?

I really really want someone to help me dealing with this problem or providing me some advice or giving me another way and code(like DEFINE_MASS_TRANSTER , DEFINE_VR_RATE and so on) to cope with such process or even sending me a right code if you have ever did the same project, because I shared almost all things that i have studied in the past six month
Here is my;
Thinks for help;
HyperNova likes this.

Last edited by classic1573; December 29, 2013 at 03:15.
classic1573 is offline   Reply With Quote

Old   April 24, 2015, 14:54
Senior Member
Join Date: May 2014
Location: Ir
Posts: 121
Rep Power: 5
HyperNova is on a distinguished road
hi, have you solved your problem ? let me know if you have ,thanks a lot
HyperNova is offline   Reply With Quote



Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
udf error srihari FLUENT 1 October 31, 2016 15:18
turbineSiting tutorial and paraview-3.98.0 pajot OpenFOAM Paraview & paraFoam 4 September 14, 2013 10:19
Wrong results from motorByke tutorial in OpenFoam 2.1.1 jsc OpenFOAM Running, Solving & CFD 3 April 16, 2013 07:26
Wrong oriented faces due to opposite face bends? Arnoldinho OpenFOAM 5 August 16, 2012 05:00
BuoyantBoussinesqSimpleFoam and axial-symmetric results wrong mass flow Thomas Baumann OpenFOAM 6 December 21, 2009 11:31

All times are GMT -4. The time now is 16:20.