stars_part.h 2.84 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*******************************************************************************
 * This file is part of SWIFT.
 * Copyright (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_DEFAULT_STAR_PART_H
#define SWIFT_DEFAULT_STAR_PART_H

/* Some standard headers. */
#include <stdlib.h>

Matthieu Schaller's avatar
Matthieu Schaller committed
25
26
27
28
29
/**
 * @brief Particle fields for the star particles.
 *
 * All quantities related to gravity are stored in the associate #gpart.
 */
30
31
struct spart {

Matthieu Schaller's avatar
Matthieu Schaller committed
32
  /*! Particle ID. */
33
34
  long long id;

Matthieu Schaller's avatar
Matthieu Schaller committed
35
  /*! Pointer to corresponding gravity part. */
36
37
  struct gpart* gpart;

Matthieu Schaller's avatar
Matthieu Schaller committed
38
  /*! Particle position. */
39
40
  double x[3];

Loic Hausammann's avatar
Loic Hausammann committed
41
42
43
  /* Offset between current position and position at last tree rebuild. */
  float x_diff[3];

Matthieu Schaller's avatar
Matthieu Schaller committed
44
  /*! Particle velocity. */
45
46
  float v[3];

Matthieu Schaller's avatar
Matthieu Schaller committed
47
  /*! Star mass */
48
49
  float mass;

Loic Hausammann's avatar
Loic Hausammann committed
50
51
52
  /* Particle cutoff radius. */
  float h;

Matthieu Schaller's avatar
Matthieu Schaller committed
53
  /*! Particle time bin */
54
  timebin_t time_bin;
55

Loic Hausammann's avatar
Loic Hausammann committed
56
57
58
  struct {
    /* Number of neighbours. */
    float wcount;
Loic Hausammann's avatar
Loic Hausammann committed
59

Loic Hausammann's avatar
Loic Hausammann committed
60
61
62
63
    /* Number of neighbours spatial derivative. */
    float wcount_dh;

  } density;
Loic Hausammann's avatar
Loic Hausammann committed
64

Loikki's avatar
Loikki committed
65
66
67
  /* Number of time step since last output */
  short int last_output;
    
68
69
70
71
72
73
74
75
76
77
#ifdef SWIFT_DEBUG_CHECKS

  /* Time of the last drift */
  integertime_t ti_drift;

  /* Time of the last kick */
  integertime_t ti_kick;

#endif

Loic Hausammann's avatar
Loic Hausammann committed
78
79
#ifdef DEBUG_INTERACTIONS_STARS
  /*! List of interacting particles in the density SELF and PAIR */
80
  long long ids_ngbs_density[MAX_NUM_OF_NEIGHBOURS_STARS];
Loic Hausammann's avatar
Loic Hausammann committed
81
82
83
84
85

  /*! Number of interactions in the density SELF and PAIR */
  int num_ngb_density;
#endif

86
87
} SWIFT_STRUCT_ALIGN;

Loic Hausammann's avatar
Loic Hausammann committed
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/**
 * @brief Contains all the constants and parameters of the stars scheme
 */
struct stars_props {

  /*! Resolution parameter */
  float eta_neighbours;

  /*! Target weightd number of neighbours (for info only)*/
  float target_neighbours;

  /*! Smoothing length tolerance */
  float h_tolerance;

  /*! Tolerance on neighbour number  (for info only)*/
  float delta_neighbours;

  /*! Maximal smoothing length */
  float h_max;

  /*! Maximal number of iterations to converge h */
  int max_smoothing_iterations;

  /*! Maximal change of h over one time-step */
  float log_max_h_change;
};

115
#endif /* SWIFT_DEFAULT_STAR_PART_H */