2D calculation of the baroclinic vorticity in compute_baroclinic_vort.cpp was incorrectly clearly variables from a previous timestep, this has been fixed.

In the old version of `compute_baroclinic_vort.cpp`

, line 25 was `barovort = temp*temp;`

. In 3D, the variable 'temp' is calculated by line 21 `compute_baroclinic_vort_x(temp, T, gradient_op, grid_type);`

. But in 2D, 'temp' is not initialized and in line 25 'temp' was determined by the previous time step (and is never cleared in derivatives.cpp).

I also took the opportunity to add a factor of 1/rho_0 to derivatives.cpp to the baroclinic vorticity calculation. It is included for calculations like vortex stretching/tilting and hence creates an issue when comparing magnitudes (if you forget or are unaware of the missing factor of 1/rho_0). The change below in derivatives.cpp fixes this issue.

**Donovan Allum**
(f2834d83)
*
at
26 Jan 14:10
*

Updating the baroclinic vorticity calculation in derivatives.cpp to...

**Donovan Allum**
(2ec830cc)
*
at
26 Jan 14:04
*

2D calculation of the baroclinic vorticity in compute_baroclinic_vo...

gravitational acceleration was not a default parameter in spins.conf (required for baroclinic vorticity).

**Donovan Allum**
(76d875c2)
*
at
30 Apr 17:25
*

added g to spins.conf in /cases/derivatives/

Merged the computation of the baroclinic vorticity in Jan 2021 but forgot to add a flag to spins.conf to turn on/off this computation. Changes are only made to the spins.conf in the directory /src/cases/derivatives/

**Donovan Allum**
(8e768d2d)
*
at
16 Apr 14:42
*

Added flag to spins.conf for derivatives.cpp to compute Baroclinic ...

*
... and
12 more commits
*

The goal for this change was to edit derivatives.cpp so that users can also calculate the baroclinic vorticity under the boussinesq approximation.

The following files were added:

- compute_baroclinic_vort.cpp: Calculates the magnitude of the baroclinic vorticity
- compute_baroclinic_vort_x.cpp: Calculates the x-component of the baroclinic vorticity
- compute_baroclinic_vort_y.cpp: Calculates the y-component of the baroclinic vorticity

The following files were edited:

- Science.hpp: Adding the new files above to this header file. Also added inline functions eqn_of_state_dT and eqn_of_state_dS to calculate the derivative of the equation of state with respect to temperature and salinity (The latter inline function was written but not used but could be required for future work).
- derivatives.cpp: Changed this casefile to calculate the magnitude and components of the baroclinic vorticity using the new files above for each output as defined in /cases/derivatives/spins.conf

**Note:** There is no z-component for the baroclinic vorticity assuming that gravity is limited to the z-direction.

**Donovan Allum**
(01972559)
*
at
11 Jan 16:17
*

Added the baroclinic vorticity as a new output for the derivatives ...