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
a9b4fb91
Commit
a9b4fb91
authored
7 years ago
by
lhausamm
Browse files
Options
Downloads
Patches
Plain Diff
cooling_rate was not returning du_dt, but u
parent
af92d4c3
No related branches found
No related tags found
1 merge request
!469
Update cooling grackle
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cooling/grackle/cooling.h
+9
-8
9 additions, 8 deletions
src/cooling/grackle/cooling.h
src/cooling/grackle/grackle_wrapper.c
+0
-1
0 additions, 1 deletion
src/cooling/grackle/grackle_wrapper.c
with
9 additions
and
9 deletions
src/cooling/grackle/cooling.h
+
9
−
8
View file @
a9b4fb91
...
...
@@ -50,6 +50,8 @@
* @param cooling The #cooling_function_data used in the run.
* @param p Pointer to the particle data.
* @param dt The time-step of this particle.
*
* @return du / dt
*/
__attribute__
((
always_inline
))
INLINE
static
double
cooling_rate
(
const
struct
phys_const
*
restrict
phys_const
,
...
...
@@ -61,6 +63,7 @@ __attribute__((always_inline)) INLINE static double cooling_rate(
/* Get current internal energy (dt=0) */
double
u_old
=
hydro_get_internal_energy
(
p
);
double
u_new
=
u_old
;
/* Get current density */
const
float
rho
=
hydro_get_density
(
p
);
/* Actual scaling fractor */
...
...
@@ -71,12 +74,12 @@ __attribute__((always_inline)) INLINE static double cooling_rate(
double
Z
=
0
.
02041
;
if
(
wrap_do_cooling
(
rho
,
&
u_
old
,
dt
,
Z
,
a_now
)
==
0
)
{
if
(
wrap_do_cooling
(
rho
,
&
u_
new
,
dt
,
Z
,
a_now
)
==
0
)
{
error
(
"Error in do_cooling.
\n
"
);
return
0
;
}
return
u_old
;
return
(
u_new
-
u_old
)
/
dt
;
}
/**
...
...
@@ -99,23 +102,21 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
if
(
dt
==
0
.)
return
;
/* Get current internal energy (dt=0) */
const
float
u_old
=
hydro_get_internal_energy
(
p
);
/* Current du_dt */
const
float
hydro_du_dt
=
hydro_get_internal_energy_dt
(
p
);
float
u_
new
;
float
d
u_
dt
;
float
delta_u
;
u_
new
=
cooling_rate
(
phys_const
,
us
,
cooling
,
p
,
dt
);
d
u_
dt
=
cooling_rate
(
phys_const
,
us
,
cooling
,
p
,
dt
);
delta_u
=
u_
new
-
u_old
;
delta_u
=
d
u_
dt
*
dt
;
/* record energy lost */
xp
->
cooling_data
.
radiated_energy
+=
-
delta_u
*
hydro_get_mass
(
p
);
/* Update the internal energy */
hydro_set_internal_energy_dt
(
p
,
hydro_du_dt
+
d
elta_u
/
dt
);
hydro_set_internal_energy_dt
(
p
,
hydro_du_dt
+
d
u_
dt
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/cooling/grackle/grackle_wrapper.c
+
0
−
1
View file @
a9b4fb91
...
...
@@ -157,7 +157,6 @@ int wrap_do_cooling(double rho, double *u, double dt, double Z, double a_now) {
error
(
"Error in solve_chemistry."
);
return
0
;
}
// return updated chemistry and energy
for
(
int
i
=
0
;
i
<
FIELD_SIZE
;
i
++
)
{
u
[
i
]
=
energy
[
i
]
/
u_factor
;
...
...
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