Skip to content
Snippets Groups Projects
Commit c1bca0e1 authored by Alexei Borissov's avatar Alexei Borissov
Browse files

changed table ordering when reading in z_*.hdf5 tables

parent 120fc2e7
Branches
Tags
1 merge request!593Eagle cooling
...@@ -887,18 +887,26 @@ construct_1d_print_table_from_4d_elements( ...@@ -887,18 +887,26 @@ construct_1d_print_table_from_4d_elements(
for (int j = 0; j < cooling->N_Elements; j++) { for (int j = 0; j < cooling->N_Elements; j++) {
for (int i = index_low; i < index_high; i++) { for (int i = index_low; i < index_high; i++) {
if (j == 0) result_table[i] = 0.0; if (j == 0) result_table[i] = 0.0;
index[0] = row_major_index_4d(x_i, j, y_i, i, n_x, index[0] = row_major_index_4d(x_i, y_i, i, j, n_x,
cooling->N_Elements, n_y, n_y, array_size, cooling->N_Elements);
array_size); index[1] = row_major_index_4d(x_i, y_i+1, i, j, n_x,
index[1] = row_major_index_4d(x_i, j, y_i + 1, i, n_x, n_y, array_size, cooling->N_Elements);
cooling->N_Elements, n_y, index[2] = row_major_index_4d(x_i+1, y_i, i, j, n_x,
array_size); n_y, array_size, cooling->N_Elements);
index[2] = row_major_index_4d(x_i + 1, j, y_i, i, n_x, index[3] = row_major_index_4d(x_i+1, y_i+1, i, j, n_x,
cooling->N_Elements, n_y, n_y, array_size, cooling->N_Elements);
array_size); //index[0] = row_major_index_4d(x_i, j, y_i, i, n_x,
index[3] = row_major_index_4d(x_i + 1, j, y_i + 1, i, // cooling->N_Elements, n_y,
n_x, cooling->N_Elements, // array_size);
n_y, array_size); //index[1] = row_major_index_4d(x_i, j, y_i + 1, i, n_x,
// cooling->N_Elements, n_y,
// array_size);
//index[2] = row_major_index_4d(x_i + 1, j, y_i, i, n_x,
// cooling->N_Elements, n_y,
// array_size);
//index[3] = row_major_index_4d(x_i + 1, j, y_i + 1, i,
// n_x, cooling->N_Elements,
// n_y, array_size);
result_table[i+array_size*j] = ((1 - d_x) * (1 - d_y) * table[index[0]] + result_table[i+array_size*j] = ((1 - d_x) * (1 - d_y) * table[index[0]] +
(1 - d_x) * d_y * table[index[1]] + (1 - d_x) * d_y * table[index[1]] +
...@@ -968,18 +976,26 @@ construct_1d_table_from_4d_elements( ...@@ -968,18 +976,26 @@ construct_1d_table_from_4d_elements(
for (int j = 0; j < cooling->N_Elements; j++) { for (int j = 0; j < cooling->N_Elements; j++) {
for (int i = index_low; i < index_high; i++) { for (int i = index_low; i < index_high; i++) {
if (j == 0) result_table[i] = 0.0; if (j == 0) result_table[i] = 0.0;
index[0] = row_major_index_4d(x_i, j, y_i, i, n_x, index[0] = row_major_index_4d(x_i, y_i, i, j, n_x,
cooling->N_Elements, n_y, n_y, array_size, cooling->N_Elements);
array_size); index[1] = row_major_index_4d(x_i, y_i+1, i, j, n_x,
index[1] = row_major_index_4d(x_i, j, y_i + 1, i, n_x, n_y, array_size, cooling->N_Elements);
cooling->N_Elements, n_y, index[2] = row_major_index_4d(x_i+1, y_i, i, j, n_x,
array_size); n_y, array_size, cooling->N_Elements);
index[2] = row_major_index_4d(x_i + 1, j, y_i, i, n_x, index[3] = row_major_index_4d(x_i+1, y_i+1, i, j, n_x,
cooling->N_Elements, n_y, n_y, array_size, cooling->N_Elements);
array_size); //index[0] = row_major_index_4d(x_i, j, y_i, i, n_x,
index[3] = row_major_index_4d(x_i + 1, j, y_i + 1, i, // cooling->N_Elements, n_y,
n_x, cooling->N_Elements, // array_size);
n_y, array_size); //index[1] = row_major_index_4d(x_i, j, y_i + 1, i, n_x,
// cooling->N_Elements, n_y,
// array_size);
//index[2] = row_major_index_4d(x_i + 1, j, y_i, i, n_x,
// cooling->N_Elements, n_y,
// array_size);
//index[3] = row_major_index_4d(x_i + 1, j, y_i + 1, i,
// n_x, cooling->N_Elements,
// n_y, array_size);
result_table[i] += ((1 - d_x) * (1 - d_y) * table[index[0]] + result_table[i] += ((1 - d_x) * (1 - d_y) * table[index[0]] +
(1 - d_x) * d_y * table[index[1]] + (1 - d_x) * d_y * table[index[1]] +
...@@ -1477,17 +1493,17 @@ __attribute__((always_inline)) INLINE static double eagle_metal_cooling_rate( ...@@ -1477,17 +1493,17 @@ __attribute__((always_inline)) INLINE static double eagle_metal_cooling_rate(
for (i = 0; i < cooling->N_Elements; i++) { for (i = 0; i < cooling->N_Elements; i++) {
temp_lambda = temp_lambda =
interpol_4d(cooling->table.element_cooling.metal_heating, z_index, i, interpol_4d(cooling->table.element_cooling.metal_heating, z_index,
n_h_i, temp_i, dz, 0.0, d_n_h, d_temp, cooling->N_Redshifts, n_h_i, temp_i, i, dz, d_n_h, d_temp, 0.0, cooling->N_Redshifts,
cooling->N_Elements, cooling->N_nH, cooling->N_Temp) * cooling->N_nH, cooling->N_Temp, cooling->N_Elements) *
(h_plus_he_electron_abundance / solar_electron_abundance)* (h_plus_he_electron_abundance / solar_electron_abundance)*
solar_ratio[i+2]; solar_ratio[i+2];
elem_cool1 = interpol_4d(cooling->table.element_cooling.metal_heating, z_index, i, elem_cool1 = interpol_4d(cooling->table.element_cooling.metal_heating, z_index,
n_h_i, temp_i, dz, 0.0, d_n_h, 0.0, cooling->N_Redshifts, n_h_i, temp_i, i, dz, d_n_h, 0.0, 0.0, cooling->N_Redshifts,
cooling->N_Elements, cooling->N_nH, cooling->N_Temp); cooling->N_nH, cooling->N_Temp, cooling->N_Elements);
elem_cool2 = interpol_4d(cooling->table.element_cooling.metal_heating, z_index, i, elem_cool2 = interpol_4d(cooling->table.element_cooling.metal_heating, z_index,
n_h_i, temp_i+1, dz, 0.0, d_n_h, 0.0, cooling->N_Redshifts, n_h_i, temp_i+1, i, dz, d_n_h, 0.0, 0.0, cooling->N_Redshifts,
cooling->N_Elements, cooling->N_nH, cooling->N_Temp); cooling->N_nH, cooling->N_Temp, cooling->N_Elements);
cooling_rate += temp_lambda; cooling_rate += temp_lambda;
*dlambda_du += *dlambda_du +=
(elem_cool2 * h_plus_he_electron_abundance2 / (elem_cool2 * h_plus_he_electron_abundance2 /
......
...@@ -685,8 +685,8 @@ inline struct cooling_tables get_cooling_table( ...@@ -685,8 +685,8 @@ inline struct cooling_tables get_cooling_table(
table_index = table_index =
row_major_index_2d(j, i, cooling->N_Temp, cooling->N_nH); row_major_index_2d(j, i, cooling->N_Temp, cooling->N_nH);
cooling_index = row_major_index_4d( cooling_index = row_major_index_4d(
z_index, specs, i, j, cooling->N_Redshifts, cooling->N_Elements, z_index, i, j, specs, cooling->N_Redshifts,
cooling->N_nH, cooling->N_Temp); cooling->N_nH, cooling->N_Temp, cooling->N_Elements);
cooling_table.metal_heating[cooling_index] = cooling_table.metal_heating[cooling_index] =
-net_cooling_rate[table_index]; -net_cooling_rate[table_index];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment