-
-
October 28, 2019 at 4:58 pm
douniaextra1
SubscriberI wrote a UDF of a source term and temperature in function of time, but I'm not sure if it's right or no, can you please tell me if there is something wrong with it;
#include "udf.h"
#include
Â
DEFINE_SOURCE(Energy_source, c, ct)
{
real source;
real flow_time;
real t = CURRENT_TIME;
 {
if ((t>21600)&&(t<72000))Â
Â
{
source =(965.0*sin(3.14*(((t/3600)-6.0)/14)))*(0.81/0.002);
}
else
{
 source=0;
}Â Â Â
    }
return source;
}
DEFINE_PROFILE(temperature, thread, T)
{
face_t f;
real t = CURRENT_TIME;
    begin_f_loop(f, thread)
    {
Â
F_PROFILE(f, thread, T)=298+6.0*cos(3.14*(((t/3600)-14.0)/12.0));
    }
end_f_loop(f, thread)
}Â Â Â Â Â
Â
-
October 28, 2019 at 5:00 pm
Amine Ben Hadj Ali
Ansys EmployeeI would rather work on that without UDFs easy to do with Expressions. Look ok. By the way we do not debug UDFs. -
October 31, 2019 at 5:44 pm
douniaextra1
SubscriberThank you for replying me,
I tried the expression option in source term but I have a probleme with unitsÂ
the numbers that I used in the equations have a unity. they are not just a constantes, wich means that the equations has a correct unity but fluent doesnot know that. he only see the time variable (t)
do you have any idea about that ?Â
by the way I really appreciate any comment from you, they are so helpfull.
Best regards,
Dounia
-
November 1, 2019 at 8:21 am
Amine Ben Hadj Ali
Ansys EmployeeApart from time other quantities in you expression do not have any dimensions if input into Fluent. You need to make the expression in the sinus function dimensionsless: time can be only added to time and you divide by time. So (t-7)/(12).. the whole expressioneds to be multiplied by 1[W m^-3].
All hints above are in the documentation. -
November 2, 2019 at 11:36 am
douniaextra1
SubscriberThank you I got it know. can you please send me the documentation link that talks about this option so I can learn more.
but in my equation I have a condition of timeÂ
if ((t>21600)&&(t<72000))Â
Â
{
source =(965.0*sin(3.14*(((t/3600)-6.0)/14)))*(0.81/0.002);
}
else
{
 source=0;
}Â Â Â
Â
there is a condition option in Fluent "IF" but I don't know how to use it to you have any idea about that?
Thank you for keeping answering me ...
Best regards,
Dounia
-
November 4, 2019 at 5:56 am
Amine Ben Hadj Ali
Ansys EmployeeCheck FLUENT User's Guide.
IF(CONDITION, IF TRUE, IF FALSE). -
November 5, 2019 at 1:19 pm
douniaextra1
Subscriber thank you I got it know
Best regards,
Dounia
-
- The topic ‘UDF source term’ is closed to new replies.
- air flow in and out of computer case
- Varying Bond model parameters to mimic soil particle cohesion/stiction
- Eroded Mass due to Erosion of Soil Particles by Fluids
- I am doing a corona simulation. But particles are not spreading.
- Centrifugal Fan Analysis for Determination of Characteristic Curve
- Guidance needed for Conjugate Heat Transfer Analysis for a 3s3p Li-ion Battery
- Issue to compile a UDF in ANSYS Fluent
- JACOBI Convergence Issue in ANSYS AQWA
- affinity not set
- Resuming SAG Mill Simulation with New Particle Batch in Rocky
-
4047
-
1462
-
1308
-
1151
-
1021
© 2025 Copyright ANSYS, Inc. All rights reserved.