Commit ae19aedf authored by Christopher Subich's avatar Christopher Subich
Browse files

Gravity_current: compute v^2 KE if f != 0

This change allows the gravity_current case to compute the v^2 component
of the kinetic energy term even if NY=1 when rot_f != 0; in that case
the solution can still develop a 2D geostrophic balance where v-velocity
balances a pressure gradient.

Additionally, the respective component sums are explicitly initialized to
0.
parent 6948b663
......@@ -206,12 +206,12 @@ class userControl : public BaseCase {
/* Calculate and write out useful information */
// Energy (PE assumes density is density anomaly)
double ke_x, ke_y, ke_z;
double ke_x = 0, ke_y = 0, ke_z = 0;
if ( Nx > 1 ) {
ke_x = pssum(sum(0.5*rho_0*(u*u)*
(*get_quad_x())(ii)*(*get_quad_y())(jj)*(*get_quad_z())(kk)));
}
if ( Ny > 1 ) {
if ( Ny > 1 || rot_f != 0) {
ke_y = pssum(sum(0.5*rho_0*(v*v)*
(*get_quad_x())(ii)*(*get_quad_y())(jj)*(*get_quad_z())(kk)));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment