Commit 8db08c24 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Removed unnecessary variables in the GIZMO particle definition.

parent d84a2bd5
......@@ -77,7 +77,6 @@ __attribute__((always_inline)) INLINE static void hydro_init_part(
p->density.wcount = 0.0f;
p->density.wcount_dh = 0.0f;
p->rho = 0.0f;
p->geometry.volume = 0.0f;
p->geometry.matrix_E[0][0] = 0.0f;
p->geometry.matrix_E[0][1] = 0.0f;
......@@ -125,9 +124,6 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
const float ihdim = pow_dimension(ih);
p->rho += p->mass * kernel_root;
p->rho *= ihdim;
float volume;
float m, momentum[3], energy;
......@@ -258,12 +254,9 @@ __attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
__attribute__((always_inline)) INLINE static void hydro_convert_quantities(
struct part* p) {
float volume;
float m;
float momentum[3];
volume = p->geometry.volume;
p->conserved.mass = m = p->mass;
const float volume = p->geometry.volume;
const float m = p->conserved.mass;
p->primitives.rho = m / volume;
/* P actually contains internal energy at this point */
......
......@@ -57,9 +57,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_density(
pi->density.wcount += wi;
pi->density.wcount_dh -= xi * wi_dx;
/* Density. Needed for h_dt. */
pi->rho += pj->mass * wi;
/* these are eqns. (1) and (2) in the summary */
pi->geometry.volume += wi;
for (k = 0; k < 3; k++)
......@@ -73,9 +70,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_density(
pj->density.wcount += wj;
pj->density.wcount_dh -= xj * wj_dx;
/* Density. Needed for h_dt. */
pj->rho += pi->mass * wi;
/* these are eqns. (1) and (2) in the summary */
pj->geometry.volume += wj;
for (k = 0; k < 3; k++)
......@@ -119,8 +113,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
pi->density.wcount += wi;
pi->density.wcount_dh -= xi * wi_dx;
pi->rho += pj->mass * wi;
/* these are eqns. (1) and (2) in the summary */
pi->geometry.volume += wi;
for (k = 0; k < 3; k++)
......@@ -273,7 +265,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common(
xj = r * hj_inv;
kernel_deval(xj, &wj, &wj_dx);
/* Compute h_dt */
/* Compute h_dt. We are going to use an SPH-like estimate of div_v for that */
float dvdr = (pi->v[0] - pj->v[0]) * dx[0] + (pi->v[1] - pj->v[1]) * dx[1] +
(pi->v[2] - pj->v[2]) * dx[2];
float ri = 1.0f / r;
......@@ -282,9 +274,9 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common(
float wi_dr = hidp1 * wi_dx;
float wj_dr = hjdp1 * wj_dx;
dvdr *= ri;
pi->force.h_dt -= pj->mass * dvdr / pj->rho * wi_dr;
pi->force.h_dt -= pj->conserved.mass * dvdr / pj->primitives.rho * wi_dr;
if (mode == 1) {
pj->force.h_dt -= pi->mass * dvdr / pi->rho * wj_dr;
pj->force.h_dt -= pi->conserved.mass * dvdr / pi->primitives.rho * wj_dr;
}
/* Compute area */
......@@ -483,16 +475,32 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
__attribute__((always_inline)) INLINE static void runner_iact_vec_density(
float *R2, float *Dx, float *Hi, float *Hj, struct part **pi,
struct part **pj) {}
struct part **pj) {
error(
"Vectorised versions of the Gizmo interaction functions do not exist "
"yet!");
}
__attribute__((always_inline)) INLINE static void
runner_iact_nonsym_vec_density(float *R2, float *Dx, float *Hi, float *Hj,
struct part **pi, struct part **pj) {}
struct part **pi, struct part **pj) {
error(
"Vectorised versions of the Gizmo interaction functions do not exist "
"yet!");
}
__attribute__((always_inline)) INLINE static void runner_iact_vec_force(
float *R2, float *Dx, float *Hi, float *Hj, struct part **pi,
struct part **pj) {}
struct part **pj) {
error(
"Vectorised versions of the Gizmo interaction functions do not exist "
"yet!");
}
__attribute__((always_inline)) INLINE static void runner_iact_nonsym_vec_force(
float *R2, float *Dx, float *Hi, float *Hj, struct part **pi,
struct part **pj) {}
struct part **pj) {
error(
"Vectorised versions of the Gizmo interaction functions do not exist "
"yet!");
}
......@@ -41,7 +41,7 @@ void hydro_read_particles(struct part* parts, struct io_props* list,
list[1] = io_make_input_field("Velocities", FLOAT, 3, COMPULSORY,
UNIT_CONV_SPEED, parts, v);
list[2] = io_make_input_field("Masses", FLOAT, 1, COMPULSORY, UNIT_CONV_MASS,
parts, mass);
parts, conserved.mass);
list[3] = io_make_input_field("SmoothingLength", FLOAT, 1, COMPULSORY,
UNIT_CONV_LENGTH, parts, h);
list[4] =
......
/*******************************************************************************
* This file is part of SWIFT.
* Coypright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk)
* Matthieu Schaller (matthieu.schaller@durham.ac.uk)
* Bert Vandenbroucke (bert.vandenbroucke@ugent.be)
* Coypright (c) 2014 Bert Vandenbroucke (bert.vandenbroucke@ugent.be)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
......@@ -27,10 +25,6 @@ struct xpart {
/* Velocity at the last full step. */
float v_full[3];
/* Old density. */
float omega;
} __attribute__((aligned(xpart_align)));
/* Data of a single particle. */
......@@ -45,7 +39,7 @@ struct part {
/* Particle acceleration. */
float a_hydro[3];
/* Particle cutoff radius. */
/* Particle smoothing length. */
float h;
/* Particle time of beginning of time-step. */
......@@ -54,6 +48,9 @@ struct part {
/* Particle time of end of time-step. */
int ti_end;
/* Old internal energy flux */
float du_dt;
/* The primitive hydrodynamical variables. */
struct {
......@@ -192,19 +189,10 @@ struct part {
} gravity;
/* Particle mass (this field is also part of the conserved quantities...). */
float mass;
/* Particle ID. */
long long id;
/* Associated gravitas. */
struct gpart *gpart;
/* Variables needed for the code to compile (should be removed/replaced). */
float rho;
/* Old internal energy flux */
float du_dt;
} __attribute__((aligned(part_align)));
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