CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   udf: volume fraction gradient in eulerian model (http://www.cfd-online.com/Forums/fluent/35229-udf-volume-fraction-gradient-eulerian-model.html)

jwwang December 5, 2004 18:49

udf: volume fraction gradient in eulerian model
 
hi,everyone, I try to use udf to express solid phase pressure,I compile the UDF in FLUENT with no problem, but when I start calculating, FLUENT gives me this: Error: 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: ()

here is my little UDF: #include "udf.h"

DEFINE_SOURCE(y_solid_pressure, cell, thread, dS, eqn) {

real void_s, con, v_s, source=0.0;

void_s = C_VOF(cell, thread);

con = -8.686*(1.0-void_s)+6.385;

if (Data_Valid_P())

v_s = C_VOF_G(cell, thread)[1];//problem is in this sentence

source = pow(10,con)*v_s;

dS[eqn] = 0.0;

return source; }

ap December 7, 2004 17:42

Re: udf: volume fraction gradient in eulerian mode
 
You can find your answer by looking for similar problem with the temperature gradient in the forum.

You need to add some check to your UDF, because gradients are not defined at the first iteration. Data_Valid_P() is not enough for that.

Regards, ap

jwwang December 7, 2004 18:26

Re: udf: volume fraction gradient in eulerian mode
 
thanks a lot! but when I substitute velocity gadient for the volume fration gradient,it's ok! what checks I need?

jwwang December 7, 2004 19:39

Re: udf: volume fraction gradient in eulerian mode
 
Hi ap,I see your talk about temperature gradient with Satish,there is a sentence if(NULL != THREAD_STORAGE(t0,SV_T_G)) what is the THREAD_STORAGE(t0,SV_T_G) meaning? i cannot find the Marcos in the fluent UDF manual! in my case,how can i use it? thanks!

ap December 8, 2004 07:43

Re: udf: volume fraction gradient in eulerian mode
 
It's a macro which checks if the gradient of the T variable has been stored.

To use it, just replace the thread t0 with the phase thread you need to use, and replace SV_T_G with SV_VOF_G.

You can find the complete list of the variables names in the headers file:

mem.h sg_mem.h sg_mphase.h

Regards,

ap :)

jwwang December 8, 2004 08:03

Re: udf: volume fraction gradient in eulerian mode
 
thanks. i change my UDF according your suggestion, it is work,but i do not known why my original UDF didn't work,in both case, i set the solve/set/expert keep temporary solver memory from being freed? yes.could you tell me why? now my udf is: #include "udf.h"

DEFINE_SOURCE(y_solid_pressure, cell, thread, dS, eqn) {

real void_s, con, v_s, source=0.0;

void_s = C_VOF(cell, thread);

con = -8.686*(1.0-void_s)+6.385;

if (NULL != THREAD_STORAGE(thread,SV_VOF_G))

{

v_s = C_VOF_G(cell, thread)[1];

//Message("it is ok! %f \n", v_s);

}

source = pow(10,con)*v_s;

dS[eqn] = 0.0;

return source; }

ap December 8, 2004 09:05

Re: udf: volume fraction gradient in eulerian mode
 
The line

v_s = C_VOF_G(cell, thread)[1];

tries to read the gradient of the volume fraction of a phase.

At the beginning of a calculation, or when you load you case file after closing FLUENT, gradients are not defined. FLUENT needs at least one iteration to compute gradients. If you try to read them before this happens, you get an access violation error. If you keep the solver memory from beeing free, it works only if data are stil in memory, which is not your case.

THREAD_STORAGE(thread,SV_VOF_G) just checks if the memory location is not void. If it is void, it return NULL. This allows you to check if you can read the variable without errors or not.

Regards, ap :)

jwwang December 8, 2004 18:18

Re: udf: volume fraction gradient in eulerian mode
 
thank you very much! I have another problems about post processing,I use the Eulerian model to simulate the fluidized bed , now, I want to save the data at the different height per time step, for example, I want to save the data at z=1m and 2m, how can i do it?

ap December 9, 2004 15:11

