Skip to content
Snippets Groups Projects
Commit e965c9cf authored by James Willis's avatar James Willis
Browse files

Added a parameter to override the linking length set in the code by an absolute linking length.

parent 1f9f71be
Branches
Tags
1 merge request!543Fof
...@@ -65,14 +65,13 @@ SPH: ...@@ -65,14 +65,13 @@ SPH:
# Parameters for the Friends-Of-Friends algorithm # Parameters for the Friends-Of-Friends algorithm
FOF: FOF:
min_group_size: 20 # The minimum no. of particles required for a group. min_group_size: 20 # The minimum no. of particles required for a group.
linking_length_scale: 0.2 # Scales the linking length. linking_length_scale: 0.2 # Scales the linking length.
basename: fof_output # Common part of the name of output files #absolute_linking_length: 0.2 # Absolute linking length. Overrides default value of using the linking_length_scale parameter and the mean inter-particle separation.
basename: fof_output # Common part of the name of output files
# Parameters related to the initial conditions # Parameters related to the initial conditions
InitialConditions: InitialConditions:
file_name: ./EAGLE_ICs_6.hdf5 # The file to read file_name: ./EAGLE_ICs_6.hdf5 # The file to read
cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget
cleanup_velocity_factors: 1 # Remove the sqrt(a) factor in the velocities inherited from Gadget cleanup_velocity_factors: 1 # Remove the sqrt(a) factor in the velocities inherited from Gadget
...@@ -65,7 +65,10 @@ void fof_init(struct space *s, long long Ngas, long long Ngparts) { ...@@ -65,7 +65,10 @@ void fof_init(struct space *s, long long Ngas, long long Ngparts) {
/* Calculate the particle linking length based upon the mean inter-particle /* Calculate the particle linking length based upon the mean inter-particle
* spacing of the DM particles. */ * spacing of the DM particles. */
const int total_nr_dmparts = Ngparts - Ngas; const int total_nr_dmparts = Ngparts - Ngas;
const double l_x = l_x_scale * (s->dim[0] / cbrt(total_nr_dmparts)); double l_x = l_x_scale * (s->dim[0] / cbrt(total_nr_dmparts));
l_x = parser_get_opt_param_double(e->parameter_file, "FOF:absolute_linking_length", l_x);
s->l_x2 = l_x * l_x; s->l_x2 = l_x * l_x;
#ifdef WITH_MPI #ifdef WITH_MPI
...@@ -902,9 +905,6 @@ void fof_search_foreign_cells(struct space *s) { ...@@ -902,9 +905,6 @@ void fof_search_foreign_cells(struct space *s) {
struct cell *restrict local_cell = interface_cells[i]; struct cell *restrict local_cell = interface_cells[i];
/* Skip empty cells. */
if(local_cell->gcount == 0) continue;
for(int j=0; j<e->nr_proxies; j++) { for(int j=0; j<e->nr_proxies; j++) {
for(int k=0; k<e->proxies[j].nr_cells_in; k++) { for(int k=0; k<e->proxies[j].nr_cells_in; k++) {
...@@ -1018,12 +1018,9 @@ void fof_search_foreign_cells(struct space *s) { ...@@ -1018,12 +1018,9 @@ void fof_search_foreign_cells(struct space *s) {
if(!found_i) { if(!found_i) {
global_group_size[group_count] += global_group_links[i].group_i_size; global_group_size[group_count] += global_group_links[i].group_i_size;
global_group_mass[group_count] += global_group_links[i].group_i_mass; global_group_mass[group_count] += global_group_links[i].group_i_mass;
/* TODO: The CoM of groups linked across MPI domains will not be wrapped correctly as each rank will centre it within their own domain first.*/
global_group_CoM[group_count].x += global_group_links[i].group_i_CoM.x; global_group_CoM[group_count].x += global_group_links[i].group_i_CoM.x;
global_group_CoM[group_count].y += global_group_links[i].group_i_CoM.y; global_group_CoM[group_count].y += global_group_links[i].group_i_CoM.y;
global_group_CoM[group_count].z += global_group_links[i].group_i_CoM.z; global_group_CoM[group_count].z += global_group_links[i].group_i_CoM.z;
global_group_id[group_count++] = group_i; global_group_id[group_count++] = group_i;
} }
...@@ -1031,10 +1028,9 @@ void fof_search_foreign_cells(struct space *s) { ...@@ -1031,10 +1028,9 @@ void fof_search_foreign_cells(struct space *s) {
/* Need to search for group_j sizes as the group size is only known on the local node. */ /* Need to search for group_j sizes as the group size is only known on the local node. */
for(int j=0; j<global_group_link_count; j++) { for(int j=0; j<global_group_link_count; j++) {
if(global_group_links[j].group_i == group_j) { if(global_group_links[j].group_i == group_j) {
global_group_size[group_count] += global_group_links[j].group_i_size; global_group_size[group_count] += global_group_links[j].group_i_size;
global_group_mass[group_count] += global_group_links[j].group_i_mass; global_group_mass[group_count] += global_group_links[j].group_i_mass;
/* TODO: The CoM of groups linked across MPI domains will not be wrapped correctly as each rank will centre it within their own domain first.*/
global_group_CoM[group_count].x += global_group_links[j].group_i_CoM.x; global_group_CoM[group_count].x += global_group_links[j].group_i_CoM.x;
global_group_CoM[group_count].y += global_group_links[j].group_i_CoM.y; global_group_CoM[group_count].y += global_group_links[j].group_i_CoM.y;
global_group_CoM[group_count].z += global_group_links[j].group_i_CoM.z; global_group_CoM[group_count].z += global_group_links[j].group_i_CoM.z;
...@@ -1052,21 +1048,6 @@ void fof_search_foreign_cells(struct space *s) { ...@@ -1052,21 +1048,6 @@ void fof_search_foreign_cells(struct space *s) {
/* The value of which is an offset into global_group_id, which is the actual root. */ /* The value of which is an offset into global_group_id, which is the actual root. */
for(int i=0; i<group_count; i++) global_group_index[i] = i; for(int i=0; i<group_count; i++) global_group_index[i] = i;
/* Save group links for each rank to a file. */
//char fof_map_filename[200] = "group_map";
//sprintf(fof_map_filename + strlen(fof_map_filename), "_%d.dat",
// engine_rank);
//
//fof_file = fopen(fof_map_filename, "w");
//fprintf(fof_file, "# %7s %7s %7s %7s\n", "Index", "Group ID", "Group Size", "Group Mass");
//fprintf(fof_file, "#-------------------------------\n");
//for(int i=0; i<group_count; i++) {
// fprintf(fof_file, " %7d %7d %7d %7e\n", global_group_index[i], global_group_id[i], global_group_size[i], global_group_mass[i]);
//}
//
//fclose(fof_file);
/* Perform a union-find on the group links. */ /* Perform a union-find on the group links. */
for(int i=0; i<global_group_link_count; i++) { for(int i=0; i<global_group_link_count; i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment