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
abdb51c9
Commit
abdb51c9
authored
8 years ago
by
Bert Vandenbroucke
Browse files
Options
Downloads
Patches
Plain Diff
Tried implementing primitive variable drift. Does not work (yet).
parent
91510519
No related branches found
No related tags found
1 merge request
!223
Merge Gizmo-SPH into the master branch
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/engine.c
+1
-1
1 addition, 1 deletion
src/engine.c
src/hydro/Gizmo/hydro.h
+17
-4
17 additions, 4 deletions
src/hydro/Gizmo/hydro.h
src/hydro/Gizmo/hydro_iact.h
+14
-0
14 additions, 0 deletions
src/hydro/Gizmo/hydro_iact.h
src/hydro/Gizmo/hydro_part.h
+1
-1
1 addition, 1 deletion
src/hydro/Gizmo/hydro_part.h
with
33 additions
and
6 deletions
src/engine.c
+
1
−
1
View file @
abdb51c9
...
@@ -2720,7 +2720,7 @@ void engine_step(struct engine *e) {
...
@@ -2720,7 +2720,7 @@ void engine_step(struct engine *e) {
mask
|=
1
<<
task_type_sub_pair
;
mask
|=
1
<<
task_type_sub_pair
;
mask
|=
1
<<
task_type_ghost
;
mask
|=
1
<<
task_type_ghost
;
mask
|=
1
<<
task_type_extra_ghost
;
/* Adding unnecessary things to the mask
mask
|=
1
<<
task_type_extra_ghost
;
/* Adding unnecessary things to the mask
does not harm */
does not harm */
submask
|=
1
<<
task_subtype_density
;
submask
|=
1
<<
task_subtype_density
;
submask
|=
1
<<
task_subtype_gradient
;
submask
|=
1
<<
task_subtype_gradient
;
...
...
This diff is collapsed.
Click to expand it.
src/hydro/Gizmo/hydro.h
+
17
−
4
View file @
abdb51c9
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include
<float.h>
#include
<float.h>
#include
"adiabatic_index.h"
#include
"adiabatic_index.h"
#include
"approx_math.h"
#include
"hydro_gradients.h"
#include
"hydro_gradients.h"
/**
/**
...
@@ -219,6 +220,9 @@ __attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
...
@@ -219,6 +220,9 @@ __attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
p
->
a_hydro
[
0
]
=
0
.
0
f
;
p
->
a_hydro
[
0
]
=
0
.
0
f
;
p
->
a_hydro
[
1
]
=
0
.
0
f
;
p
->
a_hydro
[
1
]
=
0
.
0
f
;
p
->
a_hydro
[
2
]
=
0
.
0
f
;
p
->
a_hydro
[
2
]
=
0
.
0
f
;
/* Reset the time derivatives. */
p
->
force
.
h_dt
=
0
.
0
f
;
}
}
/**
/**
...
@@ -273,10 +277,17 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
...
@@ -273,10 +277,17 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
return
;
return
;
float
dt
=
(
t1
-
t0
)
*
timeBase
;
float
dt
=
(
t1
-
t0
)
*
timeBase
;
float
h_inv
=
1
.
0
f
/
p
->
h
;
p
->
primitives
.
rho
=
float
w
=
-
hydro_dimension
*
p
->
force
.
h_dt
*
h_inv
*
dt
;
(
p
->
conserved
.
mass
+
p
->
conserved
.
flux
.
mass
*
dt
/
p
->
force
.
dt
)
/
p
->
geometry
.
volume
;
// p->primitives.rho =
// (p->conserved.mass + p->conserved.flux.mass * dt / p->force.dt) /
// p->geometry.volume;
if
(
fabsf
(
w
)
<
0
.
2
f
)
{
p
->
primitives
.
rho
*=
approx_expf
(
w
);
}
else
{
p
->
primitives
.
rho
*=
expf
(
w
);
}
p
->
primitives
.
v
[
0
]
+=
p
->
a_hydro
[
0
]
*
dt
;
p
->
primitives
.
v
[
0
]
+=
p
->
a_hydro
[
0
]
*
dt
;
p
->
primitives
.
v
[
1
]
+=
p
->
a_hydro
[
1
]
*
dt
;
p
->
primitives
.
v
[
1
]
+=
p
->
a_hydro
[
1
]
*
dt
;
p
->
primitives
.
v
[
2
]
+=
p
->
a_hydro
[
2
]
*
dt
;
p
->
primitives
.
v
[
2
]
+=
p
->
a_hydro
[
2
]
*
dt
;
...
@@ -299,6 +310,8 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
...
@@ -299,6 +310,8 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
__attribute__
((
always_inline
))
INLINE
static
void
hydro_end_force
(
__attribute__
((
always_inline
))
INLINE
static
void
hydro_end_force
(
struct
part
*
p
)
{
struct
part
*
p
)
{
p
->
force
.
h_dt
*=
p
->
h
*
hydro_dimension_inv
;
/* Set the hydro acceleration, based on the new momentum and mass */
/* Set the hydro acceleration, based on the new momentum and mass */
/* NOTE: the momentum and mass are only correct for active particles, since
/* NOTE: the momentum and mass are only correct for active particles, since
only active particles have received flux contributions from all their
only active particles have received flux contributions from all their
...
...
This diff is collapsed.
Click to expand it.
src/hydro/Gizmo/hydro_iact.h
+
14
−
0
View file @
abdb51c9
...
@@ -265,6 +265,20 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common(
...
@@ -265,6 +265,20 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common(
xj
=
r
*
hj_inv
;
xj
=
r
*
hj_inv
;
kernel_deval
(
xj
,
&
wj
,
&
wj_dx
);
kernel_deval
(
xj
,
&
wj
,
&
wj_dx
);
/* Compute h_dt */
// float dvdr = (Wi[1] - Wj[1]) * dx[0] + (Wi[2] - Wj[2]) * dx[1] +
// (Wi[3]-Wj[3])*dx[2];
// float ri = 1.0f/r;
// float hidp1 = pow_dimension_plus_one(hi_inv);
// float hjdp1 = pow_dimension_plus_one(hj_inv);
// float wi_dr = hidp1 * wi_dx;
// float wj_dr = hjdp1 * wj_dx;
// dvdr *= ri;
// pi->force.h_dt -= pj->conserved.mass * dvdr / pj->primitives.rho * wi_dr;
// if(mode == 1){
// pj->force.h_dt -= pi->conserved.mass * dvdr / pi->primitives.rho * wj_dr;
//}
/* Compute area */
/* Compute area */
/* eqn. (7) */
/* eqn. (7) */
Anorm
=
0
.
0
f
;
Anorm
=
0
.
0
f
;
...
...
This diff is collapsed.
Click to expand it.
src/hydro/Gizmo/hydro_part.h
+
1
−
1
View file @
abdb51c9
...
@@ -167,7 +167,7 @@ struct part {
...
@@ -167,7 +167,7 @@ struct part {
/* Quantities used during the force loop. */
/* Quantities used during the force loop. */
struct
{
struct
{
/* Needed to
compile the code
. */
/* Needed to
drift the primitive variables
. */
float
h_dt
;
float
h_dt
;
/* Physical time step of the particle. */
/* Physical time step of the particle. */
...
...
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