September 10, 2024 at 12:59 pm
warhammer975
Subscriber
I tried to write a function to determine the wall cells of the inner cylinder (id=5) for pumping air into them, but so far Fluent refuses to understand this mass flow...
#include "udf.h"
Â
Â
DEFINE_EXECUTE_AT_END(find_first_near_wall_cells)
{
  Domain *domain;
  Thread *wall_thread;
  face_t f;
  cell_t c;
  Thread *adjacent_thread;
  real cell_dist;
Â
  domain = Get_Domain(1);
  Â
Â
  wall_thread = Lookup_Thread(domain, 5);Â
Â
Â
  begin_f_loop(f, wall_thread)
  {
   Â
    c = F_C0(f, wall_thread);
Â
   Â
    adjacent_thread = THREAD_T0(wall_thread);
    cell_dist = C_WALL_DIST(c, adjacent_thread);
Â
Â
    if (cell_dist < 0.001)
    {
      Message("Found adjacent cell to wall at face: %d\n", c);
    }
  }
  end_f_loop(f, wall_thread)
}
Â
DEFINE_ADJUST(adjust_mass_source, domain)
{
  Thread *t;
  cell_t c;
  real mass_flow = 2; Â
  real cell_dist;
Â
Â
  thread_loop_c(t, domain)
  {
    begin_c_loop(c, t)
    {
Â
      cell_dist = C_WALL_DIST(c, t);
Â
Â
      if (cell_dist < 0.001) Â
      {
Â
        C_UDMI(c, t, 0) = mass_flow; Â
      }
    }
    end_c_loop(c, t)
  }
}
Â