Skip to content
Snippets Groups Projects
Commit db54fc76 authored by lhausamm's avatar lhausamm
Browse files

Add iact and io for cooling

parent 74e7fc6d
No related branches found
No related tags found
1 merge request!486Add chemistry in part
......@@ -29,12 +29,16 @@
/* Import the right cooling definition */
#if defined(COOLING_NONE)
#include "./cooling/none/cooling_iact.h"
#include "./cooling/none/cooling.h"
#elif defined(COOLING_CONST_DU)
#include "./cooling/const_du/cooling_iact.h"
#include "./cooling/const_du/cooling.h"
#elif defined(COOLING_CONST_LAMBDA)
#include "./cooling/const_lambda/cooling_iact.h"
#include "./cooling/const_lambda/cooling.h"
#elif defined(COOLING_GRACKLE)
#include "./cooling/grackle/cooling_iact.h"
#include "./cooling/grackle/cooling.h"
#else
#error "Invalid choice of cooling function."
......
/*******************************************************************************
* This file is part of SWIFT.
* Coypright (c) 2016 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/>.
*
******************************************************************************/
#include "part.h"
/**
* @brief Density loop
*/
__attribute__((always_inline)) INLINE static void cooling_density_iact(
float wi, float wj, struct part *pi, struct part *pj) {
float diff = pi->cooling_data.He_density - pj->cooling_data.He_density;
pi->cooling_data.He_density += wj * diff;
pj->cooling_data.He_density += wi * diff;
};
/*******************************************************************************
* This file is part of SWIFT.
* Coypright (c) 2016 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/>.
*
******************************************************************************/
#include "io_properties.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 cooling_read_particles(struct part* parts, struct io_props* list,
int* num_fields) {
list += *num_fields;
*num_fields += 1;
/* List what we want to read */
list[0] = io_make_input_field("HeDensity", FLOAT, 1, OPTIONAL,
UNIT_CONV_DENSITY, parts, cooling_data.He_density);
}
/**
* @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 cooling_write_particles(const struct part* parts, struct io_props* list,
int* num_fields) {
int i = *num_fields;
/* List what we want to write */
list[i] = io_make_output_field(
"HeDensity", FLOAT, 1, UNIT_CONV_DENSITY, parts, cooling_data.He_density);
i++;
*num_fields = i;
}
/**
* @brief Writes the current model of SPH to the file
* @param h_grpsph The HDF5 group in which to write
*/
void writeCoolingFlavor(hid_t h_grpsph) {
/* Viscosity and thermal conduction */
io_write_attribute_s(
h_grpsph, "Chemistry Model",
"Grackle");
}
/*******************************************************************************
* This file is part of SWIFT.
* Coypright (c) 2016 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_COOLING_IO_H
#define SWIFT_COOLING_IO_H
/* Config parameters. */
#include "../config.h"
/* Import the right functions */
#if defined(COOLING_NONE)
#include "./cooling/none/cooling_io.h"
#elif defined(COOLING_CONST_DU)
#include "./cooling/const_du/cooling_io.h"
#elif defined(COOLING_CONST_LAMBDA)
#include "./cooling/const_lambda/cooling_io.h"
#elif defined(COOLING_GRACKLE)
#include "./cooling/grackle/cooling_io.h"
#else
#error "Invalid choice of cooling function."
#endif
#endif /* SWIFT_COOLING_IO_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment