|
[Sponsors] |
March 11, 2009, 14:57 |
UDF problem (ACCESS VIOLATION)
|
#1 |
Guest
Posts: n/a
|
Hi! sorry , but i am having some problems with a UDF, I am using it for discrete phase model. I can interpret it without problems but when i try to display the particles track i get the next error:
FLUENT received fatal signal (ACCESS VIOLATION) 1. Note exact evets 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: () The UDF is as follows: #include "udf.h" #include "mem.h" DEFINE_DPM_DRAG(particle_drag_force,Re,p) { cell_t c; Thread *t; real drag_force; double cd,epsilon,lkolm,pinelli; epsilon = C_D(c, t); if (Re > 1000) { cd=0.44; } else {cd=24*(1+0.15*pow(Re,0.687))/Re; } lkolm = pow(0.001003/998.2,3); lkolm = pow(lkolm/epsilon,0.25); pinelli = 16.0*lkolm/0.000421-1.0; pinelli = (exp(pinelli)-exp(-pinelli))/(exp(pinelli)+exp(-pinelli)); /* calculate TANH */ pinelli = 0.4*pinelli+0.6; cd=cd/pow(pinelli,2.0); drag_force = 18*cd*Re/24 ; return (drag_force); } I realized that when I change: epsilon = C_D(c, t); by: epsilon = 10000 or any constant value. Everything goes right. if someone cuold help me. |
|
March 12, 2009, 04:39 |
Re: UDF problem (ACCESS VIOLATION)
|
#2 |
Guest
Posts: n/a
|
Hi,
I assume your problem is unsteady in time, so I think the problem is the first iteration. You should iterate one time without using the UDF. Then, when this first iteration is done, you can turn on the UDF and then it should work. This is because Fluent need to calculate the diffusivity first. You can make a if-function in the DEFINE loop like this: real timestep = RP_Get_Real('physical_timestep'); real current_time = RP_Get_Real('current_time'); if (current_time>timestep) { your code } else { drag_force = 0; } Good luck! R Liew |
|
March 12, 2009, 09:25 |
Re: UDF problem (ACCESS VIOLATION)
|
#3 |
Guest
Posts: n/a
|
It doesn't work. I think there is a problem in the function when a use Thread and cell, could you please check it? should I include c,t as arguments?
Thank you! |
|
March 12, 2009, 12:54 |
Re: UDF problem (ACCESS VIOLATION)
|
#4 |
Guest
Posts: n/a
|
You should try this. If it's not working, you should check the UDF manual.
#include "udf.h" #include "mem.h" DEFINE_DPM_DRAG(particle_drag_force,Re,p) { cell_t c; Thread *t; real drag_force; real timestep = RP_Get_Real('physical_timestep'); real current_time = RP_Get_Real('current_time'); if (current_time>timestep) { double cd,epsilon,lkolm,pinelli; epsilon = C_D(c, t); if (Re > 1000) {cd=0.44;} else {cd=24*(1+0.15*pow(Re,0.687))/Re;} lkolm = pow(0.001003/998.2,3); lkolm = pow(lkolm/epsilon,0.25); pinelli = 16.0*lkolm/0.000421-1.0; pinelli = (exp(pinelli)-exp(-pinelli))/(exp(pinelli)+exp(-pinelli)); /* calculate TANH */ pinelli = 0.4*pinelli+0.6; cd=cd/pow(pinelli,2.0); drag_force = 18*cd*Re/24 ; } else { drag_force = 0; } return (drag_force); } |
|
March 12, 2009, 13:13 |
Re: UDF problem (ACCESS VIOLATION)
|
#5 |
Guest
Posts: n/a
|
I am not experienced with interpreted udf, but should not you use "real" (which is a fluent type) instead of "double"?
"real" as the benefit to be immediately adpated either to float or double depending on the fluent version you are running, without having to recompile your udf. Could this be the problem? Frankly I don't know... |
|
March 16, 2009, 09:02 |
|
#6 |
Member
Henrik Ström
Join Date: Mar 2009
Posts: 33
Rep Power: 17 |
c and t are not passed as arguments to the macro and you need to supply these. Change:
cell_t c; Thread *t; to cell_t c = P_CELL(p); Thread *t = P_CELL_THREAD(p); and things should hopefully work! /Henrik |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
access violation | co2 | FLUENT | 5 | November 7, 2010 11:48 |
Access Violation Help!!!!!! | thuy | FLUENT | 0 | March 5, 2008 09:26 |
ACCESS VIOLATION | MHDWill | FLUENT | 1 | September 23, 2007 03:51 |
Access violation - Help please | AlwaysLearning | FLUENT | 3 | August 22, 2006 13:21 |
access violation | R.B.M | FLUENT | 3 | July 11, 2002 06:07 |