Skip to content

Commit

Permalink
Fix bug in diagnostics from AdvectionDiffusion
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-rose committed Jul 2, 2019
1 parent 1de1ada commit 5c5a2ae
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion climlab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
has been documented for a comprehensive understanding and traceability.
'''

__version__ = '0.7.4'
__version__ = '0.7.5.dev0'

# this should ensure that we can still import constants.py as climlab.constants
from .utils import constants, thermo, legendre
Expand Down
9 changes: 4 additions & 5 deletions climlab/dynamics/advection_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ def prescribed_flux(self, fluxvalue):
W=self._weight_center, Wb=self._weight_bounds)

def _compute_advdiff_matrix(self):
Karray = np.ones_like(self._Xbounds) * self._K
Karray = np.ones_like(self._Xbounds) * self.K
try:
Uarray = np.ones_like(self._Xbounds) * self._U
Uarray = np.ones_like(self._Xbounds) * self.U
except Exception:
Uarray = 0.*Karray
self._advdiffTriDiag = adv_diff_numerics.advdiff_tridiag(X=self._Xcenter,
Expand All @@ -197,11 +197,10 @@ def _implicit_solver(self):
return newstate

def _update_diagnostics(self, newstate):
Karray = self._Xbounds * self.K
Uarray = self._Xbounds * self.U
Karray = np.ones_like(self._Xbounds) * self.K
Uarray = np.ones_like(self._Xbounds) * self.U
for varname, value in newstate.items():
field = np.moveaxis(value, self.diffusion_axis_index,-1)
#field = value.squeeze()
diff_flux = adv_diff_numerics.diffusive_flux(self._Xcenter,
self._Xbounds, Karray, field)
adv_flux = adv_diff_numerics.advective_flux(self._Xcenter,
Expand Down
2 changes: 1 addition & 1 deletion climlab/dynamics/meridional_advection_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self,
self._Xbounds[...,:] = phi_stag*const.a
self._weight_bounds[...,:] = np.cos(phi_stag)
self._weight_center[...,:] = np.cos(phi)
# Now properly compute the weighted diffusion matrix
# Now properly compute the weighted advection-diffusion matrix
self.prescribed_flux = prescribed_flux
self.K = K
self.U = U
Expand Down
2 changes: 1 addition & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = "0.7.4" %}
{% set version = "0.7.5.dev0" %}

package:
name: climlab
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os, sys
import textwrap

VERSION = '0.7.4'
VERSION = '0.7.5.dev0'

# BEFORE importing setuptools, remove MANIFEST. Otherwise it may not be
# properly updated when the contents of directories change (true for distutils,
Expand Down

0 comments on commit 5c5a2ae

Please sign in to comment.