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

Hooking multiple erosion UDFs

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 19, 2018, 20:04
Default Hooking multiple erosion UDFs
  #1
Member
 
Bhargav Bharathan
Join Date: Jun 2015
Location: Montreal, Canada
Posts: 71
Rep Power: 11
bhargavbharathan is on a distinguished road
Hello,

I'm running a multiphase flow to determine sand erosion. In addition to the Generic, Oka, Finnie and Mclaury erosion models available in Fluent, I wish to include 4 more erosion models.

I have written the UDFs for them and they compile well without errors. Usually I would hook them up at=>
Models -> Discrete Phase -> UDF -> Erosion/Accretion

But, I can only hook 1 at a time. I want to run all erosion models simultaneously to save on computation time.

Is there something I'm missing?


Thanks,

-B
bhargavbharathan is offline   Reply With Quote

Old   June 20, 2018, 13:26
Default
  #2
New Member
 
Edilberto
Join Date: Jun 2018
Posts: 8
Rep Power: 8
edilbertolg is on a distinguished road
hi there, Could you please share the UDF for erosion models? I dont have any idea on how to write them and I need them, thank you
edilbertolg is offline   Reply With Quote

Old   June 20, 2018, 16:10
Default
  #3
Member
 
Bhargav Bharathan
Join Date: Jun 2015
Location: Montreal, Canada
Posts: 71
Rep Power: 11
bhargavbharathan is on a distinguished road
Quote:
Originally Posted by edilbertolg View Post
hi there, Could you please share the UDF for erosion models? I dont have any idea on how to write them and I need them, thank you
Hi,

I can guide you in writing your erosion UDFs. Use the DEFINE_DPM_EROSION macro. You can find more information about it in the link below:

http://jullio.pe.kr/fluent6.1/help/html/udf/node93.htm

There are a few things to keep in mind:
1. define your constants.
2. specify your impact angle function f_alpha.
3. Write your erosion equation with your defined constants and f_alpha.
4. Save your erosion rate in a user-defined memory or in the default erosion storage: F_STORAGE_R(f,t,SV_DPMS_EROSION)

It is quite simple actually.

-B
bhargavbharathan is offline   Reply With Quote

Old   June 21, 2018, 04:12
Default
  #4
New Member
 
Edilberto
Join Date: Jun 2018
Posts: 8
Rep Power: 8
edilbertolg is on a distinguished road
Good morning, after your reply, I spent all night reading about the topic, I finally was able to "write" something, I am trying to make the DNV erosion model for my dissertation and I wrote this, I did it in notepad but I dont know what if the next step or if that is correct, I would appreciate if you take a look on it. thank you,


#include "udf.h"
#include "math.h"
float A1 =9.37;
float A2 =-42.295;
float A3 =110.864;
float A4 =-175.804;
float A5 =170.137;
float A6 =-98.398;
float A7 =31.211;
float A8 =-4.172;
float K= 2.0e-9; /* material Constant */
float pt=7800; /* density of steel */


DEFINE_DPM_EROSION(DNV, p, t, f, normal, alpha, Vmag, mdot)
{
real erosion;
real a=alpha;
real v=Vmag;
real F_alpha;
real m=mdot;
real V;
real at;
at=(M_PI*pow(0.026,2))/(4.*sin(a)); /* area exposed to erosion */
V=pow(v,2.6); /* impact velocity of particle raised to constant n */
F_alpha=A1*pow(((a*M_PI)/180),1)+A2*pow(((a*M_PI)/180),2)+A3*pow(((a*M_PI)/180),3)+A4*pow(((a*M_PI)/180),4)+ A5*pow(((a*M_PI)/180),5)+A6*pow(((a*M_PI)/180),6)+A7*pow(((a*M_PI)/180),7)+A8*pow(((a*M_PI)/180),8);
erosion=(m*K*V*F_alpha)/(pt*at);
F_STORAGE_R(f,t,SV_DPMS_EROSION)=erosion;
}
edilbertolg is offline   Reply With Quote

Old   June 21, 2018, 10:02
Default
  #5
Member
 
Bhargav Bharathan
Join Date: Jun 2015
Location: Montreal, Canada
Posts: 71
Rep Power: 11
bhargavbharathan is on a distinguished road
Quote:
Originally Posted by edilbertolg View Post
Good morning, after your reply, I spent all night reading about the topic, I finally was able to "write" something, I am trying to make the DNV erosion model for my dissertation and I wrote this, I did it in notepad but I dont know what if the next step or if that is correct, I would appreciate if you take a look on it. thank you,


#include "udf.h"
#include "math.h"

real K= 2.0e-9; /* material Constant */
real pt=7800; /* density of steel */


