|
[Sponsors] |
UDF for gradual increase in heat generation with time in FSW tool |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 2, 2020, 12:28 |
UDF for gradual increase in heat generation with time in FSW tool
|
#1 |
New Member
Rohan
Join Date: Mar 2020
Posts: 24
Rep Power: 6 |
Hi everyone,
I am trying to simulate the behaviour of material flow considering the gradual rise in temperature in the fsw tool with time during welding in fluent and need to define this increase with the help of an UDF. Regards, Rohan |
|
August 2, 2020, 20:26 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Ansys Flluent Customization manual
look for define_source macro
__________________
best regards ****************************** press LIKE if this message was helpful |
|
August 3, 2020, 11:34 |
|
#3 |
New Member
Rohan
Join Date: Mar 2020
Posts: 24
Rep Power: 6 |
I have seen the manual early sir but cannot getting how to formulate the whole udf for my case.
|
|
August 4, 2020, 03:02 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
show your code and we will try to fix it, if needed
__________________
best regards ****************************** press LIKE if this message was helpful |
|
August 6, 2020, 00:35 |
|
#5 |
New Member
Rohan
Join Date: Mar 2020
Posts: 24
Rep Power: 6 |
Hi sir, I am basically new to UDF formulation. My main idea that I would like to convey is that, "When the impression of the tool will rotate and traverse along the weld line then heat would gradually increase with time in it", as you can see in the attached file. I have also seen the UDF manual but no fruitful thing happened. So I would like that if you would help then it qipl not only motivate me but also help others in the forum.
|
|
August 6, 2020, 01:54 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
I will not do you job instead of you.
what I recommend, start with constant heat source, make UDF code for that and apply it You can find example in Ansys Fluent Customization manual, look for define_source macro Later add time/coordinate dependence in the code.
__________________
best regards ****************************** press LIKE if this message was helpful |
|
August 6, 2020, 04:51 |
|
#7 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
compile code
Code:
#include "udf.h" #include "math.h" DEFINE_SOURCE(energy_1, c, t, dS, eqn) { real source; real time; time = CURRENT_TIME; if (time >= 275.0) source = 0.0; else if (time >= 12.100000e+002) source = (47.69 * pow(time, 2)) / 3.82; else source = (1400000) / 3.82; dS[eqn] = 0.0; return source; }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
August 7, 2020, 00:52 |
|
#8 |
New Member
Rohan
Join Date: Mar 2020
Posts: 24
Rep Power: 6 |
Hi, @AlexanderZ,
I just saw your interpreted code. If I am not wrong you are trying to say the final code as follows: #include "udf.h" #include "math.h" DEFINE_SOURCE(energy_1, c, t, dS, eqn) { real source; real time; time = CURRENT_TIME; if (time >= 275.0) source = 0.0; else if (time >= 12.100000e+002) source = (47.69 * pow(time, 2)) / 3.82; else source = (1400000) / 3.82; dS[eqn] = 0.0; return source; } But in regard to your above mentioned troubleshooted code of mine a query is their: (1) How to add co-ordinate dependence in the code i.e. how to specify that I want to define this UDF_source code to that particular geometry (impression of tool) only? P.S. Kindly see the attcahment for further details. N.B. (1) The dimension of the plate is 200*150*4 mm (2) The dimension of the impression of the tool is, shoulder radius=12.5 mm pin base radius=3.5 mm pin tip radius=2.5 mm Length of the pin=3 mm Depression of tool inside the plate=0.05 mm Offset of tool along Aluminum side=1.5 mm |
|
August 7, 2020, 04:57 |
|
#9 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
you need to apply this source to zone, where your laser is
get coordinate of each finite cell, check if it within the laser circle or not. and move laser circle in time, of course
__________________
best regards ****************************** press LIKE if this message was helpful |
|
August 7, 2020, 23:21 |
|
#10 |
New Member
Rohan
Join Date: Mar 2020
Posts: 24
Rep Power: 6 |
Hi, @AlexanderZ, from your reply I understood that this UDF should be interpreted in boundary conditions. Ok got it.
But, I cant understood what you said by "check if it within the laser circle or not and move laser circle in time". Kindly elaborate with keeping in mind my model context. For information, In my model their is not any laser source or any thing. Just the tool will get heated up gradually with time. |
|
August 10, 2020, 01:48 |
|
#11 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
ok, so you are simulating friction welding, no idea why I thought about laser welding
so it means, you need to switch between DEFINE_SOURCE to DEFINE_PROFILE macro, cause heat is not volumetric (as in laser welding), but it is surface heat DEFINE_PROFILE is applied as boundary condition to the face concept of code is this: get coordinate of each finite face check if it within the circle of your tool if yes, put source value on the next time step move circle of tool (now coordinates are different, cause it moves in time along welding seam) repeat steps
__________________
best regards ****************************** press LIKE if this message was helpful |
|
August 10, 2020, 11:26 |
|
#12 |
New Member
Rohan
Join Date: Mar 2020
Posts: 24
Rep Power: 6 |
Hi, can you kindly show me how to do it if you are aware of the code. The dimensions of the model are given in my trailing responses. It will help me a lot.
Regards, rohan |
|
August 11, 2020, 01:56 |
|
#13 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
show your code and I'll try to fix it, if needed
__________________
best regards ****************************** press LIKE if this message was helpful |
|
July 28, 2022, 22:18 |
|
#14 |
New Member
Join Date: Apr 2022
Posts: 2
Rep Power: 0 |
Hello Alexander
I am working on a similar case but for laser welding and DEFINE_SOURCE macro. For heat source movement I manually define conditions with using if / else-if condition for each time step. I calculate the position of the laser spot according to defined welding velocity for each time step to see if it works or not. But the code only calculates the first if condition and creates the spot for the first step and does not keep continues. I think I am missing something with looping macros according to the UDF Manual it is mentioned that for DEFINE_SOURCE macro UDF will not need to loop over cells in the thread since ANSYS Fluent is already doing it. thread_loop_c looks like an option but can not find any application in DEFINE_SOURCE. I think there is a easier way for time increment (maybe for macros) in my case but I didnot find it. (Please consider the increment value is not integer - 0.00005sec) Any comment helps, thanks in advance #include "udf.h" #include "math.h" #include "metric.h" #include "sg.h" #include "sg_mphase.h" #include "mem.h" #include "sg_mem.h" #include "flow.h" #include "unsteady.h" #define A 0.24 /*Absorption coefficient*/ #define P 400 /*Laser Power*/ #define re 0.0002 /*radius on top*/ #define ri 0.0001 /*radius on bottom*/ #define r0 0.00006 /*Laser Spot radius*/ #define zi 0.00005 /*cone length parameter lower z axis*/ #define ze 0.0001 /*cone length parameter upper z axis*/ #define v1 1.200 /*laser velocity*/ #define v2 0 /*laser velocity*/ DEFINE_SOURCE(heat_source, c, t, dS, eqn) { real x[ND_ND]; double source = 0.0; //static real laser_center[ND_ND] = { 0, 0, 0 }; C_CENTROID(x, c, t); real time = RP_Get_Real("flow-time"); real H = ze - zi; real radius_vol; real q_cons; radius_vol = M_PI * H * pow(re, 2) + (re * ri) + pow(ri, 2); q_cons = 6 * A * P / radius_vol; if (time == 0.00005 && 0.00055 < x[0] && x[0] < 0.00067 && 0.00055 < x[1] && x[1] < 0.00067) { source = q_cons * exp(-1 * (pow(0.00006, 2.0) / pow(r0, 2))); } else if (time == 0.00010 && 0.00061 < x[0] && x[0] < 0.00073 && 0.00055 < x[1] && x[1] < 0.00067) { source = q_cons * exp(-1 * (pow(0.00012, 2.0) / pow(r0, 2))); } else if (time == 0.00015 && 0.00067 < x[0] && x[0] < 0.00079 && 0.00055 < x[1] && x[1] < 0.00067) { source = q_cons * exp(-1 * (pow(0.00018, 2.0) / pow(r0, 2))); } else if (time == 0.00020 && 0.00073 < x[0] && x[0] < 0.00085 && 0.00055 < x[1] && x[1] < 0.00067) { source = q_cons * exp(-1 * (pow(0.00024, 2.0) / pow(r0, 2))); } else if (time == 0.00025 && 0.00079 < x[0] && x[0] < 0.00091 && 0.00055 < x[1] && x[1] < 0.00067) { source = q_cons * exp(-1 * (pow(0.00030, 2.0) / pow(r0, 2))); } . . . |
|
August 1, 2022, 00:42 |
|
#15 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
problem is in your condition time == 0.00005 -> condition
most likely you want it to be time <= 0.00005 -> condition actually, most likely you will never get exact this time moment time == 0.00005
__________________
best regards ****************************** press LIKE if this message was helpful |
|
Tags |
#fluent #udf #data |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for Time Dependent Heat Flux | imam_mustafa | Fluent UDF and Scheme Programming | 1 | September 23, 2019 04:09 |
pimpleDyMFoam computation randomly stops | babapeti | OpenFOAM Running, Solving & CFD | 5 | January 24, 2018 06:28 |
Question about heat transfer coefficient setting for CFX | Anna Tian | CFX | 1 | June 16, 2013 07:28 |
same geometry,structured and unstructured mesh,different behaviour. | sharonyue | OpenFOAM Running, Solving & CFD | 13 | January 2, 2013 23:40 |
plot over time | fferroni | OpenFOAM Post-Processing | 7 | June 8, 2012 08:56 |