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

Expected moving path of laser in y direction in UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 19, 2021, 09:58
Default Expected moving path of laser in y direction in UDF
  #1
New Member
 
Xu Zhao
Join Date: Jun 2021
Posts: 5
Rep Power: 5
zx145833 is on a distinguished road
Hello, I'm currently simulate the oscillation laser welding process. The waveform of oscillation path in y direction is triangle wave (From zero to amplitude value A, then from A to -A, eventually from -A to zero). The cycle duty is 1/f_osc (f_osc is the oscillation frequency). The program of oscillation path in y direction is as below. Simulation results shows the position in y direction at the initial time-step is -A mm, while 0 mm for the expected result. Anyone who encounters the similar problem. Could you give me some advice? Thanks for your help.

Best wishes, Xu Zhao.

// The program

time=RP_Get_Real("flow-time");
time1=((time*f_osc)-int(time*f_osc))/f_osc; //Time normalization in the
interval [0,T]
if(time1<1/(4*f_osc)) // As aforementioned, the position in y
direction can be regarded as a three-
stage linear functions
{
y=xc[1]-4*A*f_osc*time1; // A is the oscillation amplitude
}
else if(time1>=1/(4*f_osc)&&time1<3/(4*f_osc))
{
y=xc[1]-A+4*A*f_osc*(time1-1/(4*f_osc));
}
else
{
y=xc[1]+A-4*A*f_osc*(time1-3/(4*f_osc));
}
zx145833 is offline   Reply With Quote

Old   June 19, 2021, 15:44
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
You don't show how you define f_osc, there might be a problem there.
If you do one of the following, you will have a problem with integer division that gives the result that you see :

int f_osc=10;
#define f_osc 10

This problem is avoided with these definitions:

float f_osc=10;
#define f_osc 10.0
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   June 19, 2021, 22:49
Default
  #3
New Member
 
Xu Zhao
Join Date: Jun 2021
Posts: 5
Rep Power: 5
zx145833 is on a distinguished road
Quote:
Originally Posted by pakk View Post
You don't show how you define f_osc, there might be a problem there.
If you do one of the following, you will have a problem with integer division that gives the result that you see :

int f_osc=10;
#define f_osc 10

This problem is avoided with these definitions:

float f_osc=10;
#define f_osc 10.0
Thank you for the reply. I didn't pay attention to the details and would correct it and finally the testing is successful. The habit of making program is indeed important. Thanks again.

Xu Zhao
zx145833 is offline   Reply With Quote

Reply

Tags
oscillation laser, udf, welding path


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
Moving Wall velocity in Negative X direction mpapon FLUENT 1 July 1, 2016 11:56
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42
Help please UDF flow direction val17lr FLUENT 2 September 4, 2010 06:30
udf with moving heat source Ryan FLUENT 0 April 10, 2003 20:13
udf for moving and deforming mesh xie haibo FLUENT 4 October 27, 2002 07:45


All times are GMT -4. The time now is 17:55.