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
aa103b56
Commit
aa103b56
authored
7 years ago
by
Josh Borrow
Browse files
Options
Downloads
Patches
Plain Diff
Minor refactoring changes to GIZMO-MFM to allow use with the new hydro function configuration.
parent
99efec73
No related branches found
No related tags found
1 merge request
!561
Change gradient loops
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/hydro/GizmoMFM/hydro.h
+36
-8
36 additions, 8 deletions
src/hydro/GizmoMFM/hydro.h
with
36 additions
and
8 deletions
src/hydro/GizmoMFM/hydro.h
+
36
−
8
View file @
aa103b56
...
...
@@ -421,8 +421,7 @@ __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
/**
* @brief Prepare a particle for the gradient calculation.
*
* The name of this method is confusing, as this method is really called after
* the density loop and before the gradient loop.
* This function is called after the density loop and before the gradient loop.
*
* We use it to set the physical timestep for the particle and to copy the
* actual velocities, which we need to boost our interfaces during the flux
...
...
@@ -433,7 +432,7 @@ __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
* @param xp The extended particle data to act upon.
* @param cosmo The cosmological model.
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_prepare_
force
(
__attribute__
((
always_inline
))
INLINE
static
void
hydro_prepare_
gradient
(
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
const
struct
cosmology
*
cosmo
)
{
...
...
@@ -446,6 +445,18 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
hydro_velocities_prepare_force
(
p
,
xp
);
}
/**
* @brief Resets the variables that are required for a gradient calculation.
*
* This function is called after hydro_prepare_gradient.
*
* @param p The particle to act upon.
* @param xp The extended particle data to act upon.
* @param cosmo The cosmological model.
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_reset_gradient
(
struct
part
*
restrict
p
)
{}
/**
* @brief Finishes the gradient calculation.
*
...
...
@@ -461,6 +472,28 @@ __attribute__((always_inline)) INLINE static void hydro_end_gradient(
hydro_gradients_finalize
(
p
);
#ifdef GIZMO_LLOYD_ITERATION
/* reset the gradients to zero, as we don't want them */
hydro_gradients_init
(
p
);
#endif
}
/**
* @brief Prepare a particle for the force calculation.
*
* This function is called in the extra_ghost task to convert some quantities coming
* from the gradient loop over neighbours into quantities ready to be used in the
* force loop over neighbours.
*
* @param p The particle to act upon
* @param xp The extended particle data to act upon
* @param cosmo The current cosmological model.
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_prepare_force
(
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
const
struct
cosmology
*
cosmo
)
{
/* Initialise values that are used in the force loop */
p
->
gravity
.
mflux
[
0
]
=
0
.
0
f
;
p
->
gravity
.
mflux
[
1
]
=
0
.
0
f
;
p
->
gravity
.
mflux
[
2
]
=
0
.
0
f
;
...
...
@@ -470,11 +503,6 @@ __attribute__((always_inline)) INLINE static void hydro_end_gradient(
p
->
conserved
.
flux
.
momentum
[
1
]
=
0
.
0
f
;
p
->
conserved
.
flux
.
momentum
[
2
]
=
0
.
0
f
;
p
->
conserved
.
flux
.
energy
=
0
.
0
f
;
#ifdef GIZMO_LLOYD_ITERATION
/* reset the gradients to zero, as we don't want them */
hydro_gradients_init
(
p
);
#endif
}
/**
...
...
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