irfpy.util.surfaceframe

An implementation of conversion to surface-interaction frame.

Code author: Yoshifumi Futaana

Surface interaction frame (SIF) is defined as follows. Inpinging angle, ti, is defined by the angle between the negate of the inpinging velocity vector (-vi) and the surface normal, ns.

ti = angle(-vi, ns)

From the outgoing velocity vector (vo), two angles are defined. The outgoing elevation angle, to, is defined as

to = angle(vo, ns)

The azimuthal angle, po, is the angle of the outgoing vector projected on the surface from that of the incoming angle This can be calculated by

|po| = angle( cross(vi, ns), cross(vo, ns) )

The +/- of po should also be considered, i.e.

Sign( ns dot cross(cross(vi, ns), cross(vo, ns) )
irfpy.util.surfaceframe.tosif(invec, outvec, normvec)[source]

Calculate the SIF values from the given vectors.

Three input parameters (3-element array-like or Vector3d instance) are needed. The instances will not be changed (const). @param invec A impinging vector in arbitrary coordinate system. @param outvec A outgoing vector in arbitrary coordinate system. @param normvec A normal vector in arbitrary coordinate system.

@retval ti, to, po A tuple of three angles in degrees.

If the invec is anti-parallel to normvec, ti=0, po=0 is returned. The condition ti > 90 or to > 90 is not acceptable from a physical point of view, but the calculated values are returned (with warning) since mathematically they can be calculated.

>>> t0, t1, p1 = tosif([-1, 0, -1],
... [-1/math.sqrt(2), 1/math.sqrt(2), 1], [0, 0, 1])
>>> print('%.1f' % t0)
45.0
>>> print('%.1f' % t1)
45.0
>>> print('%.1f' % p1)
-45.0

If the outgoing direction is opposite, p1 should be positive. >>> t0, t1, p1 = tosif([-1, 0, -1], … [-1/math.sqrt(2), -1/math.sqrt(2), 1], [0, 0, 1]) >>> print(‘%.1f’ % t0) 45.0 >>> print(‘%.1f’ % t1) 45.0 >>> print(‘%.1f’ % p1) 45.0

In case of the flux coming from inside surface, warning is displayed. >>> t0, t1, p1 = tosif([-1, 0, 1], … [-1/math.sqrt(2), -1/math.sqrt(2), 1], [0, 0, 1]) >>> print(‘%.1f’ % t0) 135.0

In case the flux is from antiparallel to the norm >>> t0, t1, p1 = tosif([0, -1, 0], [1, 1, 1], [0, 1, 0]) >>> print(‘%.1f’ % t0) 0.0 >>> print(‘%.1f’ % p1) 0.0

irfpy.util.surfaceframe.doctests()[source]