gravity_properties.h 3.1 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
25
26
27
28
29
/*******************************************************************************
 * 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_GRAVITY_PROPERTIES
#define SWIFT_GRAVITY_PROPERTIES

/* Config parameters. */
#include "../config.h"

#if defined(HAVE_HDF5)
#include <hdf5.h>
#endif

/* Local includes. */
30
#include "restart.h"
31

32
33
34
35
/* Forward declarations */
struct cosmology;
struct swift_params;

36
37
38
39
40
/**
 * @brief Contains all the constants and parameters of the self-gravity scheme
 */
struct gravity_props {

41
42
43
  /*! Frequency of tree-rebuild in units of #gpart updates. */
  float rebuild_frequency;

44
45
46
  /*! Periodic long-range mesh side-length */
  int mesh_size;

47
  /*! Mesh smoothing scale in units of top-level cell size */
48
  float a_smooth;
49
50
51

  /*! Distance below which the truncated mesh force is Newtonian in units of
   * a_smooth */
52
  float r_cut_min_ratio;
53
54
55

  /*! Distance above which the truncated mesh force is negligible in units of
   * a_smooth */
56
  float r_cut_max_ratio;
57

58
  /*! Time integration dimensionless multiplier */
59
60
  float eta;

61
  /*! Tree opening angle (Multipole acceptance criterion) */
62
  double theta_crit;
63

64
65
66
  /*! Square of opening angle */
  double theta_crit2;

67
  /*! Inverse of opening angle */
68
  double theta_crit_inv;
69

70
71
  /*! Comoving softening */
  double epsilon_comoving;
72

73
74
  /*! Maxium physical softening */
  double epsilon_max_physical;
75

76
  /*! Current softening length */
77
  float epsilon_cur;
78

79
80
81
82
83
84
85
86
  /*! Square of current softening length */
  float epsilon_cur2;

  /*! Inverse of current softening length */
  float epsilon_cur_inv;

  /*! Cube of the inverse of current oftening length */
  float epsilon_cur_inv3;
87
88
89
};

void gravity_props_print(const struct gravity_props *p);
Matthieu Schaller's avatar
Matthieu Schaller committed
90
void gravity_props_init(struct gravity_props *p, struct swift_params *params,
91
92
                        const struct cosmology *cosmo, int with_cosmology,
                        int periodic);
93
94
void gravity_props_update(struct gravity_props *p,
                          const struct cosmology *cosmo);
95
96
97
98
99
100

#if defined(HAVE_HDF5)
void gravity_props_print_snapshot(hid_t h_grpsph,
                                  const struct gravity_props *p);
#endif

101
102
/* Dump/restore. */
void gravity_props_struct_dump(const struct gravity_props *p, FILE *stream);
103
void gravity_props_struct_restore(struct gravity_props *p, FILE *stream);
104

105
#endif /* SWIFT_GRAVITY_PROPERTIES */