Fluids

Fluids

Temperature initialization issue

    • Dilini
      Subscriber

      Hello,

      I've got a simple UDF that contains the initial temperature values in my domain changing with depth. I have used a scalar and assigned the temperature values in it. Below is a part of my code.

      DEFINE_INIT(temp_profile1, domain)

      {

        cell_t c;

        Thread* t;

        cell_t c0;

        Thread* t0;

        real xc[ND_ND];

        real z;


        thread_loop_c(t, domain)

        {

          begin_c_loop_all(c, t)

          {

            C_CENTROID(xc, c, t);

            z = xc[2];


            if (0 <= z && z <= 7.5)

              C_UDSI(c, t, 3) = 295.00;


            else if (7.5 < z && z <= 12)

              C_UDSI(c, t, 3) = 295.00 - 0.05 * (z - 7.5);

       else

              C_UDSI(c, t, 3) = 294.775;

          }

          end_c_loop_all(c, t)

        }

      }


      After I initialize, I expect a temperature value of 295 at top, and a change in the region 7.5-12 m, and a constant 294.775 after that, However, when I view it I get the following.

    • Rob
      Ansys Employee
      What size is the model? UDFs use SI so z is in metres.
    • Dilini
      Subscriber
      z is going from 0 to 55 meters. x is going from 0 to 150,000 m. In the contour plot I have used a scaling factor of 0.001 for x.
    • Rob
      Ansys Employee
      Can you change the scale and plot with node values off? Just realised that 294.775 rounds to 2.95e2 ie the plot is correct but you've not got sufficient digits on the plot to show it.
Viewing 3 reply threads
  • You must be logged in to reply to this topic.