RadCluster
Graph-based cluster dynamics for irradiated materials
Loading...
Searching...
No Matches
Functions
rate_kernels.cpp File Reference

Go to the source code of this file.

Functions

static double sz_cbrt (const Parameters &P, int s)
 
static double sz_sqrt (const Parameters &P, int s)
 
static double sz_pow23 (const Parameters &P, int s)
 
static double K_1D_eff (const Parameters &P, int n_idx, int m_idx)
 
static double c_h_qss_case2 (const Parameters &P, const double *c_v, double Q_tot)
 
static double c_h_qss_case1 (const Parameters &P, const double *c_v, const double *Q, int n_Q)
 
static double K_ii_coal (const Parameters &P, int n, int np)
 
static double K_vv_coal (const Parameters &P, int m, int mp)
 
static double K_vi_coal (const Parameters &P, int n, int mp)
 
static double conv_phi_junc (const Parameters &P, int a, int b)
 
static double xi_of (const Parameters &P, int s)
 
static double K_100_absorb (const Parameters &P, int m, int n)
 
void build_kernel_tables (Parameters &P)
 
static int rhs_case2 (sunrealtype, N_Vector yv, N_Vector ydotv, const Parameters &P, int x_hi_i_win, int x_hi_v_win)
 
static int rhs_case1 (sunrealtype, N_Vector yv, N_Vector ydotv, const Parameters &P, int x_hi_i_win, int x_hi_v_win)
 
int rhs_full_CD (sunrealtype t, N_Vector y, N_Vector ydot, void *user_data)
 
int rhs_bin_moment (sunrealtype t, N_Vector yv, N_Vector ydotv, void *user_data)
 

Detailed Description

rate_kernels.cpp — EUROFER97 rate-equation kernels (P1-P8 arithmetic).

This is the MATERIAL-SPECIFIC half of the former rate_equations.cpp. It holds the EUROFER97 / bcc-Fe cluster-dynamics RHS arithmetic — every edge-class term (growth, shrinkage, dissociation, recombination, annihilation, coalescence, source, sink) that builds dc/dt. It is the only part of the C++ solver that encodes EUROFER physics; the host-independent solver driver, CVODE setup, sparse Jacobian, and Woodbury preconditioner live under cpp_utils/core/.

── EDGE-CLASS MAP (see the section banners below) ── SOURCE — cascade production G_n / G_{m,ℓ} / G_He. COALESCENCE — cluster–cluster aggregation K_ii / K_vv / K_vi gain+loss. GROWTH — point-defect / He absorption that enlarges a cluster. SHRINKAGE — SIA-induced cavity shrinkage (I_n + V_{m+n} → V_m). DISSOCIATION — thermal emission ε_i / ε_v / ε_h + radiation re-solution. RECOMBINATION — vacancy–SIA mutual annihilation K_iv. ANNIHILATION — V–I annihilation that consumes both partners. SINK — fixed-sink loss to dislocations / GBs / precipitates.

Implements: rhs_full_CD() — full per-size master equations, Eqs. 152, 155, 157 rhs_bin_moment() — size-bin moment equations, Chapter 9, Eqs. 193-208

NOTE ON THE REORGANIZATION (RadCluster_2_1 core/materials split): This file is the verbatim kernel half of rate_equations.cpp. The GMRES preconditioner (Jacobi + Woodbury) and the prec_setup/prec_solve dispatch wrappers were relocated, unchanged, to core/rhs_dispatch.cpp. No formula in this file was altered — the split is a pure file-level relocation.

He-vacancy reduction (he_mode): he_mode == 0 — Case 2, fission/decoupled (Eq. 175) he_mode == 1 — Case 1, fusion/mean-field (Eq. 174)

Free He treatment (he_kinetics): he_kinetics == 0 — dynamic: c_h integrated as a full ODE (Eq. 157) he_kinetics == 1 — quasi_steady_state: c_h computed algebraically from dc_h/dt = 0 at each RHS call (E_m_h = 0.06 eV → fast)

Concentration floor (C_floor): Enforced post-step in solver.cpp (after each successful CVode() call), NOT inside the RHS. Clamping inside the RHS via max(y, C_floor) creates a Jacobian kink at y = C_floor — tested and confirmed to break CVODE's BDF corrector regardless of IC choice or tolerance. The RHS uses max(y, 0) throughout: the kink is only at zero, where CVodeSetConstraints prevents the solver from probing, keeping the effective Jacobian smooth.

He-balance corrections vs. pre-2026-04 version: • Removed erroneous KHeV term from dcv (He capture does not change the vacancy cluster size class m; marginal Σ_ℓ c_{m,ℓ} is unchanged). • Fixed vacancy and He fixed-sink terms to be size-dependent: only mobile vacancy clusters (m <= m_max_v) diffuse to fixed sinks. Previously k2_disl_v was applied to ALL sizes, unphysically draining He from immobile voids and breaking He conservation (δ_He → 1).

Physics reference: Ghoniem (2026), Rate_Equations.pdf.

Definition in file rate_kernels.cpp.

Function Documentation

◆ build_kernel_tables()

void build_kernel_tables ( Parameters &  P)

