Skip to content
Snippets Groups Projects
Commit c6901f59 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Fixed the unit tests and commented-out code in the gravity softening function.

parent 027e18f5
No related branches found
No related tags found
1 merge request!884Support for multiple softening lengths in the gravity solver
......@@ -62,11 +62,6 @@ __attribute__((always_inline)) INLINE static float gravity_get_softening(
default:
return 0.f;
}
/* if (gp->type == swift_type_dark_matter_background) */
/* return grav_props->epsilon_background_fac * cbrtf(gp->mass); */
/* else */
/* return grav_props->epsilon_cur; */
}
/**
......
......@@ -22,6 +22,7 @@
#include <float.h>
/* Local includes. */
#include "cosmology.h"
#include "gravity_properties.h"
#include "kernel_gravity.h"
......
......@@ -955,12 +955,11 @@ int main(int argc, char* argv[]) {
const double r_inv = 1. / sqrt(r2);
const double r = r2 * r_inv;
const double eps = r / 10.;
const double eps_inv = 1. / eps;
/* Compute all derivatives */
struct potential_derivatives_M2L pot;
potential_derivatives_compute_M2L(dx, dy, dz, r2, r_inv, eps, eps_inv,
periodic, r_s_inv, &pot);
potential_derivatives_compute_M2L(dx, dy, dz, r2, r_inv, eps, periodic,
r_s_inv, &pot);
/* Minimal value we care about */
const double min = 1e-9;
......
......@@ -125,7 +125,8 @@ int main(int argc, char *argv[]) {
struct gravity_props props;
props.theta_crit2 = 0.;
props.epsilon_cur = eps;
props.epsilon_DM_cur = eps;
props.epsilon_baryon_cur = eps;
e.gravity_properties = &props;
struct runner r;
......@@ -386,7 +387,7 @@ int main(int argc, char *argv[]) {
/* Now let's make a multipole out of it. */
gravity_reset(ci.grav.multipole);
gravity_P2M(ci.grav.multipole, ci.grav.parts, ci.grav.count);
gravity_P2M(ci.grav.multipole, ci.grav.parts, ci.grav.count, &props);
gravity_multipole_print(&ci.grav.multipole->m_pole);
......
......@@ -115,7 +115,8 @@ int main(int argc, char *argv[]) {
struct gravity_props props;
props.a_smooth = 1.25;
props.epsilon_cur = eps;
props.epsilon_DM_cur = eps;
props.epsilon_baryon_cur = eps;
e.gravity_properties = &props;
struct runner r;
......
......@@ -28,7 +28,7 @@
int main(int argc, char *argv[]) {
size_t Ngas = 0, Ngpart = 0, Nspart = 0, Nbpart = 0;
size_t Ngas = 0, Ngpart = 0, Ngpart_background = 0, Nspart = 0, Nbpart = 0;
int flag_entropy_ICs = -1;
int i, j, k;
double dim[3];
......@@ -51,8 +51,15 @@ int main(int argc, char *argv[]) {
/* Read data */
read_ic_single("input.hdf5", &us, dim, &parts, &gparts, &sparts, &bparts,
&Ngas, &Ngpart, &Nspart, &Nbpart, &flag_entropy_ICs, 1, 1, 0,
0, 0, 0, 1., 1., 1, 0);
&Ngas, &Ngpart, &Ngpart_background, &Nspart, &Nbpart,
&flag_entropy_ICs,
/*with_hydro=*/1,
/*with_gravity=*/1,
/*with_stars=*/0,
/*with_black_holes=*/0,
/*cleanup_h=*/0,
/*cleanup_sqrt_a=*/0,
/*h=*/1., /*a=*/1., /*n_threads=*/1, /*dry_run=*/0);
/* Check global properties read are correct */
assert(dim[0] == boxSize);
......
......@@ -84,7 +84,7 @@ int main(int argc, char *argv[]) {
clocks_set_cpufreq(cpufreq);
char *base_name = "testSelectOutput";
size_t Ngas = 0, Ngpart = 0, Nspart = 0, Nbpart = 0;
size_t Ngas = 0, Ngpart = 0, Ngpart_background = 0, Nspart = 0, Nbpart = 0;
int flag_entropy_ICs = -1;
int periodic = 1;
double dim[3];
......@@ -112,8 +112,15 @@ int main(int argc, char *argv[]) {
/* Read data */
message("Reading initial conditions.");
read_ic_single("input.hdf5", &us, dim, &parts, &gparts, &sparts, &bparts,
&Ngas, &Ngpart, &Nspart, &Nbpart, &flag_entropy_ICs, 1, 0, 0,
0, 0, 0, 1., 1., 1, 0);
&Ngas, &Ngpart, &Ngpart_background, &Nspart, &Nbpart,
&flag_entropy_ICs,
/*with_hydro=*/1,
/*with_gravity=*/0,
/*with_stars=*/0,
/*with_black_holes=*/0,
/*cleanup_h=*/0,
/*cleanup_sqrt_a=*/0,
/*h=*/1., /*a=*/1., /*n_threads=*/1, /*dry_run=*/0);
/* pseudo initialization of the space */
message("Initialization of the space.");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment