CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Problem with using UDF to modify viscosity

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By teethfish
  • 1 Post By akm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 3, 2013, 10:15
Default Problem with using UDF to modify viscosity
  #1
New Member
 
teethfish
Join Date: Jul 2012
Posts: 7
Rep Power: 13
teethfish is on a distinguished road
Hi, I want to modify the viscosity in K-W SST model in Fluent 13.0. But I met a problem that my UDF cannot initiate and it shows that:
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: #f

I have tried initialise without using "compute from" ....but the error was still there, I pasted my UDF here, if anone can help me with that?

#include "udf.h"

DEFINE_TURBULENT_VISCOSITY(user_mu_t,c,t)
{
real mu_t;
real a;
real rho;
real k;
real d;

a=(C_R(c,t)-0.5542)/997.6458;
rho = 0.5542+a*a*997.6458;

k = C_K(c,t);
d = C_D(c,t);
mu_t = M_keCmu*rho*k*k/d;
return mu_t;
}
dongchao yang likes this.
teethfish is offline   Reply With Quote

Old   February 4, 2013, 08:03
Default Specific dissipation rate C_O(c,t)
  #2
akm
New Member
 
Join Date: Jan 2010
Location: Netherlands
Posts: 28
Rep Power: 16
akm is on a distinguished road
If you are working with k-w turbulence model, the dissipation rate C_D(c,t) will not be available in the UDFs as it is not calculated by the solver. Instead, specific dissipation rate is calculated C_O(c,t).

For the purpose of your udf calculation, you can covert \omega to \epsilon as under:
http://www.cfd-online.com/Wiki/Speci...ssipation_rate
soheil_r7 likes this.
akm is offline   Reply With Quote

Old   February 4, 2013, 09:47
Default
  #3
New Member
 
teethfish
Join Date: Jul 2012
Posts: 7
Rep Power: 13
teethfish is on a distinguished road
Wow, thank you for your help, you really helped me a lot!
And I have one more question, when i use this UDF:

DEFINE_TURBULENT_VISCOSITY(user_mu_t,c,t)
{
real mu_t;
real a;
real rho;
real k;
real d;

a=(C_R(c,t)-0.5542)/997.6458;
rho = 0.5542+a*a*997.6458;

k = C_K(c,t);
d = C_D(c,t);
mu_t = M_keCmu*rho*k*k/d;
return mu_t;
}

with realizable k-epsilon model, the results diverged, but it worked well with the RNG-kepsilon model, are they actually different?


Quote:
Originally Posted by akm View Post
If you are working with k-w turbulence model, the dissipation rate C_D(c,t) will not be available in the UDFs as it is not calculated by the solver. Instead, specific dissipation rate is calculated C_O(c,t).

For the purpose of your udf calculation, you can covert \omega to \epsilon as under:
http://www.cfd-online.com/Wiki/Speci...ssipation_rate
teethfish is offline   Reply With Quote

Old   May 1, 2013, 09:20
Default
  #4
Member
 
Sheng
Join Date: Jun 2011
Posts: 62
Rep Power: 14
micro11sl is on a distinguished road
Hi teethfish,
Did you get your problem sorted?
I have some problems using the modified turbulent viscosity problem as well. I guess, although you hook a same udf to different turbulence models, there're something different more than the udf. The boundary condition, wall treatment, may be different. So a possible circumstance is the solution behavior is different between two distinct turbulence model with an identical udf.

I am still investigating this.

Sheng
micro11sl is offline   Reply With Quote

Old   May 17, 2013, 07:33
Unhappy Error occurs in UDF for DPM viscosity
  #5
New Member
 
Barbara
Join Date: May 2013
Posts: 4
Rep Power: 12
Babs is on a distinguished road
Hello to you all,

I hope I post this in the right place, I did not found a more appropriate one...for an atomizer jet I have to write an UDF to express non- newtonian behaviour for the liquid phase. It is not possible to choose any non- newtonian models like cross or carreau or power- law for the DPM- material so I have to write this UDF. I want to realize the model of CROSS with this UDF.

