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

Merge branch 'master' of bitbucket.org:ohahn/monofonic into enzo

This commit is contained in:
Oliver Hahn 2022-12-16 06:01:18 +01:00
commit 99d506fffa
2 changed files with 15 additions and 8 deletions

View file

@ -2,17 +2,17 @@
// This file is part of monofonIC (MUSIC2) // This file is part of monofonIC (MUSIC2)
// A software package to generate ICs for cosmological simulations // A software package to generate ICs for cosmological simulations
// Copyright (C) 2020 by Oliver Hahn // Copyright (C) 2020 by Oliver Hahn
// //
// monofonIC is free software: you can redistribute it and/or modify // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// monofonIC is distributed in the hope that it will be useful, // monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef USE_HDF5 #ifdef USE_HDF5
@ -122,8 +122,8 @@ public:
// use destructor to write header post factum // use destructor to write header post factum
~gadget_hdf5_output_plugin() ~gadget_hdf5_output_plugin()
{ {
if (!std::uncaught_exception()) if (!std::uncaught_exception())
{ {
HDFCreateGroup(this_fname_, "Header"); HDFCreateGroup(this_fname_, "Header");
HDFWriteGroupAttribute(this_fname_, "Header", "NumPart_ThisFile", from_6array<unsigned>(header_.npart)); HDFWriteGroupAttribute(this_fname_, "Header", "NumPart_ThisFile", from_6array<unsigned>(header_.npart));
HDFWriteGroupAttribute(this_fname_, "Header", "MassTable", from_6array<double>(header_.mass)); HDFWriteGroupAttribute(this_fname_, "Header", "MassTable", from_6array<double>(header_.mass));
@ -144,6 +144,14 @@ public:
HDFWriteGroupAttribute(this_fname_, "Header", "Flag_Entropy_ICs", from_value<int>(header_.flag_entropy_instead_u)); HDFWriteGroupAttribute(this_fname_, "Header", "Flag_Entropy_ICs", from_value<int>(header_.flag_entropy_instead_u));
music::ilog << "Wrote Gadget-HDF5 file(s) to " << this_fname_ << std::endl; music::ilog << "Wrote Gadget-HDF5 file(s) to " << this_fname_ << std::endl;
music::ilog << "You can use the following values in param.txt:" << std::endl;
music::ilog << "Omega0 " << header_.Omega0 << std::endl;
music::ilog << "OmegaLambda " << header_.OmegaLambda << std::endl;
music::ilog << "OmegaBaryon " << pcc_->cosmo_param_["Omega_b"] << std::endl;
music::ilog << "HubbleParam " << header_.HubbleParam << std::endl;
music::ilog << "Hubble 100.0" << std::endl;
music::ilog << "BoxSize " << header_.BoxSize << std::endl;
} }
} }
@ -239,4 +247,4 @@ output_plugin_creator_concrete<gadget_hdf5_output_plugin<double>> creator3("gadg
#endif #endif
} // namespace } // namespace
#endif #endif

View file

@ -74,8 +74,7 @@ public:
void write_particle_data(const particle::container &pc, const cosmo_species &s, double Omega_species) void write_particle_data(const particle::container &pc, const cosmo_species &s, double Omega_species)
{ {
double rhoc = 27.7519737; // in h^2 1e10 M_sol / Mpc^3 double boxmass = Omega_species * munit_;
double boxmass = Omega_species * rhoc * std::pow(cf_.get_value<double>("setup", "BoxLength"), 3.);
double particle_mass = boxmass / pc.get_global_num_particles(); double particle_mass = boxmass / pc.get_global_num_particles();
size_t npart = pc.get_local_num_particles(); size_t npart = pc.get_local_num_particles();