Skip to content

processEigenModesDampedPara

ColtonKawamura edited this page Sep 16, 2026 · 1 revision

processEigenModesDampedPara

Computes damped eigenmodes for every packing .mat file in a directory. For each file and each damping constant it: removes rattlers (cleanRats), builds the system matrices (matSpringDampMass), and solves the quadratic eigenvalue problem with polyeig. Uses a parallel pool, and chooses the parfor loop dimension (files vs. damping values) automatically so more workers stay busy. Input files must contain x, y, Dn, K, Ly, Lx, P, N (old packing format).

Default Syntax

inPath = "path/to/packings/2d/hooke"      % string, directory of packing .mat files
outPath = "path/to/output"                % string, where results are saved
gammas = [0.001 0.01 0.03]                % double vector, damping constants
processEigenModesDampedPara(inPath, outPath, gammas)

Runs the full file x damping sweep in parallel and saves one combined 2D_damped_eigenstuff_N*_*by*_K*_M*.mat file containing outData (cells: eigenVectors, eigenValues, radii, positions; columns: pressure, damping, Lx, Ly, springConstant).

Options

opts.periodic    = true;    % logical, periodic boundary conditions in matSpringDampMass
opts.serial      = false;   % logical, run on the base MATLAB process instead of parpool
opts.singleFiles = false;   % logical, save one .mat per (file, damping) combination
                            %         (2D_eigenData_*by*_P*_damp*_K*_M*.mat) instead of one combined file
processEigenModesDampedPara(inPath, outPath, gammas, opts)

Note: in opts.serial mode only the last (file, damping) combination is kept in the combined output — use opts.singleFiles = true with opts.serial to save every combination individually.

Examples

% Parallel sweep over three dampings for all packings in a directory
processEigenModesDampedPara('data/packings/2d/hooke', 'data/junkyard/', [0.001 0.01 0.03]);

% Periodic boundary conditions
opts.periodic = true;
processEigenModesDampedPara('data/packings/2d/hooke', 'data/junkyard/', [0.01], opts);

% Serial run, saving one file per (packing, damping) pair
opts.serial     = true;
opts.singleFiles = true;
processEigenModesDampedPara('data/packings/2d/hooke', 'data/junkyard/', [0.01], opts);

% Single damping, no parallel overhead (one file x one gamma)
opts.serial = true;
processEigenModesDampedPara('data/packings/2d/hooke', 'data/junkyard/', [0.01], opts);

The combined output is the outData struct consumed by simEigenmode(..., loadPolyData = true) and by eigenWavespeed.

Clone this wiki locally