From 8e7f248ffd92e7b9a6170cfca08a034ac9b46895 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Sun, 25 Feb 2018 20:37:18 +0000 Subject: [PATCH] Added empty interaction functions for the EAGLE chemistry model. --- src/chemistry.h | 2 +- src/chemistry/EAGLE/chemistry.h | 26 ++++++++++++ src/chemistry/EAGLE/chemistry_iact.h | 61 ++++++++++++++++++++++++++++ src/chemistry/gear/chemistry.h | 3 +- 4 files changed, 89 insertions(+), 3 deletions(-) diff --git a/src/chemistry.h b/src/chemistry.h index 96745c805a..25de507d60 100644 --- a/src/chemistry.h +++ b/src/chemistry.h @@ -37,7 +37,7 @@ #include "./chemistry/gear/chemistry_iact.h" #elif defined(CHEMISTRY_EAGLE) #include "./chemistry/EAGLE/chemistry.h" -/* #include "./chemistry/EAGLE/chemistry_iact.h" */ +#include "./chemistry/EAGLE/chemistry_iact.h" #else #error "Invalid choice of chemistry function." #endif diff --git a/src/chemistry/EAGLE/chemistry.h b/src/chemistry/EAGLE/chemistry.h index df0a4599a0..0ee4d2a2bf 100644 --- a/src/chemistry/EAGLE/chemistry.h +++ b/src/chemistry/EAGLE/chemistry.h @@ -50,6 +50,32 @@ chemistry_get_element_name(enum chemistry_element elem) { return chemistry_element_names[elem]; } +/** + * @brief Prepares a particle for the smooth metal calculation. + * + * Zeroes all the relevant arrays in preparation for the sums taking place in + * the various smooth metallicity tasks + * + * @param p The particle to act upon + * @param cd #chemistry_data containing chemistry informations. + */ +__attribute__((always_inline)) INLINE static void chemistry_init_part( + struct part* restrict p, const struct chemistry_data* cd) {} + +/** + * @brief Finishes the smooth metal calculation. + * + * Multiplies the smoothed metallicity and number of neighbours by the + * appropiate constants and add the self-contribution term. + * + * This function requires the #hydro_end_density to have been called. + * + * @param p The particle to act upon. + * @param cd #chemistry_data containing chemistry informations. + */ +__attribute__((always_inline)) INLINE static void chemistry_end_density( + struct part* restrict p, const struct chemistry_data* cd) {} + /** * @brief Sets the chemistry properties of the (x-)particles to a valid start * state. diff --git a/src/chemistry/EAGLE/chemistry_iact.h b/src/chemistry/EAGLE/chemistry_iact.h index e69de29bb2..afdbbe3e4d 100644 --- a/src/chemistry/EAGLE/chemistry_iact.h +++ b/src/chemistry/EAGLE/chemistry_iact.h @@ -0,0 +1,61 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2018 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_EAGLE_CHEMISTRY_IACT_H +#define SWIFT_EAGLE_CHEMISTRY_IACT_H + +/** + * @file EAGLE/chemistry_iact.h + * @brief Smooth metal interaction functions following the EAGLE model. + */ + +#include "chemistry_struct.h" + +/** + * @brief Do chemistry computation after the runner_iact_density (symmetric + * version) + * + * @param r2 Distance squared between particles + * @param dx Distance between particles + * @param hi Smoothing length of i + * @param hj Smoothing length of j + * @param pi #part i + * @param pj #part j + * @param chem_data Chemistry informations + */ +__attribute__((always_inline)) INLINE static void runner_iact_chemistry( + float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj, + const struct chemistry_data *chem_data) {} + +/** + * @brief Do chemistry computation after the runner_iact_density (non-symmetric + * version) + * + * @param r2 Distance squared between particles + * @param dx Distance between particles + * @param hi Smoothing length of i + * @param hj Smoothing length of j + * @param pi #part i + * @param pj #part j + * @param chem_data Chemistry informations + */ +__attribute__((always_inline)) INLINE static void runner_iact_nonsym_chemistry( + float r2, float *dx, float hi, float hj, struct part *pi, + const struct part *pj, const struct chemistry_data *chem_data) {} + +#endif /* SWIFT_EAGLE_CHEMISTRY_IACT_H */ diff --git a/src/chemistry/gear/chemistry.h b/src/chemistry/gear/chemistry.h index 02a6514720..4e17be96d0 100644 --- a/src/chemistry/gear/chemistry.h +++ b/src/chemistry/gear/chemistry.h @@ -97,8 +97,7 @@ __attribute__((always_inline)) INLINE static void chemistry_init_part( * @brief Finishes the smooth metal calculation. * * Multiplies the smoothed metallicity and number of neighbours by the - * appropiate constants - * and add the self-contribution term. + * appropiate constants and add the self-contribution term. * * This method requires the #hydro_end_density to have been computed. * -- GitLab