Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions config.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@
error('Unknown geometry type: %s. Supported types: cylinder, ellipse, rectangle, airfoil, multi', geometry_type);
end

% Time-based simulation control (alternative to num_time_steps)
config.simulation.use_end_time = false; % If true, use end_time instead of num_time_steps
config.simulation.end_time = 20; % Simulation end time (when use_end_time = true)
config.simulation.end_time_ci = 0.2; % Reduced end time for CI/testing

% Adaptive time step control
config.adaptive_dt.enable = false; % Enable adaptive time step reduction
config.adaptive_dt.cfl_threshold = 0.5; % Convective CFL threshold for time step reduction (lowered for stability)
config.adaptive_dt.cfl_viscous_threshold = 0.5; % Viscous CFL threshold (nu*dt/h^2 < threshold)
config.adaptive_dt.reduction_factor = 0.2; % Factor to reduce time step by (dt_new = dt * factor)
config.adaptive_dt.min_factor = 0.001; % Minimum time step as fraction of original (dt_min = dt_0 * min_factor)
config.adaptive_dt.max_reductions = 10; % Maximum number of consecutive reductions allowed
config.adaptive_dt.nan_check_enable = true; % Enable NaN checking after time step reduction (stops simulation if found)

%% RBF-FD Algorithm Parameters
% Main stencil sizes
config.rbf.stencil_size_main = 35;
Expand Down Expand Up @@ -138,11 +152,16 @@

%% Logging and Debug Parameters
% Master debug switch - set to true to enable all debug features
debug_master = false; % Master switch for all debug features
debug_master = false; % Master switch for all debug features

% Local CFL diagnostics
config.logging.cfl_check_frequency = 1; % Run local CFL check every N steps
config.logging.cfl_local_enable = true; % Enable per-node CFL checks
config.logging.cfl_percentiles = [90 99]; % Percentiles to report

% Individual debug settings (controlled by master switch unless overridden)
config.logging.enable = debug_master; % Enable debug logging
config.logging.step_frequency = 3; % Print diagnostics every N steps
config.logging.step_frequency = 1; % Print diagnostics every N steps
config.logging.trace_substeps = debug_master; % Print substep diagnostics inside fractional step
config.logging.snapshot_on_nan = debug_master; % Save snapshot if NaN detected
config.logging.snapshot_dir = 'debug'; % Directory to save debug snapshots
Expand All @@ -164,11 +183,16 @@
% Stability thresholds
config.logging.cfl_warning_threshold = 0.8; % Warn if CFL > this value
config.logging.cfl_critical_threshold = 1.5; % Critical CFL threshold
config.logging.velocity_explosion_threshold = 100; % Velocity magnitude explosion threshold
config.logging.pressure_explosion_threshold = 1000; % Pressure explosion threshold
config.logging.cfl_stop_threshold = 0.9; % Stop simulation if CFL > this value (always active)
config.logging.velocity_explosion_threshold = 100; % Velocity magnitude explosion threshold
config.logging.pressure_explosion_threshold = 1000; % Pressure explosion threshold
config.logging.divergence_warning_threshold = 10; % Mass conservation warning
config.logging.divergence_critical_threshold = 100; % Mass conservation critical
config.logging.condition_number_threshold = 1e12; % Matrix conditioning threshold
config.logging.immediate_nan_check = true; % Check for NaNs immediately after each time step
config.logging.comprehensive_instability_check = true; % Check for all types of instability (not just NaNs)
config.logging.periodic_health_check = false; % Periodic health checks during simulation
config.logging.health_check_frequency = 10; % Health check every N steps

% Environment override for enabling logging
dbg_env = getenv('DEBUG');
Expand Down
Binary file removed debug/snapshot_step_00021.mat
Binary file not shown.
Binary file removed debug/snapshot_step_00026.mat
Binary file not shown.
Loading