Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Flow rate control in DPM using UDF(DEFINE_DPM_INJECTION_INIT)

    • cheolmae
      Subscriber

      간단한 문제 이지만 어려웠습니다.

      그래서 다른 분들도 이 글을 보고 도움을 받으시길 바라며, injection 에서 조건에 따라 정상 작동하는 UDF Code를 공유합니다.

      참고로, 이 Code는 특정위치의 센서가 상대습도 50% 미만임을 감지 할 때 작동하고, 50% 이상일 때 작동을 멈추는 물분사 시스템을 구현하는 시스템을 위한 코드입니다.

      ※ 중요

      UDF 작동 전에 UDM을 2개 이상 활성화 하시고, DPM Flow Rate를 제어하는 센서 위치를 Point로 찍고 그것을 Report로 만드십시오.

      그리고 Report를 이용하여 다시 Custom Field Function으로 만드십시오.

      그리고 Command에 다음을 입력하시고 DPM itertation과 같은 Itertation으로 설정 하십시오

      /solve/patch (*) udm-0 yes cf_0

      위에서 cf_0는 Custom Field Function 으로 설정한 이름입니다.

      UDM을 여러개 쓰실 거라면 마찬가지로 여러개 만드셔야 합니다.

      아래는 작동하는 UDF Code 입니다.

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

      #include "udf.h"
      #include "dpm.h"
      #include "dpm_injections.h"
      #include "mem.h"
      #define RH_SET_STD_0 0.5 //Point of Control
      #define RH_SET_ON_0 0.0005 //DPM Flow Rate when ON
      #define RH_SET_OFF_0 0 //DPM Flow Rate when OFF
      DEFINE_DPM_INJECTION_INIT(massflow_0, I)
      {
        real RH_SET_TRIGGER_0 = 0;
        Particle *p;
        loop(p, I->p_init)
        {
          cell_t c = PP_CELL(p);
          Thread *t = PP_CELL_THREAD(p);
          RH_SET_TRIGGER_0 = C_UDMI(c, t, 0);
          if (RH_SET_TRIGGER_0 < RH_SET_STD_0)
          {
            PP_FLOW_RATE(p) = RH_SET_ON_0;
           Message("TRIGGER is ON.  PP_FLOW_RATE(p) : %lg \n", PP_FLOW_RATE(p));
          }
          else
          {
           PP_FLOW_RATE(p) = RH_SET_OFF_0;
           Message("TRIGGER is OFF.\n");
          }
        }
      }

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

    • Rob
      Forum Moderator

      And the translation:

      It was a simple problem, but it was difficult.
      Therefore, hoping that others will find this post helpful, I am sharing a UDF code that operates correctly based on conditions in the injection process.
      For reference, this code is intended for a system implementing a water spraying system that activates when a sensor at a specific location detects 
      relative humidity below 50% and stops operation when it exceeds 50%. ※ Important Before operating the UDF, activate at least two UDMs, mark the sensor locations controlling the DPM Flow Rate as Points, and create a Report from them. Then, use the Report to create a Custom Field Function. Add the following to the Command and set it to the same Iteration as the DPM Iteration: /solve/patch (*) udm-0 yes cf_0 In the above example, cf_0 is the name set for the Custom Field Function. If you plan to use multiple UDMs, you must create multiple of them in the same way. Below is the working UDF code.

       

    • Rob
      Forum Moderator

      Thank you for sharing. 

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
[bingo_chatbox]