Skip to content

Commit

Permalink
Fix kappa definition for Giese figure
Browse files Browse the repository at this point in the history
  • Loading branch information
AgenttiX committed Mar 22, 2024
1 parent 0743e11 commit 87149dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/giese_lisa_fig2.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_kappa(bubble: Bubble) -> float:
return np.nan
if bubble.numerical_error:
return np.nan
return bubble.kappa
return bubble.kappa_giese


get_kappa.return_type = float
Expand Down
11 changes: 10 additions & 1 deletion pttools/bubble/bubble.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def __init__(

# Output values
self.alpha_plus: tp.Optional[float] = None
self.alpha_theta_bar_plus: tp.Optional[float] = None
self.elapsed: tp.Optional[float] = None
self.sp: tp.Optional[float] = None
self.sm: tp.Optional[float] = None
Expand Down Expand Up @@ -275,11 +276,13 @@ def solve(
self.solved = True
self.phase = props.find_phase(self.xi, self.v_wall)

# Validity checking for the solution
self.alpha_plus = self.model.alpha_plus(
self.wp, self.wm, vp_tilde=self.vp_tilde, sol_type=self.sol_type,
error_on_invalid=False, nan_on_invalid=True, log_invalid=True
)
self.alpha_theta_bar_plus = self.model.alpha_theta_bar_plus(self.wp)

# Validity checking for the solution
if np.isnan(self.alpha_plus):
self.alpha_plus = self.model.alpha_plus(
self.wp, self.wm, vp_tilde=self.vp_tilde, sol_type=self.sol_type,
Expand Down Expand Up @@ -475,6 +478,12 @@ def kappa(self) -> float:
raise NotYetSolvedError
return thermo.kappa(self.model, self.v, self.w, self.xi, self.v_wall, delta_e_theta=self.va_trace_anomaly_diff)

@functools.cached_property
def kappa_giese(self) -> float:
if not self.solved:
raise NotYetSolvedError
return 4 * self.kinetic_energy_density / (3 * self.alpha_theta_bar_plus * self.wp)

@functools.cached_property
def mean_adiabatic_index(self) -> float:
if not self.solved:
Expand Down

0 comments on commit 87149dd

Please sign in to comment.