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
01cbbc01
"README.md" did not exist on "d2badde65a5742b69b10b39210968be692a47ca2"
Commit
01cbbc01
authored
2 years ago
by
Mladen Ivkovic
Committed by
Matthieu Schaller
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Rt gear unphysical check fix
parent
92b0023b
No related branches found
No related tags found
2 merge requests
!1730
Master
,
!1724
Rt gear unphysical check fix
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/rt/GEAR/rt_unphysical.h
+32
-26
32 additions, 26 deletions
src/rt/GEAR/rt_unphysical.h
with
32 additions
and
26 deletions
src/rt/GEAR/rt_unphysical.h
+
32
−
26
View file @
01cbbc01
...
@@ -176,7 +176,14 @@ rt_check_unphysical_hyperbolic_flux(float flux[4][3]) {
...
@@ -176,7 +176,14 @@ rt_check_unphysical_hyperbolic_flux(float flux[4][3]) {
__attribute__
((
always_inline
))
INLINE
static
void
__attribute__
((
always_inline
))
INLINE
static
void
rt_check_unphysical_mass_fractions
(
struct
part
*
restrict
p
)
{
rt_check_unphysical_mass_fractions
(
struct
part
*
restrict
p
)
{
if
(
p
->
conserved
.
mass
<=
0
.
f
)
{
/* For now, catch either mass or rho being zero. At the moment, they are not
* necessarily both zero. For example, an unphysical check may zero out both
* mass and density when it becomes negative in a hydro step. Once that
* happens, particles may gain mass through flux exchanges with other active
* particles, while they themselves remain inactive. The density of such
* inactive particles however remains zero until the particle is active
* again. See issue #833. */
if
(
p
->
conserved
.
mass
*
p
->
rho
<=
0
.
f
)
{
/* Deal with unphysical situations and vacuum. */
/* Deal with unphysical situations and vacuum. */
p
->
rt_data
.
tchem
.
mass_fraction_HI
=
0
.
f
;
p
->
rt_data
.
tchem
.
mass_fraction_HI
=
0
.
f
;
p
->
rt_data
.
tchem
.
mass_fraction_HII
=
0
.
f
;
p
->
rt_data
.
tchem
.
mass_fraction_HII
=
0
.
f
;
...
@@ -186,31 +193,30 @@ rt_check_unphysical_mass_fractions(struct part* restrict p) {
...
@@ -186,31 +193,30 @@ rt_check_unphysical_mass_fractions(struct part* restrict p) {
return
;
return
;
}
}
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HI
<=
0
.
f
)
{
#ifdef SWIFT_RT_DEBUG_CHECKS
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HI
<
-
1e4
)
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HI
<
-
1e4
)
message
(
"WARNING: Got negative HI mass fraction?"
);
message
(
"WARNING: Got negative HI mass fraction?"
);
p
->
rt_data
.
tchem
.
mass_fraction_HI
=
RT_GEAR_TINY_MASS_FRACTION
;
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HII
<
-
1e4
)
}
message
(
"WARNING: Got negative HII mass fraction?"
);
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HII
<=
0
.
f
)
{
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HeI
<
-
1e4
)
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HII
<
-
1e4
)
message
(
"WARNING: Got negative HeI mass fraction?"
);
message
(
"WARNING: Got negative HII mass fraction?"
);
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HeII
<
-
1e4
)
p
->
rt_data
.
tchem
.
mass_fraction_HII
=
RT_GEAR_TINY_MASS_FRACTION
;
message
(
"WARNING: Got negative HeII mass fraction?"
);
}
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HeIII
<
-
1e4
)
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HeI
<=
0
.
f
)
{
message
(
"WARNING: Got negative HeIII mass fraction?"
);
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HeI
<
-
1e4
)
#endif
message
(
"WARNING: Got negative HeI mass fraction?"
);
p
->
rt_data
.
tchem
.
mass_fraction_HeI
=
RT_GEAR_TINY_MASS_FRACTION
;
/* TODO: this should be a for loop with mass fractions being enums. */
}
p
->
rt_data
.
tchem
.
mass_fraction_HI
=
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HeII
<=
0
.
f
)
{
max
(
p
->
rt_data
.
tchem
.
mass_fraction_HI
,
RT_GEAR_TINY_MASS_FRACTION
);
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HeII
<
-
1e4
)
p
->
rt_data
.
tchem
.
mass_fraction_HII
=
message
(
"WARNING: Got negative HeII mass fraction?"
);
max
(
p
->
rt_data
.
tchem
.
mass_fraction_HII
,
RT_GEAR_TINY_MASS_FRACTION
);
p
->
rt_data
.
tchem
.
mass_fraction_HeII
=
RT_GEAR_TINY_MASS_FRACTION
;
p
->
rt_data
.
tchem
.
mass_fraction_HeI
=
}
max
(
p
->
rt_data
.
tchem
.
mass_fraction_HeI
,
RT_GEAR_TINY_MASS_FRACTION
);
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HeIII
<=
0
.
f
)
{
p
->
rt_data
.
tchem
.
mass_fraction_HeII
=
if
(
p
->
rt_data
.
tchem
.
mass_fraction_HeIII
<
-
1e4
)
max
(
p
->
rt_data
.
tchem
.
mass_fraction_HeII
,
RT_GEAR_TINY_MASS_FRACTION
);
message
(
"WARNING: Got negative HeIII mass fraction?"
);
p
->
rt_data
.
tchem
.
mass_fraction_HeIII
=
p
->
rt_data
.
tchem
.
mass_fraction_HeIII
=
RT_GEAR_TINY_MASS_FRACTION
;
max
(
p
->
rt_data
.
tchem
.
mass_fraction_HeIII
,
RT_GEAR_TINY_MASS_FRACTION
);
}
const
float
XHI
=
p
->
rt_data
.
tchem
.
mass_fraction_HI
;
const
float
XHI
=
p
->
rt_data
.
tchem
.
mass_fraction_HI
;
const
float
XHII
=
p
->
rt_data
.
tchem
.
mass_fraction_HII
;
const
float
XHII
=
p
->
rt_data
.
tchem
.
mass_fraction_HII
;
...
...
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