Modifying DPM Injection Mass Flow Using UDF — Lesson 4

How do you modify DPM injection mass flow using a user-defined function (UDF)?

If you want to modify injection inputs using UDF, it will require the following DPM macro:

DEFINE_DPM_INJECTION_INIT

This macro provides access to particle variables like the number of particles in a parcel (p->number_in_parcel), DPM mass flow rate (P_FLOW_RATE(p)), etc. These variables are linked as follows:

Stream mass flow rate = (Number of particles in a parcel) *(Mass of single particle) / (injection time interval)

If you want to modify the mass flow rate, you should modify it using P_FLOW_RATE(p) and not by modifying p->number_in_parcel. This is because p->number_in_parcel is derived from P_FLOW_RATE(p).

In general, p->number_in_parcel should never be modified in the UDF. Mass flow rate should be modified by changing P_FLOW_RATE(p) only.