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

Go to the source code of this file.

Functions

int build_sparsity_pattern_full_CD (Parameters &P)
 
void color_columns_greedy (Parameters &P)
 
void build_color_groups (Parameters &P)
 
int sparse_fd_jac (sunrealtype, N_Vector y, N_Vector fy, SUNMatrix Jac, void *user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3)
 

Detailed Description

sparse_jacobian.cpp — Colored finite-difference sparse Jacobian for KLU.

See sparse_jacobian.h for interface notes.

Definition in file sparse_jacobian.cpp.

Function Documentation

◆ build_color_groups()

void build_color_groups ( Parameters &  P)

Group columns by color into P.jac_color_groups (flattened, indexed by P.jac_color_offsets). Used by the colored FD evaluator.

Definition at line 257 of file sparse_jacobian.cpp.

◆ build_sparsity_pattern_full_CD()

int build_sparsity_pattern_full_CD ( Parameters &  P)

Build the CSC sparsity pattern for full_CD modes (physics_option 0 or 1).

Fills P.jac_col_ptr (size N_eq+1) and P.jac_row_idx (size nnz) with the structural-nonzero indices. Pattern is conservative: it includes every entry that may become nonzero across the whole integration. Returns nnz.

Returns -1 for unsupported physics options.

Definition at line 39 of file sparse_jacobian.cpp.

◆ color_columns_greedy()

void color_columns_greedy ( Parameters &  P)

Greedy column coloring (CPR). Two columns share a color iff they have no common nonzero row. Fills P.jac_colors (size N_eq) and P.jac_n_colors.

Definition at line 199 of file sparse_jacobian.cpp.

◆ sparse_fd_jac()

int sparse_fd_jac ( sunrealtype  t,
N_Vector  y,
N_Vector  fy,
SUNMatrix  Jac,
void *  user_data,
N_Vector  tmp1,
N_Vector  tmp2,
N_Vector  tmp3 
)

Sparse Jacobian function for CVODE (CVLsJacFn signature).

Computes J = ∂f/∂y by evaluating the RHS once per color group with all columns in that group perturbed simultaneously. Total RHS evaluations = P.jac_n_colors + 1 (one base + one per color group).

Definition at line 283 of file sparse_jacobian.cpp.