1
0
Fork 0
mirror of https://github.com/cosmo-sims/MUSIC.git synced 2024-09-19 17:03:46 +02:00

Some fixes to the ENZO output plug-in

Added a fixed 'RefineBy=2' to ENZO parameter files.
Increased field width and precision for grid coordinates.
This commit is contained in:
Oliver Hahn 2010-07-28 01:02:47 -07:00
parent 02a822a92a
commit 83f5fb9f39

View file

@ -149,6 +149,10 @@ public:
} }
bool bhave_hydro = cf_.getValue<bool>("setup","baryons"); bool bhave_hydro = cf_.getValue<bool>("setup","baryons");
bool align_top = cf.getValueSafe<bool>( "setup", "align_top", true );
if( !align_top )
throw std::runtime_error("ENZO output plug-in requires that \'align_top=true\'!");
the_sim_header.dimensions.push_back( (int)pow(2,levelmin_) ); the_sim_header.dimensions.push_back( (int)pow(2,levelmin_) );
the_sim_header.dimensions.push_back( (int)pow(2,levelmin_) ); the_sim_header.dimensions.push_back( (int)pow(2,levelmin_) );
@ -159,7 +163,7 @@ public:
the_sim_header.offset.push_back( 0 ); the_sim_header.offset.push_back( 0 );
the_sim_header.a_start = 1.0/(1.0+cf.getValue<double>("setup","zstart")); the_sim_header.a_start = 1.0/(1.0+cf.getValue<double>("setup","zstart"));
the_sim_header.dx = cf.getValue<double>("setup","boxlength")/the_sim_header.dimensions[0]/(cf.getValue<double>("cosmology","H0")*0.01); // not sure?!? the_sim_header.dx = cf.getValue<double>("setup","boxlength")/the_sim_header.dimensions[0];// /(cf.getValue<double>("cosmology","H0")*0.01); // not sure?!?
the_sim_header.h0 = cf.getValue<double>("cosmology","H0")*0.01; the_sim_header.h0 = cf.getValue<double>("cosmology","H0")*0.01;
if( bhave_hydro ) if( bhave_hydro )
@ -192,54 +196,55 @@ public:
std::ofstream ofs( filename, std::ios::trunc ); std::ofstream ofs( filename, std::ios::trunc );
ofs ofs
<< "#\n" << "#\n"
<< "ProblemType = 30 // cosmology simulation\n" << "ProblemType = 30 // cosmology simulation\n"
<< "TopGridRank = 3\n" << "TopGridRank = 3\n"
<< "TopGridDimensions = " << nbase << " " << nbase << " " << nbase << "\n" << "TopGridDimensions = " << nbase << " " << nbase << " " << nbase << "\n"
<< "SelfGravity = 1 // gravity on\n" << "SelfGravity = 1 // gravity on\n"
<< "TopGridGravityBoundary = 0 // Periodic BC for gravity\n" << "TopGridGravityBoundary = 0 // Periodic BC for gravity\n"
<< "LeftFaceBoundaryCondition = 3 3 3 // same for fluid\n" << "LeftFaceBoundaryCondition = 3 3 3 // same for fluid\n"
<< "RightFaceBoundaryCondition = 3 3 3\n" << "RightFaceBoundaryCondition = 3 3 3\n"
<< "\n" << "RefineBy = 2\n"
<< "#\n"; << "\n"
<< "#\n";
if( bhave_hydro ) if( bhave_hydro )
ofs ofs
<< "CosmologySimulationOmegaBaryonNow = " << the_sim_header.omega_b << "\n" << "CosmologySimulationOmegaBaryonNow = " << the_sim_header.omega_b << "\n"
<< "CosmologySimulationOmegaCDMNow = " << the_sim_header.omega_m-the_sim_header.omega_b << "\n"; << "CosmologySimulationOmegaCDMNow = " << the_sim_header.omega_m-the_sim_header.omega_b << "\n";
else else
ofs ofs
<< "CosmologySimulationOmegaBaryonNow = " << 0.0 << "\n" << "CosmologySimulationOmegaBaryonNow = " << 0.0 << "\n"
<< "CosmologySimulationOmegaCDMNow = " << the_sim_header.omega_m << "\n"; << "CosmologySimulationOmegaCDMNow = " << the_sim_header.omega_m << "\n";
if( bhave_hydro ) if( bhave_hydro )
ofs ofs
<< "CosmologySimulationDensityName = GridDensity\n" << "CosmologySimulationDensityName = GridDensity\n"
<< "CosmologySimulationVelocity1Name = GridVelocities_x\n" << "CosmologySimulationVelocity1Name = GridVelocities_x\n"
<< "CosmologySimulationVelocity2Name = GridVelocities_y\n" << "CosmologySimulationVelocity2Name = GridVelocities_y\n"
<< "CosmologySimulationVelocity3Name = GridVelocities_z\n"; << "CosmologySimulationVelocity3Name = GridVelocities_z\n";
ofs ofs
<< "CosmologySimulationCalculatePositions = 1\n" << "CosmologySimulationCalculatePositions = 1\n"
<< "CosmologySimulationParticleVelocity1Name = ParticleVelocities_x\n" << "CosmologySimulationParticleVelocity1Name = ParticleVelocities_x\n"
<< "CosmologySimulationParticleVelocity2Name = ParticleVelocities_y\n" << "CosmologySimulationParticleVelocity2Name = ParticleVelocities_y\n"
<< "CosmologySimulationParticleVelocity3Name = ParticleVelocities_z\n" << "CosmologySimulationParticleVelocity3Name = ParticleVelocities_z\n"
<< "\n" << "\n"
<< "#\n" << "#\n"
<< "# define cosmology parameters\n" << "# define cosmology parameters\n"
<< "#\n" << "#\n"
<< "ComovingCoordinates = 1 // Expansion ON\n" << "ComovingCoordinates = 1 // Expansion ON\n"
<< "CosmologyOmegaMatterNow = " << the_sim_header.omega_m << "\n" << "CosmologyOmegaMatterNow = " << the_sim_header.omega_m << "\n"
<< "CosmologyOmegaLambdaNow = " << the_sim_header.omega_v << "\n" << "CosmologyOmegaLambdaNow = " << the_sim_header.omega_v << "\n"
<< "CosmologyHubbleConstantNow = " << the_sim_header.h0 << " // in 100 km/s/Mpc\n" << "CosmologyHubbleConstantNow = " << the_sim_header.h0 << " // in 100 km/s/Mpc\n"
<< "CosmologyComovingBoxSize = " << cf_.getValue<double>("setup","boxlength") << " // in Mpc/h\n" << "CosmologyComovingBoxSize = " << cf_.getValue<double>("setup","boxlength") << " // in Mpc/h\n"
<< "CosmologyMaxExpansionRate = 0.015 // maximum allowed delta(a)/a\n" << "CosmologyMaxExpansionRate = 0.015 // maximum allowed delta(a)/a\n"
<< "CosmologyInitialRedshift = " << cf_.getValue<double>("setup","zstart") << " //\n" << "CosmologyInitialRedshift = " << cf_.getValue<double>("setup","zstart") << " //\n"
<< "CosmologyFinalRedshift = 0 //\n" << "CosmologyFinalRedshift = 0 //\n"
<< "GravitationalConstant = 1 // this must be true for cosmology\n" << "GravitationalConstant = 1 // this must be true for cosmology\n"
<< "#\n" << "#\n"
<< "#\n" << "#\n"
<< "CosmologySimulationNumberOfInitialGrids = " << 1+levelmax_-levelmin_ << "\n"; << "CosmologySimulationNumberOfInitialGrids = " << 1+levelmax_-levelmin_ << "\n";
//... only for additionally refined grids //... only for additionally refined grids
@ -250,21 +255,21 @@ public:
ofs ofs
<< "CosmologySimulationGridDimension[" << 1+ilevel << "] = " << "CosmologySimulationGridDimension[" << 1+ilevel << "] = "
<< gh.size( levelmin_+ilevel+1, 0 ) << " " << std::setw(16) << gh.size( levelmin_+ilevel+1, 0 ) << " "
<< gh.size( levelmin_+ilevel+1, 1 ) << " " << std::setw(16) << gh.size( levelmin_+ilevel+1, 1 ) << " "
<< gh.size( levelmin_+ilevel+1, 2 ) << "\n" << std::setw(16) << gh.size( levelmin_+ilevel+1, 2 ) << "\n"
<< "CosmologySimulationGridLeftEdge[" << 1+ilevel << "] = " << "CosmologySimulationGridLeftEdge[" << 1+ilevel << "] = "
<< h*gh.offset_abs(levelmin_+ilevel+1, 0) << " " << std::setw(16) << std::setprecision(10) << h*gh.offset_abs(levelmin_+ilevel+1, 0) << " "
<< h*gh.offset_abs(levelmin_+ilevel+1, 1) << " " << std::setw(16) << std::setprecision(10) << h*gh.offset_abs(levelmin_+ilevel+1, 1) << " "
<< h*gh.offset_abs(levelmin_+ilevel+1, 2) << "\n" << std::setw(16) << std::setprecision(10) << h*gh.offset_abs(levelmin_+ilevel+1, 2) << "\n"
<< "CosmologySimulationGridRightEdge[" << 1+ilevel << "] = " << "CosmologySimulationGridRightEdge[" << 1+ilevel << "] = "
<< h*(gh.offset_abs(levelmin_+ilevel+1, 0)+gh.size( levelmin_+ilevel+1, 0 )) << " " << std::setw(16) << std::setprecision(10) << h*(gh.offset_abs(levelmin_+ilevel+1, 0)+gh.size( levelmin_+ilevel+1, 0 )) << " "
<< h*(gh.offset_abs(levelmin_+ilevel+1, 1)+gh.size( levelmin_+ilevel+1, 1 )) << " " << std::setw(16) << std::setprecision(10) << h*(gh.offset_abs(levelmin_+ilevel+1, 1)+gh.size( levelmin_+ilevel+1, 1 )) << " "
<< h*(gh.offset_abs(levelmin_+ilevel+1, 2)+gh.size( levelmin_+ilevel+1, 2 )) << "\n" << std::setw(16) << std::setprecision(10) << h*(gh.offset_abs(levelmin_+ilevel+1, 2)+gh.size( levelmin_+ilevel+1, 2 )) << "\n"
<< "CosmologySimulationGridLevel[" << 1+ilevel << "] = " << 1+ilevel << "\n"; << "CosmologySimulationGridLevel[" << 1+ilevel << "] = " << 1+ilevel << "\n";
} }