Populate the y-independent size lookup tables in P (cbrt/sqrt/pow23/xi, the fused Marian junction yield, and the per-bin Σn / Σn² reconstruction moments). Must be called ONCE after build_parameters() and BEFORE the first RHS evaluation. Idempotent.

Purely a cost optimization: every entry is produced by the same std:: call the kernel made inline before, and the kernel expressions are otherwise unchanged, so the RHS remains bit-identical. If this is never called the kernels fall back to computing the values inline (correct, just slower).

Definition at line 270 of file rate_kernels.cpp.

◆ c_h_qss_case1()

static double c_h_qss_case1 ( const Parameters &  P,
const double *  c_v,
const double *  Q,
int  n_Q 
)
inlinestatic

QSS free He concentration from dc_h/dt = 0 (Case 1): c_h = (G_He + beta_He · Σ Q) / (Σ KHeV[m] · c_v[m] + k2_He)

The sink runs over all V vacancy SIZE classes (KHeV and c_v are per-size). The He emission runs over the Q array, whose length n_Q differs by mode: full-CD Case 1 stores Q per size (n_Q = V), but the bin-moment kernel stores Q per BIN (n_Q = Kv = V_bin << V). Passing n_Q explicitly avoids over-reading the Q block into c_h / the conservation integrals / past the end of the state vector (the prior fixed V-length loop did exactly that in bin-moment mode, corrupting c_h and zeroing the trapped-He inventory).

Definition at line 131 of file rate_kernels.cpp.

◆ c_h_qss_case2()

static double c_h_qss_case2 ( const Parameters &  P,
const double *  c_v,
double  Q_tot 
)
inlinestatic

QSS free He concentration from dc_h/dt = 0 (Case 2): c_h = (G_He + beta_He · Q_tot) / (Σ KHeV[m] · c_v[m] + k2_He)

All c_v values are clamped to 0 before summing to avoid amplifying transiently negative concentrations (CVODE's Newton solver can probe slightly negative intermediate states).

Definition at line 110 of file rate_kernels.cpp.

◆ conv_phi_junc()

static double conv_phi_junc ( const Parameters &  P,
int  a,
int  b 
)
inlinestatic

Definition at line 231 of file rate_kernels.cpp.

◆ K_100_absorb()

static double K_100_absorb ( const Parameters &  P,
int  m,
int  n 
)
inlinestatic

Definition at line 247 of file rate_kernels.cpp.

◆ K_1D_eff()

static double K_1D_eff ( const Parameters &  P,
int  n_idx,
int  m_idx 
)
inlinestatic

Definition at line 89 of file rate_kernels.cpp.

◆ K_ii_coal()

static double K_ii_coal ( const Parameters &  P,
int  n,
int  np 
)
inlinestatic

Definition at line 149 of file rate_kernels.cpp.

◆ K_vi_coal()

static double K_vi_coal ( const Parameters &  P,
int  n,
int  mp 
)
inlinestatic

Definition at line 203 of file rate_kernels.cpp.

◆ K_vv_coal()

static double K_vv_coal ( const Parameters &  P,
int  m,
int  mp 
)
inlinestatic

Definition at line 193 of file rate_kernels.cpp.

◆ rhs_bin_moment()

int rhs_bin_moment ( sunrealtype  t,
N_Vector  y,
N_Vector  ydot,
void *  user_data 
)

Size-bin moment RHS (Chapter 9, Eqs. 193-216). Intra-bin closure dispatched by Parameters.shape_function: 0 = constant (piecewise-constant, 1 moment/bin) 1 = linear (hat-function / dual-basis, 2 moments/bin) 2 = lognormal (log-normal shape, 3 moments/bin)

Definition at line 1514 of file rate_kernels.cpp.

◆ rhs_case1()

static int rhs_case1 ( sunrealtype  ,
N_Vector  yv,
N_Vector  ydotv,
const Parameters &  P,
int  x_hi_i_win,
int  x_hi_v_win 
)
static

Definition at line 994 of file rate_kernels.cpp.

◆ rhs_case2()

static int rhs_case2 ( sunrealtype  ,
N_Vector  yv,
N_Vector  ydotv,
const Parameters &  P,
int  x_hi_i_win,
int  x_hi_v_win 
)
static

Definition at line 345 of file rate_kernels.cpp.

◆ rhs_full_CD()

int rhs_full_CD ( sunrealtype  t,
N_Vector  y,
N_Vector  ydot,
void *  user_data 
)

Full per-size RHS (Eqs. 152, 155, 157).

Dispatches between: he_mode == 0 (Case 2, fission/decoupled, Eq. 175) he_mode == 1 (Case 1, fusion/mean-field, Eq. 174)

Definition at line 1491 of file rate_kernels.cpp.

◆ sz_cbrt()

static double sz_cbrt ( const Parameters &  P,
int  s 
)
inlinestatic

Definition at line 76 of file rate_kernels.cpp.

◆ sz_pow23()

static double sz_pow23 ( const Parameters &  P,
int  s 
)
inlinestatic

Definition at line 84 of file rate_kernels.cpp.

◆ sz_sqrt()

static double sz_sqrt ( const Parameters &  P,
int  s 
)
inlinestatic

Definition at line 80 of file rate_kernels.cpp.

◆ xi_of()

static double xi_of ( const Parameters &  P,
int  s 
)
inlinestatic

Definition at line 240 of file rate_kernels.cpp.