Fluids

Fluids

Crashing UDF wrong input?

    • prebenjs
      Subscriber

      Hi,

      I'm trying to get the volume of the each cell adjacent / on a face. A section of the UDF is shown below. The code crashes when i introduce C_VOLUME. I suspect that it might be caused by the wrong input here but I'm struggling to see what the reason actually is. Can anybody advice me on this ?

      DEFINE_PROFILE(name,th,i)

      face_t f

      cell_t c; 

      mixture_domain = Get_Domain(1);

      Thread* t;

      Thread* t_prim; /*= THREAD_SUB_THREAD(mixture_domain, prim_phase_domain_index);

      Thread* t_sec; /* = THREAD_SUB_THREAD(mixture_domain, sec_phase_domain_index);

      t = Lookup_Thread(mixture_domain, 11);

      begin_f_loop(f, th)

        {

          if PRINCIPAL_FACE_P(f, th)   {

            c = F_C0(f, t); 

            volume_fraction_ = C_VOF(c, t_sec);

      volume =C_VOLUME(c,t); }

    • DrAmine
      Ansys Employee
      Wrong / Bad UDF syntax: You can retrive for t = Lookup_Thread(mixture_domain, 11) the phase level associated face threads. You use then these threads to access whatever you want.
      The DEFINE_PROFILE you are hooking at certain boundary and from there you get the thread pointer "th" (I assume phase level thread for that reason . From that "th" you can check/ or enforce mixture level thread (THREAD_SUPER_THREAD). From that Super_THREAD you can go lower level to have the phase level threads.

      So the problem is now: what is "t": it is declared and defined by you are not looping on it. Moreover is it a cell thread or face thread.
      I recommend attending some training!
Viewing 1 reply thread
  • You must be logged in to reply to this topic.