Skip to content

Commit

Permalink
docs: comments and formatting things
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroBarker committed Feb 15, 2024
1 parent 8773149 commit f24f7c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/sedov.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def __init__(self, j, w, E, rho0, p0, gamma, t_end, r_model):
self.Vstar = 2.0 / (self.j * (gamma - 1.0) + 2.0) # Eq 19
self.V0 = 2.0 / (gamma * j2w) # equation (23)

# Following Kamm & Timmes, introduce TOL in logic for determining solution family
# Following Kamm & Timmes, introduce TOL in logic for solution family
# limits exponents later to not blow up
TOL = 1.0e-5
self.family = Family.standard
Expand All @@ -124,7 +124,7 @@ def __init__(self, j, w, E, rho0, p0, gamma, t_end, r_model):
self.family = Family.singular
else:
raise ValueError(
"Something weird has happened: initial condition does not correspond to any solution family"
"Weird: initial condition does not correspond to any solution family"
)

# Check for removable singularities
Expand All @@ -150,8 +150,8 @@ def __init__(self, j, w, E, rho0, p0, gamma, t_end, r_model):
self.e = (2.0 + j * (gamma - 1.0)) / 2.0

# Equations (42)-(47)
# The if logic below avoids divide by zero in the omega2, omega3 singularity cases.
# We avoid these singularities so no harm is done by modifying alpha2, alpha4, alpha5
# Logic below avoids divide by zero in omega2, omega3 singularity cases.
# We avoid these singularities so no harm is done by modifying exponents
denom2 = (
gamma * (self.w2 - w) if self.singularity != Singularity.omega2 else TOL
)
Expand Down Expand Up @@ -244,14 +244,15 @@ def energy_integral_(self):
return J1 and J2 energy integrals
# the ennergy integrals can contain singularities at the lower bound.
# for now, offset by machine epsilon to avoid.
# TODO: Implement singularity removal ala https://cococubed.com/papers/la-ur-07-2849.pdf
# TODO: Implement singularity removal ala
https://cococubed.com/papers/la-ur-07-2849.pdf
# TODO: set Vmin appropriately
"""
self.J1 = 0.0
self.J2 = 0.0
self.alpha = 1.0

if self.family == Family.singular: # singular case, integration is analytic
if self.family == Family.singular: # singular case
self.J1 = (self.gamma + 1.0) / (
self.j * ((self.gamma - 1.0) * self.j + 2.0) ** 2.0
)
Expand Down Expand Up @@ -314,8 +315,9 @@ def lambda_(self, V):
self similar function lambda
depends on solution family
See Kamm & Timmes section 2
NOTE: The singular case is missing a factor of radius, because it's a pain to
pull through all of these functions. It's accounted for in other odd places.
NOTE: The singular case is missing a factor of radius. It's a pain to
pull through all of these functions.
It's accounted for in other odd places.
"""
eps = 1.0e-60
x1 = self.a * V
Expand Down
4 changes: 4 additions & 0 deletions src/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from sedov import Sedov

# === Helper functions for tests ===

def prepare_sedov_test(TMPDIR):
"""
Expand Down Expand Up @@ -117,6 +118,9 @@ def compare_sedov(x, rho, p, x_sol, rho_sol, p_sol):
# End compare_sedov


# =================================


def test_sedov():
"""
Test Sedov-Taylor against battle testing sedov3
Expand Down

0 comments on commit f24f7c9

Please sign in to comment.