|
[Sponsors] |
March 7, 2016, 12:03 |
Any help greatly appreciated - Erosion
|
#1 |
New Member
Taz Hussain
Join Date: Feb 2016
Posts: 8
Rep Power: 10 |
Hello fellow CFD compatriots. I am trying to model erosion within Fluent using the DNV erosion model. I am pretty new to UDF's but have managed to come up with the the following. Can someone please look at it and let me know if looks okay?
The equations I am basing it on are on page 11 on http://brage.bibsys.no/xmlui/bitstre...=1&isAllowed=y Heres my code: #include "udf.h" #include "math.h" const float PI =3.141593; 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/* float at=0.0005; /* target area /* DEFINE_DPM_EROSION(DNVV, p, t, f, normal, alpha, Vmag, mdot) { real erosion; real a=alpha; real v=Vmag; real F_alpha; real m=mdot; real V; real F; V=pow(v,2.6); F=A1*pow(((a*PI)/180),1)+A2*pow(((a*PI)/180),2)+A3*pow(((a*PI)/180),3)+A4*pow(((a*PI)/180),4)+ A5*pow(((a*PI)/180),5)+A6*pow(((a*PI)/180),6)+A7*pow(((a*PI)/180),7)+A8*pow(((a*PI)/180),8); erosion=(m*K*V*F)/(pt*at) F_STORAGE_R(f,t,SV_DPMS_EROSION)=erosion; } Looking forward to your replies! Here's my email if you'd prefer to email me on there: taz_78684@hotmail.co.uk Kindest regards, Taz |
|
March 7, 2016, 12:33 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
An important test to see if you made mistakes is to just compile it. If you get errors, you did something wrong. (If you don't get errors, it does not mean you did not make mistakes!)
The code you showed above has some mistakes that the compiler would have seen immediately, so it looks like you did not even try your code! I can see at least two things wrong in the code. Your comments in the code are wrong: Code:
float K= 2.0e-9; /* material constant /* Code:
float K= 2.0e-9; /* material constant */ Code:
erosion=(m*K*V*F)/(pt*at) |
|
March 8, 2016, 06:42 |
|
#3 | |
New Member
Taz Hussain
Join Date: Feb 2016
Posts: 8
Rep Power: 10 |
Quote:
#include "udf.h" #include "math.h" #define PI =3.141593 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(DNVV, 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=(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*PI)/180),1)+A2*pow(((a*PI)/180),2)+A3*pow(((a*PI)/180),3)+A4*pow(((a*PI)/180),4)+ A5*pow(((a*PI)/180),5)+A6*pow(((a*PI)/180),6)+A7*pow(((a*PI)/180),7)+A8*pow(((a*PI)/180),8); erosion=(m*K*V*F)/(pt*at); F_STORAGE_R(f,t,SV_DPMS_EROSION)=erosion; } But now I get an error referring to this line - at=(PI*pow(0.026,2))/4.*sin(a); /* area exposed to erosion */ It says invalid type for pointer deference: double Thank you once again for your help, Regards Taz |
||
March 9, 2016, 07:49 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Two relevant lines:
Code:
#define PI =3.141593 ... at=(PI*pow(0.026,2))/4.*sin(a); Let's do that: Code:
at=(=3.141593*pow(0.026,2))/4.*sin(a); One solution: remove the "=" from your definition: Code:
#define PI 3.141593 Code:
at=(M_PI*pow(0.026,2))/4.*sin(a); Code:
at=(M_PI*pow(0.026,2))/(4.*sin(a)); |
|
March 9, 2016, 07:59 |
|
#5 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
While I am at it: I would simplify your code...
Why do add a variable a that is the same as alpha? Why v the same as Vmag? Why m the same as mdot? And you use "(a*PI)/180" a lot in your code. Make that a variable! But I think it is even wrong to use this... Angle a is already in radians, but it looks like you think a is in degrees and you still have to do the conversion... Thirdly: you use "F" in your erosion calculation, but that is never defined. And you define F_alpha, but you never use it. I guess they refer to the same thing... Altogether: Code:
DEFINE_DPM_EROSION(DNVV, p, t, f, normal, a, v, m) { real V = pow(v,2.6); /* impact velocity of particle raised to constant n */; real at = (PI*pow(0.026,2))/4.*sin(a) /* area exposed to erosion */ real F_alpha=A1*pow(a,1)+A2*pow(a,2)+A3*pow(a,3)+A4*pow(a,4)+ A5*pow(a,5)+A6*pow(a,6)+A7*pow(a,7)+A8*pow(a,8); F_STORAGE_R(f,t,SV_DPMS_EROSION)=(m*K*V*F_alpha)/(pt*at);; } |
|
March 9, 2016, 18:51 |
|
#6 | |
New Member
Taz Hussain
Join Date: Feb 2016
Posts: 8
Rep Power: 10 |
Quote:
Thank you so much for your reply! I really appreciate it. I will implement these changes now and let you know how I get on. Once again thank you so much! Kind regards Taz |
||
June 12, 2016, 16:33 |
|
#7 |
Member
Join Date: Jun 2011
Posts: 86
Rep Power: 15 |
Just a minor correction. It should be:
F_STORAGE_R(f,t,SV_DPMS_EROSION)+=(m*K*V*F_alpha)/(pt*at); You have to remove the density of the wall from the denominator in the above equation if you want the unit to be the same as reported in Fluent. |
|
June 20, 2018, 13:12 |
Did you get it?
|
#8 |
New Member
Edilberto
Join Date: Jun 2018
Posts: 8
Rep Power: 8 |
Hi, I was wondering if you could get the correct coding for DNV erosion prediciton... I am trying to use your code but I get errors
|
|
June 21, 2018, 05:09 |
Double
|
#9 |
New Member
ASA
Join Date: Mar 2017
Location: USA
Posts: 6
Rep Power: 9 |
One more thing to consider is the data structure in C
its a better practice to always stick to "real" format, both for double (~ for double precision) and float (single precision) datatypes For example: change float A1 =9.37; to real A1 = 9.37; and try to define your constant numbers in the same format too... change pow(0.026,2) to pow(0.026,2.) pay attention to the difference between 2 and 2. (=2.0) |
|
May 16, 2019, 11:56 |
|
#10 |
New Member
James Thor
Join Date: May 2019
Posts: 13
Rep Power: 7 |
||
May 16, 2019, 12:02 |
|
#11 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
What is not correct about the code that is given above? If you really need it now, then try it. If you get errors, share them.
|
|
Tags |
dnv, dpm, erosion, fluent, udf |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Erosion Models | Owen_V | Main CFD Forum | 0 | March 26, 2015 20:17 |
FLUENT Erosion DPM (Methane with Sand) - Strange Erosion Contours | chongjqw | FLUENT | 3 | February 22, 2015 22:17 |
FLUENT Erosion DPM - Strange Erosion Contours | chongjqw | FLUENT | 0 | February 7, 2014 03:43 |
DPM - Erosion model | pipin | FLUENT | 2 | November 18, 2013 06:02 |
Erosion problem | Ko | Siemens | 2 | September 24, 2003 08:48 |