Re: udf: volume fraction gradient in eulerian mode
 
It depends on what you need to save. You can try to use fluent monitors (Solve -> Monitors) on a point, a line or a surface.

Regards,

ap

ap December 9, 2004 15:13

Re: udf: volume fraction gradient in eulerian mode
 
I'm workinng on fludized bed too. What kind of approach are you using for the solid granular phase?

Regards, ap :)

jwwang December 9, 2004 18:07

Re: udf: volume fraction gradient in eulerian mode
 
thanks, so we can talk about it , could you tell me your Email, my email is jwwang@home.ipe.ac.cn. I think the property of solid granular phase(such as granular viscosity and granular pressure)is not important in the simulation, so i treat it by the empirical approch,I think if you want to treat it by the kinetic theory of granular flow,the approach of Gidaspow is insufficient, because in fluidized bed, the characteristics is the heterogeneous structure(cluster or bubble), while, the Gidaspow's theory is based on the homogeneous assumption(Maxwellian distribution)or linear correction to the Maxwellian distribution. if you want to use the KTGF, i recommend the theory in the Physical Review Letter 1998, 81(18)3848.

jwwang December 9, 2004 18:16

Re: udf: volume fraction gradient in eulerian mode
 
I am new to FLUENT, i need the averaged solid phase volume fraction,so i want to save the information about solid phase fraction per time step in some section of the bed and write the data to file. regards, jwwang

jwwang December 9, 2004 18:19

Re: udf: volume fraction gradient in eulerian mode
 
maybe, i mistake what you said, i use the two-fluid model!

jwwang December 10, 2004 08:27

Re: udf: volume fraction gradient in eulerian mode
 
Hi, ap! I have another problem! help me! I calculate the interphase drag coefficient by UDF, at the processing, FLUENT suddenly divergence (at the previous iteration step, the residue is less than 0.01),and i output the interphase drag coefficient,and check it,it is ok! but i am sure the divergence is really caused by the UDF, because when i didn't use UDF, there is no problem! when the fluent is divergence,the velocity or pressure is very large,and give: Error: divergence detected in AMG solver: pressure correction Error Object: ()

ap December 10, 2004 15:59

Re: udf: volume fraction gradient in eulerian mode
 
In unsteady calculation, you can get some averaged variables activating the "Data sampling for time statistics" option in the Iterate panel.

You'll find the avreaged volume fraction in the "Unsteady statistics" menu, in all postprocessing windows.

Regards, ap :)

ap December 10, 2004 16:02

Re: udf: volume fraction gradient in eulerian mode
 
Can you post your drag UDF?

I know this kind of problems are frequent in FLUENT while using UDF. I'm still working on the implementation of a modified form of the kinetic theory for granular flows in FLUENT, and I have serious problems with convergence related to UDF.

Hi,

ap :-D

ap December 10, 2004 16:11

Re: udf: volume fraction gradient in eulerian mode
 
My e-mail is ap.news@virgilio.it

I agree with you. The kinetic theory approach developed by Gidaspow is insufficient, even if it is still considered a valid approach to model fluidized beds.

I'm using the kinetic theory too, but my research focuses on the interaction between the turbulence phenomena of the gas phase in risers and the solid particles.

I didn't read the Physical Review Letter 1998, 81(18)3848, but I'm very interested. Where can I find more information about that kinetic theory?

Hi, ap :)

ap December 10, 2004 16:13

Re: udf: volume fraction gradient in eulerian mode
 
No, you understood my question perfectly. I wanted to know if you're using the kinetic theory or not.

Regards,

ap :)

jwwang December 10, 2004 18:53

Re: udf: volume fraction gradient in eulerian mode
 
you can find it in the Physical Review Letter ,(mianly in) physical review E,journal of fluid mechanics,and physics of fluid. there also has a good book , Nikolai Brilliantov, kinetic theory of granular gases, oxford university press,2004.

jwwang December 10, 2004 19:02

Re: udf: volume fraction gradient in eulerian mode
 
thanks! I have solve the problem, it is because there is zero number in the denominator.


All times are GMT -4. The time now is 00:13.