[yt-svn] commit/yt: 9 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Dec 9 11:23:04 PST 2014
9 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/c89d68d99a9c/
Changeset: c89d68d99a9c
Branch: yt
User: ngoldbaum
Date: 2014-12-04 04:47:24+00:00
Summary: Fix issues with ramses unit conversions. Closes #939
Affected #: 2 files
diff -r 9d96ac2cfc308468239e99e88552a704168291e0 -r c89d68d99a9c5dd2a2ccda26f735b142b9b65d10 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -679,7 +679,9 @@
self.unit_registry.modify("code_time", self.time_unit)
vel_unit = getattr(self, "velocity_unit",
self.length_unit / self.time_unit)
+ temperature_unit = getattr(self, "temperature_unit", 1.0)
self.unit_registry.modify("code_velocity", vel_unit)
+ self.unit_registry.modify("code_temperature", temperature_unit)
# domain_width does not yet exist
if None not in (self.domain_left_edge, self.domain_right_edge):
DW = self.arr(self.domain_right_edge - self.domain_left_edge, "code_length")
diff -r 9d96ac2cfc308468239e99e88552a704168291e0 -r c89d68d99a9c5dd2a2ccda26f735b142b9b65d10 yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -33,6 +33,7 @@
get_box_grids_level
from yt.utilities.io_handler import \
io_registry
+from yt.utilities.physical_constants import mp, kb
from .fields import \
RAMSESFieldInfo
import yt.utilities.fortran_utils as fpu
@@ -492,16 +493,17 @@
length_unit = self.parameters['unit_l'] * self.parameters['boxlen']
rho_u = self.parameters['unit_d']
# We're not multiplying by the boxlength here.
- mass_unit = rho_u * self.parameters['unit_l']**3
+ mass_unit = rho_u * length_unit**3
time_unit = self.parameters['unit_t']
-
magnetic_unit = np.sqrt(4*np.pi * mass_unit /
(time_unit**2 * length_unit))
+
self.magnetic_unit = self.quan(magnetic_unit, "gauss")
self.length_unit = self.quan(length_unit, "cm")
self.mass_unit = self.quan(mass_unit, "g")
self.time_unit = self.quan(time_unit, "s")
self.velocity_unit = self.length_unit / self.time_unit
+ self.temperature_unit = self.velocity_unit**2 * mp / kb
def _parse_parameter_file(self):
# hardcoded for now
https://bitbucket.org/yt_analysis/yt/commits/09eeacb5076a/
Changeset: 09eeacb5076a
Branch: yt
User: ngoldbaum
Date: 2014-12-04 04:53:28+00:00
Summary: Remove incorrect comment.
Affected #: 1 file
diff -r c89d68d99a9c5dd2a2ccda26f735b142b9b65d10 -r 09eeacb5076a2617052bfbbb25bc71384ea44917 yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -492,7 +492,6 @@
# ensure we are correctly set up for the current domain.
length_unit = self.parameters['unit_l'] * self.parameters['boxlen']
rho_u = self.parameters['unit_d']
- # We're not multiplying by the boxlength here.
mass_unit = rho_u * length_unit**3
time_unit = self.parameters['unit_t']
magnetic_unit = np.sqrt(4*np.pi * mass_unit /
https://bitbucket.org/yt_analysis/yt/commits/ff2a3d0a25ac/
Changeset: ff2a3d0a25ac
Branch: yt
User: ngoldbaum
Date: 2014-12-05 23:21:29+00:00
Summary: Update ramses unit conversions to reflect sam geen's comments.
Affected #: 1 file
diff -r 09eeacb5076a2617052bfbbb25bc71384ea44917 -r ff2a3d0a25ac5e05cbb9fa6607f2d8aae18b75f8 yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -490,19 +490,25 @@
# Note that unit_l *already* converts to proper!
# Also note that unit_l must be multiplied by the boxlen parameter to
# ensure we are correctly set up for the current domain.
- length_unit = self.parameters['unit_l'] * self.parameters['boxlen']
+ length_unit = self.parameters['unit_l']
+ boxlen = self.parameters['boxlen']
rho_u = self.parameters['unit_d']
mass_unit = rho_u * length_unit**3
time_unit = self.parameters['unit_t']
magnetic_unit = np.sqrt(4*np.pi * mass_unit /
(time_unit**2 * length_unit))
+ # TODO:
+ # Generalize the temperature field to account for ionization
+ # For now assume an atomic ideal gas with cosmic abundances (x_H = 0.76)
+ mean_molecular_weight_factor = 0.76**-1
self.magnetic_unit = self.quan(magnetic_unit, "gauss")
- self.length_unit = self.quan(length_unit, "cm")
+ self.length_unit = self.quan(length_unit * boxlen, "cm")
self.mass_unit = self.quan(mass_unit, "g")
self.time_unit = self.quan(time_unit, "s")
- self.velocity_unit = self.length_unit / self.time_unit
- self.temperature_unit = self.velocity_unit**2 * mp / kb
+ self.velocity_unit = self.quan(length_unit, 'cm') / self.time_unit
+ self.temperature_unit = (self.velocity_unit**2 * mp *
+ mean_molecular_weight_factor / kb)
def _parse_parameter_file(self):
# hardcoded for now
https://bitbucket.org/yt_analysis/yt/commits/7c42285b13a3/
Changeset: 7c42285b13a3
Branch: yt
User: ngoldbaum
Date: 2014-12-05 23:40:17+00:00
Summary: Include missing factor of boxlen in mass unit.
Affected #: 1 file
diff -r ff2a3d0a25ac5e05cbb9fa6607f2d8aae18b75f8 -r 7c42285b13a343a8a058ef57b960ddfc59c780bb yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -493,7 +493,7 @@
length_unit = self.parameters['unit_l']
boxlen = self.parameters['boxlen']
rho_u = self.parameters['unit_d']
- mass_unit = rho_u * length_unit**3
+ mass_unit = rho_u * (length_unit * boxlen)**3
time_unit = self.parameters['unit_t']
magnetic_unit = np.sqrt(4*np.pi * mass_unit /
(time_unit**2 * length_unit))
https://bitbucket.org/yt_analysis/yt/commits/bef9a65d5786/
Changeset: bef9a65d5786
Branch: yt
User: ngoldbaum
Date: 2014-12-06 01:18:41+00:00
Summary: Adding unit symbols for code pressure and density units
Affected #: 2 files
diff -r 7c42285b13a343a8a058ef57b960ddfc59c780bb -r bef9a65d5786a891191a8345bb455df55f6ce8f7 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -619,9 +619,11 @@
import yt.units.dimensions as dimensions
self.unit_registry.add("code_length", 1.0, dimensions.length)
self.unit_registry.add("code_mass", 1.0, dimensions.mass)
+ self.unit_registry.add("code_density", 1.0, dimensions.density)
self.unit_registry.add("code_time", 1.0, dimensions.time)
self.unit_registry.add("code_magnetic", 1.0, dimensions.magnetic_field)
self.unit_registry.add("code_temperature", 1.0, dimensions.temperature)
+ self.unit_registry.add("code_pressure", 1.0, dimensions.pressure)
self.unit_registry.add("code_velocity", 1.0, dimensions.velocity)
self.unit_registry.add("code_metallicity", 1.0,
dimensions.dimensionless)
@@ -677,11 +679,17 @@
self.unit_registry.modify("code_length", self.length_unit)
self.unit_registry.modify("code_mass", self.mass_unit)
self.unit_registry.modify("code_time", self.time_unit)
- vel_unit = getattr(self, "velocity_unit",
- self.length_unit / self.time_unit)
+ vel_unit = getattr(
+ self, "velocity_unit", self.length_unit / self.time_unit)
+ pressure_unit = getattr(
+ self, "pressure_unit",
+ self.mass_unit / (self.length_unit * self.time_unit)**2)
temperature_unit = getattr(self, "temperature_unit", 1.0)
+ density_unit = getattr(self, "density_unit", self.mass_unit / self.length_unit**3)
self.unit_registry.modify("code_velocity", vel_unit)
self.unit_registry.modify("code_temperature", temperature_unit)
+ self.unit_registry.modify("code_pressure", pressure_unit)
+ self.unit_registry.modify("code_density", density_unit)
# domain_width does not yet exist
if None not in (self.domain_left_edge, self.domain_right_edge):
DW = self.arr(self.domain_right_edge - self.domain_left_edge, "code_length")
diff -r 7c42285b13a343a8a058ef57b960ddfc59c780bb -r bef9a65d5786a891191a8345bb455df55f6ce8f7 yt/units/dimensions.py
--- a/yt/units/dimensions.py
+++ b/yt/units/dimensions.py
@@ -42,6 +42,7 @@
volume = area * length
momentum = mass * velocity
force = mass * acceleration
+pressure = force / area
energy = force * length
power = energy / time
flux = power / area
https://bitbucket.org/yt_analysis/yt/commits/292fa8daef38/
Changeset: 292fa8daef38
Branch: yt
User: ngoldbaum
Date: 2014-12-06 01:20:02+00:00
Summary: Update RAMSES unit conversions to use explicit conversions for pressure and density.
Affected #: 2 files
diff -r bef9a65d5786a891191a8345bb455df55f6ce8f7 -r 292fa8daef38d2da237f048690a01f36a1d071be yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -492,16 +492,18 @@
# ensure we are correctly set up for the current domain.
length_unit = self.parameters['unit_l']
boxlen = self.parameters['boxlen']
- rho_u = self.parameters['unit_d']
- mass_unit = rho_u * (length_unit * boxlen)**3
+ density_unit = self.parameters['unit_d']
+ mass_unit = density_unit * (length_unit * boxlen)**3
time_unit = self.parameters['unit_t']
magnetic_unit = np.sqrt(4*np.pi * mass_unit /
(time_unit**2 * length_unit))
+ pressure_unit = density_unit * (length_unit / time_unit)**2
# TODO:
# Generalize the temperature field to account for ionization
# For now assume an atomic ideal gas with cosmic abundances (x_H = 0.76)
mean_molecular_weight_factor = 0.76**-1
+ self.density_unit = self.quan(density_unit, 'g/cm**3')
self.magnetic_unit = self.quan(magnetic_unit, "gauss")
self.length_unit = self.quan(length_unit * boxlen, "cm")
self.mass_unit = self.quan(mass_unit, "g")
@@ -509,6 +511,7 @@
self.velocity_unit = self.quan(length_unit, 'cm') / self.time_unit
self.temperature_unit = (self.velocity_unit**2 * mp *
mean_molecular_weight_factor / kb)
+ self.pressure_unit = self.quan(pressure_unit, 'dyne/cm**2')
def _parse_parameter_file(self):
# hardcoded for now
diff -r bef9a65d5786a891191a8345bb455df55f6ce8f7 -r 292fa8daef38d2da237f048690a01f36a1d071be yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -32,8 +32,9 @@
b_units = "code_magnetic"
ra_units = "code_length / code_time**2"
-rho_units = "code_mass / code_length**3"
-vel_units = "code_length / code_time"
+rho_units = "code_density"
+vel_units = "code_velocity"
+pressure_units = "code_pressure"
known_species_masses = dict(
(sp, mh * v) for sp, v in [
@@ -70,7 +71,7 @@
("x-velocity", (vel_units, ["velocity_x"], None)),
("y-velocity", (vel_units, ["velocity_y"], None)),
("z-velocity", (vel_units, ["velocity_z"], None)),
- ("Pressure", ("code_mass / (code_length * code_time**2)", ["pressure"], None)),
+ ("Pressure", (pressure_units, ["pressure"], None)),
("Metallicity", ("", ["metallicity"], None)),
)
known_particle_fields = (
https://bitbucket.org/yt_analysis/yt/commits/785273bf588f/
Changeset: 785273bf588f
Branch: yt
User: ngoldbaum
Date: 2014-12-06 01:20:41+00:00
Summary: Reference ramses cosmic abundance data from ramses/fields.py
Affected #: 1 file
diff -r 292fa8daef38d2da237f048690a01f36a1d071be -r 785273bf588f3417f3e2160c056d83c4e2912f28 yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -35,7 +35,7 @@
io_registry
from yt.utilities.physical_constants import mp, kb
from .fields import \
- RAMSESFieldInfo
+ RAMSESFieldInfo, _X
import yt.utilities.fortran_utils as fpu
from yt.geometry.oct_container import \
RAMSESOctreeContainer
@@ -501,7 +501,7 @@
# TODO:
# Generalize the temperature field to account for ionization
# For now assume an atomic ideal gas with cosmic abundances (x_H = 0.76)
- mean_molecular_weight_factor = 0.76**-1
+ mean_molecular_weight_factor = _X**-1
self.density_unit = self.quan(density_unit, 'g/cm**3')
self.magnetic_unit = self.quan(magnetic_unit, "gauss")
https://bitbucket.org/yt_analysis/yt/commits/a0c82c1fcf46/
Changeset: a0c82c1fcf46
Branch: yt
User: ngoldbaum
Date: 2014-12-06 01:20:58+00:00
Summary: Add basic support for detecting non-cosmological ramses outputs
Affected #: 1 file
diff -r 785273bf588f3417f3e2160c056d83c4e2912f28 -r a0c82c1fcf465f7d2f1a0d5b0ef0f0b1a26b5747 yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -556,15 +556,21 @@
self.domain_dimensions = np.ones(3, dtype='int32') * \
2**(self.min_level+1)
self.domain_right_edge = np.ones(3, dtype='float64')
- # This is likely not true, but I am not sure how to otherwise
- # distinguish them.
- mylog.warning("RAMSES frontend assumes all simulations are cosmological!")
- self.cosmological_simulation = 1
+ # This is likely not true, but it's not clear how to determine the boundary conditions
self.periodicity = (True, True, True)
- self.current_redshift = (1.0 / rheader["aexp"]) - 1.0
- self.omega_lambda = rheader["omega_l"]
- self.omega_matter = rheader["omega_m"]
- self.hubble_constant = rheader["H0"] / 100.0 # This is H100
+ # These conditions seem to always be true for non-cosmological datasets
+ if rheader["time"] > 0 and rheader["H0"] == 1 and rheader["aexp"] == 1:
+ self.cosmological_simulation = 0
+ self.current_redshift = 0
+ self.hubble_constant = 0
+ self.omega_matter = 0
+ self.omega_lambda = 0
+ else:
+ self.cosmological_simulation = 1
+ self.current_redshift = (1.0 / rheader["aexp"]) - 1.0
+ self.omega_lambda = rheader["omega_l"]
+ self.omega_matter = rheader["omega_m"]
+ self.hubble_constant = rheader["H0"] / 100.0 # This is H100
self.max_level = rheader['levelmax'] - self.min_level - 1
f.close()
https://bitbucket.org/yt_analysis/yt/commits/a43f02e6bea1/
Changeset: a43f02e6bea1
Branch: yt
User: xarthisius
Date: 2014-12-09 19:22:53+00:00
Summary: Merged in ngoldbaum/yt (pull request #1335)
Ramses unit conversions.
Affected #: 4 files
diff -r 4ce155015ea95a99e4c6d2c805b0db6536bdc6f3 -r a43f02e6bea17aa9d8758344689f7f7004b5bc4f yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -618,9 +618,11 @@
import yt.units.dimensions as dimensions
self.unit_registry.add("code_length", 1.0, dimensions.length)
self.unit_registry.add("code_mass", 1.0, dimensions.mass)
+ self.unit_registry.add("code_density", 1.0, dimensions.density)
self.unit_registry.add("code_time", 1.0, dimensions.time)
self.unit_registry.add("code_magnetic", 1.0, dimensions.magnetic_field)
self.unit_registry.add("code_temperature", 1.0, dimensions.temperature)
+ self.unit_registry.add("code_pressure", 1.0, dimensions.pressure)
self.unit_registry.add("code_velocity", 1.0, dimensions.velocity)
self.unit_registry.add("code_metallicity", 1.0,
dimensions.dimensionless)
@@ -676,9 +678,17 @@
self.unit_registry.modify("code_length", self.length_unit)
self.unit_registry.modify("code_mass", self.mass_unit)
self.unit_registry.modify("code_time", self.time_unit)
- vel_unit = getattr(self, "velocity_unit",
- self.length_unit / self.time_unit)
+ vel_unit = getattr(
+ self, "velocity_unit", self.length_unit / self.time_unit)
+ pressure_unit = getattr(
+ self, "pressure_unit",
+ self.mass_unit / (self.length_unit * self.time_unit)**2)
+ temperature_unit = getattr(self, "temperature_unit", 1.0)
+ density_unit = getattr(self, "density_unit", self.mass_unit / self.length_unit**3)
self.unit_registry.modify("code_velocity", vel_unit)
+ self.unit_registry.modify("code_temperature", temperature_unit)
+ self.unit_registry.modify("code_pressure", pressure_unit)
+ self.unit_registry.modify("code_density", density_unit)
# domain_width does not yet exist
if (self.domain_left_edge is not None and
self.domain_right_edge is not None):
diff -r 4ce155015ea95a99e4c6d2c805b0db6536bdc6f3 -r a43f02e6bea17aa9d8758344689f7f7004b5bc4f yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -33,8 +33,9 @@
get_box_grids_level
from yt.utilities.io_handler import \
io_registry
+from yt.utilities.physical_constants import mp, kb
from .fields import \
- RAMSESFieldInfo
+ RAMSESFieldInfo, _X
import yt.utilities.fortran_utils as fpu
from yt.geometry.oct_container import \
RAMSESOctreeContainer
@@ -489,19 +490,28 @@
# Note that unit_l *already* converts to proper!
# Also note that unit_l must be multiplied by the boxlen parameter to
# ensure we are correctly set up for the current domain.
- length_unit = self.parameters['unit_l'] * self.parameters['boxlen']
- rho_u = self.parameters['unit_d']
- # We're not multiplying by the boxlength here.
- mass_unit = rho_u * self.parameters['unit_l']**3
+ length_unit = self.parameters['unit_l']
+ boxlen = self.parameters['boxlen']
+ density_unit = self.parameters['unit_d']
+ mass_unit = density_unit * (length_unit * boxlen)**3
time_unit = self.parameters['unit_t']
-
magnetic_unit = np.sqrt(4*np.pi * mass_unit /
(time_unit**2 * length_unit))
+ pressure_unit = density_unit * (length_unit / time_unit)**2
+ # TODO:
+ # Generalize the temperature field to account for ionization
+ # For now assume an atomic ideal gas with cosmic abundances (x_H = 0.76)
+ mean_molecular_weight_factor = _X**-1
+
+ self.density_unit = self.quan(density_unit, 'g/cm**3')
self.magnetic_unit = self.quan(magnetic_unit, "gauss")
- self.length_unit = self.quan(length_unit, "cm")
+ self.length_unit = self.quan(length_unit * boxlen, "cm")
self.mass_unit = self.quan(mass_unit, "g")
self.time_unit = self.quan(time_unit, "s")
- self.velocity_unit = self.length_unit / self.time_unit
+ self.velocity_unit = self.quan(length_unit, 'cm') / self.time_unit
+ self.temperature_unit = (self.velocity_unit**2 * mp *
+ mean_molecular_weight_factor / kb)
+ self.pressure_unit = self.quan(pressure_unit, 'dyne/cm**2')
def _parse_parameter_file(self):
# hardcoded for now
@@ -546,15 +556,21 @@
self.domain_dimensions = np.ones(3, dtype='int32') * \
2**(self.min_level+1)
self.domain_right_edge = np.ones(3, dtype='float64')
- # This is likely not true, but I am not sure how to otherwise
- # distinguish them.
- mylog.warning("RAMSES frontend assumes all simulations are cosmological!")
- self.cosmological_simulation = 1
+ # This is likely not true, but it's not clear how to determine the boundary conditions
self.periodicity = (True, True, True)
- self.current_redshift = (1.0 / rheader["aexp"]) - 1.0
- self.omega_lambda = rheader["omega_l"]
- self.omega_matter = rheader["omega_m"]
- self.hubble_constant = rheader["H0"] / 100.0 # This is H100
+ # These conditions seem to always be true for non-cosmological datasets
+ if rheader["time"] > 0 and rheader["H0"] == 1 and rheader["aexp"] == 1:
+ self.cosmological_simulation = 0
+ self.current_redshift = 0
+ self.hubble_constant = 0
+ self.omega_matter = 0
+ self.omega_lambda = 0
+ else:
+ self.cosmological_simulation = 1
+ self.current_redshift = (1.0 / rheader["aexp"]) - 1.0
+ self.omega_lambda = rheader["omega_l"]
+ self.omega_matter = rheader["omega_m"]
+ self.hubble_constant = rheader["H0"] / 100.0 # This is H100
self.max_level = rheader['levelmax'] - self.min_level - 1
f.close()
diff -r 4ce155015ea95a99e4c6d2c805b0db6536bdc6f3 -r a43f02e6bea17aa9d8758344689f7f7004b5bc4f yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -32,8 +32,9 @@
b_units = "code_magnetic"
ra_units = "code_length / code_time**2"
-rho_units = "code_mass / code_length**3"
-vel_units = "code_length / code_time"
+rho_units = "code_density"
+vel_units = "code_velocity"
+pressure_units = "code_pressure"
known_species_masses = dict(
(sp, mh * v) for sp, v in [
@@ -70,7 +71,7 @@
("x-velocity", (vel_units, ["velocity_x"], None)),
("y-velocity", (vel_units, ["velocity_y"], None)),
("z-velocity", (vel_units, ["velocity_z"], None)),
- ("Pressure", ("code_mass / (code_length * code_time**2)", ["pressure"], None)),
+ ("Pressure", (pressure_units, ["pressure"], None)),
("Metallicity", ("", ["metallicity"], None)),
)
known_particle_fields = (
diff -r 4ce155015ea95a99e4c6d2c805b0db6536bdc6f3 -r a43f02e6bea17aa9d8758344689f7f7004b5bc4f yt/units/dimensions.py
--- a/yt/units/dimensions.py
+++ b/yt/units/dimensions.py
@@ -42,6 +42,7 @@
volume = area * length
momentum = mass * velocity
force = mass * acceleration
+pressure = force / area
energy = force * length
power = energy / time
flux = power / area
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