Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

udf for defining density

    • raju.chowdhury
      Subscriber

      I want to use temperature-dependent density for the gas phase (secondary phase) in my VOF multiphase model. The udf is as follows:

      #include "udf.h"

      #include "math.h"

      DEFINE_PROPERTY(cell_density,c,t)

      {

      /* Declare local variables */

      real g_density;

      real temp;

      /* Retrieve temperature of phase 2 */

      Thread *phase_thread = THREAD_SUB_THREAD(t, 1);

      temp = C_T_M1(c, phase_thread);

      /* Apply temperature-dependent density correlation */

      if (temp > 273.0)

      g_density = 486.27 * pow(temp, -1.0);

      else

       g_density = 1.63;

      return g_density;

      }

      While compiling the code, getting the following error:

      ==============================================================================

      Node 0: Process 139300: Received signal SIGSEGV.

      ==============================================================================

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed: No such file or directory

      999999: mpt_accept: error: accept failed:

      ===================================================================================

      = BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES

      = RANK 0 PID 139300 RUNNING AT CNA309-6LJDRZ2

      = EXIT STATUS: -1 (ffffffff)

      ===================================================================================

      The fl process could not be started.

      Also, after compiling the code, fluent is not allowed to initialize. See the below screenshot.

       

      If anyone can help to resolve the issue, that would be great.

      Thanks.

    • Rob
      Forum Moderator

      Why are you using the previous time step data? 

    • raju.chowdhury
      Subscriber

      Yes, got it. It would be C_T instead of C_T_M1. Thank you for noticing that. I will try with this.

    • sjohn
      Subscriber

      Hi Rob, 
      I would also like to implement density change based on temperature but use ideal gas law which requires pressure and temperature. How would I retrieve pressure of phase 2 in the above code? I am not at all familiar with UDF but had learnt the C programming language decades ago. 
      Thanks.

    • Rob
      Forum Moderator

      sjohn - you can't alter density with pressure other than ideal or Real Gas as it messes with the continuity equation. 

      raju - Yes, but check phase calls too. Temperature is a mixture thread variable in VOF, enthalpy is phase thread: I think, hence you checking. 

    • sjohn
      Subscriber

      That's right Rob, I was wondering if I can mimic combustion of a monopropellant to form gasesous products. Using another CFD software my colleague was able to specify reduction in density of the monoprop in cells, wherein the monoprop temperature exceeded the ignition temperature. In Fluent, would I need to write a UDF or is there another way?

    • Rob
      Forum Moderator

      If you can ignore the pressure effect you can have the temperature for density. Or there's sink/source terms for mass based on whatever you need to include. 

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