stars_iact.h 2.03 KB
Newer Older
Loic Hausammann's avatar
Loic Hausammann committed
1
2
3
4
5
6
7
8
9
10
11
12
/**
 * @brief Density interaction between two particles (non-symmetric).
 *
 * @param r2 Comoving square distance between the two particles.
 * @param dx Comoving vector separating both particles (pi - pj).
 * @param hi Comoving smoothing-length of particle i.
 * @param hj Comoving smoothing-length of particle j.
 * @param si First sparticle.
 * @param pj Second particle (not updated).
 * @param a Current scale factor.
 * @param H Current Hubble parameter.
 */
13
14
15
16
17
__attribute__((always_inline)) INLINE static void
runner_iact_nonsym_stars_density(float r2, const float *dx, float hi, float hj,
                                 struct spart *restrict si,
                                 const struct part *restrict pj, float a,
                                 float H) {
Loic Hausammann's avatar
Loic Hausammann committed
18
19
20
21
22
23
24
25
26
27
28
29
30

  float wi, wi_dx;

  /* Get r and 1/r. */
  const float r_inv = 1.0f / sqrtf(r2);
  const float r = r2 * r_inv;

  /* Compute the kernel function */
  const float hi_inv = 1.0f / hi;
  const float ui = r * hi_inv;
  kernel_deval(ui, &wi, &wi_dx);

  /* Compute contribution to the number of neighbours */
31
  si->density.wcount += wi;
32
  si->density.wcount_dh -= (hydro_dimension * wi + ui * wi_dx);
Loic Hausammann's avatar
Loic Hausammann committed
33
34
35

#ifdef DEBUG_INTERACTIONS_STARS
  /* Update ngb counters */
36
  if (si->num_ngb_density < MAX_NUM_OF_NEIGHBOURS_STARS)
Loic Hausammann's avatar
Loic Hausammann committed
37
38
39
40
    si->ids_ngbs_density[si->num_ngb_density] = pj->id;
  ++si->num_ngb_density;
#endif
}
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

/**
 * @brief Feedback interaction between two particles (non-symmetric).
 *
 * @param r2 Comoving square distance between the two particles.
 * @param dx Comoving vector separating both particles (pi - pj).
 * @param hi Comoving smoothing-length of particle i.
 * @param hj Comoving smoothing-length of particle j.
 * @param si First sparticle.
 * @param pj Second particle (not updated).
 * @param a Current scale factor.
 * @param H Current Hubble parameter.
 */
__attribute__((always_inline)) INLINE static void
runner_iact_nonsym_stars_feedback(float r2, const float *dx, float hi, float hj,
				  struct spart *restrict si,
				  const struct part *restrict pj, float a,
				  float H) {}