-
-
October 8, 2023 at 2:51 am
joce0001
SubscriberI have a fluid whose temperature varies depending on the height, I have made the UDF, I have compiled, but I do not know how to enter this UDF as an initial condition, because in the Solution Initialization section there is no way to select UDF.
The UDF programming is as follows
#include "udf.h"
DEFINE_INIT(temperatura_profundidad, domain)
{
  cell_t cell;
  Thread *thread;
  real x[ND_ND];  /* Vector de posición */
  real profundidad;
  real temperatura;  /* Loop sobre todas las celdas en el dominio */
  thread_loop_c(thread, domain)
  {
    begin_c_loop(cell, thread)
    {
      C_CENTROID(x, cell, thread);  /* Obtener las coordenadas del centroide de la celda */
      profundidad = x[1];  /* Asumiendo que la coordenada y representa la profundidad */
      temperatura = -7.1 * profundidad + 298;  /* Aplicar la fórmula de temperatura en función de la profundidad */
      C_T(cell, thread) = temperatura;  /* Definir la temperatura de la celda */
    }
    end_c_loop(cell, thread)
  }
} -
October 9, 2023 at 9:05 am
Rob
Forum Moderatorhttps://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v232/en/flu_udf/flu_udf_ActivatingGeneralSolverUDFs.html%23flu_udf_sec_use_init
-
- The topic ‘UDF DEFINE INIT’ is closed to new replies.
-
3467
-
1057
-
1051
-
929
-
896
© 2025 Copyright ANSYS, Inc. All rights reserved.