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

Pulsed laser udf

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 28, 2018, 04:36
Post Pulsed laser udf
  #1
Member
 
Saurabh Das
Join Date: Jul 2018
Posts: 43
Rep Power: 7
Sorabh is on a distinguished road
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)
        }    
}
On running this udf, the temperature of the region does not change, but stays equal to the initial temperature.
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.
Sorabh is offline   Reply With Quote

Old   August 28, 2018, 05:31
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
Please check the value of "vol". For double data type, the lower bound is at the order of 10^{-308}, which means exp(-vol) \approx 0, for vol > 710. As a result, the expression involving "exp(-vol)" will be zero if r > 1.33e-3.
blackmask is offline   Reply With Quote

Old   August 28, 2018, 06:08
Default
  #3
Member
 
Saurabh Das
Join Date: Jul 2018
Posts: 43
Rep Power: 7
Sorabh is on a distinguished road
Quote:
Originally Posted by blackmask View Post
Please check the value of "vol". For double data type, the lower bound is at the order of 10^{-308}, which means exp(-vol) \approx 0, for vol > 710. As a result, the expression involving "exp(-vol)" will be zero if r > 1.33e-3.
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.
Sorabh is offline   Reply With Quote

Old   August 28, 2018, 06:36
Default
  #4
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
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.
blackmask is offline   Reply With Quote

Old   August 29, 2018, 01:39
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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);
best regards
Sorabh likes this.
AlexanderZ is offline   Reply With Quote

Reply

Tags
if-else, pulsed laser


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
UDF for vapor pressure anuarun Fluent UDF and Scheme Programming 12 December 24, 2021 10: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


All times are GMT -4. The time now is 22:30.