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
1ff9660d
Commit
1ff9660d
authored
8 years ago
by
Bert Vandenbroucke
Browse files
Options
Downloads
Patches
Plain Diff
Added GIZMO_TOTAL_ENERGY flag that evolves total instead of thermal energy.
parent
c4640e79
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!317
Cleaned up GIZMO code, added SineWavePotential tests.
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/const.h
+1
-0
1 addition, 0 deletions
src/const.h
src/hydro/Gizmo/hydro.h
+27
-1
27 additions, 1 deletion
src/hydro/Gizmo/hydro.h
src/hydro/Gizmo/hydro_iact.h
+4
-0
4 additions, 0 deletions
src/hydro/Gizmo/hydro_iact.h
with
32 additions
and
1 deletion
src/const.h
+
1
−
0
View file @
1ff9660d
...
...
@@ -58,6 +58,7 @@
/* Options to control the movement of particles for GIZMO_SPH. */
/* This option disables particle movement */
//#define GIZMO_FIX_PARTICLES
#define GIZMO_TOTAL_ENERGY
/* Source terms */
#define SOURCETERMS_NONE
...
...
This diff is collapsed.
Click to expand it.
src/hydro/Gizmo/hydro.h
+
27
−
1
View file @
1ff9660d
...
...
@@ -116,6 +116,12 @@ __attribute__((always_inline)) INLINE static void hydro_first_init_part(
p
->
conserved
.
energy
*=
mass
;
#endif
#ifdef GIZMO_TOTAL_ENERGY
p
->
conserved
.
energy
+=
0
.
5
f
*
(
p
->
conserved
.
momentum
[
0
]
*
p
->
primitives
.
v
[
0
]
+
p
->
conserved
.
momentum
[
1
]
*
p
->
primitives
.
v
[
1
]
+
p
->
conserved
.
momentum
[
2
]
*
p
->
primitives
.
v
[
2
]);
#endif
#if defined(GIZMO_FIX_PARTICLES)
p
->
v
[
0
]
=
0
.;
p
->
v
[
1
]
=
0
.;
...
...
@@ -231,7 +237,15 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
p
->
primitives
.
v
[
0
]
=
momentum
[
0
]
/
m
;
p
->
primitives
.
v
[
1
]
=
momentum
[
1
]
/
m
;
p
->
primitives
.
v
[
2
]
=
momentum
[
2
]
/
m
;
const
float
energy
=
p
->
conserved
.
energy
;
float
energy
=
p
->
conserved
.
energy
;
#ifdef GIZMO_TOTAL_ENERGY
energy
-=
0
.
5
f
*
(
momentum
[
0
]
*
p
->
primitives
.
v
[
0
]
+
momentum
[
1
]
*
p
->
primitives
.
v
[
1
]
+
momentum
[
2
]
*
p
->
primitives
.
v
[
2
]);
#endif
p
->
primitives
.
P
=
hydro_gamma_minus_one
*
energy
/
volume
;
/* sanity checks */
...
...
@@ -594,6 +608,12 @@ __attribute__((always_inline)) INLINE static void hydro_set_internal_energy(
/* conserved.energy is NOT the specific energy (u), but the total thermal
energy (u*m) */
p
->
conserved
.
energy
=
u
*
p
->
conserved
.
mass
;
#ifdef GIZMO_TOTAL_ENERGY
p
->
conserved
.
energy
+=
0
.
5
f
*
p
->
conserved
.
mass
*
(
p
->
conserved
.
momentum
[
0
]
*
p
->
primitives
.
v
[
0
]
+
p
->
conserved
.
momentum
[
1
]
*
p
->
primitives
.
v
[
1
]
+
p
->
conserved
.
momentum
[
2
]
*
p
->
primitives
.
v
[
2
]);
#endif
p
->
primitives
.
P
=
hydro_gamma_minus_one
*
p
->
primitives
.
rho
*
u
;
}
...
...
@@ -611,5 +631,11 @@ __attribute__((always_inline)) INLINE static void hydro_set_entropy(
p
->
conserved
.
energy
=
gas_internal_energy_from_entropy
(
p
->
primitives
.
rho
,
S
)
*
p
->
conserved
.
mass
;
#ifdef GIZMO_TOTAL_ENERGY
p
->
conserved
.
energy
+=
0
.
5
f
*
p
->
conserved
.
mass
*
(
p
->
conserved
.
momentum
[
0
]
*
p
->
primitives
.
v
[
0
]
+
p
->
conserved
.
momentum
[
1
]
*
p
->
primitives
.
v
[
1
]
+
p
->
conserved
.
momentum
[
2
]
*
p
->
primitives
.
v
[
2
]);
#endif
p
->
primitives
.
P
=
gas_pressure_from_entropy
(
p
->
primitives
.
rho
,
S
);
}
This diff is collapsed.
Click to expand it.
src/hydro/Gizmo/hydro_iact.h
+
4
−
0
View file @
1ff9660d
...
...
@@ -393,6 +393,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common(
pi
->
conserved
.
flux
.
momentum
[
2
]
-=
dti
*
Anorm
*
totflux
[
3
];
pi
->
conserved
.
flux
.
energy
-=
dti
*
Anorm
*
totflux
[
4
];
#ifndef GIZMO_TOTAL_ENERGY
float
ekin
=
0
.
5
f
*
(
pi
->
primitives
.
v
[
0
]
*
pi
->
primitives
.
v
[
0
]
+
pi
->
primitives
.
v
[
1
]
*
pi
->
primitives
.
v
[
1
]
+
pi
->
primitives
.
v
[
2
]
*
pi
->
primitives
.
v
[
2
]);
...
...
@@ -400,6 +401,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common(
pi
->
conserved
.
flux
.
energy
+=
dti
*
Anorm
*
totflux
[
2
]
*
pi
->
primitives
.
v
[
1
];
pi
->
conserved
.
flux
.
energy
+=
dti
*
Anorm
*
totflux
[
3
]
*
pi
->
primitives
.
v
[
2
];
pi
->
conserved
.
flux
.
energy
-=
dti
*
Anorm
*
totflux
[
0
]
*
ekin
;
#endif
/* here is how it works:
Mode will only be 1 if both particles are ACTIVE and they are in the same
...
...
@@ -427,6 +429,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common(
pj
->
conserved
.
flux
.
momentum
[
2
]
+=
dtj
*
Anorm
*
totflux
[
3
];
pj
->
conserved
.
flux
.
energy
+=
dtj
*
Anorm
*
totflux
[
4
];
#ifndef GIZMO_TOTAL_ENERGY
ekin
=
0
.
5
f
*
(
pj
->
primitives
.
v
[
0
]
*
pj
->
primitives
.
v
[
0
]
+
pj
->
primitives
.
v
[
1
]
*
pj
->
primitives
.
v
[
1
]
+
pj
->
primitives
.
v
[
2
]
*
pj
->
primitives
.
v
[
2
]);
...
...
@@ -434,6 +437,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common(
pj
->
conserved
.
flux
.
energy
-=
dtj
*
Anorm
*
totflux
[
2
]
*
pj
->
primitives
.
v
[
1
];
pj
->
conserved
.
flux
.
energy
-=
dtj
*
Anorm
*
totflux
[
3
]
*
pj
->
primitives
.
v
[
2
];
pj
->
conserved
.
flux
.
energy
+=
dtj
*
Anorm
*
totflux
[
0
]
*
ekin
;
#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