TAGGED: #fluent-#cfd-#ansys, ansys-thermal, convection
-
-
June 16, 2025 at 9:49 am
iitdhn.a
Subscriberhi, I want to apply convention boundary condion on a wall as a functin of varing ambient temperature. I have written a udf for free stream temperature (ambient) as funciton of time but it has unexpected effect in the convection boundary condition at the wall. when I am changing the temperature value in the udf it has no effect on solution. but for expression and as constant free stream temperature it works fine.
-
June 16, 2025 at 10:37 am
-
June 17, 2025 at 12:47 pm
iitdhn.a
SubscriberTahnks you for the reply!
I used the following udf code to define varing ambient temperature and the unit I used in degree C
DEFINE_PROFILE(ambient_temperature_profile, t, i){  real time = CURRENT_TIME;  real hour = time / 3600.0;  real temp;  face_t f;  while (hour >= 24.0)    hour -= 24.0;  if (hour >= 8.0 && hour <= 13.0)  {    temp = -20.0 + ((0.0 + 20.0) / 5.0) * (hour - 8.0); // -20°C → 0°C  }  else if (hour > 13.0 && hour <= 18.0)  {    temp = 0.0 - (15.0 / 5.0) * (hour - 13.0); // 0°C → -15°C  }  else if (hour > 18.0 && hour < 24.0)  {    temp = -15.0 - (5.0 / 6.0) * (hour - 18.0); // -15°C → -20°C  }  else  {    temp = -20.0; // Constant at night (midnight → 8 AM)  }  begin_f_loop(f, t)  {    F_PROFILE(f, t, i) = temp;  }  end_f_loop(f, t)}Â
-
June 17, 2025 at 1:26 pm
Rob
Forum ModeratorÂ
Alter to Kelvin, UDFs use SI units regardless of other settings. Also avoid the arrow symbols in comments, they should be OK but there’s a risk Fluent will see it as something else because of the UNIX legacy.Â
To add, given flow timescales of under a second, and your code being hours you may want to review just how long you intend this model to run for.Â
Â
-
- You must be logged in to reply to this topic.
-
3266
-
1031
-
1004
-
859
-
798
© 2025 Copyright ANSYS, Inc. All rights reserved.