# BSSN  Z4c  Implementation Pathway

**Status (2026-05-15):** First cut implemented and validated. Z4c is wired
into the CPU solver (Theta field in `state.rs`, d_t Theta plus the two
coupling terms in `rhs.rs`, kappa_1/kappa_2 in `params.rs`) and the GPU
path. Validated bounded to 7 light crossings of the gauge wave; see
[bssn_validation_results.md](bssn_validation_results.md) section 5.
Remaining: complete the Z4c equation set (a few d_t A-tilde and d_t chi
terms are simplified), then the kappa_1/kappa_2 sweep to reach the full
1000-crossing Apples-with-Apples horizon. The plan below is the spec for
that completion work.
**Why:** Vacuum BSSN's bounded-evolution horizon is ~5 light crossings (literature-standard; reproduced and validated by us). Beyond that, the canonical formulation-level constraint-violating eigenmode appears. Z4c is the standard NR-community fix; it converts non-propagating constraint drift into radiative decay by promoting the Hamiltonian and momentum constraints to dynamical fields with their own propagation + damping.

**Reference:** Bernuzzi & Hilditch, *"Constraint violation in free evolution schemes: Comparing BSSNOK with a conformal decomposition of Z4"*, Phys. Rev. D 81, 084003 (2010); Hilditch et al., *"Compact binary evolutions with the Z4c formulation"*, Phys. Rev. D 88, 084057 (2013).

---

## 1. What changes from BSSN to Z4c

Z4c adds **one scalar field** () and **modifies the existing K and \tilde{} evolution equations**. No new spatial dimensions, no new tensors, no new gauge variables.

### New evolution variable
- `theta: Vec<f64>` per grid point (one scalar). Goes into `Fields` next to `chi` and `k_trace`.

### Modified equations (vs current vacuum BSSN)

**_t K:**
```
_t K = _t K|_BSSN  +    (1  ) 
```
The (1) term is the constraint-propagation feedback.   0.020.1,   01.

**_t \tilde{}:**
```
_t \tilde{} = _t \tilde{}|_BSSN    2   \tilde{Z}  +  (advection of \tilde{Z})
```
Where \tilde{Z} is the conformal momentum-constraint auxiliary, often computed as
`\tilde{Z} = (1/2) \tilde{} (\tilde{}_geometric  \tilde{}_evolved)`  a measure of momentum-constraint violation.

**_t  (new equation):**
```
_t  = /2  (R + (2/3)K  _ij ^ij  2 K )      (2 + )   +  ^k _k 
```
The first parenthesized term is exactly the local Hamiltonian constraint H   is forced to track H. The  term damps  (and through , damps H).

**_t :** unchanged (no  coupling)
**_t \tilde{}_ij:** unchanged
**_t _ij:** unchanged
**_t  /  / B:** unchanged (gauge sector untouched)

### Algebraic constraint
- After every RK4 substep, enforce `_clean = ` (no projection needed)  it's a free dynamical scalar.

---

## 2. Implementation plan (~200300 lines of Rust)

### 2.1 `state.rs` (30 lines)
- Add `theta: Vec<f64>` to `Fields`.
- Update `new`, `zeros_like`, `axpby`, `rk_stage`, `rk4_combine` to handle .
- No change to `enforce_algebraic` ( has no projection constraint).

### 2.2 `params.rs` (10 lines)
- Add `kappa_1: f64` (default 0.02; standard NR value 0.020.10).
- Add `kappa_2: f64` (default 0.0; range 02).
- Default `formulation: "bssn"` switches to `"z4c"` to enable.

### 2.3 `initial_data.rs` (10 lines)
- Initialize ` = 0` for all initial-data presets (consistent with H = 0 at t=0 if initial data is constraint-satisfying).

### 2.4 `rhs.rs` (100 lines)
- Compute  contributions to _t K (one term).
- Compute \tilde{Z} at each grid point (uses the geometric-vs-evolved \tilde{} difference)  contributes to _t \tilde{}.
- Add _t  equation as a new RHS block (uses already-computed `r_scalar`, `kt`, `a_sq`, `alpha`, `advect_chi`-style advection).
- The existing `kappa_h` Hamiltonian damping in _t K is **superseded** by Z4c's (1) term  remove or zero it when formulation=="z4c".

### 2.5 `engine.rs` (10 lines)
- Thread ,  through all four RK4 calls.
- Initialize  from initial data.

### 2.6 `compute_constraints` (5 lines)
- Add the \tilde{Z} momentum-constraint diagnostic alongside H.

### 2.7 `compute_ham_field` (no change)
- Still useful as a standalone diagnostic; H = _t  source term, easy to extract.

---

## 3. Validation plan for Z4c (the test that earns "research-grade asymptotic")

Once Z4c is implemented:

1. **Re-run the full validation suite** in `bssn_validation_results.md` with `formulation="z4c"`. The first three gates should still pass at the same numbers (Z4c reduces to BSSN when =0 and =0).

2. **Long-time gauge wave to 1000 light crossings**  the gold-standard Apples-with-Apples test. Bernuzzi-Hilditch 2010 demonstrated Z4c is stable for this. Acceptance: `||H||_L2` bounded over the full run, no slicing collapse, no NaN.

3. **Polarized Gowdy T** (the 5 test deferred from the original plan). Z4c is what makes Gowdy work for collapsing-direction evolutions (the hard part).

4. **Robust stability test** (random small noise on Minkowski)  Z4c should kill the noise within a few crossings; pure BSSN doesn't.

5. **Resolution scaling regression**  should still be O(N) ( is a single scalar; per-step cost increases by maybe 5%).

---

## 4. Effort estimate

- **Implementation:** 12 focused days for a working first cut. Most of the work is careful translation of the equations into the existing `compute_rhs` structure + adding the  field everywhere `chi` is referenced.
- **Tuning + validation:** 1 day to find the ,  sweet spot for the gauge wave + run the full validation suite + write the updated validation document.
- **Total:** 23 days to claim "asymptotic-stability research-grade vacuum BSSN/Z4c on the GMDBS toroid."

---

## 5. What this unblocks

- Long-time vacuum evolutions (gauge wave, Gowdy T, Brill waves) at full literature horizon (~1000 crossings).
- Initial step toward strong-field evolutions: with Z4c stable, the next pieces (puncture initial data, AH finder,  extraction at periodic boundary or matched outer boundary) become plumbing rather than research.
- The Apples-with-Apples full battery becomes attainable as a single cargo-test run.
- Citable claim: "Z4c-grade vacuum NR on a periodic substrate." That's the line that gets reviewers to take the toroidal substrate seriously.

---

## 6. Why we're shipping vacuum BSSN first instead of going straight to Z4c

The current solver passes the convergence + scaling + bounded-stability gates with literature-matching numbers. That's a real, verifiable, citable artifact. Z4c is the obvious next step but it's the kind of work that should land on a fully-validated foundation  not as the first thing built. We did it in the right order: vacuum BSSN validated, gap diagnosed and pinned to the canonical Z4c-motivating mode, Z4c scoped as the next phase.

This document is the bridge between today's `bssn_validation_results.md` and the next phase's expanded validation. When that next phase lands, this doc gets updated to point at the new validation results, and the BSSN map's Phase B' marker advances.
