Skip to content

Latest commit

 

History

History
executable file
·
76 lines (60 loc) · 4.06 KB

README.md

File metadata and controls

executable file
·
76 lines (60 loc) · 4.06 KB

DOI documentation CI codecov

Overview

FluidSF is a Python package for calculating structure functions from fluid data. These structure functions can be used to estimate turbulence cascade rates without the constraints of spectral methods. This package serves as a useful tool for analyzing turbulent dynamics in the ocean, atmosphere, and beyond.

Plot of multiple methods to estimate energy flux for 2D fluid simulation

Note: FluidSF only calculates structure functions, it does not support spectral flux calculations or coarse-graining at this point. This image is an example use-case and demonstrates that advective structure functions agree with other common methods in ocean turbulence analysis.

For detailed documentation and examples, see the FluidSF website.

Installation

Fork/clone this repository to your local machine. The easiest method to install FluidSF is with pip:

$ pip install .

Quickstart

Once FluidSF is installed, you can load the module into Python and run some basic calculations with random data. For more detail on this example, see the full notebook on the FluidSF website.

First we'll initialize a random 2-D field to analyze:

import numpy as np
nx, ny = 100, 100
x = np.linspace(1, nx, nx)
y = np.linspace(1, ny, ny)
U = np.random.rand(nx, ny)
V = np.random.rand(nx, ny)

Next, we'll generate the advective structure functions.

import fluidsf
sf = fluidsf.generate_structure_functions(U, V, x, y, boundary=None)

Finally, let's plot!

import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot(sf["x-diffs"], sf["SF_advection_velocity_x"], label="Advective velocity SF in x", color='k')
ax.plot(sf["y-diffs"], sf["SF_advection_velocity_y"], label="Advective velocity SF in y", color='k', linestyle='dotted')
ax.set_xlabel("Separation distance")
ax.set_ylabel("Structure function")
ax.legend()
plt.show()

Advective structure function plots

"Can I use FluidSF with my data?"

Hopefully! FluidSF was initially developed for numerical simulations and satellite data, but there are of course many different types of data. If you are interested in using this package but you are unsure how to use it with your dataset, please reach out and we are happy to assist!

The best way to communicate about your data needs is to open an issue where you can describe your dataset and what you're hoping to learn with FluidSF. Before opening an issue you can check through the open (and closed) issues to see if any other users have a similar question or dataset.

We have plans to support many different types of data, especially oceanographic data, but we encourage any users to engage with us so we can make sure we support as many datasets as possible!

Contributing

This project welcomes contributions and suggestions. Feel free to open an issue, submit a pull request, and/or contact the owner directly.

References

  • Pearson, B. et al., 2021: Advective structure functions in anisotropic two-dimensional turbulence. Journal of Fluid Mechanics.
  • Lindborg, E. 2008: Third-order structure function relations for quasi-geostrophic turbulence. Journal of Fluid Mechanics.