<p><b>mpetersen@lanl.gov</b> 2012-07-16 09:07:42 -0600 (Mon, 16 Jul 2012)</p><p>BRANCH COMMIT Allow linear equation of state to be used for Richardson number-based mixing.  Specifically, let the EOS routine work with a linear EOS when displaced to another level.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/rich_vert_mix_bug/src/core_ocean/mpas_ocn_equation_of_state.F
===================================================================
--- branches/ocean_projects/rich_vert_mix_bug/src/core_ocean/mpas_ocn_equation_of_state.F        2012-07-16 14:39:35 UTC (rev 2025)
+++ branches/ocean_projects/rich_vert_mix_bug/src/core_ocean/mpas_ocn_equation_of_state.F        2012-07-16 15:07:42 UTC (rev 2026)
@@ -74,10 +74,13 @@
    ! Input: grid - grid metadata
    !        s - state: tracers
    !        k_displaced 
-   !  If k_displaced&lt;=0, state % rho is returned with no displaced
-   !  If k_displaced&gt;0,the state % rhoDisplaced is returned, and is for
+   !
+   !  If k_displaced==0, state % rho is returned with no displacement 
+   !
+   !  If k_displaced~=0,the state % rhoDisplaced is returned, and is for
    !  a parcel adiabatically displaced from its original level to level 
-   !  k_displaced.  This does not effect the linear EOS.
+   !  k_displaced.  When using the linear EOS, state % rhoDisplaced is 
+   !  still filled, but depth (i.e. pressure) does not modify the output.
    !
    ! Output: s - state: computed density
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -103,19 +106,19 @@
       indexT = s % index_temperature
       indexS = s % index_salinity
 
-      if (linearEos) then
+      !  Choose to fill the array rho or rhoDisplaced
+      if (k_displaced == 0) then
          rho =&gt; s % rho % array
+      else
+         rho =&gt; s % rhoDisplaced % array
+      endif
 
+      if (linearEos) then
+
          call ocn_equation_of_state_linear_rho(grid, indexT, indexS, tracers, rho, err)
 
       elseif (jmEos) then
 
-         if(k_displaced == 0) then
-             rho =&gt; s % rho % array
-         else
-             rho =&gt; s % rhoDisplaced % array
-         endif
-
          call ocn_equation_of_state_jm_rho(grid, k_displaced, displacement_type, indexT, indexS, tracers, rho, err)
 
       endif

Modified: branches/ocean_projects/rich_vert_mix_bug/src/core_ocean/mpas_ocn_time_integration_rk4.F
===================================================================
--- branches/ocean_projects/rich_vert_mix_bug/src/core_ocean/mpas_ocn_time_integration_rk4.F        2012-07-16 14:39:35 UTC (rev 2025)
+++ branches/ocean_projects/rich_vert_mix_bug/src/core_ocean/mpas_ocn_time_integration_rk4.F        2012-07-16 15:07:42 UTC (rev 2026)
@@ -309,7 +309,7 @@
          block =&gt; block % next
       end do
 
-      ! Update halo on u and tracers, which weres just updated for implicit vertical mixing.  If not done, 
+      ! Update halo on u and tracers, which were just updated for implicit vertical mixing.  If not done, 
       ! this leads to lack of volume conservation.  It is required because halo updates in RK4 are only
       ! conducted on tendencies, not on the velocity and tracer fields.  So this update is required to 
       ! communicate the change due to implicit vertical mixing across the boundary.

</font>
</pre>