PHASTA / vtkpytools

Internal tools for using VTK
https://fluid.colorado.edu/wiki/index.php/VTKpytools
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

feat: Calculation for Boundary Layer Statistics #10

Closed jrwrigh closed 3 years ago

jrwrigh commented 4 years ago
jrwrigh commented 4 years ago

I will probably want to flip this into something more flexible. ie.

  1. Have a series of functions that take in vpt.Profile and output boundary layer statistics. One function per statistic (unless it makes sense otherwise)
  2. Have a function that takes in a list of BL thickness functions to evaluate at every point on the wall.
def BL99(profile):
    # Compute delta
return 'delta_99', delta

def BL_momentum(profile):
    # Compute Momentum delta
return 'delta_mom', delta

def computeBLStats(wall, functions):
    for pnt in wall:
        profile = getProfile(dataBlock, pnt)
        for deltafunc in functions:
              deltaName, delta = deltafunc(profile)

This would allow for easy extension in the future while also allowing "on-the-fly" BL stats to be computed easily. This should also generalize to 3D as well.... maybe.

jrwrigh commented 3 years ago

Quick speed comparison between sampling all the points up front ("New BL heights") and sampling profiles one at a time ('Get Boundary layer heights'):

In[1]: %timeit runcell('Get Boundary layer heights', '/projects/tools/Models/BoeingBump/DNS/FlatPlate/Post/CRS_4d_HexWedgeCompare.py')
Out[1]: 23.3 s +/- 39.2 ms per loop (mean +/- std. dev. of 7 runs, 1 loop each)

In[2]: %timeit runcell('New BL heights', '/projects/tools/Models/BoeingBump/DNS/FlatPlate/Post/CRS_4d_HexWedgeCompare.py')
Out[2]: 2.91 s +/- 78 ms per loop (mean +/- std. dev. of 7 runs, 1 loop each)

Also confirmed that the results are identical (wall is from the original method, vortInt is from the new method):

In[79]: np.allclose(wall['delta_displace'], vortInt['delta_displace'])
Out[79]: True

In[80]: np.allclose(wall['delta_momentum'], vortInt['delta_momentum'])
Out[80]: True