Skip to content
Snippets Groups Projects
Commit 08746cb6 authored by Tom Theuns's avatar Tom Theuns
Browse files

passed values of external potential via engine

parent a3aff96c
Branches
Tags
1 merge request!143Gravity particles
......@@ -82,11 +82,10 @@ __attribute__((always_inline))
* @param phys_const The physical constants in internal units.
* @param gp The particle to act upon.
*/
__attribute__((always_inline)) INLINE static void external_gravity(
const struct phys_const* const phys_const, struct gpart* gp) {
__attribute__((always_inline)) INLINE static void external_gravity(const struct external_potential* potential, const struct phys_const* const phys_const, struct gpart* gp) {
#ifdef EXTERNAL_POTENTIAL_POINTMASS
external_gravity_pointmass(phys_const, gp);
external_gravity_pointmass(potential, phys_const, gp);
#endif
}
......
......@@ -25,6 +25,7 @@
#include "../config.h"
/* Local includes. */
#include "error.h"
#include "physical_constants_cgs.h"
#include "physical_constants.h"
#include "units.h"
......@@ -85,8 +86,13 @@ __attribute__((always_inline))
* @param phys_cont The physical constants in internal units.
* @param gp Pointer to the g-particle data.
*/
__attribute__((always_inline)) INLINE static void external_gravity_pointmass(
const struct phys_const* const phys_const, struct gpart* g) {
__attribute__((always_inline)) INLINE static void external_gravity_pointmass(const struct external_potential* potential, const struct phys_const* const phys_const, struct gpart* g) {
/* message(" (x,y,z) = (%e, %e, %e), M= %e", potential->point_mass.x, */
/* potential->point_mass.y, potential->point_mass.z, */
/* potential->point_mass.mass); */
/* exit(-1); */
const double G_newton = phys_const->newton_gravity;
const float dx = g->x[0] - External_Potential_X;
......
......@@ -120,10 +120,6 @@ void runner_dograv_external(struct runner *r, struct cell *c) {
/* CentreOfPotential[1] = 0.5 * s->dim[1]; */
/* CentreOfPotential[2] = 0.5 * s->dim[2]; */
message(" (x,y,z) = (%e, %e, %e), M= %e", r->e->potential->point_mass.x,
r->e->potential->point_mass.y, r->e->potential->point_mass.z,
r->e->potential->point_mass.mass);
exit(-1);
/* Recurse? */
if (c->split) {
......@@ -145,7 +141,7 @@ void runner_dograv_external(struct runner *r, struct cell *c) {
if (g->ti_end <= ti_current) {
// external_gravity_pointmass(e->physical_constants,
// potential_constants, g);
external_gravity_pointmass(r->e->physical_constants, g);
external_gravity(r->e->potential, r->e->physical_constants, g);
/* check for energy and angular momentum conservation - begin by
* synchronizing velocity*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment