DEF only works in the DOC (catalytic converter). The urea in DEF breaks down to ammonia when it hits the hot exhaust stream. The Ammonia reacts with NOX to form Nitrogen and water in the DOC. It would have little to no effect if injected downstream of the DPF where there is no catalyst to aid the reaction. As far as I know, DEF is only injected upstream of the DOC. The rate of injection is determined by NOX sensors downstream of the DOC.