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
0c5e3efe
Commit
0c5e3efe
authored
Oct 20, 2015
by
Matthieu Schaller
Browse files
Time-stepping conditions extracted from the code.
parent
cb33f5d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/timestep.h
0 → 100644
View file @
0c5e3efe
/*******************************************************************************
* This file is part of SWIFT.
* Coypright (c) 2015 Matthieu Schaller (matthieu.schaller@durham.ac.uk)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
/**
* @brief Computes the hydro time-step of a given particle
*
* @param p Pointer to the particle data
* @param xp Pointer to the extended particle data
*
*/
__attribute__
((
always_inline
))
INLINE
static
float
compute_timestep_hydro
(
struct
part
*
p
,
struct
xpart
*
xp
)
{
/* CFL condition */
float
dt_cfl
=
const_cfl
*
p
->
h
/
p
->
force
.
v_sig
;
/* Limit change in h */
float
dt_h_change
=
(
p
->
force
.
h_dt
!=
0
.
0
f
)
?
fabsf
(
const_ln_max_h_change
*
p
->
h
/
p
->
force
.
h_dt
)
:
FLT_MAX
;
/* Limit change in u */
float
dt_u_change
=
(
p
->
force
.
u_dt
!=
0
.
0
f
)
?
fabsf
(
const_max_u_change
*
p
->
u
/
p
->
force
.
u_dt
)
:
FLT_MAX
;
return
fminf
(
dt_cfl
,
fminf
(
dt_h_change
,
dt_u_change
));
}
/**
* @brief Computes the gravity time-step of a given particle
*
* @param p Pointer to the particle data
* @param xp Pointer to the extended particle data
*
*/
__attribute__
((
always_inline
))
INLINE
static
float
compute_timestep_grav
(
struct
part
*
p
,
struct
xpart
*
xp
)
{
/* Currently no limit is imposed */
return
FLT_MAX
;
}
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