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

Fixed a bug that caused only 4th order gradients to be used.

Fixed a bug causing wrong shift-backs of particle positions for Gadget.
Disabled optimized unigrid mode as it did not work in all circumstances (issue posted).
This commit is contained in:
Oliver Hahn 2010-07-07 15:31:15 -07:00
parent 1c376c816a
commit 689484eb68
4 changed files with 36 additions and 10 deletions

View file

@ -47,6 +47,8 @@ void GenerateDensityUnigrid( config_file& cf, transfer_function *ptf, tf_type ty
levelmax = cf.getValue<unsigned>("setup","levelmax");
boxlength = cf.getValue<real_t>( "setup", "boxlength" );
std::cerr << " RUNNING UNIGRID VERSION\n";
//... parse random number options
for( int i=0; i<=100; ++i )
{
@ -210,11 +212,11 @@ void GenerateDensityHierarchy( config_file& cf, transfer_function *ptf, tf_type
boxlength = cf.getValue<real_t>( "setup", "boxlength" );
// TODO: need to make sure unigrid gets called whenever possible
if( levelmin == levelmax && levelmin==levelminPoisson )
/*if( levelmin == levelmax && levelmin==levelminPoisson )
{
GenerateDensityUnigrid(cf,ptf,type,refh,delta);
return;
}
}*/
//... parse random number options
@ -242,6 +244,8 @@ void GenerateDensityHierarchy( config_file& cf, transfer_function *ptf, tf_type
}
//... parse grid setup parameters
unsigned nbase = (unsigned)pow(2,levelmin);
float lxref[3];

13
main.cc
View file

@ -48,7 +48,7 @@
#include "transfer_function.hh"
#define THE_CODE_NAME "music!"
#define THE_CODE_VERSION "0.3a"
#define THE_CODE_VERSION "0.3.1a"
namespace music
@ -261,6 +261,17 @@ int main (int argc, const char * argv[])
lmax = cf.getValue<unsigned>( "setup", "levelmax" );
lbaseTF = cf.getValueSafe<unsigned>( "setup", "levelminTF", lbase );
if( lbase == lmax )
cf.insertValue("setup","no_shift","yes");
if( lbaseTF < lbase )
{
std::cout << " - WARNING: levelminTF < levelmin. This is not good!\n"
<< " I will set levelminTF = levelmin.\n";
lbaseTF = lbase;
cf.insertValue("setup","levelminTF",cf.getValue<std::string>("setup","levelmin"));
}
temp = cf.getValue<std::string>( "setup", "ref_offset" );
sscanf( temp.c_str(), "%g,%g,%g", &tf0, &tf1, &tf2 ); x0[0] = tf0; x0[1] = tf1; x0[2] = tf2;

23
mesh.hh
View file

@ -888,6 +888,8 @@ public:
padding_ = cf_.getValue<unsigned>("setup","padding");
align_top_ = cf_.getValue<bool>("setup","align_top");
bool bnoshift = cf_.getValueSafe<bool>("setup","no_shift",false);
std::string temp;
temp = cf_.getValue<std::string>( "setup", "ref_offset" );
@ -904,9 +906,18 @@ public:
xc[0] = fmod(x0ref_[0]+0.5*lxref_[0],1.0);
xc[1] = fmod(x0ref_[1]+0.5*lxref_[1],1.0);
xc[2] = fmod(x0ref_[2]+0.5*lxref_[2],1.0);
xshift_[0] = (int)((0.5-xc[0])*ncoarse);
xshift_[1] = (int)((0.5-xc[1])*ncoarse);
xshift_[2] = (int)((0.5-xc[2])*ncoarse);
if( levelmin_ != levelmax_ && !bnoshift)
{
xshift_[0] = (int)((0.5-xc[0])*ncoarse);
xshift_[1] = (int)((0.5-xc[1])*ncoarse);
xshift_[2] = (int)((0.5-xc[2])*ncoarse);
}else{
xshift_[0] = 0;
xshift_[1] = 0;
xshift_[2] = 0;
}
char strtmp[32];
sprintf( strtmp, "%d", xshift_[0] ); cf_.insertValue( "setup", "shift_x", strtmp );
@ -1162,9 +1173,9 @@ public:
std::cout << "-------------------------------------------------------------\n";
if( xshift_[0]!=0||xshift_[1]!=0||xshift_[2]!=0 )
std::cout
<< " - Domain will be shifted by (" << xshift_[0] << ", " << xshift_[1] << ", " << xshift_[2] << ")\n" << std::endl
<< " - Grid structure:\n";
std::cout << " - Domain will be shifted by (" << xshift_[0] << ", " << xshift_[1] << ", " << xshift_[2] << ")\n" << std::endl;
std::cout << " - Grid structure:\n";
for( unsigned ilevel=levelmin_; ilevel<=levelmax_; ++ilevel )
{

View file

@ -138,7 +138,7 @@ double multigrid_poisson_plugin::gradient( int dir, grid_hierarchy& u, grid_hier
{
Du = u;
unsigned order = cf_.getValueSafe<unsigned>( "setup", "grad_order", 4 );
unsigned order = cf_.getValueSafe<unsigned>( "poisson", "grad_order", 4 );
switch( order )
{