-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_horndeski_anec_comparison.py
More file actions
238 lines (194 loc) · 7.23 KB
/
run_horndeski_anec_comparison.py
File metadata and controls
238 lines (194 loc) · 7.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
"""
Horndeski vs GR ANEC Comparison
Produces JSON comparing:
- Pure GR ANEC (baseline)
- Horndeski with Vainshtein screening
Tests whether screening suppresses negative energy.
"""
import numpy as np
import json
import sys
import os
from typing import Dict, List, Tuple
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from src.metrics.alcubierre_simple import alcubierre_metric
from src.metrics.natario_simple import natario_metric
from src.scalar_field.horndeski import HorndeskiField, HorndeskiParams
from src.anec.runner import create_test_rays, run_multimetric_anec_sweep
def create_rho_functions(
v_s: float = 0.1,
R: float = 1.0,
sigma: float = 0.5,
screening_enabled: bool = False,
horndeski: HorndeskiField = None
) -> Dict:
"""
Create energy density functions for different scenarios.
Args:
v_s: Warp velocity
R: Bubble radius
sigma: Wall thickness
screening_enabled: Apply Vainshtein screening
horndeski: Horndeski field (for screening calculation)
Returns:
Dict of scenario_name → rho_func
"""
# Estimate warp stress-energy (from Phase A)
rho_warp_base = 1e37 # J/m³ (conservative for v_s ~ 0.1)
def rho_gr(t, x, y, z):
"""Pure GR energy density (constant for now)."""
return np.ones_like(x) * rho_warp_base
def rho_horndeski_screened(t, x, y, z):
"""Horndeski with Vainshtein screening."""
if not screening_enabled or horndeski is None:
return rho_gr(t, x, y, z)
# Distance from bubble center
r = np.sqrt(x**2 + y**2 + z**2)
# Get screening data
screening_data = horndeski.estimate_warp_bubble_screening(
v_s, R, rho_warp_base
)
R_V = screening_data['R_V_m']
# Base energy density
rho_base = rho_gr(t, x, y, z)
# Apply screening suppression to scalar contribution
# Assume T_total = T_GR + T_scalar
# T_scalar gets suppressed by ε²(r)
epsilon = horndeski.screening_suppression(r, R_V)
# For demo: assume 50% scalar contribution
# T_total = 0.5 * T_GR + 0.5 * ε² * T_GR
rho_total = 0.5 * rho_base + 0.5 * epsilon**2 * rho_base
return rho_total
return {
'gr_baseline': rho_gr,
'horndeski_screened': rho_horndeski_screened
}
def run_horndeski_anec_comparison(
output_file: str = 'results/horndeski_anec_sweep.json',
n_rays: int = 9
):
"""
Run Horndeski vs GR ANEC comparison.
Args:
output_file: JSON output path
n_rays: Number of null rays
"""
print("=" * 70)
print("Horndeski vs GR ANEC Comparison")
print("=" * 70)
print()
# Parameters
v_s = 0.1
R = 1.0
sigma = 0.5
print("Configuration:")
print(f" Warp velocity: v_s = {v_s:.2f} c")
print(f" Bubble radius: R = {R:.1f} m")
print(f" Wall thickness: σ = {sigma:.1f} m")
print(f" Number of rays: {n_rays}")
print()
# Create Horndeski field
params = HorndeskiParams(Lambda_3=1e-3)
horndeski = HorndeskiField(params)
# Estimate screening
rho_warp = 1e37
screening_data = horndeski.estimate_warp_bubble_screening(v_s, R, rho_warp)
print("Vainshtein Screening Estimate:")
print(f" R_V = {screening_data['R_V_m']:.2e} m")
print(f" R_V/R = {screening_data['R_V_over_R']:.2e}")
print(f" ε(R) = {screening_data['epsilon_wall']:.4f}")
print(f" ε²(R) = {screening_data['stress_suppression_wall']:.4e}")
print(f" Screening effective: {screening_data['screening_effective']}")
print()
# Create metrics
def alc_metric(x, y, z, t):
return alcubierre_metric(x, y, z, t, v_s=v_s, R=R, sigma=sigma)
def nat_metric(x, y, z, t):
return natario_metric(x, y, z, t, v_s=v_s, R=R, sigma=sigma)
metrics = {
'alcubierre_gr': alc_metric,
'alcubierre_horndeski': alc_metric, # Same metric, different rho
'natario_gr': nat_metric,
'natario_horndeski': nat_metric
}
# Create energy density functions
rho_funcs_gr = create_rho_functions(
v_s, R, sigma, screening_enabled=False, horndeski=None
)
rho_funcs_h = create_rho_functions(
v_s, R, sigma, screening_enabled=True, horndeski=horndeski
)
rho_funcs = {
'alcubierre_gr': rho_funcs_gr['gr_baseline'],
'alcubierre_horndeski': rho_funcs_h['horndeski_screened'],
'natario_gr': rho_funcs_gr['gr_baseline'],
'natario_horndeski': rho_funcs_h['horndeski_screened']
}
# Create rays
rays = create_test_rays(n_rays=n_rays)
# Run ANEC sweep
print(f"Running ANEC sweep ({n_rays} rays × 4 scenarios)...")
print()
results = run_multimetric_anec_sweep(
metrics, rho_funcs, rays,
lambda_max=10.0, n_points=50
)
# Add metadata
results['screening_data'] = {
k: (float(v) if isinstance(v, (np.float64, np.float32)) else v)
for k, v in screening_data.items()
}
results['parameters'] = {
'v_s': v_s,
'R': R,
'sigma': sigma,
'Lambda_3': params.Lambda_3,
'rho_warp_base': rho_warp
}
# Save JSON
os.makedirs(os.path.dirname(output_file), exist_ok=True)
with open(output_file, 'w') as f:
json.dump(results, f, indent=2)
print()
print(f"Results saved to: {output_file}")
print()
# Summary
print("=" * 70)
print("SUMMARY")
print("=" * 70)
for metric_name in ['alcubierre_gr', 'alcubierre_horndeski',
'natario_gr', 'natario_horndeski']:
if metric_name in results['metrics']:
data = results['metrics'][metric_name]
print(f"\n{metric_name}:")
print(f" Negative ANEC: {data['negative_count']}/{n_rays} " +
f"({data['negative_fraction']*100:.1f}%)")
print(f" ANEC median: {data['anec_median']:.2e} J")
# Comparison
if 'alcubierre_gr' in results['metrics'] and 'alcubierre_horndeski' in results['metrics']:
gr_neg = results['metrics']['alcubierre_gr']['negative_fraction']
h_neg = results['metrics']['alcubierre_horndeski']['negative_fraction']
print()
print("Screening Impact (Alcubierre):")
print(f" GR: {gr_neg*100:.1f}% negative")
print(f" Horndeski: {h_neg*100:.1f}% negative")
if h_neg < gr_neg:
reduction = (gr_neg - h_neg) / gr_neg * 100
print(f" → Reduction: {reduction:.1f}%")
print(" ✓ Screening helps (but still violations?)")
elif h_neg == gr_neg:
print(" → No change")
print(" ✗ Screening ineffective")
else:
print(" → Worse!")
print(" ✗ Screening makes it worse (unexpected)")
print()
print("=" * 70)
print("NOTE: This uses simplified ANEC runner (straight-line geodesics)")
print("Actual values are order-of-magnitude estimates only.")
print("=" * 70)
if __name__ == '__main__':
run_horndeski_anec_comparison(
output_file='results/horndeski_anec_sweep.json',
n_rays=9
)