Fluids

Fluids

UDF using “gradient value” not working in parallel

    • fuad87
      Subscriber

      Hello All,


      I have written an UDF for my UDS. Now I need to use the gradient of that UDS to the momentum eqn as source. The problem is that the gradient of the UDS (C_UDSI_G(c,t,i)[j]) is not available when momentum equation is being solved unless I input "yes" to this “Keep temporary solver memory from being freed?”. But keeping memory is not available in parallel, hence I can use my code only in serial. How can I store the gradient of the UDS and use it as source to the momentum in parallel? TIA

    • DrAmine
      Ansys Employee

      Which release are you using? 

    • fuad87
      Subscriber

      I am using 17.2 academic 

    • DrAmine
      Ansys Employee

      Hi,


      With the documented way to obtain gradients (via Keep temporary solver memory from being freed? yes) I am able to obtain gradient for my UDS in parallel (R19.1).

    • fuad87
      Subscriber

      I couldn't do it in parallel. I don't know why. So tried this, but an error saying "Scalar_Reconstruction" is undefined variable. 


       


      DEFINE_ADJUST(my_adjust,d)


      {


      #if !RP_HOST


      int n;


      int phase_domain_index = 0;  /*primary phase index is 0 */


      Domain *domain;


              cell_t c;


              Thread *t;


      Thread *liq; 


              domain = DOMAIN_SUB_DOMAIN(d,phase_domain_index); 


       


      for (n=0; n

      {


      MD_Alloc_Storage_Vars(domain, SV_UDSI_RG(n), SV_UDSI_G(n), SV_NULL);


      Scalar_Reconstruction(domain, SV_UDS_I(n), -1, SV_UDSI_RG(n), NULL);


      Scalar_Derivatives(domain, SV_UDS_I(n), -1, SV_UDSI_G(n), SV_UDSI_RG(n), NULL);


      }


       


          thread_loop_c (t,d)


      {


      liq = THREAD_SUB_THREAD(t,phase_domain_index);


      begin_c_loop (c,t)


      {


      C_UDMI(c,t,0) = C_UDSI_G(c,liq,0)[0];


      C_UDMI(c,t,1) = C_UDSI_G(c,liq,1)[0];


      C_UDMI(c,t,2) = C_UDSI_G(c,liq,1)[1];


      C_UDMI(c,t,3) = C_UDSI_G(c,liq,2)[1];


      }


      end_c_loop (c,t)


          }


      #endif


       }

    • DrAmine
      Ansys Employee

      The documented approach is working for me in parallel. The approach you are posting is not documented and not supported. Anyway I managed to have gradients based on that approach. Alloc_Storage_Vars is the right function at first. Please help your self by writing debugging messages as they helped me actually to debug the errors.

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