DEFINE_DPM_EROSION(DNV, p, t, f, normal, alpha, Vmag, mdot)
{
real erosion;
real a=alpha;
real v=Vmag;
real F_alpha;
real m=mdot;
real V;
real at;
at=(M_PI*pow(0.026,2))/(4.*sin(a)); /* area exposed to erosion */
V=pow(v,2.6); /* impact velocity of particle raised to constant n */
F_alpha=A1*pow(((a*M_PI)/180),1)+A2*pow(((a*M_PI)/180),2)+A3*pow(((a*M_PI)/180),3)+A4*pow(((a*M_PI)/180),4)+ A5*pow(((a*M_PI)/180),5)+A6*pow(((a*M_PI)/180),6)+A7*pow(((a*M_PI)/180),7)+A8*pow(((a*M_PI)/180),8);
erosion=(m*K*V*F_alpha)/(pt*at);
F_STORAGE_R(f,t,SV_DPMS_EROSION)=erosion;
}
Hi,

Great job, but may I make a few suggestions to make it easier to read and edit in the future.

1. You can put A1-A8 directly in the UDF. I made an error in the first comment. It is best to define the variables early on and put the constants in the equation. Your F_alpha would then look something like:

f_alpha=9.370*alpha-42.295*pow(alpha,2)+110.864*pow(alpha,3)-175.804*pow(alpha,4)+170.137*pow(alpha,5)-98.298*pow(alpha,6)+31.211*pow(alpha,7)-4.170*pow(alpha,8);


2. While defining K and pt, real is sufficient. I've never tried float but you can try.
3. You need to include the following after the definitions and before you commence your equations. These retrieve and store data in adjacent cells and threads. Your erosion UDF will not compile without these lines.

real A[ND_ND];
Thread *t0;
cell_t c0;
t0 = THREAD_T0(t);
c0 = F_C0(f,t);

4. I'm not sure about the necessity for your line for area exposed to erosion. I don't use it since to my understanding, if we add the lines for (3), fluent will do the rest. But please try with and without it and let me know how it goes.


Best,

-B
bhargavbharathan is offline   Reply With Quote

Old   June 21, 2018, 17:24
Default
  #6
New Member
 
Edilberto
Join Date: Jun 2018
Posts: 8
Rep Power: 8
edilbertolg is on a distinguished road
Hi, I finally get no errors, however, when I try to compile (interpreted), I get these line and fluent crashes after 10 iterations

C:/Users/edilb/AppData/Local/Temp/c5.c.19628.0.c:2: math.h: No such file or directory
C:/Users/edilb/AppData/Local/Temp/c5.c.19444.1.c:2: math.h: No such file or directory
C:/Users/edilb/AppData/Local/Temp/c5.c.9248.2.c:2: math.h: No such file or directory
C:/Users/edilb/AppData/Local/Temp/c5.c.21208.3.c:2: math.h: No such file or directory
C:/Users/edilb/AppData/Local/Temp/c5.c.2204.4.c:2: math.h: No such file or directory
C:/Users/edilb/AppData/Local/Temp/c5.c.7000.5.c:2: math.h: No such file or directory
C:/Users/edilb/AppData/Local/Temp/c5.c.15792.6.c:2: math.h: No such file or directory
C:/Users/edilb/AppData/Local/Temp/c5.c.9244.7.c:2: math.h: No such file or directory
edilbertolg is offline   Reply With Quote

Old   June 21, 2018, 17:27
Default
  #7
Member
 
Bhargav Bharathan
Join Date: Jun 2015
Location: Montreal, Canada
Posts: 71
Rep Power: 11
bhargavbharathan is on a distinguished road
Quote:
Originally Posted by edilbertolg View Post
Hi, I finally get no errors, however, when I try to compile (interpreted), I get these line and fluent crashes after 10 iterations

C:/Users/edilb/AppData/Local/Temp/c5.c.19628.0.c:2: math.h: No such file or directory
C:/Users/edilb/AppData/Local/Temp/c5.c.19444.1.c:2: math.h: No such file or directory
C:/Users/edilb/AppData/Local/Temp/c5.c.9248.2.c:2: math.h: No such file or directory
C:/Users/edilb/AppData/Local/Temp/c5.c.21208.3.c:2: math.h: No such file or directory
C:/Users/edilb/AppData/Local/Temp/c5.c.2204.4.c:2: math.h: No such file or directory
C:/Users/edilb/AppData/Local/Temp/c5.c.7000.5.c:2: math.h: No such file or directory
C:/Users/edilb/AppData/Local/Temp/c5.c.15792.6.c:2: math.h: No such file or directory
C:/Users/edilb/AppData/Local/Temp/c5.c.9244.7.c:2: math.h: No such file or directory
Hi,

Can you run me through your case, setup, BC etc. so I can get a better understanding of the scenario under which this error occurs.

