SPINS Science Files

From Fluids Wiki
Revision as of 16:00, 17 September 2020 by Ddeepwel (talk | contribs) (Add comments on units)
Jump to navigation Jump to search

SPINS comes with a variety of Science files which help with simulation data analysis. Below is a list of currently available functions with a brief description of their purpose and the assumptions behind their implementation. These Science files are in spins/src/Science.

Unless otherwise mentioned, the functions below work for both unmapped and mapped domains where the mapping is along the bottom of the domain (where the bottom is at the 0-index in the z-dimension, as opposed to at the index). Another way to say this is that z increases with the index.

Units

The units of each of the functions have been built under the assumption that physical units are being used in the simulation. These computations will work for nondimensional simulations, but more care must be taken to ensure the scalings are appropriate. Physical units are typically:

Length m
Time s
Density kg/m^3

The reference density should be 1000 kg/m^3 for the stress and dissipation calculations to be physically correct. The density field can be (and often is) non-dimensionalized to . If nondimensionalized, compute_Background_PE.cpp and compute_BPE_from_internal.cpp assume this form of scaling. These two functions also need to know if the density field is dimensional or not.


bottom_slope.cpp

Returns the vector of the bottom slope at each x-grid point. This is used for calculating the stresses along the bottom boundary (cf. bottom_stress_x.cpp and bottom_stress_y.cpp).

bottom_stress_x.cpp

Returns the 2D vector of the x-component of stress on the bottom boundary. The z boundary condition must be no slip.

If the case is unmapped:

where is the dynamic viscosity.

If the case is mapped:

where and where is the bottom slope.


bottom_stress_y.cpp

Returns the 2D vector of the y-component of stress on the bottom boundary. The z boundary condition must be no slip.

If the case is unmapped:

where is the dynamic viscosity.

If the case is mapped:

where and where is the bottom slope.


compute_Background_PE.cpp

Returns the value of the background potential energy,

where is the depth of an element of the sorted density field which minimized the potential energy (ie. ). For more information see Winters et al. (1995).

compute_BPE_from_internal.cpp

Returns the rate of energy transfer from internal energy into background potential energy.

where and are the depths of the upper and lower boundaries, respectively. The integral is taken over the horizontal extent. For more information see Winters et al. (1995).

compute_quadweights.cpp

Create the quadrature weights for each dimension.

If the boundary condition is no-slip, use the Clenshaw-Curtis quadrature weights:

If the boundary condition is free-slip, use the trapezoid rule:

compute_vorticity.cpp

Compute all vorticity components.

compute_vort_x.cpp

Compute the x-component of vorticity:

compute_vort_y.cpp

Compute the y-component of vorticity:

compute_vort_z.cpp

Compute the z-component of vorticity: