diff --git a/configure.ac b/configure.ac index e3a796c14251e6a0309a04eab571a9e026c503e5..7e325482692d72a90df4df23fb37b8ae34d38c44 100644 --- a/configure.ac +++ b/configure.ac @@ -855,7 +855,7 @@ fi # Hydro scheme. AC_ARG_WITH([hydro], [AS_HELP_STRING([--with-hydro=<scheme>], - [Hydro dynamics to use @<:@gadget2, minimal, hopkins, default, gizmo, shadowfax, minimal-multi-mat, debug default: gadget2@:>@] + [Hydro dynamics to use @<:@gadget2, minimal, hopkins, pressure-energy, default, gizmo, shadowfax debug default: gadget2@:>@] )], [with_hydro="$withval"], [with_hydro="gadget2"] @@ -879,6 +879,9 @@ case "$with_hydro" in hopkins) AC_DEFINE([HOPKINS_PE_SPH], [1], [Pressure-Entropy SPH]) ;; + pressure-energy) + AC_DEFINE([HOPKINS_PU_SPH], [1], [Pressure-Energy SPH]) + ;; default) AC_DEFINE([DEFAULT_SPH], [1], [Default SPH]) ;; diff --git a/src/debug.c b/src/debug.c index bf167e9a2954ed7b81588bc2aacf8e3b2b8cbe09..2ca6a9bf832e2da1860d4f89f032c8a4f7bef86b 100644 --- a/src/debug.c +++ b/src/debug.c @@ -46,6 +46,8 @@ #include "./hydro/Gadget2/hydro_debug.h" #elif defined(HOPKINS_PE_SPH) #include "./hydro/PressureEntropy/hydro_debug.h" +#elif defined(HOPKINS_PU_SPH) +#include "./hydro/PressureEnergy/hydro_debug.h" #elif defined(DEFAULT_SPH) #include "./hydro/Default/hydro_debug.h" #elif defined(GIZMO_SPH) diff --git a/src/hydro.h b/src/hydro.h index 0b6438471ec799f9b44e01b48dd528de9f57e379..cc6fa46ad374b39f5c9777874d2d85608b5eb2d6 100644 --- a/src/hydro.h +++ b/src/hydro.h @@ -41,6 +41,10 @@ #include "./hydro/PressureEntropy/hydro.h" #include "./hydro/PressureEntropy/hydro_iact.h" #define SPH_IMPLEMENTATION "Pressure-Entropy SPH (Hopkins 2013)" +#elif defined(HOPKINS_PU_SPH) +#include "./hydro/PressureEnergy/hydro.h" +#include "./hydro/PressureEnergy/hydro_iact.h" +#define SPH_IMPLEMENTATION "Pressure-Energy SPH (Hopkins 2013)" #elif defined(DEFAULT_SPH) #include "./hydro/Default/hydro.h" #include "./hydro/Default/hydro_iact.h" diff --git a/src/hydro/PressureEnergy/hydro.h b/src/hydro/PressureEnergy/hydro.h new file mode 100644 index 0000000000000000000000000000000000000000..fc352adf514d701f0555fbac21a70559b7fd67e8 --- /dev/null +++ b/src/hydro/PressureEnergy/hydro.h @@ -0,0 +1,340 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2017 Matthieu Schaller (matthieu.schaller@durham.ac.uk) + * + * 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 + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + ******************************************************************************/ +#ifndef SWIFT_PRESSURE_ENERGY_HYDRO_H +#define SWIFT_PRESSURE_ENERGY_HYDRO_H + +/** + * @file PressureEnergy/hydro.h + * @brief Pressure-Energy implementation of SPH (Non-neighbour loop + * equations) + * + * The thermal variable is the energy (u) and the pressure is smoothed over + * contact discontinuities to prevent spurious surface tension. + * + * Follows equations (16), (17) and (18) of Hopkins, P., MNRAS, 2013, + * Volume 428, Issue 4, pp. 2840-2856 with a simple Balsara viscosity term. + */ + +#include "adiabatic_index.h" +#include "approx_math.h" +#include "dimension.h" +#include "equation_of_state.h" +#include "hydro_properties.h" +#include "kernel_hydro.h" +#include "minmax.h" + +#include <float.h> + +/** + * @brief Returns the internal energy of a particle + * + * @param p The particle of interest + */ +__attribute__((always_inline)) INLINE static float hydro_get_internal_energy( + const struct part *restrict p) { + + return 0.f; +} + +/** + * @brief Returns the pressure of a particle + * + * @param p The particle of interest + */ +__attribute__((always_inline)) INLINE static float hydro_get_pressure( + const struct part *restrict p) { + + return 0.f; +} + +/** + * @brief Returns the entropy of a particle + * + * @param p The particle of interest + */ +__attribute__((always_inline)) INLINE static float hydro_get_entropy( + const struct part *restrict p) { + + return 0.f; +} + +/** + * @brief Returns the sound speed of a particle + * + * @param p The particle of interest + */ +__attribute__((always_inline)) INLINE static float hydro_get_soundspeed( + const struct part *restrict p) { + + return 0.f; +} + +/** + * @brief Returns the physical density of a particle + * + * @param p The particle of interest + */ +__attribute__((always_inline)) INLINE static float hydro_get_density( + const struct part *restrict p) { + + return 0.f; +} + +/** + * @brief Returns the mass of a particle + * + * @param p The particle of interest + */ +__attribute__((always_inline)) INLINE static float hydro_get_mass( + const struct part *restrict p) { + + return 0.f; +} + +/** + * @brief Returns the time derivative of internal energy of a particle + * + * We assume a constant density. + * + * @param p The particle of interest + */ +__attribute__((always_inline)) INLINE static float hydro_get_internal_energy_dt( + const struct part *restrict p) { + + return 0.f; +} + +/** + * @brief Returns the time derivative of internal energy of a particle + * + * We assume a constant density. + * + * @param p The particle of interest. + * @param du_dt The new time derivative of the internal energy. + */ +__attribute__((always_inline)) INLINE static void hydro_set_internal_energy_dt( + struct part *restrict p, float du_dt) {} + +/** + * @brief Computes the hydro time-step of a given particle + * + * @param p Pointer to the particle data + * @param xp Pointer to the extended particle data + * + */ +__attribute__((always_inline)) INLINE static float hydro_compute_timestep( + const struct part *restrict p, const struct xpart *restrict xp, + const struct hydro_props *restrict hydro_properties) { + + return FLT_MAX; +} + +/** + * @brief Does some extra hydro operations once the actual physical time step + * for the particle is known. + * + * @param p The particle to act upon. + * @param dt Physical time step of the particle during the next step. + */ +__attribute__((always_inline)) INLINE static void hydro_timestep_extra( + struct part *p, float dt) {} + +/** + * @brief Prepares a particle for the density calculation. + * + * Zeroes all the relevant arrays in preparation for the sums taking place in + * the variaous density tasks + * + * @param p The particle to act upon + */ +__attribute__((always_inline)) INLINE static void hydro_init_part( + struct part *restrict p, const struct hydro_space *hs) { + + p->density.wcount = 0.f; + p->density.wcount_dh = 0.f; +} + +/** + * @brief Finishes the density calculation. + * + * Multiplies the density and number of neighbours by the appropiate constants + * and add the self-contribution term. + * + * @param p The particle to act upon + */ +__attribute__((always_inline)) INLINE static void hydro_end_density( + struct part *restrict p) { + + /* Some smoothing length multiples. */ + const float h = p->h; + const float h_inv = 1.0f / h; /* 1/h */ + const float h_inv_dim = pow_dimension(h_inv); /* 1/h^d */ + const float h_inv_dim_plus_one = h_inv_dim * h_inv; /* 1/h^(d+1) */ + + /* Final operation on the density (add self-contribution). */ + p->density.wcount += kernel_root; + p->density.wcount_dh -= hydro_dimension * kernel_root; + + /* Finish the calculation by inserting the missing h-factors */ + p->density.wcount *= h_inv_dim; + p->density.wcount_dh *= h_inv_dim_plus_one; +} + +/** + * @brief Sets all particle fields to sensible values when the #part has 0 ngbs. + * + * @param p The particle to act upon + * @param xp The extended particle data to act upon + */ +__attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( + struct part *restrict p, struct xpart *restrict xp) { + + /* Some smoothing length multiples. */ + const float h = p->h; + const float h_inv = 1.0f / h; /* 1/h */ + const float h_inv_dim = pow_dimension(h_inv); /* 1/h^d */ + + /* Re-set problematic values */ + p->density.wcount = kernel_root * kernel_norm * h_inv_dim; + p->density.wcount_dh = 0.f; +} + +/** + * @brief Prepare a particle for the force calculation. + * + * Computes viscosity term, conduction term and smoothing length gradient terms. + * + * @param p The particle to act upon + * @param xp The extended particle data to act upon + */ +__attribute__((always_inline)) INLINE static void hydro_prepare_force( + struct part *restrict p, struct xpart *restrict xp) {} + +/** + * @brief Reset acceleration fields of a particle + * + * Resets all hydro acceleration and time derivative fields in preparation + * for the sums taking place in the variaous force tasks + * + * @param p The particle to act upon + */ +__attribute__((always_inline)) INLINE static void hydro_reset_acceleration( + struct part *restrict p) { + + /* Reset the acceleration. */ + p->a_hydro[0] = 0.0f; + p->a_hydro[1] = 0.0f; + p->a_hydro[2] = 0.0f; + + /* Reset the time derivatives. */ + p->force.h_dt = 0.0f; + + /* Reset maximal signal velocity */ + p->force.v_sig = 0.0f; +} + +/** + * @brief Sets the values to be predicted in the drifts to their values at a + * kick time + * + * @param p The particle. + * @param xp The extended data of this particle. + */ +__attribute__((always_inline)) INLINE static void hydro_reset_predicted_values( + struct part *restrict p, const struct xpart *restrict xp) { + + /* Re-set the predicted velocities */ + p->v[0] = xp->v_full[0]; + p->v[1] = xp->v_full[1]; + p->v[2] = xp->v_full[2]; +} + +/** + * @brief Predict additional particle fields forward in time when drifting + * + * @param p The particle + * @param xp The extended data of the particle + * @param dt The drift time-step. + */ +__attribute__((always_inline)) INLINE static void hydro_predict_extra( + struct part *restrict p, const struct xpart *restrict xp, float dt) { + + const float h_inv = 1.f / p->h; + + /* Predict smoothing length */ + const float w1 = p->force.h_dt * h_inv * dt; + if (fabsf(w1) < 0.2f) + p->h *= approx_expf(w1); /* 4th order expansion of exp(w) */ + else + p->h *= expf(w1); +} + +/** + * @brief Finishes the force calculation. + * + * Multiplies the forces and accelerationsby the appropiate constants + * + * @param p The particle to act upon + */ +__attribute__((always_inline)) INLINE static void hydro_end_force( + struct part *restrict p) {} + +/** + * @brief Kick the additional variables + * + * @param p The particle to act upon + * @param xp The particle extended data to act upon + * @param dt The time-step for this kick + * @param half_dt The half time-step for this kick + */ +__attribute__((always_inline)) INLINE static void hydro_kick_extra( + struct part *restrict p, struct xpart *restrict xp, float dt) {} + +/** + * @brief Converts hydro quantity of a particle at the start of a run + * + * Requires the density to be known + * + * @param p The particle to act upon + */ +__attribute__((always_inline)) INLINE static void hydro_convert_quantities( + struct part *restrict p, struct xpart *restrict xp) {} + +/** + * @brief Initialises the particles for the first time + * + * This function is called only once just after the ICs have been + * read in to do some conversions. + * + * @param p The particle to act upon + * @param xp The extended particle data to act upon + */ +__attribute__((always_inline)) INLINE static void hydro_first_init_part( + struct part *restrict p, struct xpart *restrict xp) { + + p->time_bin = 0; + xp->v_full[0] = p->v[0]; + xp->v_full[1] = p->v[1]; + xp->v_full[2] = p->v[2]; + + hydro_reset_acceleration(p); + hydro_init_part(p, NULL); +} + +#endif /* SWIFT_PRESSURE_ENERGY_HYDRO_H */ diff --git a/src/hydro/PressureEnergy/hydro_debug.h b/src/hydro/PressureEnergy/hydro_debug.h new file mode 100644 index 0000000000000000000000000000000000000000..e3a44fb148f4644284736f9179188c7dcc736c19 --- /dev/null +++ b/src/hydro/PressureEnergy/hydro_debug.h @@ -0,0 +1,44 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Coypright (c) 2017 Matthieu Schaller (matthieu.schaller@durham.ac.uk) + * + * 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 + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + ******************************************************************************/ +#ifndef SWIFT_PRESSURE_ENERGY_HYDRO_DEBUG_H +#define SWIFT_PRESSURE_ENERGY_HYDRO_DEBUG_H + +/** + * @file PressureEnergy/hydro_debug.h + * @brief Pressure-Energy implementation of SPH (Debugging routines) + * + * The thermal variable is the energy (u) and the pressure is smoothed over + * contact discontinuities to prevent spurious surface tension. + * + * Follows equations (16), (17) and (18) of Hopkins, P., MNRAS, 2013, + * Volume 428, Issue 4, pp. 2840-2856 with a simple Balsara viscosity term. + */ + +__attribute__((always_inline)) INLINE static void hydro_debug_particle( + const struct part* p, const struct xpart* xp) { + printf( + "x=[%.3e,%.3e,%.3e], " + "v=[%.3e,%.3e,%.3e],v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e],\n " + "h=%.3e, wcount=%.3f, wcount_dh=%.3e, time_bin=%d\n", + p->x[0], p->x[1], p->x[2], p->v[0], p->v[1], p->v[2], xp->v_full[0], + xp->v_full[1], xp->v_full[2], p->a_hydro[0], p->a_hydro[1], p->a_hydro[2], + p->h, p->density.wcount, p->density.wcount_dh, p->time_bin); +} + +#endif /* SWIFT_PRESSURE_ENERGY_HYDRO_DEBUG_H */ diff --git a/src/hydro/PressureEnergy/hydro_iact.h b/src/hydro/PressureEnergy/hydro_iact.h new file mode 100644 index 0000000000000000000000000000000000000000..9bf5872b0917d1a93cf7d4f79ca52daf2ef2bc3a --- /dev/null +++ b/src/hydro/PressureEnergy/hydro_iact.h @@ -0,0 +1,78 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2017 Matthieu Schaller (matthieu.schaller@durham.ac.uk) + * + * 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 + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + ******************************************************************************/ +#ifndef SWIFT_PRESSURE_ENERGY_HYDRO_IACT_H +#define SWIFT_PRESSURE_ENERGY_HYDRO_IACT_H + +/** + * @file PressureEnergy/hydro_iact.h + * @brief Pressure-Energy implementation of SPH (Neighbour loop equations) + * + * The thermal variable is the energy (u) and the pressure is smoothed over + * contact discontinuities to prevent spurious surface tension. + * + * Follows equations (16), (17) and (18) of Hopkins, P., MNRAS, 2013, + * Volume 428, Issue 4, pp. 2840-2856 with a simple Balsara viscosity term. + */ + +/** + * @brief Density loop (non-symmetric version) + */ +__attribute__((always_inline)) INLINE static void runner_iact_nonsym_density( + float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) { + + float wi, wi_dx; + + /* Get r and r inverse. */ + const float r_inv = 1.0f / sqrtf(r2); + const float r = r2 * r_inv; + + /* Compute the kernel function */ + const float h_inv = 1.0f / hi; + const float ui = r * h_inv; + kernel_deval(ui, &wi, &wi_dx); + + /* Compute contribution to the number of neighbours */ + pi->density.wcount += wi; + pi->density.wcount_dh -= hydro_dimension * wi + ui * wi_dx; +} + +/** + * @brief Density loop + */ +__attribute__((always_inline)) INLINE static void runner_iact_density( + float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) { + + /* MISSING ! */ +} + +/** + * @brief Force loop (non-symmetric version) + */ +__attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( + float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) { +} + +/** + * @brief Force loop + */ +__attribute__((always_inline)) INLINE static void runner_iact_force( + float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) { +} + +#endif /* SWIFT_PRESSURE_ENERGY_HYDRO_IACT_H */ diff --git a/src/hydro/PressureEnergy/hydro_io.h b/src/hydro/PressureEnergy/hydro_io.h new file mode 100644 index 0000000000000000000000000000000000000000..9caf6e51c6d4e5b8bc2b786cbf324cc4ebffb4ff --- /dev/null +++ b/src/hydro/PressureEnergy/hydro_io.h @@ -0,0 +1,97 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Coypright (c) 2017 Matthieu Schaller (matthieu.schaller@durham.ac.uk) + * + * 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 + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + ******************************************************************************/ +#ifndef SWIFT_PRESSURE_ENERGY_HYDRO_IO_H +#define SWIFT_PRESSURE_ENERGY_HYDRO_IO_H + +/** + * @file PressureEnergy/hydro_io.h + * @brief Pressure-Energy implementation of SPH (i/o routines) + * + * The thermal variable is the energy (u) and the pressure is smoothed over + * contact discontinuities to prevent spurious surface tension. + * + * Follows equations (17) and (18) of Hopkins, P., MNRAS, 2013, + * Volume 428, Issue 4, pp. 2840-2856 with a simple Balsara viscosity term. + */ + +#include "adiabatic_index.h" +#include "hydro.h" +#include "io_properties.h" +#include "kernel_hydro.h" + +/** + * @brief Specifies which particle fields to read from a dataset + * + * @param parts The particle array. + * @param list The list of i/o properties to read. + * @param num_fields The number of i/o fields to read. + */ +void hydro_read_particles(struct part* parts, struct io_props* list, + int* num_fields) { + + *num_fields = 4; + + /* List what we want to read */ + list[0] = io_make_input_field("Coordinates", DOUBLE, 3, COMPULSORY, + UNIT_CONV_LENGTH, parts, x); + list[1] = io_make_input_field("Velocities", FLOAT, 3, COMPULSORY, + UNIT_CONV_SPEED, parts, v); + list[2] = io_make_input_field("SmoothingLength", FLOAT, 1, COMPULSORY, + UNIT_CONV_LENGTH, parts, h); + list[3] = io_make_input_field("ParticleIDs", ULONGLONG, 1, COMPULSORY, + UNIT_CONV_NO_UNITS, parts, id); +} + +/** + * @brief Specifies which particle fields to write to a dataset + * + * @param parts The particle array. + * @param list The list of i/o properties to write. + * @param num_fields The number of i/o fields to write. + */ +void hydro_write_particles(struct part* parts, struct io_props* list, + int* num_fields) { + + *num_fields = 4; + + /* List what we want to write */ + list[0] = io_make_output_field("Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH, + parts, x); + list[1] = + io_make_output_field("Velocities", FLOAT, 3, UNIT_CONV_SPEED, parts, v); + list[2] = io_make_output_field("SmoothingLength", FLOAT, 1, UNIT_CONV_LENGTH, + parts, h); + list[3] = io_make_output_field("ParticleIDs", ULONGLONG, 1, + UNIT_CONV_NO_UNITS, parts, id); +} + +/** + * @brief Writes the current model of SPH to the file + * @param h_grpsph The HDF5 group in which to write + */ +void writeSPHflavour(hid_t h_grpsph) {} + +/** + * @brief Are we writing entropy in the internal energy field ? + * + * @return 1 if entropy is in 'internal energy', 0 otherwise. + */ +int writeEntropyFlag() { return 0; } + +#endif /* SWIFT_PRESSURE_ENERGY_HYDRO_IO_H */ diff --git a/src/hydro/PressureEnergy/hydro_part.h b/src/hydro/PressureEnergy/hydro_part.h new file mode 100644 index 0000000000000000000000000000000000000000..2d5dc202323a4f4e68a3763dd380cc9feb28c537 --- /dev/null +++ b/src/hydro/PressureEnergy/hydro_part.h @@ -0,0 +1,111 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2017 Matthieu Schaller (matthieu.schaller@durham.ac.uk) + * + * 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 + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + ******************************************************************************/ +#ifndef SWIFT_PRESSURE_ENERGY_HYDRO_PART_H +#define SWIFT_PRESSURE_ENERGY_HYDRO_PART_H + +/** + * @file PressureEnergy/hydro_part.h + * @brief Pressure-Energy implementation of SPH (Particle definition) + * + * The thermal variable is the energy (u) and the pressure is smoothed over + * contact discontinuities to prevent spurious surface tension. + * + * Follows equations (16), (17) and (18) of Hopkins, P., MNRAS, 2013, + * Volume 428, Issue 4, pp. 2840-2856 with a simple Balsara viscosity term. + */ + +#include "cooling_struct.h" + +/* Extra particle data not needed during the SPH loops over neighbours. */ +struct xpart { + + /*! Offset between current position and position at last tree rebuild. */ + float x_diff[3]; + + /* Offset between the current position and position at the last sort. */ + float x_diff_sort[3]; + + /*! Velocity at the last full step. */ + float v_full[3]; + + /*! Additional data used to record cooling information */ + struct cooling_xpart_data cooling_data; + +} SWIFT_STRUCT_ALIGN; + +/* 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]; + + /*! Particle predicted velocity. */ + float v[3]; + + /*! Particle acceleration. */ + float a_hydro[3]; + + /*! Particle cutoff radius. */ + float h; + + union { + + struct { + + /*! Number of neighbours. */ + float wcount; + + /*! Number of neighbours spatial derivative. */ + float wcount_dh; + + } density; + + struct { + + /*! Signal velocity. */ + float v_sig; + + /*! Time derivative of the smoothing length */ + float h_dt; + + } force; + }; + + /* Time-step length */ + timebin_t time_bin; + +#ifdef SWIFT_DEBUG_CHECKS + + /* Time of the last drift */ + integertime_t ti_drift; + + /* Time of the last kick */ + integertime_t ti_kick; + +#endif + +} SWIFT_STRUCT_ALIGN; + +#endif /* SWIFT_PRESSURE_ENERGY_HYDRO_PART_H */ diff --git a/src/hydro_io.h b/src/hydro_io.h index c5f9aae9f7bb5f581b09dcd3f309c5fa95f33e51..b1d43592d504f82a2db1a9f265d30c20d6eddc35 100644 --- a/src/hydro_io.h +++ b/src/hydro_io.h @@ -29,6 +29,8 @@ #include "./hydro/Gadget2/hydro_io.h" #elif defined(HOPKINS_PE_SPH) #include "./hydro/PressureEntropy/hydro_io.h" +#elif defined(HOPKINS_PU_SPH) +#include "./hydro/PressureEnergy/hydro_io.h" #elif defined(DEFAULT_SPH) #include "./hydro/Default/hydro_io.h" #elif defined(GIZMO_SPH) diff --git a/src/part.h b/src/part.h index 0cfe731e52167825b89c3e732620bf47ba75bdad..a207e82c2ee19f6ddad6dd261167a3360e23bfdd 100644 --- a/src/part.h +++ b/src/part.h @@ -51,6 +51,9 @@ #elif defined(HOPKINS_PE_SPH) #include "./hydro/PressureEntropy/hydro_part.h" #define hydro_need_extra_init_loop 1 +#elif defined(HOPKINS_PU_SPH) +#include "./hydro/PressureEnergy/hydro_part.h" +#define hydro_need_extra_init_loop 1 #elif defined(DEFAULT_SPH) #include "./hydro/Default/hydro_part.h" #define hydro_need_extra_init_loop 0