Commit d22a3689 authored by Mladen Ivkovic's avatar Mladen Ivkovic

added rt struct

parent 30ac285b
......@@ -40,6 +40,7 @@
#include "star_formation_struct.h"
#include "timestep_limiter_struct.h"
#include "tracers_struct.h"
#include "rt_struct.h"
/* Extra particle data not needed during the SPH loops over neighbours. */
struct xpart {
......@@ -71,6 +72,9 @@ struct xpart {
/* Additional data used by the feedback */
struct feedback_part_data feedback_data;
/* Additional Radiative Transfer Data */
struct rt_xpart_data rt_data;
#ifdef WITH_LOGGER
/* Additional data for the particle logger */
struct logger_part_data logger_data;
......
......@@ -31,4 +31,44 @@ __attribute__((always_inline)) INLINE static void rt_dummy_function(void) {
message("Called debug RT scheme.");
}
/**
* @brief First initialisation of the RT extra hydro partilce data.
*/
__attribute__((always_inline)) INLINE static void rt_first_init_xpart(struct xpart* restrict xp) {
xp->rt_data.iact_stars = 0;
xp->rt_data.calls_tot = 0;
xp->rt_data.calls_per_step = 0;
}
/**
* @brief Initialisation of the RT extra hydro partilce data.
*/
__attribute__((always_inline)) INLINE static void rt_init_xpart(struct xpart* restrict xp) {
xp->rt_data.iact_stars = 0;
xp->rt_data.calls_per_step = 0;
}
/**
* @brief First initialisation of the RT extra star partilce data.
*/
__attribute__((always_inline)) INLINE static void rt_first_init_spart( struct spart* restrict sp) {
sp->rt_data.iact_hydro = 0;
sp->rt_data.calls_tot = 0;
sp->rt_data.calls_per_step = 0;
}
/**
* @brief First initialisation of the RT extra star partilce data.
*/
__attribute__((always_inline)) INLINE static void rt_init_spart( struct spart* restrict sp) {
sp->rt_data.iact_hydro = 0;
sp->rt_data.calls_per_step = 0;
}
#endif /* SWIFT_RT_DEBUG_H */
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Mladen Ivkovic (mladen.ivkovic@hotmail.com)
*
* 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_RT_STRUCT_DEBUG_H
#define SWIFT_RT_STRUCT_DEBUG_H
/**
* @file src/rt/debug/rt_struct.h
* @brief Main header file for the debug radiative transfer struct.
*/
struct rt_xpart_data {
int iact_stars; /* how many stars this particle interacted with */
int calls_tot; /* total number of calls to this particle during entire run */
int calls_per_step; /* calls per time step to this particle */
};
struct rt_spart_data {
int iact_hydro; /* how many hydro particles this particle interacted with */
int calls_tot; /* total number of calls to this particle during entire run */
int calls_per_step; /* calls per time step to this particle */
};
#endif /* SWIFT_RT_STRUCT_DEBUG_H */
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Mladen Ivkovic (mladen.ivkovic@hotmail.com)
*
* 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_RT_STRUCT_H
#define SWIFT_RT_STRUCT_H
/**
* @file src/rt_struct.h
* @brief Branches between the different radiative transfer structs.
*/
/* Config parameters. */
#include "../config.h"
/* Import the right RT struct definition */
#if defined(RT_NONE)
#include "./rt/none/rt_struct.h"
#elif defined(RT_DEBUG)
#include "./rt/debug/rt_struct.h"
#elif defined(RT_M1)
#include "./rt/M1closure/rt_struct.h"
#else
#error "Invalid choice of radiation scheme"
#endif
#endif /* SWIFT_RT_STRUCT_H */
......@@ -59,6 +59,7 @@
#include "pressure_floor.h"
#include "proxy.h"
#include "restart.h"
#include "rt.h"
#include "sink.h"
#include "sort_part.h"
#include "space_unique_id.h"
......@@ -4923,6 +4924,9 @@ void space_first_init_parts_mapper(void *restrict map_data, int count,
/* And the black hole markers */
black_holes_mark_part_as_not_swallowed(&p[k].black_holes_data);
/* And the radiative transfer */
rt_first_init_xpart(&xp[k]);
#ifdef SWIFT_DEBUG_CHECKS
/* Check part->gpart->part linkeage. */
if (p[k].gpart && p[k].gpart->id_or_neg_offset != -(k + delta))
......@@ -5082,6 +5086,9 @@ void space_first_init_sparts_mapper(void *restrict map_data, int count,
/* Also initialise the chemistry */
chemistry_first_init_spart(chemistry, &sp[k]);
/* And radiative transfer data */
rt_first_init_spart(&sp[k]);
#ifdef SWIFT_DEBUG_CHECKS
if (sp[k].gpart && sp[k].gpart->id_or_neg_offset != -(k + delta))
error("Invalid gpart -> spart link");
......@@ -5275,6 +5282,7 @@ void space_init_parts_mapper(void *restrict map_data, int count,
black_holes_init_potential(&parts[k].black_holes_data);
chemistry_init_part(&parts[k], e->chemistry);
pressure_floor_init_part(&parts[k], &xparts[k]);
rt_init_xpart(&xparts[k]);
star_formation_init_part(&parts[k], e->star_formation);
tracers_after_init(&parts[k], &xparts[k], e->internal_units,
e->physical_constants, with_cosmology, e->cosmology,
......
......@@ -20,6 +20,7 @@
#define SWIFT_GEAR_STARS_H
#include "minmax.h"
#include "rt.h"
#include <float.h>
......@@ -50,6 +51,7 @@ __attribute__((always_inline)) INLINE static void stars_init_spart(
sp->density.wcount = 0.f;
sp->density.wcount_dh = 0.f;
rt_init_spart(sp);
}
/**
......
......@@ -27,6 +27,7 @@
#include "feedback_struct.h"
#include "star_formation_struct.h"
#include "tracers_struct.h"
#include "rt_struct.h"
/**
* @brief Particle fields for the star particles.
......@@ -91,6 +92,9 @@ struct spart {
/*! Chemistry structure */
struct chemistry_spart_data chemistry_data;
/*! Radiative Transfer data */
struct rt_spart_data rt_data;
/*! Particle time bin */
timebin_t time_bin;
......
Markdown is supported
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