I compiled this UDF and everything works fine but after exactly 9 iteration steps the same error as descriped above ocurrs:

Error:
Ansys 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 contributor.
Error: Object f#

The code I use for realizing the UDF (and that causes this error) is:
------------------------------------------------------------------

#include "udf.h"
#include "dpm.h"


DEFINE_DPM_PROPERTY(cell_viscosity_CROSS_m2, c, t, p)
{
real mu_INF,mu_0,k,mu_CROSS,m;
double aux,SR;

SR=C_STRAIN_RATE_MAG(c,t);


k=0.01372;
m=0.7857;
mu_0=1.885;
mu_INF=0.05320;
mu_CROSS=DPM_MU(p);


aux=pow(SR,m);

mu_CROSS=mu_INF+(mu_0-mu_INF)/(1+k*aux);

return mu_CROSS;
}


I treid it out in steady, in transient, I changed the URF, I just interpreted it I compiled it, but nothing helps...I guess there is some error in the code that I do not see....actually my programming skills are quite bad and I do not have any experience at all with UDF.

I would really appreciate if someone could help me or has some advice for me. Greetings and thank you, have a nice weekend!
Babs is offline   Reply With Quote

Old   May 17, 2013, 08:07
Default
  #6
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
Check one of the pointers before actually access them. Try add the highlighted line to see whether it helps.


Quote:
Originally Posted by Babs View Post


DEFINE_DPM_PROPERTY(cell_viscosity_CROSS_m2, c, t, p)
{
real mu_INF,mu_0,k,mu_CROSS,m;
double aux,SR;

if ( NULLP(T_STORAGE_R_NV(t, SV_U_G)) ) return;


SR=C_STRAIN_RATE_MAG(c,t);


k=0.01372;
m=0.7857;
mu_0=1.885;
mu_INF=0.05320;
mu_CROSS=DPM_MU(p);


aux=pow(SR,m);

mu_CROSS=mu_INF+(mu_0-mu_INF)/(1+k*aux);

return mu_CROSS;
}

blackmask is offline   Reply With Quote

Old   May 17, 2013, 08:29
Default
  #7
New Member
 
Barbara
Join Date: May 2013
Posts: 4
Rep Power: 12
Babs is on a distinguished road
Hello Blackmask,

Thank you for your quick response and your advice. I tried it out but it did not work, the same error occurs at the same iteration step.

Maybe there is something wrong with the usage of the macro DPM_MU(p)? I tried to vary the posibilietes to include this (still I am not sure if I need it) but nothing changes...:-(
Babs is offline   Reply With Quote

Old   May 17, 2013, 09:31
Default
  #8
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
I did not see that your error occurs after several iterations. Did the calculation tends to diverge before the error occurred?
blackmask is offline   Reply With Quote

Old   May 17, 2013, 13:28
Default
  #9
New Member
 
Barbara
Join Date: May 2013
Posts: 4
Rep Power: 12
Babs is on a distinguished road
No, not at all...it neither brings any messages of divergences. The residuals are normal and tend to fall than to rise.
Babs is offline   Reply With Quote

Old   May 20, 2013, 04:16
Default
  #10
New Member
 
Barbara
Join Date: May 2013
Posts: 4
Rep Power: 12
Babs is on a distinguished road
Quote:
Originally Posted by blackmask View Post
I did not see that your error occurs after several iterations. Did the calculation tends to diverge before the error occurred?
But as I found out, before this error occurs, there is brought a message "Advancing DPM injection..." and then the error occurs. So I guess it has directly to do with the particle model and with the code. When I set the viscosity to a constant value it works.

Has anyone any ideas?
Babs is offline   Reply With Quote

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with divergence TDK FLUENT 13 December 14, 2018 06:00
Problem UDF for Turbulen viscosity fevi84 Fluent UDF and Scheme Programming 2 June 25, 2017 18:25
Help !! UDF for second phase viscosity. yong FLUENT 2 January 24, 2007 11:11
parallel UDF problem kerem FLUENT 2 June 20, 2006 06:56
Help - UDF for solid shear viscosity nbh2801 FLUENT 0 April 21, 2006 07:49


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