How to modify DPM injection mass flow using UDF?
If you want to modify injection inputs using UDF, you will require the following DPM macro
DEFINE_DPM_INJECTION_INIT
This macro provides access to particle variables like 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.