Fluids

Fluids

ADJUST macro to get second derivatives of converged velocity field

    • uconcorde
      Subscriber

      Hi Amine,


      I am trying to use ADJUST macro to get second derivatives of my converged velocity field, but I got all zero values. Here is the code and procedure I am using. Can you please help me to find any mistake I have?


       


      # include "udf.h"


      DEFINE_ADJUST(adjust_gradient,domain)


      {


      Thread *t;


      cell_t c;


      face_t f;


      domain = Get_Domain(1);


      thread_loop_c(t,domain)


      {


         begin_c_loop(c,t)


         {


            C_UDSI(c,t,0) = C_DUDX(c,t); // calculate d2u/dx2


         }


         end_c_loop(c,t)


      }


      }


       


      Procedure:


      1) Open my .cas file


      2) Interpreted udf


      3) Open my converged .dat file


      4) User defined -> Scalars -> 1 -> Solution Zones: all fluid zones; Flux Function: none; Unsteady Function: none


      5) Solving -> deselect User Scalar 0


      6) Run calculation for 1 time steps


      7) Check contour plot of User Defined Scalar: all zero values.


       


      Best,


      David

    • Rob
      Ansys Employee

      I suspect the solver is clearing the gradient value before it's saved in the case. I'd have a look at UDM rather than UDS: there is a difference, and also check the options in the TUI  /solve/set/expert


      As an aside, please don't post into old threads which are marked as "solved": we don't tend to check in those!


       

Viewing 1 reply thread
  • You must be logged in to reply to this topic.