Fluids

Fluids

UDF for evaporation

    • vidyadhar.kpm
      Subscriber

      Hello All,


      I am working on evaporation of a liquid using VOF method.
      I have written the following UDF (single file) for simulating mass transfer.

      When I press the "Run Calculate ----> calculate" button, after interpretation and initialization, I am facing this problem-

      Error: received a fatal signal (Segmentation fault). Error Object: #f

      I request you to help me what is wrong in the UDF.


      #include "udf.h"
      #include "sg_mphase.h"
      #define T_SAT 343
      #define LAT_HT 339.8e3
      #define CON 3.2

      DEFINE_ADJUST(my_adjust,d)
      {
      real source;
      Thread *t0;
      face_t f;
      cell_t c0;
      int ID=3; /* 3 IS THE ZONE ID FOR MENISCUS AS SEEN IN BOUNDARY CONDITIONS PANEL*/
      /*BELOW MENTIONED IS THE POINTER FOR DOMAIN OF PHASE*/
      Domain *domain = Get_Domain (3); /*CHECK WHETHER I HAVE TO SPECIFY 1-MIXTURE OR 2-PRIMARY PHASE OR 3-SECONDARY PHASE.*/
      Thread *thread = Lookup_Thread(domain,ID);
      begin_f_loop(f,thread)
      {
      /*TO SELECT ONE LAYER OF CELLS ADJACENT TO MENISCUS*/
      c0 = F_C0(f,thread); /*See ADJACENT CELL INDEX*/
      t0 = THREAD_T0(thread); /*See ADJACENT CELL THREAD*/
      source= 0.002; /*MENTION SOURCE HERE*/;
      if(C_T(c0,thread) >= T_SAT)
      {
      C_UDMI(c0,t0,0)=source;
      }
      }
      end_f_loop(f,thread) /*the semicolon should be present or not check*/
      }

      DEFINE_MASS_TRANSFER(liq_gas_source,cell,mix_th,fr om_index,from_species_index,to_index,to_species_in dex)
      {
      real m_lg=0;
      Thread *liq=THREAD_SUB_THREAD(mix_th,from_index);
      Thread *gas=THREAD_SUB_THREAD(mix_th,to_index);
      m_lg=C_UDMI(cell,liq,0);
      return (m_lg);
      }

    • DrAmine
      Ansys Employee

      As ANSYS Staff we are not here to debug udfs. But please check if you have defined the UDMI in GUI and verify the ID of the thread you want to pick up: Is it a cell or face zone?

    • vidyadhar.kpm
      Subscriber

      Hello Amine,


      Thanks for the reply.


      I have defined UDMI in GUI by switching the Number of user defined memory locations to 1. Even then I am facing the error upon pressing calculate button.


      Error: received a fatal signal (Segmentation fault).


      Error Object: #f


      I wanted to pickup the "meniscus" zone which is of the type "interior" as seen in the boundary conditions panel with ID=3. Therefore the 'meniscus' comes under face zone.


      I wanted to apply the source terms in one layer of cells adjacent to the "meniscus" in the liquid phase domain. The liquid phase domain is having an ID=3 under "Phases" dialogue box.


      Does compilation instead of interpretation of the UDF solve the purpose as somebody has suggested it?



      Thanks & Regards,


      vidyadhar


       


       

    • DrAmine
      Ansys Employee
      Compilation is always Superior to Interpretation.
    • DrAmine
      Ansys Employee
      Still not getting it sorted it you can just check for the free surface by checking the gradient of Vof instead of the checking a specific interior which is not always aligned with free surface.
    • Karthik R
      Administrator

      Hello,


      Just to add to Amine's comments, make sure you are initializing the model right. One you initialize and provide data for the initial meniscus location, the udf should start populating the UDMIs correctly. You should be able to go to contour plots and see you UDMI value she there. If you are not seeing these correct, you might want to use fprintf and message statement to debug your UDF.


      Also, please check if you are seeing any error messages when you compile and load your UDF.


      please let us know what you find.


      Thanks.


      Best,


      Karthik

    • vidyadhar.kpm
      Subscriber

      Hello Karthik,


      Thanks for the suggestions.


      1) I have initialized the model and patched the required regions with liquid volume fraction 1 in the Fluent GUI panel. Even then I was facing the segmentation fault error.


      2) When I compiled the UDF, I am facing the following issues:


      Upon clicking the Build Button:


      > Copied C:UsersSANTOSHDesktop est/C:UsersSANTOSHDesktop estUDF2_OLD.c to libudfsrc


      Creating user_nt.udf file for 2ddp ...


      (system "copy "C:PROGRA~1ANSYSI~1v171fluent"fluent17.1.0srcudfmakefile_nt.udf "libudfwin642ddpmakefile" ")


      1 file(s) copied.


      (chdir "libudf")(chdir "win642ddp")'nmake' is not recognized as an internal or external command,


      operable program or batch file.


       


      Done.


       


       


      Upon clicking Load Button:


       


      Opening library "C:UsersSANTOSHDesktoptestlibudf"...


      Error: The UDF library you are trying to load (libudf) is not compiled for 2ddp on the current platform (win64).


       


      The system cannot find the file specified.


       


      C:UsersSANTOSHDesktoptestlibudfwin642ddplibudf.dll


       


      Error: The UDF library you are trying to load (libudf) is not compiled for 2ddp on the current platform (win64).nnThe system cannot find the file specified.


      nnC:UsersSANTOSHDesktoptestlibudfwin642ddplibudf.dll


      Error Object: #f


       


       


      3) I think the Lookup_Thread utility needs to be supplied with pointer of mixture domain?


       


      Thanks & Regards,


      vidyadhar


       


       


       

    • DrAmine
      Ansys Employee
      Do you have compiler installed and compiler paths set?
    • Keyur Kanade
      Ansys Employee

      You can use following link for downloading visual studio


      https://www.visualstudio.com/post-download-vs/?sku=xdesk&clcid=0x409&telem=ga


       

    • vidyadhar.kpm
      Subscriber

      Hi,


      Even after compilation, I am facing the same Segmentation Fault.


      I think I have done a mistake in the UDF.


      Instead of assigning UDMI at cells next to 'meniscus' which is an interior zone, now I am using the macro sub_domain_loop to apply source term at UDM which is defined at locations where C_VOF is neither zero nor one.


      Thanks & Regards,


      vidyadhar

Viewing 9 reply threads
  • You must be logged in to reply to this topic.