-
-
February 13, 2025 at 10:08 pm
Prakash Singh
SubscriberHow to get area weighted avg outlet temp at a specific time using udf?
-
February 14, 2025 at 7:40 am
Nilay Pedram
Forum ModeratorHello,
Please refer to this discussion - how to calculate avg temp at outlet? -
February 14, 2025 at 12:29 pm
Prakash Singh
SubscriberThank you.
-
February 16, 2025 at 9:28 am
Prakash Singh
SubscriberHow can I patch the fluid domain using UDF? I want to patch the fluid domain with T= 300 K at t= 0 sec, and T= stored outlet temperature at t=2.1 sec. I have already written a UDF to store the outlet temp.
where t varies as follows:
real t = CURRENT_TIME;for(;;){Â Â Â Â if(t<=4.2)Â Â Â Â Â Â break;Â Â Â Â t=t-4.2;Â Â }Thank you. -
February 17, 2025 at 9:47 am
SRP
Ansys EmployeeHi,
Since you've already written a UDF to store the outlet temperature, you'll need to include a conditional statement within your UDF to check the current simulation time and apply the desired temperature accordingly.
DEFINE_ADJUST macro can be used to make adjustments at every time step based on the current simulation time.
-
February 17, 2025 at 12:44 pm
Prakash Singh
SubscriberDEFINE_EXECUTE_AT_END(patch_temperature)
{
  Domain *d = Get_Domain(1);
  Thread *t;
  cell_t c;
  double t = CURRENT_TIME;  // Adjusting current_time to within 4.2s periodic cycle
  for(;;)
    {
      if(t<=4.2)
          break;
      t=t-4.2;}
// Patching at t = 2.1 sec using stored outlet temperature
  if (fabs(current_time - 2.1) < 1e-3) Â
  {
    Message("Using stored outlet temperature: %f K\n", stored_temp);    thread_loop_c(t, d)
    {
      if (FLUID_THREAD_P(t))
      {
        begin_c_loop(c, t)
        {
          C_T(c, t) = stored_temp;  // Use dynamically stored outlet temperature
        }
        end_c_loop(c, t)
      }
    }
    Message("Temperature patched to %f K at t = 2.1 sec\n", stored_temp);
  }I am attempting this method. However, the issue is that I am not achieving the same outcome as I achieved by manual patching. Kindly see the attached image.
What am I doing wrong?
Thank you for taking your time to read my issue.
-
February 17, 2025 at 12:48 pm
Prakash Singh
Subscriber*Note:Â
// Adjusting current_time to within 4.2s periodic cycle
  for(;;)
    {
      if(t<=4.2)
          break;
      t=t-4.2;}//
please read 't' as 'current_time' in the above code.
-
- You must be logged in to reply to this topic.
- How do I get my hands on Ansys Rocky DEM
- Non-Intersected faces found for matching interface periodic-walls
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Script Error
- Facing trouble regarding setting up boundary conditions for SOEC Modeling
- convergence issue for transonic flow
- Running ANSYS Fluent on a HPC Cluster
- Point exception in erosion calculation
- Errors with multi-connected bodies using AQWA
-
1987
-
896
-
599
-
591
-
408
© 2025 Copyright ANSYS, Inc. All rights reserved.