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
5218a5a4
Commit
5218a5a4
authored
8 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Include self-gravity and external gravity in time-step calculation
parent
88308011
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/timestep.h
+13
-13
13 additions, 13 deletions
src/timestep.h
with
13 additions
and
13 deletions
src/timestep.h
+
13
−
13
View file @
5218a5a4
...
...
@@ -70,14 +70,15 @@ make_integer_timestep(float new_dt, timebin_t old_bin, integertime_t ti_current,
__attribute__
((
always_inline
))
INLINE
static
integertime_t
get_gpart_timestep
(
const
struct
gpart
*
restrict
gp
,
const
struct
engine
*
restrict
e
)
{
const
float
new_dt_external
=
external_gravity_timestep
(
e
->
time
,
e
->
external_potential
,
e
->
physical_constants
,
gp
);
float
new_dt
=
FLT_MAX
;
/* const float new_dt_self = */
/* gravity_compute_timestep_self(e->physical_constants, gp); */
const
float
new_dt_self
=
FLT_MAX
;
// MATTHIEU
if
(
e
->
policy
&
engine_policy_external_gravity
)
new_dt
=
min
(
new_dt
,
external_gravity_timestep
(
e
->
time
,
e
->
external_potential
,
e
->
physical_constants
,
gp
));
float
new_dt
=
min
(
new_dt_external
,
new_dt_self
);
if
(
e
->
policy
&
engine_policy_self_gravity
)
new_dt
=
min
(
new_dt
,
gravity_compute_timestep_self
(
gp
));
/* Limit timestep within the allowed range */
new_dt
=
min
(
new_dt
,
e
->
dt_max
);
...
...
@@ -114,14 +115,13 @@ __attribute__((always_inline)) INLINE static integertime_t get_part_timestep(
float
new_dt_grav
=
FLT_MAX
;
if
(
p
->
gpart
!=
NULL
)
{
const
float
new_dt_external
=
external_gravity_timestep
(
e
->
time
,
e
->
external_potential
,
e
->
physical_constants
,
p
->
gpart
);
if
(
e
->
policy
&
engine_policy_external_gravity
)
new_dt_grav
=
min
(
new_dt_grav
,
external_gravity_timestep
(
e
->
time
,
e
->
external_potential
,
e
->
physical_constants
,
p
->
gpart
));
/* const float new_dt_self = */
/* gravity_compute_timestep_self(e->physical_constants, p->gpart); */
const
float
new_dt_self
=
FLT_MAX
;
// MATTHIEU
new_dt_grav
=
min
(
new_dt_external
,
new_dt_self
);
if
(
e
->
policy
&
engine_policy_self_gravity
)
new_dt_grav
=
min
(
new_dt_grav
,
gravity_compute_timestep_self
(
p
->
gpart
));
}
/* Final time-step is minimum of hydro and gravity */
...
...
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