commit/enzo-dev: gbryan: Merged in brittonsmith/enzo-dev-cosmotest (pull request #419)

3 views
Skip to first unread message

commits...@bitbucket.org

unread,
Feb 5, 2019, 10:26:39 PM2/5/19
to enzo...@googlegroups.com
1 new commit in enzo-dev:

https://bitbucket.org/enzo/enzo-dev/commits/d4cee1981c1f/
Changeset: d4cee1981c1f
Branch: week-of-code
User: gbryan
Date: 2019-02-06 03:26:33+00:00
Summary: Merged in brittonsmith/enzo-dev-cosmotest (pull request #419)

Add Cosmology Simulation to test suite

Approved-by: John Regan <johnanth...@gmail.com>
Approved-by: Brian O'Shea <os...@msu.edu>
Approved-by: John Wise <jw...@physics.gatech.edu>
Affected #: 30 files

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/AMRCosmology/AMRCosmology.enzo
--- a/run/CosmologySimulation/AMRCosmology/AMRCosmology.enzo
+++ /dev/null
@@ -1,118 +0,0 @@
-#;-*-C-*-
-
-# AMR PROBLEM DEFINITION FILE: Cosmology Simulation
-# This is a small cosmology simulation that runs to z = 0.
-# The redshift outputs can be used to create a light-cone out to z = 0.1.
-#
-# define problem
-#
-ProblemType = 30 // cosmology simulation
-TopGridRank = 3
-TopGridDimensions = 32 32 32
-SelfGravity = 1 // gravity on
-TopGridGravityBoundary = 0 // Periodic BC for gravity
-LeftFaceBoundaryCondition = 3 3 3 // same for fluid
-RightFaceBoundaryCondition = 3 3 3
-
-#
-# problem parameters
-#
-CosmologySimulationOmegaBaryonNow = 0.0441
-CosmologySimulationOmegaCDMNow = 0.2239
-CosmologySimulationDensityName = GridDensity
-CosmologySimulationVelocity1Name = GridVelocities
-CosmologySimulationVelocity2Name = GridVelocities
-CosmologySimulationVelocity3Name = GridVelocities
-CosmologySimulationParticlePositionName = ParticlePositions
-CosmologySimulationParticleVelocityName = ParticleVelocities
-CosmologySimulationNumberOfInitialGrids = 1
-CosmologySimulationUseMetallicityField = 1
-
-#
-# cosmology parameters
-#
-ComovingCoordinates = 1
-CosmologyOmegaMatterNow = 0.268
-CosmologyOmegaLambdaNow = 0.732
-CosmologyHubbleConstantNow = 0.704
-CosmologyComovingBoxSize = 32.0
-CosmologyMaxExpansionRate = 0.02
-CosmologyInitialRedshift = 50
-CosmologyFinalRedshift = 0
-GravitationalConstant = 1
-
-#
-# I/O and stop/start parameters
-#
-dtDataDump = 5
-RedshiftDumpName = RD
-RedshiftDumpDir = RD
-DataDumpName = DD
-DataDumpDir = DD
-
-CosmologyOutputRedshift[0] = 0.100
-CosmologyOutputRedshift[1] = 0.089
-CosmologyOutputRedshift[2] = 0.078
-CosmologyOutputRedshift[3] = 0.067
-CosmologyOutputRedshift[4] = 0.057
-CosmologyOutputRedshift[5] = 0.047
-CosmologyOutputRedshift[6] = 0.037
-CosmologyOutputRedshift[7] = 0.027
-CosmologyOutputRedshift[8] = 0.017
-CosmologyOutputRedshift[9] = 0.007
-
-#
-# hydro parameters
-#
-HydroMethod = 0 // PPM
-Gamma = 1.6667
-PPMDiffusionParameter = 0 // diffusion off
-DualEnergyFormalism = 1 // use total & internal energy
-InterpolationMethod = 1 // SecondOrderA
-FluxCorrection = 1
-ConservativeInterpolation = 1
-CourantSafetyNumber = 0.5
-ParticleCourantSafetyNumber = 0.8
-UseMinimumPressureSupport = 0
-
-#
-# grid refinement parameters
-#
-StaticHierarchy = 0
-MaximumRefinementLevel = 5
-MaximumGravityRefinementLevel = 5
-MaximumParticleRefinementLevel = 5
-RefineBy = 2
-CellFlaggingMethod = 2 4
-MinimumOverDensityForRefinement = 8.0 8.0
-MinimumMassForRefinementLevelExponent = 0.0 0.0
-MinimumEfficiency = 0.35
-
-#
-# microphysics parameters
-#
-MultiSpecies = 0
-RadiativeCooling = 1
-RadiationFieldType = 0
-
-#
-# star formation parameters
-#
-StarParticleCreation = 1
-StarParticleFeedback = 1
-StarMakerOverDensityThreshold = 100
-StarMakerMinimumMass = 1e6
-StarMakerMinimumDynamicalTime = 1e6
-StarMakerMassEfficiency = 0.1
-StarMassEjectionFraction = 0.25
-StarMetalYield = 0.1
-StarEnergyToThermalFeedback = 1e-5
-StarFeedbackDistRadius = 1
-StarFeedbackDistCellStep = 3
-
-#
-# some global parameters
-#
-GreensFunctionMaxNumber = 40
-ParallelRootGridIO = 1
-ParallelParticleIO = 1

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/AMRCosmology/AMRCosmology.enzotest
--- a/run/CosmologySimulation/AMRCosmology/AMRCosmology.enzotest
+++ /dev/null
@@ -1,14 +0,0 @@
-name = 'AMRCosmology'
-answer_testing_script = None
-nprocs = 2
-runtime = 'long'
-AMR = True
-hydro = True
-gravity = True
-cosmology = True
-dimensionality = 3
-author = 'Uncle Enzo'
-max_time_minutes = 120
-fullsuite = False
-pushsuite = False
-quicksuite = False

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/AMRCosmology/AMRCosmology.inits
--- a/run/CosmologySimulation/AMRCosmology/AMRCosmology.inits
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Cosmology Parameters
-#
-CosmologyOmegaMatterNow = 0.268
-CosmologyOmegaLambdaNow = 0.732
-CosmologyOmegaBaryonNow = 0.0441
-CosmologyComovingBoxSize = 32.0 // in Mpc/h
-CosmologyHubbleConstantNow = 0.704 // in units of 100 km/s/Mpc
-CosmologyInitialRedshift = 50
-
-#
-# Power spectrum Parameters
-#
-PowerSpectrumType = 11 // Eisenstein & Hu
-PowerSpectrumSigma8 = 0.807
-PowerSpectrumPrimordialIndex = 0.961
-PowerSpectrumRandomSeed = -312367047
-
-#
-# Grid info
-#
-Rank = 3
-InitializeGrids = 1
-GridRefinement = 1
-GridDims = 32 32 32
-
-#
-# Particle info
-#
-InitializeParticles = 1
-ParticleRefinement = 1
-ParticleDims = 32 32 32
-
-#
-# Names
-#
-ParticlePositionName = ParticlePositions
-ParticleVelocityName = ParticleVelocities
-GridDensityName = GridDensity
-GridVelocityName = GridVelocities

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/AMRCosmology/notes.txt
--- a/run/CosmologySimulation/AMRCosmology/notes.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-This is a cosmology simulation that runs to z = 0 with tabulated
-radiative cooling and conventional, non-radiative star formation and
-feedback. It will run on 2 processors in about 40 minutes.
-
-note: you'll need a cool_rates.in file, which can be found in the inputs
-directory
-
-Usage:
-./inits.exe -d AMRCosmology.inits
-mpirun -np 2 ./ring.exe pv ParticlePositions ParticleVelocities
-mpirun -np 2 ./enzo.exe -d AMRCosmology.enzo

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/AMRCosmology_Grackle/AMRCosmology_Grackle.enzo
--- a/run/CosmologySimulation/AMRCosmology_Grackle/AMRCosmology_Grackle.enzo
+++ /dev/null
@@ -1,122 +0,0 @@
-#;-*-C-*-
-
-# AMR PROBLEM DEFINITION FILE: Cosmology Simulation
-# This is a small cosmology simulation that runs to z = 0.
-# The redshift outputs can be used to create a light-cone out to z = 0.1.
-#
-# define problem
-#
-ProblemType = 30 // cosmology simulation
-TopGridRank = 3
-TopGridDimensions = 32 32 32
-SelfGravity = 1 // gravity on
-TopGridGravityBoundary = 0 // Periodic BC for gravity
-LeftFaceBoundaryCondition = 3 3 3 // same for fluid
-RightFaceBoundaryCondition = 3 3 3
-
-#
-# problem parameters
-#
-CosmologySimulationOmegaBaryonNow = 0.0441
-CosmologySimulationOmegaCDMNow = 0.2239
-CosmologySimulationDensityName = GridDensity
-CosmologySimulationVelocity1Name = GridVelocities
-CosmologySimulationVelocity2Name = GridVelocities
-CosmologySimulationVelocity3Name = GridVelocities
-CosmologySimulationParticlePositionName = ParticlePositions
-CosmologySimulationParticleVelocityName = ParticleVelocities
-CosmologySimulationNumberOfInitialGrids = 1
-CosmologySimulationUseMetallicityField = 1
-
-#
-# cosmology parameters
-#
-ComovingCoordinates = 1
-CosmologyOmegaMatterNow = 0.268
-CosmologyOmegaLambdaNow = 0.732
-CosmologyHubbleConstantNow = 0.704
-CosmologyComovingBoxSize = 32.0
-CosmologyMaxExpansionRate = 0.02
-CosmologyInitialRedshift = 50
-CosmologyFinalRedshift = 0
-GravitationalConstant = 1
-
-#
-# I/O and stop/start parameters
-#
-dtDataDump = 5
-RedshiftDumpName = RD
-RedshiftDumpDir = RD
-DataDumpName = DD
-DataDumpDir = DD
-
-CosmologyOutputRedshift[0] = 0.100
-CosmologyOutputRedshift[1] = 0.089
-CosmologyOutputRedshift[2] = 0.078
-CosmologyOutputRedshift[3] = 0.067
-CosmologyOutputRedshift[4] = 0.057
-CosmologyOutputRedshift[5] = 0.047
-CosmologyOutputRedshift[6] = 0.037
-CosmologyOutputRedshift[7] = 0.027
-CosmologyOutputRedshift[8] = 0.017
-CosmologyOutputRedshift[9] = 0.007
-
-#
-# hydro parameters
-#
-HydroMethod = 0 // PPM
-Gamma = 1.6667
-PPMDiffusionParameter = 0 // diffusion off
-DualEnergyFormalism = 1 // use total & internal energy
-InterpolationMethod = 1 // SecondOrderA
-FluxCorrection = 1
-ConservativeInterpolation = 1
-CourantSafetyNumber = 0.5
-ParticleCourantSafetyNumber = 0.8
-UseMinimumPressureSupport = 0
-
-#
-# grid refinement parameters
-#
-StaticHierarchy = 0
-MaximumRefinementLevel = 5
-MaximumGravityRefinementLevel = 5
-MaximumParticleRefinementLevel = 5
-RefineBy = 2
-CellFlaggingMethod = 2 4
-MinimumOverDensityForRefinement = 8.0 8.0
-MinimumMassForRefinementLevelExponent = 0.0 0.0
-MinimumEfficiency = 0.35
-
-#
-# microphysics parameters
-#
-RadiativeCooling = 1
-use_grackle = 1
-MultiSpecies = 0 // sets grackle.primordial_chemistry
-MetalCooling = 1 // sets grackle.metal_cooling
-grackle_data_file = CloudyData_UVB=HM2012.h5
-UVbackground = 1
-CMBTemperatureFloor = 1 // sets grackle.cmb_temperature_floor
-
-#
-# star formation parameters
-#
-StarParticleCreation = 1
-StarParticleFeedback = 1
-StarMakerOverDensityThreshold = 100
-StarMakerMinimumMass = 1e6
-StarMakerMinimumDynamicalTime = 1e6
-StarMakerMassEfficiency = 0.1
-StarMassEjectionFraction = 0.25
-StarMetalYield = 0.1
-StarEnergyToThermalFeedback = 1e-5
-StarFeedbackDistRadius = 1
-StarFeedbackDistCellStep = 3
-
-#
-# some global parameters
-#
-GreensFunctionMaxNumber = 40
-ParallelRootGridIO = 1
-ParallelParticleIO = 1

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/AMRCosmology_Grackle/AMRCosmology_Grackle.enzotest
--- a/run/CosmologySimulation/AMRCosmology_Grackle/AMRCosmology_Grackle.enzotest
+++ /dev/null
@@ -1,14 +0,0 @@
-name = 'AMRCosmology_Grackle'
-answer_testing_script = None
-nprocs = 2
-runtime = 'long'
-AMR = True
-hydro = True
-gravity = True
-cosmology = True
-dimensionality = 3
-author = 'Uncle Enzo'
-max_time_minutes = 120
-fullsuite = False
-pushsuite = False
-quicksuite = False

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/AMRCosmology_Grackle/AMRCosmology_Grackle.inits
--- a/run/CosmologySimulation/AMRCosmology_Grackle/AMRCosmology_Grackle.inits
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Cosmology Parameters
-#
-CosmologyOmegaMatterNow = 0.268
-CosmologyOmegaLambdaNow = 0.732
-CosmologyOmegaBaryonNow = 0.0441
-CosmologyComovingBoxSize = 32.0 // in Mpc/h
-CosmologyHubbleConstantNow = 0.704 // in units of 100 km/s/Mpc
-CosmologyInitialRedshift = 50
-
-#
-# Power spectrum Parameters
-#
-PowerSpectrumType = 11 // Eisenstein & Hu
-PowerSpectrumSigma8 = 0.807
-PowerSpectrumPrimordialIndex = 0.961
-PowerSpectrumRandomSeed = -312367047
-
-#
-# Grid info
-#
-Rank = 3
-InitializeGrids = 1
-GridRefinement = 1
-GridDims = 32 32 32
-
-#
-# Particle info
-#
-InitializeParticles = 1
-ParticleRefinement = 1
-ParticleDims = 32 32 32
-
-#
-# Names
-#
-ParticlePositionName = ParticlePositions
-ParticleVelocityName = ParticleVelocities
-GridDensityName = GridDensity
-GridVelocityName = GridVelocities

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/AMRCosmology_Grackle/notes.txt
--- a/run/CosmologySimulation/AMRCosmology_Grackle/notes.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-This is a cosmology simulation identical to AMRCosmology, except using
-the Grackle to solve the cooling. See the documentation
-for more information on running with Grackle.
-
-This simulation runs to z = 0 with tabulated primordial and metal
-cooling from Grackle and conventional, non-radiative star formation and
-feedback. It will run on 2 processors in about 40 minutes.
-
-To run this, you will need to copy the file, CloudyData_UVB=HM2012.h5,
-from the input directory of your Grackle source, to the run directory
-of the simulation.
-
-Usage:
-./inits.exe -d AMRCosmology_Grackle.inits
-mpirun -np 2 ./ring.exe pv ParticlePositions ParticleVelocities
-mpirun -np 2 ./enzo.exe -d AMRCosmology_Grackle.enzo

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/AMRNestedCosmology/AMRNestedCosmology.enzo
--- a/run/CosmologySimulation/AMRNestedCosmology/AMRNestedCosmology.enzo
+++ /dev/null
@@ -1,121 +0,0 @@
-#;-*-C-*-
-
-# AMR PROBLEM DEFINITION FILE: Nested Cosmology Simulation
-# This is a cosmology simulation that runs until a dense object collapses.
-#
-# define problem
-#
-ProblemType = 30
-TopGridRank = 3
-SelfGravity = 1
-TopGridGravityBoundary = 0
-LeftFaceBoundaryCondition = 3 3 3
-RightFaceBoundaryCondition = 3 3 3
-BaryonSelfGravityApproximation = 1
-TopGridDimensions = 32 32 32
-
-#
-# problem parameters
-#
-CosmologySimulationOmegaBaryonNow = 0.04
-CosmologySimulationOmegaCDMNow = 0.26
-CosmologySimulationInitialTemperature = 140.0
-CosmologySimulationDensityName = GridDensity
-CosmologySimulationVelocity1Name = GridVelocities
-CosmologySimulationVelocity2Name = GridVelocities
-CosmologySimulationVelocity3Name = GridVelocities
-CosmologySimulationParticlePositionName = ParticlePositions
-CosmologySimulationParticleVelocityName = ParticleVelocities
-CosmologySimulationNumberOfInitialGrids = 3
-CosmologySimulationGridDimension[1] = 32 32 32
-CosmologySimulationGridLeftEdge[1] = 0.25 0.25 0.25
-CosmologySimulationGridRightEdge[1] = 0.75 0.75 0.75
-CosmologySimulationGridLevel[1] = 1
-CosmologySimulationGridDimension[2] = 32 32 32
-CosmologySimulationGridLeftEdge[2] = 0.375 0.375 0.375
-CosmologySimulationGridRightEdge[2] = 0.625 0.625 0.625
-CosmologySimulationGridLevel[2] = 2
-
-#
-# cosmology parameters
-#
-ComovingCoordinates = 1
-CosmologyOmegaMatterNow = 0.3
-CosmologyOmegaLambdaNow = 0.7
-CosmologyHubbleConstantNow = 0.70
-CosmologyComovingBoxSize = 0.3
-CosmologyMaxExpansionRate = 0.02
-CosmologyInitialRedshift = 99
-CosmologyFinalRedshift = 15
-GravitationalConstant = 1
-
-#
-# I/O and stop/start parameters
-#
-
-dtDataDump = 1.0
-RedshiftDumpName = RD
-RedshiftDumpDir = RD
-DataDumpName = DD
-DataDumpDir = DD
-
-CosmologyOutputRedshift[0] = 99
-CosmologyOutputRedshift[1] = 40
-CosmologyOutputRedshift[2] = 35
-CosmologyOutputRedshift[3] = 30
-CosmologyOutputRedshift[4] = 25
-CosmologyOutputRedshift[5] = 24
-CosmologyOutputRedshift[6] = 23
-CosmologyOutputRedshift[7] = 22
-CosmologyOutputRedshift[8] = 21
-CosmologyOutputRedshift[9] = 20
-CosmologyOutputRedshift[10] = 19
-CosmologyOutputRedshift[11] = 18
-CosmologyOutputRedshift[12] = 17
-CosmologyOutputRedshift[13] = 16
-CosmologyOutputRedshift[14] = 15
-
-#
-# hydro parameters
-#
-Gamma = 1.6667
-PPMDiffusionParameter = 0
-DualEnergyFormalism = 1
-HydroMethod = 0
-InterpolationMethod = 1
-CourantSafetyNumber = 0.4
-ParticleCourantSafetyNumber = 0.6
-UseMinimumPressureSupport = 0
-FluxCorrection = 1
-ConservativeInterpolation = 0
-
-#
-# microphysics parameters
-#
-RadiativeCooling = 1
-MultiSpecies = 2
-RadiationFieldType = 0
-
-#
-# grid refinement parameters
-#
-StaticHierarchy = 0
-MaximumRefinementLevel = 12
-MaximumGravityRefinementLevel = 12
-OutputFirstTimeAtLevel = 6
-StopFirstTimeAtLevel = 12
-RefineBy = 2
-CellFlaggingMethod = 2 4 7
-MinimumEfficiency = 0.35
-MinimumOverDensityForRefinement = 0.125 0.125
-RefineRegionLeftEdge = 0.375 0.375 0.375
-RefineRegionRightEdge = 0.625 0.625 0.625
-MinimumMassForRefinementLevelExponent = -0.3
-MinimumEnergyRatioForRefinement = 0.4
-
-#
-# some global parameters
-#
-GreensFunctionMaxNumber = 40
-#ParallelRootGridIO = 1
-#ParallelParticleIO = 1

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/AMRNestedCosmology/AMRNestedCosmology.enzotest
--- a/run/CosmologySimulation/AMRNestedCosmology/AMRNestedCosmology.enzotest
+++ /dev/null
@@ -1,14 +0,0 @@
-name = 'AMRNestedCosmology'
-answer_testing_script = None
-nprocs = 1
-runtime = 'medium'
-AMR = True
-hydro = True
-gravity = True
-cosmology = True
-dimensionality = 3
-author = 'Uncle Enzo'
-max_time_minutes = 10
-fullsuite = False
-pushsuite = False
-quicksuite = False

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/AMRNestedCosmology/AMRNestedCosmology_SubGrid.inits
--- a/run/CosmologySimulation/AMRNestedCosmology/AMRNestedCosmology_SubGrid.inits
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Cosmology Parameters
-#
-CosmologyOmegaMatterNow = 0.3
-CosmologyOmegaLambdaNow = 0.7
-CosmologyOmegaBaryonNow = 0.04
-CosmologyComovingBoxSize = 0.3 // in Mpc/h
-CosmologyHubbleConstantNow = 0.70 // in units of 100 km/s/Mpc
-CosmologyInitialRedshift = 99
-#
-# Power spectrum Parameters
-#
-PowerSpectrumType = 11 // Eisenstein & Hu
-PowerSpectrumSigma8 = 0.9
-PowerSpectrumPrimordialIndex = 1.0
-PowerSpectrumRandomSeed = -267478895
-#
-# Grid info
-#
-Rank = 3
-InitializeGrids = 1
-GridRefinement = 2
-GridDims = 32 32 32
-#
-# Particle info
-#
-InitializeParticles = 1
-ParticleRefinement = 2
-ParticleDims = 32 32 32
-
-#
-# Overall field parameters
-#
-MaxDims = 128 128 128
-NewCenterFloat = 0.480763 0.674363 0.285945
-StartIndexInNewCenterTopGridSystem = 8 8 8
-EndIndexInNewCenterTopGridSystem = 23 23 23
-RootGridDims = 32 32 32
-#
-# Names
-#
-ParticlePositionName = ParticlePositions.1
-ParticleVelocityName = ParticleVelocities.1
-GridDensityName = GridDensity.1
-GridVelocityName = GridVelocities.1

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/AMRNestedCosmology/AMRNestedCosmology_SubSubGrid.inits
--- a/run/CosmologySimulation/AMRNestedCosmology/AMRNestedCosmology_SubSubGrid.inits
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Cosmology Parameters
-#
-CosmologyOmegaMatterNow = 0.3
-CosmologyOmegaLambdaNow = 0.7
-CosmologyOmegaBaryonNow = 0.04
-CosmologyComovingBoxSize = 0.3 // in Mpc/h
-CosmologyHubbleConstantNow = 0.70 // in units of 100 km/s/Mpc
-CosmologyInitialRedshift = 99
-#
-# Power spectrum Parameters
-#
-PowerSpectrumType = 11 // Eisenstein & Hu
-PowerSpectrumSigma8 = 0.9
-PowerSpectrumPrimordialIndex = 1.0
-PowerSpectrumRandomSeed = -267478895
-#
-# Grid info
-#
-Rank = 3
-InitializeGrids = 1
-GridRefinement = 1
-GridDims = 32 32 32
-#
-# Particle info
-#
-InitializeParticles = 1
-ParticleRefinement = 1
-ParticleDims = 32 32 32
-
-#
-# Overall field parameters
-#
-MaxDims = 128 128 128
-NewCenterFloat = 0.480763 0.674363 0.285945
-StartIndexInNewCenterTopGridSystem = 12 12 12
-EndIndexInNewCenterTopGridSystem = 19 19 19
-RootGridDims = 32 32 32
-#
-# Names
-#
-ParticlePositionName = ParticlePositions.2
-ParticleVelocityName = ParticleVelocities.2
-GridDensityName = GridDensity.2
-GridVelocityName = GridVelocities.2

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/AMRNestedCosmology/AMRNestedCosmology_TopGrid.inits
--- a/run/CosmologySimulation/AMRNestedCosmology/AMRNestedCosmology_TopGrid.inits
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Cosmology Parameters
-#
-CosmologyOmegaMatterNow = 0.3
-CosmologyOmegaLambdaNow = 0.7
-CosmologyOmegaBaryonNow = 0.04
-CosmologyComovingBoxSize = 0.3 // in Mpc/h
-CosmologyHubbleConstantNow = 0.70 // in units of 100 km/s/Mpc
-CosmologyInitialRedshift = 99
-
-#
-# Power spectrum Parameters
-#
-PowerSpectrumType = 11 // Eisenstein & Hu
-PowerSpectrumSigma8 = 0.9
-PowerSpectrumPrimordialIndex = 1.0
-PowerSpectrumRandomSeed = -267478895
-
-#
-# Grid info
-#
-Rank = 3
-InitializeGrids = 1
-GridRefinement = 4
-GridDims = 32 32 32
-
-#
-# Particle info
-#
-InitializeParticles = 1
-ParticleRefinement = 4
-ParticleDims = 32 32 32
-
-#
-# Overall field parameters
-#
-MaxDims = 128 128 128
-NewCenterFloat = 0.480763 0.674363 0.285945
-StartIndex = 0 0 0
-RootGridDims = 32 32 32
-
-#
-# Names
-#
-ParticlePositionName = ParticlePositions.0
-ParticleVelocityName = ParticleVelocities.0
-GridDensityName = GridDensity.0
-GridVelocityName = GridVelocities.0

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/AMRNestedCosmology/notes.txt
--- a/run/CosmologySimulation/AMRNestedCosmology/notes.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-This is a cosmological simulation that simulates the collapse of a
-metal-free object at z ~ 20. It uses the primordial chemistry with H2
-cooling. The simulation stops when the maximum refinement level
-reaches 12. It will run on a single processor in about 5 minutes.
-
-Usage:
-./inits.exe -d -s AMRNestedCosmology_SubGrid.inits AMRNestedCosmology_TopGrid.init
-./inits.exe -d -s AMRNestedCosmology_SubSubGrid.inits AMRNestedCosmology_SubGrid.inits
-./inits.exe -d AMRNestedCosmology_SubSubGrid.inits
-./enzo.exe -d AMRNestedCosmology.enzo
-
-To run in parallel with parallel i/o:
-Uncomment the following lines in AMRNestedCosmology.enzo:
-#ParallelRootGridIO = 1
-#ParallelParticleIO = 1
-
-After running inits, and before running enzo, do:
-mpirun -np NPROCS ./ring.exe pv ParticlePositions.0 ParticleVelocities.0
-mpirun -np NPROCS ./ring.exe pv ParticlePositions.1 ParticleVelocities.1
-mpirun -np NPROCS ./ring.exe pv ParticlePositions.2 ParticleVelocities.2

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/amr_cosmology/amr_cosmology.conf
--- /dev/null
+++ b/run/CosmologySimulation/amr_cosmology/amr_cosmology.conf
@@ -0,0 +1,43 @@
+[setup]
+boxlength = 32.
+zstart = 50
+levelmin = 5
+levelmin_TF = 5
+levelmax = 5
+padding = 4
+overlap = 8
+# For zoom-in ICs, set these two parameters
+#ref_dims = 512,512,512
+#ref_center = 0.5,0.5,0.5
+align_top = no
+baryons = yes
+use_2LPT = yes
+use_LLA = yes
+periodic_TF = yes
+center_vel = no
+
+[cosmology]
+Omega_m = 0.268
+Omega_L = 0.732
+Omega_b = 0.0441
+H0 = 70.4
+sigma_8 = 0.828
+nspec = 0.9632
+transfer = eisenstein
+
+[random]
+cubesize = 256
+seed[5] = 8675309
+
+[output]
+format = enzo
+filename = IC
+
+[poisson]
+fft_fine = no
+accuracy = 1e-5
+pre_smooth = 3
+post_smooth = 3
+smoother = gs
+laplace_order = 6
+grad_order = 6

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/amr_cosmology/amr_cosmology.enzo
--- /dev/null
+++ b/run/CosmologySimulation/amr_cosmology/amr_cosmology.enzo
@@ -0,0 +1,129 @@
+#;-*-C-*-
+
+# AMR PROBLEM DEFINITION FILE: Cosmology Simulation
+# This is a small cosmology simulation that runs to z = 0.
+# The redshift outputs can be used to create a light-cone out to z = 0.1.
+#
+# define problem
+#
+ProblemType = 30 // cosmology simulation
+TopGridRank = 3
+TopGridDimensions = 32 32 32
+SelfGravity = 1 // gravity on
+TopGridGravityBoundary = 0 // Periodic BC for gravity
+LeftFaceBoundaryCondition = 3 3 3 // same for fluid
+RightFaceBoundaryCondition = 3 3 3
+
+#
+# problem parameters
+#
+CosmologySimulationOmegaBaryonNow = 0.0441
+CosmologySimulationOmegaCDMNow = 0.2239
+CosmologySimulationDensityName = GridDensity
+CosmologySimulationVelocity1Name = GridVelocities_x
+CosmologySimulationVelocity2Name = GridVelocities_y
+CosmologySimulationVelocity3Name = GridVelocities_z
+CosmologySimulationParticleVelocity1Name = ParticleVelocities_x
+CosmologySimulationParticleVelocity2Name = ParticleVelocities_y
+CosmologySimulationParticleVelocity3Name = ParticleVelocities_z
+CosmologySimulationParticleDisplacement1Name = ParticleDisplacements_x
+CosmologySimulationParticleDisplacement2Name = ParticleDisplacements_y
+CosmologySimulationParticleDisplacement3Name = ParticleDisplacements_z
+CosmologySimulationCalculatePositions = 1
+CosmologySimulationNumberOfInitialGrids = 1
+CosmologySimulationUseMetallicityField = 1
+
+#
+# cosmology parameters
+#
+ComovingCoordinates = 1
+CosmologyOmegaMatterNow = 0.268
+CosmologyOmegaLambdaNow = 0.732
+CosmologyHubbleConstantNow = 0.704
+CosmologyComovingBoxSize = 32.0
+CosmologyMaxExpansionRate = 0.02
+CosmologyInitialRedshift = 50
+CosmologyFinalRedshift = 0
+GravitationalConstant = 1
+
+#
+# I/O and stop/start parameters
+#
+dtDataDump = 25
+RedshiftDumpName = RD
+RedshiftDumpDir = RD
+DataDumpName = DD
+DataDumpDir = DD
+OutputCoolingTime = 1
+OutputTemperature = 1
+
+CosmologyOutputRedshift[0] = 0.100
+CosmologyOutputRedshift[1] = 0.089
+CosmologyOutputRedshift[2] = 0.078
+CosmologyOutputRedshift[3] = 0.067
+CosmologyOutputRedshift[4] = 0.057
+CosmologyOutputRedshift[5] = 0.047
+CosmologyOutputRedshift[6] = 0.037
+CosmologyOutputRedshift[7] = 0.027
+CosmologyOutputRedshift[8] = 0.017
+CosmologyOutputRedshift[9] = 0.007
+
+#
+# hydro parameters
+#
+HydroMethod = 0 // PPM
+Gamma = 1.6667
+PPMDiffusionParameter = 0 // diffusion off
+DualEnergyFormalism = 1 // use total & internal energy
+InterpolationMethod = 1 // SecondOrderA
+FluxCorrection = 1
+ConservativeInterpolation = 1
+CourantSafetyNumber = 0.5
+ParticleCourantSafetyNumber = 0.8
+UseMinimumPressureSupport = 0
+
+#
+# grid refinement parameters
+#
+StaticHierarchy = 0
+MaximumRefinementLevel = 5
+MaximumGravityRefinementLevel = 5
+MaximumParticleRefinementLevel = 5
+RefineBy = 2
+CellFlaggingMethod = 2 4
+MinimumOverDensityForRefinement = 8.0 8.0
+MinimumMassForRefinementLevelExponent = 0.0 0.0
+MinimumEfficiency = 0.35
+
+#
+# microphysics parameters
+#
+RadiativeCooling = 1
+use_grackle = 1
+MultiSpecies = 0 // sets grackle.primordial_chemistry
+MetalCooling = 1 // sets grackle.metal_cooling
+grackle_data_file = CloudyData_UVB=HM2012.h5
+UVbackground = 1
+CMBTemperatureFloor = 1 // sets grackle.cmb_temperature_floor
+
+#
+# star formation parameters
+#
+StarParticleCreation = 1
+StarParticleFeedback = 1
+StarMakerOverDensityThreshold = 100
+StarMakerMinimumMass = 1e6
+StarMakerMinimumDynamicalTime = 1e6
+StarMakerMassEfficiency = 0.1
+StarMassEjectionFraction = 0.25
+StarMetalYield = 0.1
+StarEnergyToThermalFeedback = 1e-5
+StarFeedbackDistRadius = 1
+StarFeedbackDistCellStep = 3
+
+#
+# some global parameters
+#
+GreensFunctionMaxNumber = 40
+ParallelRootGridIO = 1
+ParallelParticleIO = 1

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/amr_cosmology/amr_cosmology.enzotest
--- /dev/null
+++ b/run/CosmologySimulation/amr_cosmology/amr_cosmology.enzotest
@@ -0,0 +1,15 @@
+name = 'amr_cosmology'
+answer_testing_script = 'test_amr_cosmology.py'
+nprocs = 1
+runtime = 'short'
+hydro = True
+gravity = True
+AMR = True
+cosmology = True
+cosmology_simulation = True
+dimensionality = 3
+max_time_minutes = 20
+fullsuite = True
+pushsuite = True
+quicksuite = True
+hub_download = '5afb0040ec1bd30001fcd002'
\ No newline at end of file

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/amr_cosmology/notes.txt
--- /dev/null
+++ b/run/CosmologySimulation/amr_cosmology/notes.txt
@@ -0,0 +1,20 @@
+This is a cosmology simulation with Cen & Ostriker star
+formation/feedback, cooling with Grackle, and initial conditions made
+with MUSIC. It consists of a 32 Mpc/h box with 32^3 root grid cells
+and dark matter particles and 5 levels of AMR.
+
+This simulation will run to z = 0 in about 10 minutes on a single
+core. To run this, you will need to copy the file,
+CloudyData_UVB=HM2012.h5, from the input directory of your Grackle
+source, to the run directory of the simulation.
+
+To generate the ICs with MUSIC:
+./MUSIC amr_cosmology.conf
+
+Initial conditions can also be downloaded from the "Enzo test data"
+collection on the yt Hub (hub.yt), or do:
+pip install girder-client
+girder-cli --api-url https://girder.hub.yt/api/v1 download 5afb0040ec1bd30001fcd002
+
+To run the simulation:
+./enzo.exe -d amr_cosmology.enzo

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/amr_cosmology/test_amr_cosmology.py
--- /dev/null
+++ b/run/CosmologySimulation/amr_cosmology/test_amr_cosmology.py
@@ -0,0 +1,260 @@
+import glob
+import yt
+import matplotlib.pyplot as plt
+import numpy as np
+import os
+from yt.analysis_modules.halo_mass_function.api import *
+from yt.analysis_modules.halo_analysis.api import HaloCatalog
+from yt.testing import assert_rel_equal
+from numpy.testing import assert_equal
+
+from yt.utilities.answer_testing.framework import \
+ sim_dir_load
+
+_pf_name = os.path.basename(os.path.dirname(__file__)) + ".enzo"
+_dir_name = os.path.dirname(__file__)
+
+sim_dir = os.path.basename(_dir_name)
+test_data_dir = os.path.join(
+ os.environ.get("COSMO_TEST_DATA_DIR", "."), sim_dir)
+if not os.path.exists(test_data_dir):
+ os.makedirs(test_data_dir)
+generate_answers = int(os.environ.get("COSMO_TEST_GENERATE", 1))
+tolerance = os.environ.get("COSMO_TEST_MASS_TOLERANCE", 8)
+
+def test_hmf():
+ es = sim_dir_load(_pf_name, path=_dir_name)
+ es.get_time_series()
+ ds = es[-1]
+ hc = HaloCatalog(
+ data_ds=ds, finder_method='fof',
+ output_dir=os.path.join(_dir_name, "halo_catalogs/catalog"))
+ hc.create()
+ masses = hc.data_source['particle_mass'].in_units('Msun')
+ h = ds.hubble_constant
+ mtot = np.log10(masses*1.2) - np.log10(h)
+ masses_sim = np.sort(mtot)
+ sim_volume = ds.domain_width.in_units('Mpccm').prod()
+ n_cumulative_sim = np.arange(len(mtot),0,-1)
+ masses_sim,unique_indices = np.unique(masses_sim,return_index=True)
+
+ n_cumulative_sim = n_cumulative_sim[unique_indices]/sim_volume
+ filename = 'hmf.h5'
+ save_filename = os.path.join(_dir_name, filename)
+ data = {'masses': masses_sim, 'n_sim': n_cumulative_sim}
+ yt.save_as_dataset(ds, save_filename, data)
+
+ # make a plot
+ fig = plt.figure(figsize=(8,8))
+ plt.semilogy(masses_sim,n_cumulative_sim,'-')
+ plt.ylabel('Cumulative Halo Number Density $\mathrm{Mpc}^{-3}$',fontsize=16)
+ plt.xlabel('log Mass/$\mathrm{M}_{\odot}$',fontsize=16)
+ plt.tick_params(labelsize=16)
+ plt.savefig(os.path.join(_dir_name, 'hmf.png'),format='png')
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ # do the comparison
+ ds_comp = yt.load(compare_filename)
+
+ # assert quality to 8 decimals
+ assert_rel_equal(data['masses'], ds_comp.data['masses'], 8)
+ assert_rel_equal(data['n_sim'], ds_comp.data['n_sim'], 8)
+
+def test_max_density_halo_quantities():
+ ds = yt.load(os.path.join(_dir_name, 'RD0009/RD0009'))
+
+ # Find the point of maximum density, center a sphere of radius
+ # 1 Mpc around it, and sum the masses inside
+ val,pos = ds.find_max('Density')
+ sp = ds.sphere(pos,(1000.,'kpc'))
+ ct = sp['creation_time']
+ dm = (ct < 0)
+ dm_mass = np.sum(sp['particle_mass'][dm]).in_units('Msun')
+ gas_mass = np.sum(sp['cell_mass'].in_units('Msun'))
+
+ # Also look at the radial profiles of density and temperature
+ # within these spheres. The bin size is chosen to make the profiles
+ # smooth and for each bin to be larger than the cell size.
+ ptest0 = yt.create_profile(sp,"radius","density",n_bins=[20])
+ ptest1 = yt.create_profile(sp,"radius","temperature",n_bins=[20])
+
+ # Save the quantities to be compared
+ data = {"dm_mass": dm_mass,
+ "gas_mass": gas_mass,
+ "max_position": pos,
+ "density_profile": ptest0['density'],
+ "temperature_profile": ptest1['temperature']}
+
+ # save your results file
+ filename = "max_density_halo_quantities.h5"
+ save_filename = os.path.join(_dir_name, filename)
+ yt.save_as_dataset(ds, save_filename, data)
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ ds_comp = yt.load(compare_filename)
+ assert_rel_equal(data["dm_mass"], ds_comp.data["dm_mass"], tolerance)
+ assert_rel_equal(data["gas_mass"], ds_comp.data["gas_mass"], tolerance)
+ assert_rel_equal(data["max_position"], ds_comp.data["max_position"], tolerance)
+ assert_rel_equal(data["density_profile"], ds_comp.data["density_profile"], tolerance)
+ assert_rel_equal(data["temperature_profile"], ds_comp.data["temperature_profile"], tolerance)
+
+def test_dark_matter_mass():
+ # gather most recent data set
+ sim = sim_dir_load(_pf_name, path=_dir_name,
+ find_outputs=True)
+ sim.get_time_series()
+ ds = sim[-1]
+ data = ds.all_data()
+
+ # sum masses
+ MDM = np.sum(data['particle_mass'][ data['particle_type'] == 1 ].to('Msun'))
+
+ output_data = {'mass' : MDM}
+
+ # save
+ filename = "DM_mass_results.h5"
+ save_filename = os.path.join(_dir_name, filename)
+ yt.save_as_dataset(ds, save_filename, output_data)
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ ds_comp = yt.load(compare_filename)
+ assert_rel_equal(output_data['mass'], ds_comp.data['mass'], tolerance)
+
+def test_individual_baryon_mass():
+ # gather most recent data set
+ sim = sim_dir_load(_pf_name, path=_dir_name,
+ find_outputs=True)
+
+ if (sim.parameters['CosmologySimulationOmegaBaryonNow'] == 0.0):
+ return
+
+ sim.get_time_series()
+ ds = sim[-1]
+ data = ds.all_data()
+
+ # sum masses
+ Mstar = np.sum(data['particle_mass'][ data['particle_type'] == 2 ].to('Msun'))
+ Mgas = np.sum(data['cell_mass'].to('Msun'))
+
+ output_data = {'masses' : np.array([Mstar, Mgas])}
+
+ # save
+ filename = "gas_stars_mass_results.h5"
+ save_filename = os.path.join(_dir_name, filename)
+ yt.save_as_dataset(ds, save_filename, output_data)
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ ds_comp = yt.load(compare_filename)
+ assert_rel_equal(output_data['masses'], ds_comp.data['masses'], tolerance)
+
+def test_total_baryon_mass():
+ # gather most recent data set
+ sim = sim_dir_load(_pf_name, path=_dir_name,
+ find_outputs=True)
+
+ if (sim.parameters['CosmologySimulationOmegaBaryonNow'] == 0.0):
+ return
+
+ sim.get_time_series()
+ ds = sim[-1]
+ data = ds.all_data()
+
+ # sum masses
+ Mstar = np.sum(data['particle_mass'][ data['particle_type'] == 2 ].to('Msun'))
+ Mgas = np.sum(data['cell_mass'].to('Msun'))
+
+ output_data = {'masses' : Mstar + Mgas}
+
+ # save
+ filename = "baryon_mass_results.h5"
+ save_filename = os.path.join(_dir_name, filename)
+ yt.save_as_dataset(ds, save_filename, output_data)
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ ds_comp = yt.load(compare_filename)
+ assert_rel_equal(output_data['masses'], ds_comp.data['masses'], tolerance)
+
+def test_output_number():
+ ds = yt.load(os.path.join(_dir_name, 'DD0000/DD0000'))
+
+ DDnum = len(glob.glob(os.path.join(_dir_name, 'DD????/DD????')))
+ RDnum = len(glob.glob(os.path.join(_dir_name, 'RD????/RD????')))
+
+ output_data = {'number_of_files' : np.array([DDnum,RDnum])}
+
+ filename = "outputnum_results.h5"
+ save_filename = os.path.join(_dir_name, filename)
+ yt.save_as_dataset(ds, save_filename, output_data)
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ ds_comp = yt.load(compare_filename)
+ assert_equal(output_data['number_of_files'],
+ ds_comp.data['number_of_files'])
+
+def test_phase():
+ es = sim_dir_load(_pf_name, path=_dir_name)
+ es.get_time_series(redshifts=[0])
+ ds = es[-1]
+ ad = ds.all_data()
+ profile = ad.profile([("gas", "density")],
+ [("gas", "temperature"),
+ ("gas", "cell_mass")])
+ profile1 = ad.profile([("gas", "density")],
+ [("gas", "temperature"),
+ ("gas", "cooling_time")],
+ weight_field=('gas', 'cell_mass'))
+ density = profile.x
+ temperature = profile['gas', 'temperature']
+ cooling_time = profile1['gas', 'cooling_time']
+ cell_mass = profile['gas', 'cell_mass']
+
+ filename = 'phase_data.h5'
+ save_filename = os.path.join(_dir_name, filename)
+ data = {'density': density, 'temperature': temperature,
+ 'cooling_time': cooling_time, 'cell_mass': cell_mass}
+ yt.save_as_dataset(ds, save_filename, data)
+
+ pp = yt.PhasePlot(ad, 'density', 'temperature', 'cell_mass')
+ pp.set_unit('cell_mass', 'Msun')
+ pp.save(_dir_name)
+ pp1 = yt.PhasePlot(ad, 'density', 'temperature', 'cooling_time',
+ weight_field='cell_mass')
+ pp1.save(_dir_name)
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ # do the comparison
+ ds_comp = yt.load(compare_filename)
+
+ # assert quality to 8 decimals
+ assert_rel_equal(data['density'], ds_comp.data['density'], 8)
+ assert_rel_equal(data['temperature'], ds_comp.data['temperature'], 8)
+ assert_rel_equal(data['cooling_time'], ds_comp.data['cooling_time'], 8)
+ assert_rel_equal(data['cell_mass'], ds_comp.data['cell_mass'], 8)

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/amr_nested_cosmology/amr_nested_cosmology.enzo
--- /dev/null
+++ b/run/CosmologySimulation/amr_nested_cosmology/amr_nested_cosmology.enzo
@@ -0,0 +1,126 @@
+#;-*-C-*-
+
+# AMR PROBLEM DEFINITION FILE: Cosmology Simulation
+# This is a small cosmology simulation that runs to z = 0.
+# The redshift outputs can be used to create a light-cone out to z = 0.1.
+#
+# define problem
+#
+ProblemType = 30 // cosmology simulation
+TopGridRank = 3
+TopGridDimensions = 32 32 32
+SelfGravity = 1 // gravity on
+TopGridGravityBoundary = 0 // Periodic BC for gravity
+LeftFaceBoundaryCondition = 3 3 3 // same for fluid
+RightFaceBoundaryCondition = 3 3 3
+
+#
+# problem parameters
+#
+CosmologySimulationOmegaBaryonNow = 0.0441
+CosmologySimulationOmegaCDMNow = 0.2239
+CosmologySimulationDensityName = GridDensity
+CosmologySimulationVelocity1Name = GridVelocities_x
+CosmologySimulationVelocity2Name = GridVelocities_y
+CosmologySimulationVelocity3Name = GridVelocities_z
+CosmologySimulationParticleVelocity1Name = ParticleVelocities_x
+CosmologySimulationParticleVelocity2Name = ParticleVelocities_y
+CosmologySimulationParticleVelocity3Name = ParticleVelocities_z
+CosmologySimulationParticleDisplacement1Name = ParticleDisplacements_x
+CosmologySimulationParticleDisplacement2Name = ParticleDisplacements_y
+CosmologySimulationParticleDisplacement3Name = ParticleDisplacements_z
+CosmologySimulationCalculatePositions = 1
+CosmologySimulationNumberOfInitialGrids = 2
+CosmologySimulationGridDimension[1] = 10 14 14
+CosmologySimulationGridLeftEdge[1] = 0.40625 0.375 0.34375
+CosmologySimulationGridRightEdge[1] = 0.5625 0.59375 0.5625
+CosmologySimulationGridLevel[1] = 1
+CosmologySimulationUseMetallicityField = 1
+
+#
+# cosmology parameters
+#
+ComovingCoordinates = 1
+CosmologyOmegaMatterNow = 0.268
+CosmologyOmegaDarkMatterNow = 0.2239
+CosmologyOmegaLambdaNow = 0.732
+CosmologyHubbleConstantNow = 0.704
+CosmologyComovingBoxSize = 32.0
+CosmologyMaxExpansionRate = 0.02
+CosmologyInitialRedshift = 50
+CosmologyFinalRedshift = 1.8
+GravitationalConstant = 1
+
+#
+# I/O and stop/start parameters
+#
+dtDataDump = 5
+RedshiftDumpName = RD
+RedshiftDumpDir = RD
+DataDumpName = DD
+DataDumpDir = DD
+OutputCoolingTime = 1
+OutputTemperature = 1
+
+#
+# hydro parameters
+#
+HydroMethod = 0 // PPM
+Gamma = 1.6667
+PPMDiffusionParameter = 0 // diffusion off
+DualEnergyFormalism = 1 // use total & internal energy
+InterpolationMethod = 1 // SecondOrderA
+FluxCorrection = 1
+ConservativeInterpolation = 1
+CourantSafetyNumber = 0.5
+ParticleCourantSafetyNumber = 0.8
+UseMinimumPressureSupport = 0
+
+#
+# grid refinement parameters
+#
+StaticHierarchy = 0
+MaximumRefinementLevel = 5
+MaximumGravityRefinementLevel = 5
+MaximumParticleRefinementLevel = 5
+RefineBy = 2
+CellFlaggingMethod = 2 4 8
+MinimumOverDensityForRefinement = 1.0 1.0
+MinimumMassForRefinementLevelExponent = 0.0 0.0
+MinimumEfficiency = 0.35
+MustRefineParticlesCreateParticles = 3
+MustRefineParticlesRefineToLevel = 1
+CosmologySimulationParticleTypeName = RefinementMask
+
+#
+# microphysics parameters
+#
+RadiativeCooling = 1
+use_grackle = 1
+MultiSpecies = 0 // sets grackle.primordial_chemistry
+MetalCooling = 1 // sets grackle.metal_cooling
+grackle_data_file = CloudyData_UVB=HM2012.h5
+UVbackground = 1
+CMBTemperatureFloor = 1 // sets grackle.cmb_temperature_floor
+
+#
+# star formation parameters
+#
+StarParticleCreation = 1
+StarParticleFeedback = 1
+StarMakerOverDensityThreshold = 100
+StarMakerMinimumMass = 1e6
+StarMakerMinimumDynamicalTime = 1e6
+StarMakerMassEfficiency = 0.1
+StarMassEjectionFraction = 0.25
+StarMetalYield = 0.1
+StarEnergyToThermalFeedback = 1e-5
+StarFeedbackDistRadius = 1
+StarFeedbackDistCellStep = 3
+
+#
+# some global parameters
+#
+GreensFunctionMaxNumber = 40
+ParallelRootGridIO = 1
+ParallelParticleIO = 1

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/amr_nested_cosmology/amr_nested_cosmology.enzotest
--- /dev/null
+++ b/run/CosmologySimulation/amr_nested_cosmology/amr_nested_cosmology.enzotest
@@ -0,0 +1,15 @@
+name = 'amr_nested_cosmology'
+answer_testing_script = 'test_amr_cosmology.py'
+nprocs = 1
+runtime = 'short'
+hydro = True
+gravity = True
+AMR = True
+cosmology = True
+cosmology_simulation = True
+dimensionality = 3
+max_time_minutes = 20
+fullsuite = True
+pushsuite = True
+quicksuite = True
+hub_download = '5afef79bec1bd30001fcd07e'
\ No newline at end of file

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/amr_nested_cosmology/notes.txt
--- /dev/null
+++ b/run/CosmologySimulation/amr_nested_cosmology/notes.txt
@@ -0,0 +1,20 @@
+This is a variation of the amr_cosmology simulation with 1 level of
+initial refinement and must-refine-particles. The simulation uses Cen
+& Ostriker star formation/feedback, cooling with Grackle, and initial
+conditions made with MUSIC. The nested refinement zooms in on the most
+massive halo in the box at z = 1.8. Must-refine-particles are used to
+allow AMR only for particles that end up within 3 virial radii of the
+most massive halo at z = 1.8. The simulation will run in about 1
+minute on a single core.
+
+The zoom initial conditions with must-refine-particle flagging was
+created using the method outlined in
+https://bitbucket.org/jwise77/enzo-mrp-music
+
+Initial conditions can be downloaded from the "Enzo test data"
+collection on the yt Hub (hub.yt), or do:
+pip install girder-client
+girder-cli --api-url https://girder.hub.yt/api/v1 download 5afef79bec1bd30001fcd07e
+
+To run the simulation:
+./enzo.exe -d amr_nested_cosmology.enzo

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/amr_nested_cosmology/test_amr_nested_cosmology.py
--- /dev/null
+++ b/run/CosmologySimulation/amr_nested_cosmology/test_amr_nested_cosmology.py
@@ -0,0 +1,260 @@
+import glob
+import yt
+import matplotlib.pyplot as plt
+import numpy as np
+import os
+from yt.analysis_modules.halo_mass_function.api import *
+from yt.analysis_modules.halo_analysis.api import HaloCatalog
+from yt.testing import assert_rel_equal
+from numpy.testing import assert_equal
+
+from yt.utilities.answer_testing.framework import \
+ sim_dir_load
+
+_pf_name = os.path.basename(os.path.dirname(__file__)) + ".enzo"
+_dir_name = os.path.dirname(__file__)
+
+sim_dir = os.path.basename(_dir_name)
+test_data_dir = os.path.join(
+ os.environ.get("COSMO_TEST_DATA_DIR", "."), sim_dir)
+if not os.path.exists(test_data_dir):
+ os.makedirs(test_data_dir)
+generate_answers = int(os.environ.get("COSMO_TEST_GENERATE", 1))
+tolerance = os.environ.get("COSMO_TEST_MASS_TOLERANCE", 8)
+
+def test_hmf():
+ es = sim_dir_load(_pf_name, path=_dir_name)
+ es.get_time_series()
+ ds = es[-1]
+ hc = HaloCatalog(
+ data_ds=ds, finder_method='fof',
+ output_dir=os.path.join(_dir_name, "halo_catalogs/catalog"))
+ hc.create()
+ masses = hc.data_source['particle_mass'].in_units('Msun')
+ h = ds.hubble_constant
+ mtot = np.log10(masses*1.2) - np.log10(h)
+ masses_sim = np.sort(mtot)
+ sim_volume = ds.domain_width.in_units('Mpccm').prod()
+ n_cumulative_sim = np.arange(len(mtot),0,-1)
+ masses_sim,unique_indices = np.unique(masses_sim,return_index=True)
+
+ n_cumulative_sim = n_cumulative_sim[unique_indices]/sim_volume
+ filename = 'hmf.h5'
+ save_filename = os.path.join(_dir_name, filename)
+ data = {'masses': masses_sim, 'n_sim': n_cumulative_sim}
+ yt.save_as_dataset(ds, save_filename, data)
+
+ # make a plot
+ fig = plt.figure(figsize=(8,8))
+ plt.semilogy(masses_sim,n_cumulative_sim,'-')
+ plt.ylabel('Cumulative Halo Number Density $\mathrm{Mpc}^{-3}$',fontsize=16)
+ plt.xlabel('log Mass/$\mathrm{M}_{\odot}$',fontsize=16)
+ plt.tick_params(labelsize=16)
+ plt.savefig(os.path.join(_dir_name, 'hmf.png'),format='png')
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ # do the comparison
+ ds_comp = yt.load(compare_filename)
+
+ # assert quality to 8 decimals
+ assert_rel_equal(data['masses'], ds_comp.data['masses'], 8)
+ assert_rel_equal(data['n_sim'], ds_comp.data['n_sim'], 8)
+
+def test_max_density_halo_quantities():
+ ds = yt.load(os.path.join(_dir_name, 'DD0013/DD0013'))
+
+ # Find the point of maximum density, center a sphere of radius
+ # 1 Mpc around it, and sum the masses inside
+ val,pos = ds.find_max('Density')
+ sp = ds.sphere(pos,(1000.,'kpc'))
+ ct = sp['creation_time']
+ dm = (ct < 0)
+ dm_mass = np.sum(sp['particle_mass'][dm]).in_units('Msun')
+ gas_mass = np.sum(sp['cell_mass'].in_units('Msun'))
+
+ # Also look at the radial profiles of density and temperature
+ # within these spheres. The bin size is chosen to make the profiles
+ # smooth and for each bin to be larger than the cell size.
+ ptest0 = yt.create_profile(sp,"radius","density",n_bins=[20])
+ ptest1 = yt.create_profile(sp,"radius","temperature",n_bins=[20])
+
+ # Save the quantities to be compared
+ data = {"dm_mass": dm_mass,
+ "gas_mass": gas_mass,
+ "max_position": pos,
+ "density_profile": ptest0['density'],
+ "temperature_profile": ptest1['temperature']}
+
+ # save your results file
+ filename = "max_density_halo_quantities.h5"
+ save_filename = os.path.join(_dir_name, filename)
+ yt.save_as_dataset(ds, save_filename, data)
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ ds_comp = yt.load(compare_filename)
+ assert_rel_equal(data["dm_mass"], ds_comp.data["dm_mass"], tolerance)
+ assert_rel_equal(data["gas_mass"], ds_comp.data["gas_mass"], tolerance)
+ assert_rel_equal(data["max_position"], ds_comp.data["max_position"], tolerance)
+ assert_rel_equal(data["density_profile"], ds_comp.data["density_profile"], tolerance)
+ assert_rel_equal(data["temperature_profile"], ds_comp.data["temperature_profile"], tolerance)
+
+def test_dark_matter_mass():
+ # gather most recent data set
+ sim = sim_dir_load(_pf_name, path=_dir_name,
+ find_outputs=True)
+ sim.get_time_series()
+ ds = sim[-1]
+ data = ds.all_data()
+
+ # sum masses
+ MDM = np.sum(data['particle_mass'][ data['particle_type'] == 1 ].to('Msun'))
+
+ output_data = {'mass' : MDM}
+
+ # save
+ filename = "DM_mass_results.h5"
+ save_filename = os.path.join(_dir_name, filename)
+ yt.save_as_dataset(ds, save_filename, output_data)
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ ds_comp = yt.load(compare_filename)
+ assert_rel_equal(output_data['mass'], ds_comp.data['mass'], tolerance)
+
+def test_individual_baryon_mass():
+ # gather most recent data set
+ sim = sim_dir_load(_pf_name, path=_dir_name,
+ find_outputs=True)
+
+ if (sim.parameters['CosmologySimulationOmegaBaryonNow'] == 0.0):
+ return
+
+ sim.get_time_series()
+ ds = sim[-1]
+ data = ds.all_data()
+
+ # sum masses
+ Mstar = np.sum(data['particle_mass'][ data['particle_type'] == 2 ].to('Msun'))
+ Mgas = np.sum(data['cell_mass'].to('Msun'))
+
+ output_data = {'masses' : np.array([Mstar, Mgas])}
+
+ # save
+ filename = "gas_stars_mass_results.h5"
+ save_filename = os.path.join(_dir_name, filename)
+ yt.save_as_dataset(ds, save_filename, output_data)
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ ds_comp = yt.load(compare_filename)
+ assert_rel_equal(output_data['masses'], ds_comp.data['masses'], tolerance)
+
+def test_total_baryon_mass():
+ # gather most recent data set
+ sim = sim_dir_load(_pf_name, path=_dir_name,
+ find_outputs=True)
+
+ if (sim.parameters['CosmologySimulationOmegaBaryonNow'] == 0.0):
+ return
+
+ sim.get_time_series()
+ ds = sim[-1]
+ data = ds.all_data()
+
+ # sum masses
+ Mstar = np.sum(data['particle_mass'][ data['particle_type'] == 2 ].to('Msun'))
+ Mgas = np.sum(data['cell_mass'].to('Msun'))
+
+ output_data = {'masses' : Mstar + Mgas}
+
+ # save
+ filename = "baryon_mass_results.h5"
+ save_filename = os.path.join(_dir_name, filename)
+ yt.save_as_dataset(ds, save_filename, output_data)
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ ds_comp = yt.load(compare_filename)
+ assert_rel_equal(output_data['masses'], ds_comp.data['masses'], tolerance)
+
+def test_output_number():
+ ds = yt.load(os.path.join(_dir_name, 'DD0000/DD0000'))
+
+ DDnum = len(glob.glob(os.path.join(_dir_name, 'DD????/DD????')))
+ RDnum = len(glob.glob(os.path.join(_dir_name, 'RD????/RD????')))
+
+ output_data = {'number_of_files' : np.array([DDnum,RDnum])}
+
+ filename = "outputnum_results.h5"
+ save_filename = os.path.join(_dir_name, filename)
+ yt.save_as_dataset(ds, save_filename, output_data)
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ ds_comp = yt.load(compare_filename)
+ assert_equal(output_data['number_of_files'],
+ ds_comp.data['number_of_files'])
+
+def test_phase():
+ es = sim_dir_load(_pf_name, path=_dir_name)
+ es.get_time_series(redshifts=[0])
+ ds = es[-1]
+ ad = ds.all_data()
+ profile = ad.profile([("gas", "density")],
+ [("gas", "temperature"),
+ ("gas", "cell_mass")])
+ profile1 = ad.profile([("gas", "density")],
+ [("gas", "temperature"),
+ ("gas", "cooling_time")],
+ weight_field=('gas', 'cell_mass'))
+ density = profile.x
+ temperature = profile['gas', 'temperature']
+ cooling_time = profile1['gas', 'cooling_time']
+ cell_mass = profile['gas', 'cell_mass']
+
+ filename = 'phase_data.h5'
+ save_filename = os.path.join(_dir_name, filename)
+ data = {'density': density, 'temperature': temperature,
+ 'cooling_time': cooling_time, 'cell_mass': cell_mass}
+ yt.save_as_dataset(ds, save_filename, data)
+
+ pp = yt.PhasePlot(ad, 'density', 'temperature', 'cell_mass')
+ pp.set_unit('cell_mass', 'Msun')
+ pp.save(_dir_name)
+ pp1 = yt.PhasePlot(ad, 'density', 'temperature', 'cooling_time',
+ weight_field='cell_mass')
+ pp1.save(_dir_name)
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ # do the comparison
+ ds_comp = yt.load(compare_filename)
+
+ # assert quality to 8 decimals
+ assert_rel_equal(data['density'], ds_comp.data['density'], 8)
+ assert_rel_equal(data['temperature'], ds_comp.data['temperature'], 8)
+ assert_rel_equal(data['cooling_time'], ds_comp.data['cooling_time'], 8)
+ assert_rel_equal(data['cell_mass'], ds_comp.data['cell_mass'], 8)

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/dm_only/dm_only.conf
--- /dev/null
+++ b/run/CosmologySimulation/dm_only/dm_only.conf
@@ -0,0 +1,43 @@
+[setup]
+boxlength = 32.
+zstart = 50
+levelmin = 5
+levelmin_TF = 5
+levelmax = 5
+padding = 4
+overlap = 8
+# For zoom-in ICs, set these two parameters
+#ref_dims = 512,512,512
+#ref_center = 0.5,0.5,0.5
+align_top = no
+baryons = no
+use_2LPT = yes
+use_LLA = yes
+periodic_TF = yes
+center_vel = no
+
+[cosmology]
+Omega_m = 0.268
+Omega_L = 0.732
+Omega_b = 0.0441
+H0 = 70.4
+sigma_8 = 0.828
+nspec = 0.9632
+transfer = eisenstein
+
+[random]
+cubesize = 256
+seed[5] = 8675309
+
+[output]
+format = enzo
+filename = IC
+
+[poisson]
+fft_fine = no
+accuracy = 1e-5
+pre_smooth = 3
+post_smooth = 3
+smoother = gs
+laplace_order = 6
+grad_order = 6

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/dm_only/dm_only.enzo
--- /dev/null
+++ b/run/CosmologySimulation/dm_only/dm_only.enzo
@@ -0,0 +1,85 @@
+#;-*-C-*-
+
+# AMR PROBLEM DEFINITION FILE: Cosmology Simulation
+# This is a small cosmology simulation that runs to z = 0.
+# The redshift outputs can be used to create a light-cone out to z = 0.1.
+#
+# define problem
+#
+ProblemType = 30 // cosmology simulation
+TopGridRank = 3
+TopGridDimensions = 32 32 32
+SelfGravity = 1 // gravity on
+TopGridGravityBoundary = 0 // Periodic BC for gravity
+LeftFaceBoundaryCondition = 3 3 3 // same for fluid
+RightFaceBoundaryCondition = 3 3 3
+
+#
+# problem parameters
+#
+CosmologySimulationOmegaBaryonNow = 0.0
+CosmologySimulationOmegaCDMNow = 0.268
+CosmologySimulationParticleVelocity1Name = ParticleVelocities_x
+CosmologySimulationParticleVelocity2Name = ParticleVelocities_y
+CosmologySimulationParticleVelocity3Name = ParticleVelocities_z
+CosmologySimulationParticleDisplacement1Name = ParticleDisplacements_x
+CosmologySimulationParticleDisplacement2Name = ParticleDisplacements_y
+CosmologySimulationParticleDisplacement3Name = ParticleDisplacements_z
+CosmologySimulationCalculatePositions = 1
+CosmologySimulationNumberOfInitialGrids = 1
+
+#
+# cosmology parameters
+#
+ComovingCoordinates = 1
+CosmologyOmegaMatterNow = 0.268
+CosmologyOmegaLambdaNow = 0.732
+CosmologyHubbleConstantNow = 0.704
+CosmologyComovingBoxSize = 32.0
+CosmologyMaxExpansionRate = 0.02
+CosmologyInitialRedshift = 50
+CosmologyFinalRedshift = 0
+GravitationalConstant = 1
+
+#
+# I/O and stop/start parameters
+#
+dtDataDump = 25
+RedshiftDumpName = RD
+RedshiftDumpDir = RD
+DataDumpName = DD
+DataDumpDir = DD
+
+#
+# hydro parameters
+#
+HydroMethod = 0 // PPM
+Gamma = 1.6667
+PPMDiffusionParameter = 0 // diffusion off
+DualEnergyFormalism = 1 // use total & internal energy
+InterpolationMethod = 1 // SecondOrderA
+FluxCorrection = 1
+ConservativeInterpolation = 1
+CourantSafetyNumber = 0.5
+ParticleCourantSafetyNumber = 0.8
+UseMinimumPressureSupport = 0
+
+#
+# grid refinement parameters
+#
+StaticHierarchy = 0
+MaximumRefinementLevel = 5
+MaximumGravityRefinementLevel = 5
+MaximumParticleRefinementLevel = 5
+RefineBy = 2
+CellFlaggingMethod = 2 4
+MinimumOverDensityForRefinement = 8.0 8.0
+MinimumMassForRefinementLevelExponent = 0.0 0.0
+MinimumEfficiency = 0.35
+
+#
+# some global parameters
+#
+GreensFunctionMaxNumber = 40
+ParallelRootGridIO = 1
+ParallelParticleIO = 1

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/dm_only/dm_only.enzotest
--- /dev/null
+++ b/run/CosmologySimulation/dm_only/dm_only.enzotest
@@ -0,0 +1,15 @@
+name = 'dm_only'
+answer_testing_script = 'test_dm_only.py'
+nprocs = 1
+runtime = 'short'
+hydro = False
+gravity = True
+AMR = True
+cosmology = True
+cosmology_simulation = True
+dimensionality = 3
+max_time_minutes = 1
+fullsuite = True
+pushsuite = True
+quicksuite = True
+hub_download = '5afb0145ec1bd30001fcd024'
\ No newline at end of file

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/dm_only/notes.txt
--- /dev/null
+++ b/run/CosmologySimulation/dm_only/notes.txt
@@ -0,0 +1,15 @@
+This is a dark-matter-only version of the amr_cosmology simulation. It
+consists of a 32 Mpc/h box with 32^3 dark matter particles and 5
+levels of AMR. This simulation will run to z = 0 in less than a minute
+on a single core.
+
+To generate the ICs with MUSIC:
+./MUSIC dm_only.conf
+
+Initial conditions can also be downloaded from the "Enzo test data"
+collection on the yt Hub (hub.yt), or do:
+pip install girder-client
+girder-cli --api-url https://girder.hub.yt/api/v1 download 5afb0145ec1bd30001fcd024
+
+To run the simulation:
+./enzo.exe -d dm_only.enzo

diff -r e58dbfd476cb -r d4cee1981c1f run/CosmologySimulation/dm_only/test_dm_only.py
--- /dev/null
+++ b/run/CosmologySimulation/dm_only/test_dm_only.py
@@ -0,0 +1,112 @@
+import glob
+import yt
+import matplotlib.pyplot as plt
+import numpy as np
+import os
+from yt.analysis_modules.halo_mass_function.api import *
+from yt.analysis_modules.halo_analysis.api import HaloCatalog
+from yt.testing import assert_rel_equal
+from numpy.testing import assert_equal
+
+from yt.utilities.answer_testing.framework import \
+ sim_dir_load
+
+_pf_name = os.path.basename(os.path.dirname(__file__)) + ".enzo"
+_dir_name = os.path.dirname(__file__)
+
+sim_dir = os.path.basename(_dir_name)
+test_data_dir = os.path.join(
+ os.environ.get("COSMO_TEST_DATA_DIR", "."), sim_dir)
+if not os.path.exists(test_data_dir):
+ os.makedirs(test_data_dir)
+generate_answers = int(os.environ.get("COSMO_TEST_GENERATE", 1))
+tolerance = os.environ.get("COSMO_TEST_MASS_TOLERANCE", 8)
+
+def test_hmf():
+ es = sim_dir_load(_pf_name, path=_dir_name)
+ es.get_time_series()
+ ds = es[-1]
+ hc = HaloCatalog(
+ data_ds=ds, finder_method='fof',
+ output_dir=os.path.join(_dir_name, "halo_catalogs/catalog"))
+ hc.create()
+ masses = hc.data_source['particle_mass'].in_units('Msun')
+ h = ds.hubble_constant
+ mtot = np.log10(masses*1.2) - np.log10(h)
+ masses_sim = np.sort(mtot)
+ sim_volume = ds.domain_width.in_units('Mpccm').prod()
+ n_cumulative_sim = np.arange(len(mtot),0,-1)
+ masses_sim,unique_indices = np.unique(masses_sim,return_index=True)
+
+ n_cumulative_sim = n_cumulative_sim[unique_indices]/sim_volume
+ filename = 'hmf.h5'
+ save_filename = os.path.join(_dir_name, filename)
+ data = {'masses': masses_sim, 'n_sim': n_cumulative_sim}
+ yt.save_as_dataset(ds, save_filename, data)
+
+ # make a plot
+ fig = plt.figure(figsize=(8,8))
+ plt.semilogy(masses_sim,n_cumulative_sim,'-')
+ plt.ylabel('Cumulative Halo Number Density $\mathrm{Mpc}^{-3}$',fontsize=16)
+ plt.xlabel('log Mass/$\mathrm{M}_{\odot}$',fontsize=16)
+ plt.tick_params(labelsize=16)
+ plt.savefig(os.path.join(_dir_name, 'hmf.png'),format='png')
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ # do the comparison
+ ds_comp = yt.load(compare_filename)
+
+ # assert quality to 8 decimals
+ assert_rel_equal(data['masses'], ds_comp.data['masses'], 8)
+ assert_rel_equal(data['n_sim'], ds_comp.data['n_sim'], 8)
+
+def test_dark_matter_mass():
+ # gather most recent data set
+ sim = sim_dir_load(_pf_name, path=_dir_name,
+ find_outputs=True)
+ sim.get_time_series()
+ ds = sim[-1]
+ data = ds.all_data()
+
+ # sum masses
+ MDM = np.sum(data['particle_mass'][ data['particle_type'] == 1 ].to('Msun'))
+
+ output_data = {'mass' : MDM}
+
+ # save
+ filename = "DM_mass_results.h5"
+ save_filename = os.path.join(_dir_name, filename)
+ yt.save_as_dataset(ds, save_filename, output_data)
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ ds_comp = yt.load(compare_filename)
+ assert_rel_equal(output_data['mass'], ds_comp.data['mass'], tolerance)
+
+def test_output_number():
+ ds = yt.load(os.path.join(_dir_name, 'DD0000/DD0000'))
+
+ DDnum = len(glob.glob(os.path.join(_dir_name, 'DD????/DD????')))
+ RDnum = len(glob.glob(os.path.join(_dir_name, 'RD????/RD????')))
+
+ output_data = {'number_of_files' : np.array([DDnum,RDnum])}
+
+ filename = "outputnum_results.h5"
+ save_filename = os.path.join(_dir_name, filename)
+ yt.save_as_dataset(ds, save_filename, output_data)
+
+ compare_filename = os.path.join(test_data_dir, filename)
+ if generate_answers:
+ os.rename(save_filename, compare_filename)
+ return
+
+ ds_comp = yt.load(compare_filename)
+ assert_equal(output_data['number_of_files'],
+ ds_comp.data['number_of_files'])

This diff is so big that we needed to truncate the remainder.

Repository URL: https://bitbucket.org/enzo/enzo-dev/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
Reply all
Reply to author
Forward
0 new messages