-B
bhargavbharathan is offline   Reply With Quote

Old   June 21, 2018, 17:34
Default
  #8
New Member
 
Edilberto
Join Date: Jun 2018
Posts: 8
Rep Power: 8
edilbertolg is on a distinguished road
I am doing the same process as the one I did for erosion prediction using ansys default,,,, I modelled the pipe bend and mesh, then I stated inlet velocity for gas phase and k-e turbulence, calculate, after converging I activate the DPM where I state the sand properties (velocity, diameter, mass rate, etc) , then I click in run again in order to obtain the erosion rate... I tryed to complile the UDF but I got those lines ,,, then I click in injections and select UDF (erosion ) and run again.. then it crashes...
edilbertolg is offline   Reply With Quote

Old   June 21, 2018, 17:37
Default
  #9
Member
 
Bhargav Bharathan
Join Date: Jun 2015
Location: Montreal, Canada
Posts: 71
Rep Power: 11
bhargavbharathan is on a distinguished road
Quote:
Originally Posted by edilbertolg View Post
I am doing the same process as the one I did for erosion prediction using ansys default,,,, I modelled the pipe bend and mesh, then I stated inlet velocity for gas phase and k-e turbulence, calculate, after converging I activate the DPM where I state the sand properties (velocity, diameter, mass rate, etc) , then I click in run again in order to obtain the erosion rate... I tryed to complile the UDF but I got those lines ,,, then I click in injections and select UDF (erosion ) and run again.. then it crashes...
Hi,

Is your model steady state or transient. Also, is your particle tracking steady state or transient?

-BB
bhargavbharathan is offline   Reply With Quote

Old   June 21, 2018, 17:39
Default
  #10
New Member
 
Edilberto
Join Date: Jun 2018
Posts: 8
Rep Power: 8
edilbertolg is on a distinguished road
both steady state... I dont activate the multiphase function... Basically I solve the continous phase and then I "inject" the sand particles.
edilbertolg is offline   Reply With Quote

Old   June 21, 2018, 17:42
Default
  #11
Member
 
Bhargav Bharathan
Join Date: Jun 2015
Location: Montreal, Canada
Posts: 71
Rep Power: 11
bhargavbharathan is on a distinguished road
Quote:
Originally Posted by edilbertolg View Post
both steady state... I dont activate the multiphase function... Basically I solve the continous phase and then I "inject" the sand particles.
Hi,

I'm not sure you can run erosion without multiphase. It goes Multiphase model -> Discrete Phase (Where you will hook up your erosion UDF) -> Injections.

-BB
bhargavbharathan is offline   Reply With Quote

Old   June 21, 2018, 17:42
Default
  #12
New Member
 
Edilberto
Join Date: Jun 2018
Posts: 8
Rep Power: 8
edilbertolg is on a distinguished road
given that I did not find any tutorial (step by step) on how to get erosion prediction using ansys, I followed the steps stated in this website ..
https://www.ansys-blog.com/erosion-f...mics-modeling/
edilbertolg is offline   Reply With Quote

Old   June 21, 2018, 17:53
Default
  #13
Member
 
Bhargav Bharathan
Join Date: Jun 2015
Location: Montreal, Canada
Posts: 71
Rep Power: 11
bhargavbharathan is on a distinguished road
Quote:
Originally Posted by edilbertolg View Post
given that I did not find any tutorial (step by step) on how to get erosion prediction using ansys, I followed the steps stated in this website ..
https://www.ansys-blog.com/erosion-f...mics-modeling/
Hi,

I've read that post as well and I've tried their steps, it doesn't work. ANSYS Fluent from my knowledge is a very fickle software. The way you setup is different for each case.

I follow some steps which I deem as best practice for erosion simulations in Fluent:

1. Setup the entire case in transient first including multiphase, discrete phase, injections, erosion UDF compiling and hooking up and BC.
2. Go to General and turn steady state ON, delete your injections (its better to write it to a file before deleting) and turn OFF volume fraction under equations in solution controls.
3. Now run the case in steady state till convergence. (This is absolutely critical) Depending on the accuracy you are going for you may change the convergence residuals although smaller the better in this case. I suggest 1e-5 at least.
4. After steady state convergence -> turn ON transient, load your injections, turn ON volume fraction under equations.
5. Run in transient for the duration you wish.

These steps work for me without fail, but my case is in transient. For steady state you may have to tweak a little bit. It is going to involve a lot of trial and errors.

-BB
bhargavbharathan is offline   Reply With Quote

Old   June 21, 2018, 17:57
Default
  #14
New Member
 
Edilberto
Join Date: Jun 2018
Posts: 8
Rep Power: 8
edilbertolg is on a distinguished road
I will try to do it tomorrow.. thank your for your support.. Im going to bed because im really tired (im in the UK) .. thank you again
edilbertolg is offline   Reply With Quote

