gravity_properties.h 2.92 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 "cosmology.h"
31
#include "parser.h"
32
#include "restart.h"
33
34
35
36
37
38

/**
 * @brief Contains all the constants and parameters of the self-gravity scheme
 */
struct gravity_props {

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

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

  /*! Distance below which the truncated mesh force is Newtonian in units of
   * a_smooth */
  float r_cut_min;

  /*! Distance above which the truncated mesh force is negligible in units of
   * a_smooth */
  float r_cut_max;
52

53
  /*! Time integration dimensionless multiplier */
54
55
  float eta;

56
  /*! Tree opening angle (Multipole acceptance criterion) */
57
  double theta_crit;
58

59
60
61
  /*! Square of opening angle */
  double theta_crit2;

62
  /*! Inverse of opening angle */
63
  double theta_crit_inv;
64

65
66
  /*! Comoving softening */
  double epsilon_comoving;
67

68
69
  /*! Maxium physical softening */
  double epsilon_max_physical;
70

71
72
  /*! Current sftening length */
  float epsilon_cur;
73

74
75
76
77
78
79
80
81
  /*! 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;
82
83
84
};

void gravity_props_print(const struct gravity_props *p);
Peter W. Draper's avatar
Peter W. Draper committed
85
void gravity_props_init(struct gravity_props *p, struct swift_params *params,
86
87
                        const struct cosmology *cosmo);
void gravity_update(struct gravity_props *p, const struct cosmology *cosmo);
88
89
90
91
92
93

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

94
95
96
97
/* Dump/restore. */
void gravity_props_struct_dump(const struct gravity_props *p, FILE *stream);
void gravity_props_struct_restore(const struct gravity_props *p, FILE *stream);

98
#endif /* SWIFT_GRAVITY_PROPERTIES */