Surface normal for Lambertian diffusion

Dear David,

Thank you for your reply. My final goal is to create a model of a Lambertian diffuse reflector for optical photons. Unfortunately, any other user routines, like frghns.f, won’t allow to do so. Thank you for your hint about METAL property and correct definition of NEWREG region. I’ve corrected my initial model and it seemed to work kind of ok (the result is on picture below).


OpticV2.inp (1.8 KB)
usrmed_V2.f (2.6 KB)

But I’ve faced with another riddle. In order not to create another separate topic, may I ask you another question concerning to usrmed.f routine:
In order to reproduce true Lambertian diffuse reflection I need to find a vector normal to the boundary surface between two regions (Region 1 and Region 2) at a point where initial optical photon would hit. Does FLUKA have some kind of built-in function that could calculate directional cosines of this normal vector at the point of interaction? (In my usrmed_V2.f file I did it manually, but this is not the case when the boundary surface has a complex shape). Thank you in advance.

Dear Alexy,

you can get the surface normal with the built in function:

SUBROUTINE GEONOR (XA, YA, ZA, U, V, W, NREG, IOLREG, NSURF, UNOR, VNOR, WNOR)

The input variables are:
XA, YA, ZA: Particle coordinates
U, V, W: Particle direction
NREG: The new region of the crossing
IOLREG: The old region of the crossing
NSURF: Unused, any integer value is fine

The output variables:
UNOR, VNOR, WNOR: The direction cosines of the surface normal.

In case of reflections, the old and new regions may need to be swapped to get the normal pointing in the correct direction.

Cheers,
David

1 Like

Dear David,

Thank you for your reply. This function is what I was looking for.