[yt-svn] commit/yt: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Oct 28 16:14:29 PDT 2013
3 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/9422da59573d/
Changeset: 9422da59573d
Branch: yt
User: chummels
Date: 2013-10-29 00:08:04
Summary: Adding an explantory line in 'yt notebook' so that the user knows that the "enter password" prompt is for them to define a password.
Affected #: 1 file
diff -r 7e151eeaaad8e8b781d89cdd067e908fc291dd83 -r 9422da59573d69656bd9a0b872cfef9f68199b4b yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -1452,6 +1452,7 @@
except ImportError:
# pre-IPython v1.0
from IPython.frontend.html.notebook.notebookapp import NotebookApp
+ print "You must choose a password so that others cannot connect to your notebook."
pw = ytcfg.get("yt", "notebook_password")
if len(pw) == 0 and not args.no_password:
import IPython.lib
https://bitbucket.org/yt_analysis/yt/commits/59ce40ee4fde/
Changeset: 59ce40ee4fde
Branch: yt
User: chummels
Date: 2013-10-29 00:11:10
Summary: Adding Shear criterion field to universal fields.
Affected #: 1 file
diff -r 9422da59573d69656bd9a0b872cfef9f68199b4b -r 59ce40ee4fde66d2103505d639ee2dbd4a080d8b yt/data_objects/universal_fields.py
--- a/yt/data_objects/universal_fields.py
+++ b/yt/data_objects/universal_fields.py
@@ -1180,6 +1180,68 @@
units=r"\rm{s}^{-1}",
convert_function=_convertShear, take_log=False)
+def _ShearCriterion(field, data):
+ """
+ Shear is defined as [(dvx/dy + dvy/dx)^2 + (dvz/dy + dvy/dz)^2 +
+ (dvx/dz + dvz/dx)^2 ]^(0.5)
+ where dvx/dy = [vx(j-1) - vx(j+1)]/[2dy]
+ and is in units of s^(-1)
+ (it's just like vorticity except add the derivative pairs instead
+ of subtracting them)
+
+ Divide by c_s to leave Shear in units of cm**-1, which
+ can be compared against the inverse of the local cell size (1/dx)
+ to determine if refinement should occur.
+ """
+ # We need to set up stencils
+ if data.pf["HydroMethod"] == 2:
+ sl_left = slice(None,-2,None)
+ sl_right = slice(1,-1,None)
+ div_fac = 1.0
+ else:
+ sl_left = slice(None,-2,None)
+ sl_right = slice(2,None,None)
+ div_fac = 2.0
+ new_field = np.zeros(data["x-velocity"].shape)
+ if data.pf.dimensionality > 1:
+ dvydx = (data["y-velocity"][sl_right,1:-1,1:-1] -
+ data["y-velocity"][sl_left,1:-1,1:-1]) \
+ / (div_fac*data["dx"].flat[0])
+ dvxdy = (data["x-velocity"][1:-1,sl_right,1:-1] -
+ data["x-velocity"][1:-1,sl_left,1:-1]) \
+ / (div_fac*data["dy"].flat[0])
+ new_field[1:-1,1:-1,1:-1] += (dvydx + dvxdy)**2.0
+ del dvydx, dvxdy
+ if data.pf.dimensionality > 2:
+ dvzdy = (data["z-velocity"][1:-1,sl_right,1:-1] -
+ data["z-velocity"][1:-1,sl_left,1:-1]) \
+ / (div_fac*data["dy"].flat[0])
+ dvydz = (data["y-velocity"][1:-1,1:-1,sl_right] -
+ data["y-velocity"][1:-1,1:-1,sl_left]) \
+ / (div_fac*data["dz"].flat[0])
+ new_field[1:-1,1:-1,1:-1] += (dvzdy + dvydz)**2.0
+ del dvzdy, dvydz
+ dvxdz = (data["x-velocity"][1:-1,1:-1,sl_right] -
+ data["x-velocity"][1:-1,1:-1,sl_left]) \
+ / (div_fac*data["dz"].flat[0])
+ dvzdx = (data["z-velocity"][sl_right,1:-1,1:-1] -
+ data["z-velocity"][sl_left,1:-1,1:-1]) \
+ / (div_fac*data["dx"].flat[0])
+ new_field[1:-1,1:-1,1:-1] += (dvxdz + dvzdx)**2.0
+ del dvxdz, dvzdx
+ new_field /= data["SoundSpeed"]**2.0
+ new_field = new_field**(0.5)
+ new_field = np.abs(new_field)
+ return new_field
+
+def _convertShearCriterion(data):
+ return data.convert("cm")**-1.0
+add_field("ShearCriterion", function=_ShearCriterion,
+ validators=[ValidateSpatial(1,
+ ["x-velocity","y-velocity","z-velocity", "SoundSpeed"])],
+ units=r"\rm{cm}^{-1}",
+ convert_function=_convertShearCriterion, take_log=False)
+
def _ShearMach(field, data):
"""
Dimensionless Shear (ShearMach) is defined nearly the same as shear,
https://bitbucket.org/yt_analysis/yt/commits/9255afc9fcde/
Changeset: 9255afc9fcde
Branch: yt
User: chummels
Date: 2013-10-29 00:13:45
Summary: Merging to tip.
Affected #: 2 files
diff -r 7d4f39cdfb791a92a1d1dc7d6d4b5e26d8c32394 -r 9255afc9fcde5d129db7538e4bd57b1dfd482f34 yt/data_objects/universal_fields.py
--- a/yt/data_objects/universal_fields.py
+++ b/yt/data_objects/universal_fields.py
@@ -1180,6 +1180,68 @@
units=r"\rm{s}^{-1}",
convert_function=_convertShear, take_log=False)
+def _ShearCriterion(field, data):
+ """
+ Shear is defined as [(dvx/dy + dvy/dx)^2 + (dvz/dy + dvy/dz)^2 +
+ (dvx/dz + dvz/dx)^2 ]^(0.5)
+ where dvx/dy = [vx(j-1) - vx(j+1)]/[2dy]
+ and is in units of s^(-1)
+ (it's just like vorticity except add the derivative pairs instead
+ of subtracting them)
+
+ Divide by c_s to leave Shear in units of cm**-1, which
+ can be compared against the inverse of the local cell size (1/dx)
+ to determine if refinement should occur.
+ """
+ # We need to set up stencils
+ if data.pf["HydroMethod"] == 2:
+ sl_left = slice(None,-2,None)
+ sl_right = slice(1,-1,None)
+ div_fac = 1.0
+ else:
+ sl_left = slice(None,-2,None)
+ sl_right = slice(2,None,None)
+ div_fac = 2.0
+ new_field = np.zeros(data["x-velocity"].shape)
+ if data.pf.dimensionality > 1:
+ dvydx = (data["y-velocity"][sl_right,1:-1,1:-1] -
+ data["y-velocity"][sl_left,1:-1,1:-1]) \
+ / (div_fac*data["dx"].flat[0])
+ dvxdy = (data["x-velocity"][1:-1,sl_right,1:-1] -
+ data["x-velocity"][1:-1,sl_left,1:-1]) \
+ / (div_fac*data["dy"].flat[0])
+ new_field[1:-1,1:-1,1:-1] += (dvydx + dvxdy)**2.0
+ del dvydx, dvxdy
+ if data.pf.dimensionality > 2:
+ dvzdy = (data["z-velocity"][1:-1,sl_right,1:-1] -
+ data["z-velocity"][1:-1,sl_left,1:-1]) \
+ / (div_fac*data["dy"].flat[0])
+ dvydz = (data["y-velocity"][1:-1,1:-1,sl_right] -
+ data["y-velocity"][1:-1,1:-1,sl_left]) \
+ / (div_fac*data["dz"].flat[0])
+ new_field[1:-1,1:-1,1:-1] += (dvzdy + dvydz)**2.0
+ del dvzdy, dvydz
+ dvxdz = (data["x-velocity"][1:-1,1:-1,sl_right] -
+ data["x-velocity"][1:-1,1:-1,sl_left]) \
+ / (div_fac*data["dz"].flat[0])
+ dvzdx = (data["z-velocity"][sl_right,1:-1,1:-1] -
+ data["z-velocity"][sl_left,1:-1,1:-1]) \
+ / (div_fac*data["dx"].flat[0])
+ new_field[1:-1,1:-1,1:-1] += (dvxdz + dvzdx)**2.0
+ del dvxdz, dvzdx
+ new_field /= data["SoundSpeed"]**2.0
+ new_field = new_field**(0.5)
+ new_field = np.abs(new_field)
+ return new_field
+
+def _convertShearCriterion(data):
+ return data.convert("cm")**-1.0
+add_field("ShearCriterion", function=_ShearCriterion,
+ validators=[ValidateSpatial(1,
+ ["x-velocity","y-velocity","z-velocity", "SoundSpeed"])],
+ units=r"\rm{cm}^{-1}",
+ convert_function=_convertShearCriterion, take_log=False)
+
def _ShearMach(field, data):
"""
Dimensionless Shear (ShearMach) is defined nearly the same as shear,
diff -r 7d4f39cdfb791a92a1d1dc7d6d4b5e26d8c32394 -r 9255afc9fcde5d129db7538e4bd57b1dfd482f34 yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -1452,6 +1452,7 @@
except ImportError:
# pre-IPython v1.0
from IPython.frontend.html.notebook.notebookapp import NotebookApp
+ print "You must choose a password so that others cannot connect to your notebook."
pw = ytcfg.get("yt", "notebook_password")
if len(pw) == 0 and not args.no_password:
import IPython.lib
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list