Old   January 2, 2019, 09:02
Default
  #15
New Member
 
Bob Guo
Join Date: Feb 2016
Posts: 1
Rep Power: 0
bao483 is on a distinguished road
Quote:
Originally Posted by bhargavbharathan View Post
Hello,

I'm running a multiphase flow to determine sand erosion. In addition to the Generic, Oka, Finnie and Mclaury erosion models available in Fluent, I wish to include 4 more erosion models.

I have written the UDFs for them and they compile well without errors. Usually I would hook them up at=>
Models -> Discrete Phase -> UDF -> Erosion/Accretion

But, I can only hook 1 at a time. I want to run all erosion models simultaneously to save on computation time.

Is there something I'm missing?


Thanks,

-B
have you solved this problem? I also want to calculate different erosion models at one time, is it possible to do this in Fluent?
bao483 is offline   Reply With Quote

Old   May 3, 2019, 08:51
Default could you help me
  #16
New Member
 
James Thor
Join Date: May 2019
Posts: 13
Rep Power: 7
Ya Hong is on a distinguished road
Quote:
Originally Posted by bao483 View Post
have you solved this problem? I also want to calculate different erosion models at one time, is it possible to do this in Fluent?
I'm sorry to bother you, but I'm also doing research on this, because I'm weak on programming. Could you please give me a relevant UDF erosion program for study?
Ya Hong is offline   Reply With Quote

Old   May 3, 2019, 08:52
Default Please
  #17
New Member
 
James Thor
Join Date: May 2019
Posts: 13
Rep Power: 7
Ya Hong is on a distinguished road
Quote:
Originally Posted by edilbertolg View Post
I will try to do it tomorrow.. thank your for your support.. Im going to bed because im really tired (im in the UK) .. thank you again
I'm sorry to bother you, but I'm also doing research on this, because I'm weak on programming. Could you please give me a relevant UDF erosion program for study?
Ya Hong is offline   Reply With Quote

Old   May 3, 2019, 08:54
Default Please
  #18
New Member
 
James Thor
Join Date: May 2019
Posts: 13
Rep Power: 7
Ya Hong is on a distinguished road
Quote:
Originally Posted by bhargavbharathan View Post
Hi,

I've read that post as well and I've tried their steps, it doesn't work. ANSYS Fluent from my knowledge is a very fickle software. The way you setup is different for each case.

I follow some steps which I deem as best practice for erosion simulations in Fluent:

1. Setup the entire case in transient first including multiphase, discrete phase, injections, erosion UDF compiling and hooking up and BC.
2. Go to General and turn steady state ON, delete your injections (its better to write it to a file before deleting) and turn OFF volume fraction under equations in solution controls.
3. Now run the case in steady state till convergence. (This is absolutely critical) Depending on the accuracy you are going for you may change the convergence residuals although smaller the better in this case. I suggest 1e-5 at least.
4. After steady state convergence -> turn ON transient, load your injections, turn ON volume fraction under equations.
5. Run in transient for the duration you wish.

These steps work for me without fail, but my case is in transient. For steady state you may have to tweak a little bit. It is going to involve a lot of trial and errors.

-BB
I'm sorry to bother you, but I'm also doing research on this, because I'm weak on programming. Could you please give me a relevant UDF erosion program for study?
Ya Hong is offline   Reply With Quote

Old   May 16, 2019, 11:58
Default
  #19
New Member
 
James Thor
Join Date: May 2019
Posts: 13
Rep Power: 7
Ya Hong is on a distinguished road
Quote:
Originally Posted by bhargavbharathan View Post
Hello,

I'm running a multiphase flow to determine sand erosion. In addition to the Generic, Oka, Finnie and Mclaury erosion models available in Fluent, I wish to include 4 more erosion models.

I have written the UDFs for them and they compile well without errors. Usually I would hook them up at=>
Models -> Discrete Phase -> UDF -> Erosion/Accretion

But, I can only hook 1 at a time. I want to run all erosion models simultaneously to save on computation time.

Is there something I'm missing?


Thanks,

-B
Can you tell me the correct procedure? I really need it right now. I input it and I get a zero erosion rate.
Ya Hong 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
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 07:09
how can i use multiple udfs hami9293 Fluent UDF and Scheme Programming 15 May 27, 2020 20:25
Interpreting Multiple UDFs Sarah.Tiani Fluent UDF and Scheme Programming 5 January 18, 2013 05:52
OpenFOAM static build on Cray XT5 asaijo OpenFOAM Installation 9 April 6, 2011 13:21
Multiple UDFs Graeme FLUENT 4 August 28, 2004 16:47


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