Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
08746cb6
Commit
08746cb6
authored
9 years ago
by
Tom Theuns
Browse files
Options
Downloads
Patches
Plain Diff
passed values of external potential via engine
parent
a3aff96c
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!143
Gravity particles
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/gravity/Default/gravity.h
+2
-3
2 additions, 3 deletions
src/gravity/Default/gravity.h
src/potentials.h
+8
-2
8 additions, 2 deletions
src/potentials.h
src/runner.c
+1
-5
1 addition, 5 deletions
src/runner.c
with
11 additions
and
10 deletions
src/gravity/Default/gravity.h
+
2
−
3
View file @
08746cb6
...
...
@@ -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
}
...
...
This diff is collapsed.
Click to expand it.
src/potentials.h
+
8
−
2
View file @
08746cb6
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
src/runner.c
+
1
−
5
View file @
08746cb6
...
...
@@ -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*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment