|
[Sponsors] |
![]() |
![]() |
#1 |
Member
Saurabh Das
Join Date: Jul 2018
Posts: 43
Rep Power: 8 ![]() |
Hello, I am writing a udf that will allow me to apply laser at a given point repetitively.
In the following udf, laser will be applied for the first 1 second, followed by a lull for the next half second. Laser will fire again for a half second, and then the laser will fall silent. Code:
#include "udf.h" #define a 0.2e-3 //radius of laser beam #define I 1.05e9 //Laser Intensity DEFINE_PROFILE(heat_Momin_flux, thread, position) { face_t f; double x[ND_ND],r,t,tempp,vol,ft; t = CURRENT_TIME; //assigning current time vallue to t begin_f_loop(f,thread) { tempp = F_T(f,thread); F_CENTROID(x,f,thread); r = sqrt(pow(x[0],2.0) + pow(x[1],2.0)); vol = (r*r)/(a*a); //exponential for laser if (t >=0 && t < 1) ft = 1; else if (t >= 1 && t < 1.5) ft = 0; else if (t >= 1.5 && t < 2) ft = 1; else ft = 0; F_PROFILE(f,thread,position) = I*ft*exp(-vol); end_f_loop(f,thread) } } I do think that the if else ladder is creating a problem. But I am not too sure. Please help me, I would be thankful to you if you could point out the error in this code. |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Member
Saurabh Das
Join Date: Jul 2018
Posts: 43
Rep Power: 8 ![]() |
The equation in which the exp(-vol) is used is the laser equation and as such, the value of exp(-vol) indicates the effect of laser at a given distance. Points at a farther distance will have higher vol, thus exp(-vol) will be almost equal to zero, indicating no effect of laser at points far away from laser application, but the points which are closer to the point of laser application will have larger change in heat flux.
|
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
|
You should count the cells which have non-zero values, say, "exp(-vol) > 1.0e-15". And you might need to sum up all the heat flux caused by the laser and make appropriate normalization rather than rely on the analytical expression.
|
|
![]() |
![]() |
![]() |
![]() |
#5 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 ![]() ![]() |
you may try to use UDMI variable to check your profile.
Add following line in your code Code:
F_UDMI(F,t,0)= I*ft*exp(-vol); |
|
![]() |
![]() |
![]() |
Tags |
if-else, pulsed laser |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for vapor pressure | anuarun | Fluent UDF and Scheme Programming | 13 | June 23, 2024 13:12 |
Replicating Scalable Wall Function with a UDF | yousefaz | FLUENT | 0 | August 4, 2017 02:30 |
Source Term UDF VS Porous Media Model | pchoopanya | Fluent UDF and Scheme Programming | 1 | August 28, 2013 06:12 |
DEFINE_GEOM UDF Problems | Pat | FLUENT | 0 | August 14, 2003 13:16 |
UDF on-off Pulsed velocity inlet | Samuel | FLUENT | 0 | March 10, 2002 22:07 |