SPINS Science Files: Difference between revisions

From Fluids Wiki
Jump to navigation Jump to search
(Early addition of Science files)
 
(Update with more functions)
Line 1: Line 1:
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.
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 <math> N_z-1 </math> index). Another way to say this is that z increases with the index.


== bottom_slope.cpp ==
== 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|bottom_stress_x.cpp]] and  [[#bottom_stress_y.cpp|bottom_stress_y.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|bottom_stress_x.cpp]] and  [[#bottom_stress_y.cpp|bottom_stress_y.cpp]]).
Assumes the bottom is at the 0-index for <math> z </math>.


<div id="bottom_stress_x.cpp"></div>
<div id="bottom_stress_x.cpp"></div>
== bottom_stress_x.cpp ==
== bottom_stress_x.cpp ==
Returns the x-component of stress along the bottom boundary.  
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:
If the case is unmapped:
<math> t_x = \mu u_z </math>
<math> t_x = \mu u_z </math>
where <math> \mu </math> is the dynamic viscosity.
where <math> \mu </math> is the dynamic viscosity.


If the case is mapped:
If the case is mapped:
<math> t_x = \frac{\mu}{\alpha^2(x)}\left( 2 h'(x) (w_z - u_x) + (u_z + w_x)(1 - h'^2(x))  \right)  </math>
<math> t_x = \frac{\mu}{\alpha^2(x)}\left( 2 h'(x) (w_z - u_x) + (u_z + w_x)(1 - h'^2(x))  \right)  </math>
where <math> \alpha(x) = sqrt{1 + h'^2(x)} </math> and where <math> h'^2(x) </math> is the bottom slope.
 
where <math> \alpha(x) = \sqrt{1 + h'^2(x)} </math> and where <math> h'(x) </math> is the bottom slope.




Line 24: Line 26:
<div id="bottom_stress_y.cpp"></div>
<div id="bottom_stress_y.cpp"></div>
== bottom_stress_y.cpp ==
== 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:
<math> t_y = \mu v_z </math>
where <math> \mu </math> is the dynamic viscosity.
If the case is mapped:
<math> t_y = \frac{\mu}{\alpha(x)}\left( v_z - h'(x) v_x \right)  </math>
where <math> \alpha(x) = \sqrt{1 + h'^2(x)} </math> and where <math> h'(x) </math> is the bottom slope.
== compute_Background_PE ==
Returns the value of the background potential energy,
<math> E_b = g \int_V \rho_* z_* dV  </math>
where <math> z_* </math> is the depth of an element of the sorted density field which minimized the potential energy (ie. <math> \rho_*</math>). 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.
<math> \phi_i = -g\kappa \int_A \rho(z=z_u) - \rho(z=z_l) dA </math>
where <math> z_u </math> and <math> z_l </math> 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:
<math> w = ... </math>
If the boundary condition is free-slip, use the trapezoid rule:
<math> w = L_x/N_x = \Delta x </math>
== compute_vorticity.cpp ==
Compute all vorticity components.
== compute_vort_x.cpp ==
Compute the x-component of vorticity: <math> \omega_x = w_y - v_z </math>
== compute_vort_y.cpp ==
Compute the y-component of vorticity: <math> \omega_y = u_z - w_x </math>
== compute_vort_z.cpp ==
Compute the z-component of vorticity: <math> \omega_z = v_x - u_y </math>

Revision as of 19:09, 16 September 2020

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.

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

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: