Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
1da074ae
Commit
1da074ae
authored
May 22, 2017
by
Matthieu Schaller
Browse files
Added a growth time for the sine-wave external potential test case.
parent
9d92c916
Changes
2
Hide whitespace changes
Inline
Side-by-side
examples/parameter_example.yml
View file @
1da074ae
...
...
@@ -107,6 +107,12 @@ DiscPatchPotential:
timestep_mult
:
0.03
# Dimensionless pre-factor for the time-step condition
growth_time
:
5.
# (Optional) Time for the disc to grow to its final size (multiple of the dynamical time)
# Sine Wave potential
SineWavePotential
:
amplitude
:
10.
# Amplitude of the sine wave (internal units)
timestep_limit
:
1.
# Time-step dimensionless pre-factor.
growth_time
:
0.
# (Optional) Time for the potential to grow to its final size.
# Parameters related to cooling function ----------------------------------------------
# Constant du/dt cooling function
...
...
src/potential/sine_wave/potential.h
View file @
1da074ae
...
...
@@ -43,6 +43,9 @@ struct external_potential {
/*! Amplitude of the sine wave. */
double
amplitude
;
/*! Growth time of the potential. */
double
growth_time
;
/*! Time-step limiting factor. */
double
timestep_limit
;
};
...
...
@@ -76,7 +79,13 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
double
time
,
const
struct
external_potential
*
restrict
potential
,
const
struct
phys_const
*
restrict
phys_const
,
struct
gpart
*
restrict
g
)
{
g
->
a_grav
[
0
]
=
potential
->
amplitude
*
sin
(
2
.
*
M_PI
*
g
->
x
[
0
])
/
float
Acorr
=
1
.;
if
(
time
<
potential
->
growth_time
)
{
Acorr
=
time
/
potential
->
growth_time
;
}
g
->
a_grav
[
0
]
=
potential
->
amplitude
*
Acorr
*
sin
(
2
.
*
M_PI
*
g
->
x
[
0
])
/
phys_const
->
const_newton_G
;
}
...
...
@@ -114,6 +123,8 @@ static INLINE void potential_init_backend(
potential
->
amplitude
=
parser_get_param_double
(
parameter_file
,
"SineWavePotential:amplitude"
);
potential
->
growth_time
=
parser_get_opt_param_double
(
parameter_file
,
"SineWavePotential:growth_time"
,
0
.);
potential
->
timestep_limit
=
parser_get_param_double
(
parameter_file
,
"SineWavePotential:timestep_limit"
);
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment