For creating profiles at specific non-spatially-defined locations (such as Re_theta), we need to find intersections of discrete data (wall-localized data normally) with the desired location.
def find_roots(x,y):
s = np.abs(np.diff(np.sign(y))).astype(bool)
return x[:-1][s] + np.diff(x)[s]/(np.abs(y[1:][s]/y[:-1][s])+1)
where s gives the indices where y changes sign. Then it performs linear interpolation at those locations. For the example problem (given x and D arrays), the solution would be find_roots(x, D-0.2).
For creating profiles at specific non-spatially-defined locations (such as Re_theta), we need to find intersections of discrete data (wall-localized data normally) with the desired location.
Example: Given data:
, at what x locations does D = 0.2?
Possible solution: (from StackExchange)
where
s
gives the indices wherey
changes sign. Then it performs linear interpolation at those locations. For the example problem (givenx
andD
arrays), the solution would befind_roots(x, D-0.2)
.