This was my approach. I just checked my simulations for the attached urban scene. Each surface (roof or facade) was simulated with a 20cm sensor point grid. Very minimal negative results (at most 5 per surface). I got to that point by using the following parameters:
“-ab 5 -ad 50000 -as 4096 -c 1 -dc 0.75 -dp 512 -dr 3 -ds 0.05 -dt 0.15 -lr 8 -lw 2e-07 -ss 1.0 -st 0.15”.
The maximum sensor point count for any single scene was 65000. The surface that provided the most issues was the facade of B1391 facing B1390 (mostly East). I think this was due to a general lack of direct sunlight due to the shading from B1390.
However, I have written a backstop into my code just in case. This is how I ensure that my diffuse stream is non negative.
def calculate_diffuse_irradiance(total_irradiance, direct_irradiance):
if total_irradiance < direct_irradiance:
return direct_irradiance * 0.01
else:
return total_irradiance - direct_irradiance