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

Merged in music20 (pull request #5)

Music20

Approved-by: Oliver Hahn
This commit is contained in:
oliver.hahn 2024-03-01 09:18:12 +00:00 committed by Oliver Hahn
commit 49c43415d6
45 changed files with 739 additions and 417 deletions

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
numerics.cc - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef WITH_MPI #ifdef WITH_MPI
#ifdef MANNO #ifdef MANNO

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
numerics.hh - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __NUMERICS_HH #ifndef __NUMERICS_HH
#define __NUMERICS_HH #define __NUMERICS_HH

View file

@ -1,3 +1,20 @@
// This file is part of monofonIC (MUSIC2)
// A software package to generate ICs for cosmological simulations
// Copyright (C) 2024 by Oliver Hahn
//
// monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once #pragma once

View file

@ -1,12 +1,19 @@
/* // This file is part of monofonIC (MUSIC2)
// A software package to generate ICs for cosmological simulations
constraints.cc - This file is part of MUSIC - // Copyright (C) 2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "constraints.hh" #include "constraints.hh"

View file

@ -1,12 +1,19 @@
/* // This file is part of monofonIC (MUSIC2)
// A software package to generate ICs for cosmological simulations
constraints.hh - This file is part of MUSIC - // Copyright (C) 2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once #pragma once
#include <vector> #include <vector>

View file

@ -1,11 +1,19 @@
/* // This file is part of monofonIC (MUSIC2)
// A software package to generate ICs for cosmological simulations
convolution_kernel.cc - This file is part of MUSIC - // Copyright (C) 2024 by Oliver Hahn
a code to generate multi-scale initial conditions for cosmological simulations //
// monofonIC is free software: you can redistribute it and/or modify
Copyright (C) 2010-23 Oliver Hahn // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
*/ // (at your option) any later version.
//
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <general.hh> #include <general.hh>
#include <densities.hh> #include <densities.hh>

View file

@ -1,12 +1,19 @@
/* // This file is part of monofonIC (MUSIC2)
// A software package to generate ICs for cosmological simulations
convolution_kernel.hh - This file is part of MUSIC - // Copyright (C) 2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010-23 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __CONVOLUTION_KERNELS_HH #ifndef __CONVOLUTION_KERNELS_HH
#define __CONVOLUTION_KERNELS_HH #define __CONVOLUTION_KERNELS_HH

View file

@ -1,6 +1,6 @@
// This file is part of monofonIC (MUSIC2) // This file is part of MUSIC
// 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) 2010-2024 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

View file

@ -1,6 +1,6 @@
// This file is part of monofonIC (MUSIC2) // This file is part of MUSIC
// 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) 2010-2024 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

View file

@ -1,6 +1,6 @@
// This file is part of monofonIC (MUSIC2) // This file is part of MUSIC
// 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) 2010-2024 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

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
defaults.cc - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "defaults.hh" #include "defaults.hh"

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
defaults.hh - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __DEFAULTS_HH #ifndef __DEFAULTS_HH

View file

@ -1,15 +1,24 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
densities.cc - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cstring> #include <cstring>
#include "math/special.hh"
#include "densities.hh" #include "densities.hh"
#include "random.hh" #include "random.hh"
#include "convolution_kernel.hh" #include "convolution_kernel.hh"
@ -17,21 +26,8 @@
//TODO: this should be a larger number by default, just to maintain consistency with old default //TODO: this should be a larger number by default, just to maintain consistency with old default
#define DEF_RAN_CUBE_SIZE 32 #define DEF_RAN_CUBE_SIZE 32
double Meyer_scaling_function( double k, double kmax )
{
constexpr double twopithirds{2.0*M_PI/3.0};
constexpr double fourpithirds{4.0*M_PI/3.0};
auto nu = []( double x ){ return x<0.0?0.0:(x<1.0?x:1.0); };
k = std::abs(k)/kmax * fourpithirds;
if( k < twopithirds ) return 1.0;
else if( k< fourpithirds ){
return std::cos( 0.5*M_PI * nu(3*k/(2*M_PI)-1.0) );
}
return 0.0;
}
/* interpolate upwards in the hierarchy */
template <typename m1, typename m2> template <typename m1, typename m2>
void fft_coarsen(m1 &v, m2 &V) void fft_coarsen(m1 &v, m2 &V)
{ {
@ -89,13 +85,14 @@ void fft_coarsen(m1 &v, m2 &V)
val_fine *= val_phas * fftnorm / 8.0; val_fine *= val_phas * fftnorm / 8.0;
if( i!=(int)nxF/2 && j!=(int)nyF/2 && k!=(int)nzF/2 ){ double blend_coarse_x = Meyer_scaling_function(kx, nxF / 2);
RE(ccoarse[qc]) = val_fine.real(); double blend_coarse_y = Meyer_scaling_function(ky, nyF / 2);
IM(ccoarse[qc]) = val_fine.imag(); double blend_coarse_z = Meyer_scaling_function(kz, nzF / 2);
}else{
RE(ccoarse[qc]) = 0.0;//val_fine.real(); double blend_coarse = blend_coarse_x*blend_coarse_y*blend_coarse_z;
IM(ccoarse[qc]) = 0.0;//val_fine.imag();
} RE(ccoarse[qc]) = val_fine.real() * blend_coarse;
IM(ccoarse[qc]) = val_fine.imag() * blend_coarse;
} }
delete[] rfine; delete[] rfine;
@ -117,6 +114,7 @@ void fft_coarsen(m1 &v, m2 &V)
FFTW_API(destroy_plan)(ipc); FFTW_API(destroy_plan)(ipc);
} }
/* interpolate downwards in the hierarchy */
template <typename m1, typename m2> template <typename m1, typename m2>
void fft_interpolate(m1 &V, m2 &v, int margin, bool from_basegrid = false) void fft_interpolate(m1 &V, m2 &v, int margin, bool from_basegrid = false)
{ {
@ -124,6 +122,7 @@ void fft_interpolate(m1 &V, m2 &v, int margin, bool from_basegrid = false)
size_t nxf = v.size(0), nyf = v.size(1), nzf = v.size(2), nzfp = nzf + 2; size_t nxf = v.size(0), nyf = v.size(1), nzf = v.size(2), nzfp = nzf + 2;
size_t mxf = v.margin(0), myf = v.margin(1), mzf = v.margin(2); size_t mxf = v.margin(0), myf = v.margin(1), mzf = v.margin(2);
// adjust offsets to respect margins, all grids have 'margins' except basegrid (which is periodic)
if (!from_basegrid) if (!from_basegrid)
{ {
oxf += mxf/2; oxf += mxf/2;
@ -216,16 +215,14 @@ void fft_interpolate(m1 &V, m2 &v, int margin, bool from_basegrid = false)
std::complex<double> val(RE(ccoarse[qc]), IM(ccoarse[qc])); std::complex<double> val(RE(ccoarse[qc]), IM(ccoarse[qc]));
val *= val_phas * 8.0; val *= val_phas * 8.0;
if(i != (int)nxc / 2 && j != (int)nyc / 2 && k != (int)nzc / 2){ double blend_coarse_x = Meyer_scaling_function(kx, nxc / 4);
double blend_coarse_x = Meyer_scaling_function(kx, nxc / 2); double blend_coarse_y = Meyer_scaling_function(ky, nyc / 4);
double blend_coarse_y = Meyer_scaling_function(ky, nyc / 2); double blend_coarse_z = Meyer_scaling_function(kz, nzc / 4);
double blend_coarse_z = Meyer_scaling_function(kz, nzc / 2); double blend_coarse = blend_coarse_x*blend_coarse_y*blend_coarse_z;
double blend_coarse = blend_coarse_x*blend_coarse_y*blend_coarse_z; double blend_fine = 1.0-blend_coarse;
double blend_fine = 1.0-blend_coarse;
RE(cfine[qf]) = blend_fine * RE(cfine[qf]) + blend_coarse * val.real(); RE(cfine[qf]) = blend_fine * RE(cfine[qf]) + blend_coarse * val.real();
IM(cfine[qf]) = blend_fine * IM(cfine[qf]) + blend_coarse * val.imag(); IM(cfine[qf]) = blend_fine * IM(cfine[qf]) + blend_coarse * val.imag();
}
} }
delete[] rcoarse; delete[] rcoarse;

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
densities.hh - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __DENSITIES_HH #ifndef __DENSITIES_HH
#define __DENSITIES_HH #define __DENSITIES_HH

View file

@ -1,3 +1,20 @@
// This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
// Copyright (C) 2010-2024 by Oliver Hahn
//
// monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once #pragma once
#include <vector> #include <vector>

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
fd_schemes.hh - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __FD_SCHEMES_HH #ifndef __FD_SCHEMES_HH
#define __FD_SCHEMES_HH #define __FD_SCHEMES_HH

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
general.hh - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once #pragma once

View file

@ -1,4 +1,4 @@
// This file is part of monofonIC (MUSIC2) // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations // A software package to generate ICs for cosmological simulations
// Copyright (C) 2020 by Oliver Hahn & Michael Michaux (this file) // Copyright (C) 2020 by Oliver Hahn & Michael Michaux (this file)
// //

View file

@ -1,4 +1,4 @@
// This file is part of monofonIC (MUSIC2) // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations // A software package to generate ICs for cosmological simulations
// Copyright (C) 2020 by Oliver Hahn & Michael Michaux (this file) // Copyright (C) 2020 by Oliver Hahn & Michael Michaux (this file)
// //

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
main.cc - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdio.h> #include <stdio.h>
#include <iostream> #include <iostream>

40
src/math/special.hh Normal file
View file

@ -0,0 +1,40 @@
// This file is part of monofonIC (MUSIC2)
// A software package to generate ICs for cosmological simulations
// Copyright (C) 2020 by Oliver Hahn
//
// monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include <cmath>
inline double Meyer_scaling_function( double k, double kmax )
{
constexpr double twopithirds{2.0*M_PI/3.0};
constexpr double fourpithirds{4.0*M_PI/3.0};
auto nu = []( double x ){ return x<0.0?0.0:(x<1.0?x:1.0); };
k = std::abs(k)/kmax * 2 * M_PI;
if( k < twopithirds ) return 1.0;
else if( k< fourpithirds ){
return std::cos( 0.5*M_PI * nu(3*k/(2*M_PI)-1.0) );
}
return 0.0;
}
inline double Shannon_scaling_function( double k, double kmax )
{
if( std::abs(k) < kmax ) return 1.0;
return 0.0;
}

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
mesh.hh - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once #pragma once

View file

@ -1,11 +1,19 @@
/* // This file is part of MUSIC
* mg_interp.hh // A software package to generate ICs for cosmological simulations
* FROLIC_mg // Copyright (C) 2010-2024 by Oliver Hahn
* //
* Created by Oliver Hahn on 5/27/10. // monofonIC is free software: you can redistribute it and/or modify
* Copyright 2010 KIPAC/Stanford University. All rights reserved. // it under the terms of the GNU General Public License as published by
* // the Free Software Foundation, either version 3 of the License, or
*/ // (at your option) any later version.
//
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __MG_INTERP_HH #ifndef __MG_INTERP_HH
#define __MG_INTERP_HH #define __MG_INTERP_HH

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
mg_operators.hh - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __MG_OPERATORS_HH #ifndef __MG_OPERATORS_HH
#define __MG_OPERATORS_HH #define __MG_OPERATORS_HH

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
mg_solver.hh - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once #pragma once

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
output.cc - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "output.hh" #include "output.hh"

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
output.hh - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __OUTPUT_HH #ifndef __OUTPUT_HH
#define __OUTPUT_HH #define __OUTPUT_HH

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
cosmology.cc - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <perturbation_theory.hh> #include <perturbation_theory.hh>
#include <mesh.hh> #include <mesh.hh>

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
cosmology.hh - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once #pragma once

View file

@ -1,6 +1,6 @@
// This file is part of monofonIC (MUSIC2) // This file is part of MUSIC
// 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) 2010-2024 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

View file

@ -145,6 +145,7 @@ void RNG_music::parse_random_parameters(void)
void RNG_music::compute_random_numbers(void) void RNG_music::compute_random_numbers(void)
{ {
bool rndsign = pcf_->get_value_safe<bool>("random", "grafic_sign", false); bool rndsign = pcf_->get_value_safe<bool>("random", "grafic_sign", false);
bool bUseNGenIC = pcf_->get_value_safe<bool>("random","coarse_ngenic",false);
std::vector<rng *> randc(std::max(levelmax_, levelmin_seed_) + 1, (rng *)NULL); std::vector<rng *> randc(std::max(levelmax_, levelmin_seed_) + 1, (rng *)NULL);
@ -156,7 +157,8 @@ void RNG_music::compute_random_numbers(void)
if (rngfnames_[levelmin_seed_].size() > 0) if (rngfnames_[levelmin_seed_].size() > 0)
randc[levelmin_seed_] = new rng(1 << levelmin_seed_, rngfnames_[levelmin_seed_], rndsign); randc[levelmin_seed_] = new rng(1 << levelmin_seed_, rngfnames_[levelmin_seed_], rndsign);
else else
randc[levelmin_seed_] = new rng(1 << levelmin_seed_, ran_cube_size_, rngseeds_[levelmin_seed_]); randc[levelmin_seed_] = new rng(1 << levelmin_seed_, ran_cube_size_, rngseeds_[levelmin_seed_],
bUseNGenIC, true);
for (int i = levelmin_seed_ + 1; i <= levelmin_; ++i) for (int i = levelmin_seed_ + 1; i <= levelmin_; ++i)
{ {
@ -178,7 +180,7 @@ void RNG_music::compute_random_numbers(void)
randc[levelmin_seed_] = new rng(1 << levelmin_seed_, rngfnames_[levelmin_seed_], rndsign); randc[levelmin_seed_] = new rng(1 << levelmin_seed_, rngfnames_[levelmin_seed_], rndsign);
else else
randc[levelmin_seed_] = randc[levelmin_seed_] =
new rng(1 << levelmin_seed_, ran_cube_size_, rngseeds_[levelmin_seed_]); //, x0, lx ); new rng(1 << levelmin_seed_, ran_cube_size_, rngseeds_[levelmin_seed_], bUseNGenIC, true); //, x0, lx );
for (int ilevel = levelmin_seed_ - 1; ilevel >= (int)levelmin_; --ilevel) for (int ilevel = levelmin_seed_ - 1; ilevel >= (int)levelmin_; --ilevel)
{ {
@ -205,7 +207,7 @@ void RNG_music::compute_random_numbers(void)
if (rngfnames_[levelmin_].size() > 0) if (rngfnames_[levelmin_].size() > 0)
randc[levelmin_] = new rng(1 << levelmin_, rngfnames_[levelmin_], rndsign); randc[levelmin_] = new rng(1 << levelmin_, rngfnames_[levelmin_], rndsign);
else else
randc[levelmin_] = new rng(1 << levelmin_, ran_cube_size_, rngseeds_[levelmin_]); randc[levelmin_] = new rng(1 << levelmin_, ran_cube_size_, rngseeds_[levelmin_], bUseNGenIC, true);
} }
store_rnd(levelmin_, randc[levelmin_]); store_rnd(levelmin_, randc[levelmin_]);

View file

@ -4,15 +4,24 @@
#include <gsl/gsl_rng.h> #include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h> #include <gsl/gsl_randist.h>
#include "math/special.hh"
#include "random.hh" #include "random.hh"
#include "random_music_wnoise_generator.hh" #include "random_music_wnoise_generator.hh"
template <typename T> template <typename T>
void rapid_proto_ngenic_rng(size_t res, long baseseed, music_wnoise_generator<T> &R) void music_wnoise_generator<T>:: gen_topgrid_NGenIC(size_t res, long baseseed) {
{ music::ulog.Print(
music::ulog.Print("Invoking the N-GenIC random number generator"); "Generating large-scale random numbers using N-GenIC RNG with seed %ld",
baseseed);
rnums_.push_back(new Meshvar<T>(res, 0, 0, 0));
cubemap_[0] = 0; // create dummy map index
register_cube(0, 0, 0);
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// execute N-GenIC rando number generator
unsigned *seedtable = new unsigned[res * res]; unsigned *seedtable = new unsigned[res * res];
gsl_rng *random_generator = gsl_rng_alloc(gsl_rng_ranlxd1); gsl_rng *random_generator = gsl_rng_alloc(gsl_rng_ranlxd1);
@ -39,91 +48,87 @@ void rapid_proto_ngenic_rng(size_t res, long baseseed, music_wnoise_generator<T>
for (j = 0; j < i + 1; j++) for (j = 0; j < i + 1; j++)
seedtable[(res - 1 - j) * res + (res - 1 - i)] = 0x7fffffff * gsl_rng_uniform(random_generator); seedtable[(res - 1 - j) * res + (res - 1 - i)] = 0x7fffffff * gsl_rng_uniform(random_generator);
} }
gsl_rng_free( random_generator );
real_t *rnoise = new real_t[res * res * (res + 2)]; real_t *rnoise = new real_t[res * res * (res + 2)];
complex_t *knoise = reinterpret_cast<complex_t *>(rnoise); complex_t *knoise = reinterpret_cast<complex_t *>(rnoise);
double fnorm = 1. / sqrt(res * res * res); double fnorm = pow((double)res, -1.5);
// #warning need to check for race conditions below // launch threads with indendent RNGs
//#pragma omp parallel for #pragma omp parallel
for (size_t i = 0; i < res; i++) {
{ gsl_rng *thread_rng = gsl_rng_alloc(gsl_rng_ranlxd1);
int ii = (int)res - (int)i;
if (ii == (int)res)
ii = 0;
for (size_t j = 0; j < res; j++) #pragma omp for
{ for (size_t i = 0; i < res; i++) {
gsl_rng_set(random_generator, seedtable[i * res + j]); int ii = (int)res - (int)i;
if (ii == (int)res)
ii = 0;
for (size_t k = 0; k < res / 2; k++) for (size_t j = 0; j < res; j++) {
{ gsl_rng_set(thread_rng, seedtable[i * res + j]);
double phase = gsl_rng_uniform(random_generator) * 2 * M_PI; for (size_t k = 0; k < res / 2; k++) {
double ampl; double phase = gsl_rng_uniform(thread_rng) * 2 * M_PI;
do double ampl;
ampl = gsl_rng_uniform(random_generator); do {
while (ampl == 0); ampl = gsl_rng_uniform(thread_rng);
} while (ampl == 0);
if (i == res / 2 || j == res / 2 || k == res / 2) if (i == res / 2 || j == res / 2 || k == res / 2)
continue; continue;
if (i == 0 && j == 0 && k == 0) if (i == 0 && j == 0 && k == 0)
continue; continue;
T rp = -sqrt(-log(ampl)) * cos(phase) * fnorm; T rp = -sqrt(-log(ampl)) * cos(phase) * fnorm;
T ip = -sqrt(-log(ampl)) * sin(phase) * fnorm; T ip = -sqrt(-log(ampl)) * sin(phase) * fnorm;
if (k > 0) if (k > 0) {
{ RE(knoise[(i * res + j) * (res / 2 + 1) + k]) = rp;
RE(knoise[(i * res + j) * (res / 2 + 1) + k]) = rp; IM(knoise[(i * res + j) * (res / 2 + 1) + k]) = ip;
IM(knoise[(i * res + j) * (res / 2 + 1) + k]) = ip; } else /* k=0 plane needs special treatment */
} {
else /* k=0 plane needs special treatment */ if (i == 0) {
{ if (j >= res / 2) {
if (i == 0) continue;
{ } else {
if (j >= res / 2) int jj =
continue; (int)res - (int)j; /* note: j!=0 surely holds at this point */
else
{
int jj = (int)res - (int)j; /* note: j!=0 surely holds at this point */
RE(knoise[(i * res + j) * (res / 2 + 1) + k]) = rp; RE(knoise[(i * res + j) * (res / 2 + 1) + k]) = rp;
IM(knoise[(i * res + j) * (res / 2 + 1) + k]) = ip; IM(knoise[(i * res + j) * (res / 2 + 1) + k]) = ip;
RE(knoise[(i * res + jj) * (res / 2 + 1) + k]) = rp; RE(knoise[(i * res + jj) * (res / 2 + 1) + k]) = rp;
IM(knoise[(i * res + jj) * (res / 2 + 1) + k]) = -ip; IM(knoise[(i * res + jj) * (res / 2 + 1) + k]) = -ip;
} }
} } else {
else if (i >= res / 2) {
{ continue;
if (i >= res / 2) } else {
continue; int ii = (int)res - (int)i;
else if (ii == (int)res)
{ ii = 0;
int ii = (int)res - (int)i; int jj = (int)res - (int)j;
if (ii == (int)res) if (jj == (int)res)
ii = 0; jj = 0;
int jj = (int)res - (int)j;
if (jj == (int)res)
jj = 0;
RE(knoise[(i * res + j) * (res / 2 + 1) + k]) = rp; RE(knoise[(i * res + j) * (res / 2 + 1) + k]) = rp;
IM(knoise[(i * res + j) * (res / 2 + 1) + k]) = ip; IM(knoise[(i * res + j) * (res / 2 + 1) + k]) = ip;
if (ii >= 0 && ii < (int)res) if (ii >= 0 && ii < (int)res) {
{ RE(knoise[(ii * res + jj) * (res / 2 + 1) + k]) = rp;
RE(knoise[(ii * res + jj) * (res / 2 + 1) + k]) = rp; IM(knoise[(ii * res + jj) * (res / 2 + 1) + k]) = -ip;
IM(knoise[(ii * res + jj) * (res / 2 + 1) + k]) = -ip; }
} }
} }
} }
} }
} }
} }
} gsl_rng_free( thread_rng );
}
delete[] seedtable; delete[] seedtable;
//... perform FT to real space //... perform FT to real space
fftw_plan_t plan = FFTW_API(plan_dft_c2r_3d)(res, res, res, knoise, rnoise, FFTW_ESTIMATE); fftw_plan_t plan = FFTW_API(plan_dft_c2r_3d)(res, res, res, knoise, rnoise, FFTW_ESTIMATE);
@ -131,12 +136,11 @@ void rapid_proto_ngenic_rng(size_t res, long baseseed, music_wnoise_generator<T>
FFTW_API(destroy_plan)(plan); FFTW_API(destroy_plan)(plan);
// copy to array that holds the random numbers // copy to array that holds the random numbers
#pragma omp parallel for #pragma omp parallel for
for (int i = 0; i < (int)res; ++i) for (int i = 0; i < (int)res; ++i)
for (size_t j = 0; j < res; ++j) for (size_t j = 0; j < res; ++j)
for (size_t k = 0; k < res; ++k) for (size_t k = 0; k < res; ++k)
R(i, j, k) = rnoise[((size_t)i * res + j) * res + k]; (*this)(i, j, k) = -rnoise[((size_t)i * res + j) * (res + 2) + k];
delete[] rnoise; delete[] rnoise;
} }
@ -152,7 +156,8 @@ music_wnoise_generator<T>::music_wnoise_generator(unsigned res, unsigned cubesiz
} }
template <typename T> template <typename T>
music_wnoise_generator<T>::music_wnoise_generator(unsigned res, unsigned cubesize, long baseseed, bool zeromean) music_wnoise_generator<T>::music_wnoise_generator( unsigned res, unsigned cubesize, long baseseed,
bool bUseNGenIC, bool zeromean )
: res_(res), cubesize_(cubesize), ncubes_(1), baseseed_(baseseed) : res_(res), cubesize_(cubesize), ncubes_(1), baseseed_(baseseed)
{ {
music::ilog.Print("Generating random numbers (2) with seed %ld", baseseed); music::ilog.Print("Generating random numbers (2) with seed %ld", baseseed);
@ -160,23 +165,20 @@ music_wnoise_generator<T>::music_wnoise_generator(unsigned res, unsigned cubesiz
double mean = 0.0; double mean = 0.0;
size_t res_l = res; size_t res_l = res;
bool musicnoise = true; if( bUseNGenIC ){
if (!musicnoise) cubesize_ = res;
cubesize_ = res_; ncubes_ = 1;
}
if (!musicnoise)
music::elog.Print("This currently breaks compatibility. Need to disable by hand! Make sure to not check into repo");
initialize(); initialize();
if (musicnoise) if( !bUseNGenIC ){
mean = fill_all(); mean = fill_all();
else }else{
{ music::ilog.Print("Using N-GenIC generator for top grid...");
rnums_.push_back(new Meshvar<T>(res, 0, 0, 0)); mean = 0.0;
cubemap_[0] = 0; // create dummy map index gen_topgrid_NGenIC( res_, baseseed_ );
register_cube(0, 0, 0); zeromean = false;
rapid_proto_ngenic_rng( res_, baseseed_, *this );
} }
if (zeromean) if (zeromean)
@ -603,9 +605,6 @@ music_wnoise_generator<T>::music_wnoise_generator(music_wnoise_generator<T> &rc,
{ {
int ii(i), jj(j), kk(k); int ii(i), jj(j), kk(k);
// if( i==(int)nxc/2 ) continue;
// if( j==(int)nyc/2 ) continue;
if (i > (int)nxc / 2) if (i > (int)nxc / 2)
ii += (int)nx / 2; ii += (int)nx / 2;
if (j > (int)nyc / 2) if (j > (int)nyc / 2)
@ -627,18 +626,21 @@ music_wnoise_generator<T>::music_wnoise_generator(music_wnoise_generator<T> &rc,
val *= val_phas * sqrt8; val *= val_phas * sqrt8;
// if (x0_ == NULL || lx_ == NULL){ if(i != (int)nxc / 2 && j != (int)nyc / 2 && k != (int)nzc / 2){
if (i != (int)nxc / 2 && j != (int)nyc / 2 && k != (int)nzc / 2) double blend_coarse_x = Meyer_scaling_function(kx, nxc / 2);
{ double blend_coarse_y = Meyer_scaling_function(ky, nyc / 2);
RE(cfine[qf]) = val.real(); double blend_coarse_z = Meyer_scaling_function(kz, nzc / 2);
IM(cfine[qf]) = val.imag();
} // double blend_coarse_x = Shannon_scaling_function(kx, nxc / 2);
else // double blend_coarse_y = Shannon_scaling_function(ky, nyc / 2);
{ // double blend_coarse_z = Shannon_scaling_function(kz, nzc / 2);
RE(cfine[qf]) = val.real();
IM(cfine[qf]) = 0.0; double blend_coarse = blend_coarse_x*blend_coarse_y*blend_coarse_z;
} double blend_fine = std::sqrt(1.0-blend_coarse*blend_coarse);
// }
RE(cfine[qf]) = blend_fine * RE(cfine[qf]) + blend_coarse * val.real();
IM(cfine[qf]) = blend_fine * IM(cfine[qf]) + blend_coarse * val.imag();
}
} }
delete[] rcoarse; delete[] rcoarse;

View file

@ -39,6 +39,9 @@ protected:
//! subtract a constant from an entire cube //! subtract a constant from an entire cube
void subtract_from_cube(int i, int j, int k, double val); void subtract_from_cube(int i, int j, int k, double val);
//! usees the N-GenIC random number generator to set up the top grid
void gen_topgrid_NGenIC( size_t res, long baseseed );
//! copy random numbers from a cube to a full grid array //! copy random numbers from a cube to a full grid array
template <class C> template <class C>
void copy_cube(int i, int j, int k, C &dat) void copy_cube(int i, int j, int k, C &dat)
@ -127,7 +130,7 @@ public:
music_wnoise_generator(music_wnoise_generator<T> &rc, unsigned cubesize, long baseseed, int *x0_ = NULL, int *lx_ = NULL, bool zeromean = true); music_wnoise_generator(music_wnoise_generator<T> &rc, unsigned cubesize, long baseseed, int *x0_ = NULL, int *lx_ = NULL, bool zeromean = true);
//! constructor //! constructor
music_wnoise_generator(unsigned res, unsigned cubesize, long baseseed, bool zeromean = true); music_wnoise_generator(unsigned res, unsigned cubesize, long baseseed, bool bUseNGenIC, bool zeromean = true );
//! constructor to read white noise from file //! constructor to read white noise from file
music_wnoise_generator(unsigned res, std::string randfname, bool rndsign); music_wnoise_generator(unsigned res, std::string randfname, bool rndsign);

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
poisson.cc - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/****** ABSTRACT FACTORY PATTERN IMPLEMENTATION *******/ /****** ABSTRACT FACTORY PATTERN IMPLEMENTATION *******/

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
poisson.cc - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __POISSON_HH #ifndef __POISSON_HH
#define __POISSON_HH #define __POISSON_HH

View file

@ -1,11 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
random.cc - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions for cosmological simulations //
// monofonIC is free software: you can redistribute it and/or modify
Copyright (C) 2010-23 Oliver Hahn // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
*/ // (at your option) any later version.
//
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "random.hh" #include "random.hh"

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
random.hh - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010-23 by Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//... for testing purposes............. //... for testing purposes.............
// #define DEGRADE_RAND1 // #define DEGRADE_RAND1

View file

@ -1,3 +1,21 @@
// This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
// Copyright (C) 2010-2024 by Oliver Hahn
//
// monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <algorithm> #include <algorithm>
#include "region_generator.hh" #include "region_generator.hh"

View file

@ -1,3 +1,20 @@
// This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
// Copyright (C) 2010-2024 by Oliver Hahn
//
// monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __REGION_GENERATOR_HH #ifndef __REGION_GENERATOR_HH
#define __REGION_GENERATOR_HH #define __REGION_GENERATOR_HH

View file

@ -1,11 +1,19 @@
/* // This file is part of MUSIC
* schemes.hh // A software package to generate ICs for cosmological simulations
* GravitySolver // Copyright (C) 2010-2024 by Oliver Hahn
* //
* Created by Oliver Hahn on 2/1/10. // monofonIC is free software: you can redistribute it and/or modify
* Copyright 2010 KIPAC/Stanford University. All rights reserved. // it under the terms of the GNU General Public License as published by
* // the Free Software Foundation, either version 3 of the License, or
*/ // (at your option) any later version.
//
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __SCHEME_HH #ifndef __SCHEME_HH
#define __SCHEME_HH #define __SCHEME_HH

View file

@ -1,11 +1,19 @@
/* // This file is part of MUSIC
* solver.h // A software package to generate ICs for cosmological simulations
* GravitySolver // Copyright (C) 2010-2024 by Oliver Hahn
* //
* Created by Oliver Hahn on 1/20/10. // monofonIC is free software: you can redistribute it and/or modify
* Copyright 2010 KIPAC/Stanford University. All rights reserved. // it under the terms of the GNU General Public License as published by
* // the Free Software Foundation, either version 3 of the License, or
*/ // (at your option) any later version.
//
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once #pragma once

View file

@ -1,19 +1,20 @@
// This file is part of MUSIC2 // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations // A software package to generate ICs for cosmological simulations
// Copyright (C) 2020-23 by Oliver Hahn // Copyright (C) 2010-2024 by Oliver Hahn
// //
// MUSIC2 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.
// //
// MUSIC2 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/>.
#pragma once #pragma once
#ifdef __APPLE__ #ifdef __APPLE__

View file

@ -1,13 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
tests.hh - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __TESTS_HH #ifndef __TESTS_HH
#define __TESTS_HH #define __TESTS_HH

View file

@ -1,12 +1,19 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
transfer_function.cc - This file is part of MUSIC - // Copyright (C) 2010-2024 by Oliver Hahn
a code to generate multi-scale initial conditions //
for cosmological simulations // monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Copyright (C) 2010 Oliver Hahn // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
*/ //
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "transfer_function.hh" #include "transfer_function.hh"

View file

@ -1,12 +1,20 @@
/* // This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
// Copyright (C) 2010-2024 by Oliver Hahn
//
// monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// monofonIC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
transfer_function.hh - This file is part of MUSIC -
a code to generate multi-scale initial conditions
for cosmological simulations
Copyright (C) 2010 Oliver Hahn
*/
#pragma once #pragma once
#include <vector> #include <vector>