Commit 18f77b9e authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Add the chemistry information to all the other hydro schemes.

parent 37340e14
......@@ -32,8 +32,6 @@
void hydro_read_particles(struct part* parts, struct io_props* list,
int* num_fields) {
*num_fields = 8;
/* List what we want to read */
list[0] = io_make_input_field("Coordinates", DOUBLE, 3, COMPULSORY,
UNIT_CONV_LENGTH, parts, x);
......@@ -51,6 +49,13 @@ void hydro_read_particles(struct part* parts, struct io_props* list,
UNIT_CONV_ACCELERATION, parts, a_hydro);
list[7] = io_make_input_field("Density", FLOAT, 1, OPTIONAL,
UNIT_CONV_DENSITY, parts, rho);
*num_fields = 8;
list += *num_fields;
/* Read in chemistry information */
const int num_chem_fields = chemistry_read_particles(parts, list);
*num_fields += num_chem_fields;
list += num_chem_fields;
}
void convert_part_pos(const struct engine* e, const struct part* p,
......@@ -77,8 +82,6 @@ void convert_part_pos(const struct engine* e, const struct part* p,
void hydro_write_particles(struct part* parts, struct io_props* list,
int* num_fields) {
*num_fields = 8;
/* List what we want to write */
list[0] = io_make_output_field_convert_part(
"Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH, parts, convert_part_pos);
......@@ -96,6 +99,14 @@ void hydro_write_particles(struct part* parts, struct io_props* list,
UNIT_CONV_ACCELERATION, parts, a_hydro);
list[7] =
io_make_output_field("Density", FLOAT, 1, UNIT_CONV_DENSITY, parts, rho);
*num_fields = 8;
list += *num_fields;
/* Write some chemistry information */
const int num_chem_fields = chemistry_write_particles(parts, list);
*num_fields += num_chem_fields;
list += num_chem_fields;
}
/**
......
......@@ -46,6 +46,12 @@ struct xpart {
/* Data of a single particle. */
struct part {
/* Particle ID. */
long long id;
/* Pointer to corresponding gravity part. */
struct gpart* gpart;
/* Particle position. */
double x[3];
......@@ -116,11 +122,8 @@ struct part {
/* Particle mass. */
float mass;
/* Particle ID. */
long long id;
/* Pointer to corresponding gravity part. */
struct gpart* gpart;
/* Chemistry information */
struct chemistry_part_data chemistry_data;
/* Particle time-bin */
timebin_t time_bin;
......
......@@ -41,8 +41,6 @@
void hydro_read_particles(struct part* parts, struct io_props* list,
int* num_fields) {
*num_fields = 8;
/* List what we want to read */
list[0] = io_make_input_field("Coordinates", DOUBLE, 3, COMPULSORY,
UNIT_CONV_LENGTH, parts, x);
......@@ -61,6 +59,14 @@ void hydro_read_particles(struct part* parts, struct io_props* list,
UNIT_CONV_ACCELERATION, parts, a_hydro);
list[7] = io_make_input_field("Density", FLOAT, 1, OPTIONAL,
UNIT_CONV_DENSITY, parts, primitives.rho);
*num_fields = 8;
list += *num_fields;
/* Read in chemistry information */
const int num_chem_fields = chemistry_read_particles(parts, list);
*num_fields += num_chem_fields;
list += num_chem_fields;
}
/**
......@@ -131,8 +137,6 @@ void convert_part_pos(const struct engine* e, const struct part* p,
void hydro_write_particles(struct part* parts, struct io_props* list,
int* num_fields) {
*num_fields = 10;
/* List what we want to write */
list[0] = io_make_output_field_convert_part(
"Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH, parts, convert_part_pos);
......@@ -155,6 +159,14 @@ void hydro_write_particles(struct part* parts, struct io_props* list,
parts, primitives.P);
list[9] = io_make_output_field_convert_part(
"TotEnergy", FLOAT, 1, UNIT_CONV_ENERGY, parts, convert_Etot);
*num_fields = 10;
list += *num_fields;
/* Write some chemistry information */
const int num_chem_fields = chemistry_write_particles(parts, list);
*num_fields += num_chem_fields;
list += num_chem_fields;
}
/**
......
......@@ -188,6 +188,9 @@ struct part {
} gravity;
/* Chemistry information */
struct chemistry_part_data chemistry_data;
/* Time-step length */
timebin_t time_bin;
......
......@@ -48,8 +48,6 @@
void hydro_read_particles(struct part* parts, struct io_props* list,
int* num_fields) {
*num_fields = 8;
/* List what we want to read */
list[0] = io_make_input_field("Coordinates", DOUBLE, 3, COMPULSORY,
UNIT_CONV_LENGTH, parts, x);
......@@ -67,6 +65,13 @@ void hydro_read_particles(struct part* parts, struct io_props* list,
UNIT_CONV_ACCELERATION, parts, a_hydro);
list[7] = io_make_input_field("Density", FLOAT, 1, OPTIONAL,
UNIT_CONV_DENSITY, parts, rho);
*num_fields = 8;
list += *num_fields;
/* Read in chemistry information */
const int num_chem_fields = chemistry_read_particles(parts, list);
*num_fields += num_chem_fields;
list += num_chem_fields;
}
void convert_S(const struct engine* e, const struct part* p, float* ret) {
......@@ -103,8 +108,6 @@ void convert_part_pos(const struct engine* e, const struct part* p,
void hydro_write_particles(struct part* parts, struct io_props* list,
int* num_fields) {
*num_fields = 10;
/* List what we want to write */
list[0] = io_make_output_field_convert_part(
"Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH, parts, convert_part_pos);
......@@ -126,6 +129,14 @@ void hydro_write_particles(struct part* parts, struct io_props* list,
"Entropy", FLOAT, 1, UNIT_CONV_ENTROPY_PER_UNIT_MASS, parts, convert_S);
list[9] = io_make_output_field_convert_part(
"Pressure", FLOAT, 1, UNIT_CONV_PRESSURE, parts, convert_P);
*num_fields = 10;
list += *num_fields;
/* Write some chemistry information */
const int num_chem_fields = chemistry_write_particles(parts, list);
*num_fields += num_chem_fields;
list += num_chem_fields;
}
/**
......
......@@ -149,6 +149,9 @@ struct part {
} force;
};
/* Chemistry information */
struct chemistry_part_data chemistry_data;
/*! Time-step length */
timebin_t time_bin;
......
......@@ -45,8 +45,6 @@
void hydro_read_particles(struct part* parts, struct io_props* list,
int* num_fields) {
*num_fields = 8;
/* List what we want to read */
list[0] = io_make_input_field("Coordinates", DOUBLE, 3, COMPULSORY,
UNIT_CONV_LENGTH, parts, x);
......@@ -65,6 +63,14 @@ void hydro_read_particles(struct part* parts, struct io_props* list,
UNIT_CONV_ACCELERATION, parts, a_hydro);
list[7] = io_make_input_field("Density", FLOAT, 1, OPTIONAL,
UNIT_CONV_DENSITY, parts, rho);
*num_fields = 8;
list += *num_fields;
/* Read in chemistry information */
const int num_chem_fields = chemistry_read_particles(parts, list);
*num_fields += num_chem_fields;
list += num_chem_fields;
}
void convert_u(const struct engine* e, const struct part* p, float* ret) {
......@@ -101,8 +107,6 @@ void convert_part_pos(const struct engine* e, const struct part* p,
void hydro_write_particles(struct part* parts, struct io_props* list,
int* num_fields) {
*num_fields = 11;
/* List what we want to write */
list[0] = io_make_output_field_convert_part(
"Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH, parts, convert_part_pos);
......@@ -127,6 +131,14 @@ void hydro_write_particles(struct part* parts, struct io_props* list,
"Pressure", FLOAT, 1, UNIT_CONV_PRESSURE, parts, convert_P);
list[10] = io_make_output_field("WeightedDensity", FLOAT, 1,
UNIT_CONV_DENSITY, parts, rho_bar);
*num_fields = 11;
list += *num_fields;
/* Write some chemistry information */
const int num_chem_fields = chemistry_write_particles(parts, list);
*num_fields += num_chem_fields;
list += num_chem_fields;
}
/**
......
......@@ -138,6 +138,9 @@ struct part {
} force;
};
/* Chemistry information */
struct chemistry_part_data chemistry_data;
/* Time-step length */
timebin_t time_bin;
......
......@@ -35,8 +35,6 @@
void hydro_read_particles(struct part* parts, struct io_props* list,
int* num_fields) {
*num_fields = 8;
/* List what we want to read */
list[0] = io_make_input_field("Coordinates", DOUBLE, 3, COMPULSORY,
UNIT_CONV_LENGTH, parts, x);
......@@ -55,6 +53,13 @@ void hydro_read_particles(struct part* parts, struct io_props* list,
UNIT_CONV_ACCELERATION, parts, a_hydro);
list[7] = io_make_input_field("Density", FLOAT, 1, OPTIONAL,
UNIT_CONV_DENSITY, parts, primitives.rho);
*num_fields = 8;
list += *num_fields;
/* Read in chemistry information */
const int num_chem_fields = chemistry_read_particles(parts, list);
*num_fields += num_chem_fields;
list += num_chem_fields;
}
/**
......@@ -128,8 +133,6 @@ void convert_part_pos(const struct engine* e, const struct part* p,
void hydro_write_particles(struct part* parts, struct io_props* list,
int* num_fields) {
*num_fields = 13;
/* List what we want to write */
list[0] = io_make_output_field_convert_part(
"Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH, parts, convert_part_pos);
......@@ -158,6 +161,14 @@ void hydro_write_particles(struct part* parts, struct io_props* list,
parts, primitives.P);
list[12] = io_make_output_field_convert_part(
"TotEnergy", FLOAT, 1, UNIT_CONV_ENERGY, parts, convert_Etot);
*num_fields = 13;
list += *num_fields;
/* Write some chemistry information */
const int num_chem_fields = chemistry_write_particles(parts, list);
*num_fields += num_chem_fields;
list += num_chem_fields;
}
/**
......
......@@ -169,6 +169,9 @@ struct part {
} force;
/* Chemistry information */
struct chemistry_part_data chemistry_data;
/* Time-step length */
timebin_t time_bin;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment