Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ParHalo particle attribute to ClusterMerger setup #330

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ static FieldIdx_t ColorField3Idx = Idx_Undefined;

// problem-specific function prototypes
#ifdef MASSIVE_PARTICLES
int ParHaloIdx = Idx_Undefined;

void AddNewParticleAttribute_ClusterMerger();

long Read_Particle_Number_ClusterMerger(std::string filename);
void Par_Init_ByFunction_ClusterMerger(const long NPar_ThisRank,
const long NPar_AllRank,
Expand Down Expand Up @@ -113,6 +117,9 @@ void Validate()
Aux_Error( ERROR_INFO, "COMOVING must be disabled !!\n" );
# endif

if ( PAR_NATT_USER != 1 )
Aux_Error( ERROR_INFO, "PAR_NATT_USER must be set to 1 in the Makefile!!");

if ( !OPT__UNIT )
Aux_Error( ERROR_INFO, "OPT__UNIT must be enabled !!\n" );

Expand All @@ -124,7 +131,7 @@ void Validate()
if ( OPT__BC_POT == BC_POT_PERIODIC )
Aux_Error( ERROR_INFO, "do not use periodic BC (OPT__BC_POT = 1) for this test !!\n" );
# endif

# ifdef MASSIVE_PARTICLES
if ( OPT__INIT == INIT_BY_FUNCTION && amr->Par->Init != PAR_INIT_BY_FUNCTION )
Aux_Error( ERROR_INFO, "please set PAR_INIT = 1 (by FUNCTION) !!\n" );
Expand Down Expand Up @@ -692,7 +699,7 @@ void Init_TestProb_Hydro_ClusterMerger()
End_User_Ptr = End_ClusterMerger;
Par_Init_ByFunction_Ptr = Par_Init_ByFunction_ClusterMerger;
Init_Field_User_Ptr = AddNewField_ClusterMerger;
//Par_Init_Attribute_User_Ptr = AddNewParticleAttribute_ClusterMerger;
Par_Init_Attribute_User_Ptr = AddNewParticleAttribute_ClusterMerger;
# ifdef MHD
Init_Function_BField_User_Ptr = SetBFieldIC;
# endif
Expand Down Expand Up @@ -785,4 +792,15 @@ void AddNewField_ClusterMerger()

}

#endif

#ifdef MASSIVE_PARTICLES

void AddNewParticleAttribute_ClusterMerger()
{
if ( ParHaloIdx == Idx_Undefined )
ParHaloIdx = AddParticleAttribute( "ParHalo" );
}


#endif
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ extern long NPar_AllCluster;


#ifdef MASSIVE_PARTICLES

extern int ParHaloIdx;

void Read_Particles_ClusterMerger(std::string filename, long offset, long num,
real_par_in xpos[], real_par_in ypos[],
real_par_in zpos[], real_par_in xvel[],
Expand Down Expand Up @@ -217,6 +220,9 @@ void Par_Init_ByFunction_ClusterMerger( const long NPar_ThisRank, const long NPa
// synchronize all particles to the physical time at the base level
ParTime[pp] = (real_par)Time[0];

// Set tag for each cluster
AllAttribute[ParHaloIdx][pp] = real( c );

}

delete [] mass;
Expand Down
Loading