Skip to content

Add: solve SHOCK_PRANDTL_MEYER expansion within the ShockSolver class#1082

Merged
AlbertoCuadra merged 3 commits intomasterfrom
develop
Oct 16, 2025
Merged

Add: solve SHOCK_PRANDTL_MEYER expansion within the ShockSolver class#1082
AlbertoCuadra merged 3 commits intomasterfrom
develop

Conversation

@AlbertoCuadra
Copy link
Copy Markdown
Member

@AlbertoCuadra AlbertoCuadra commented Oct 16, 2025

This PR adds a new method to the ShockSolver class that computes isentropic expansion fans using a generalized Prandtl–Meyer formulation consistent with the thermochemical framework of the Combustion Toolbox.

This feature extends the shock module beyond compression waves and introduces a real-gas Prandtl–Meyer expansion solver, compatible with both frozen and equilibrium thermochemical models, with built-in path history for visualization and analysis.

Capabilities

  • Computes downstream state after a flow expansion through a deflection angle θ₂
  • Marches along a constant-entropy and specific-volume (SV) path
  • Uses perfect-gas Prandtl–Meyer theory only for initialization
  • Tracks full expansion path history in mix2.polar (for polar plotting)
  • Enforces stagnation enthalpy conservation during expansion
  • Control number of points through the isentropic expansion path using numPointsPrandtMeyer during ShockSolver definition

Supported caloric models

Numerical Method Summary

  • Initial guess (ρ₂, M₂) generated from classical Prandtl–Meyer relations
  • Expansion path traced using tracePrandtlMeyerExpansion under SV constraints
  • Iterative refinement of downstream density using Newton–Raphson
  • At each iteration:
    • Thermodynamic state enforced via stateSV
    • Velocity and Mach updated from constant stagnation enthalpy
    • Generalized Prandtl–Meyer integrand used instead of γ-based analytical formula

Validation

The implementation was verified against Caltech’s Shock-Detonation Toolbox for both thermally perfect and calorically imperfect (equilibrium) gas models. The figure below shows the equilibrium Prandtl–Meyer expansion for deflection angles $\theta_2 \in [0, 82^\circ]$ in an air mixture (79% $\text{N}_2$ / 21% $\text{O}_2$) at a free-stream Mach number $\mathcal{M}_1 = 1$.

test_validation

Example

% Import packages
import combustiontoolbox.databases.NasaDatabase
import combustiontoolbox.core.*
import combustiontoolbox.shockdetonation.*
import combustiontoolbox.utils.display.*

% Definitions
FLAG_FROZEN = false;

% Get Nasa database
DB = NasaDatabase();

% Define chemical system
system = ChemicalSystem(DB);

% Initialize mixture
mix = Mixture(system);

% Define chemical state
set(mix, {'N2', 'O2'}, [79, 21]/21);

% Define properties
mixArray1 = setProperties(mix, 'temperature', 3000, 'pressure', 1, 'M1', 1, 'theta', 82);

% Initialize solver
solver = ShockSolver('problemType', 'SHOCK_PRANDTL_MEYER');

% Solve problem
[mixArray1, mixArray2] = solver.solveArray(mixArray1);

% Generate report from mixArray
report(solver, mixArray1, mixArray2)

% Generate report from polar of last mixArray2
mixArray2(end).polar(1).rangeName = 'theta';
report(solver, mixArray2(end).polar, mixArray2(end).polar)

Benchmark

𝗦𝘆𝘀𝘁𝗲𝗺 𝗜𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻

CT version    MATLAB version    OS version      CPU name      Clock speed    Cache L2    Cores
__________    ______________    __________    ____________    ___________    ________    _____

  1.2.8           R2025b          15.6.1      Apple M2 Pro        N/A         65536       10  

𝗕𝗲𝗻𝗰𝗵𝗺𝗮𝗿𝗸𝗶𝗻𝗴

Module      Solver             Problem                             Filename                       Cases    Species    Tolerance    AvgTime
______    ___________    ___________________    ______________________________________________    _____    _______    _________    _______

CT-SD     ShockSolver    SHOCK_PRANDTL_MEYER    run_validation_SHOCK_PRANDTL_MEYER_SDToolbox_1      1        11       1.00e-05      1.2191
CT-SD     ShockSolver    SHOCK_PRANDTL_MEYER    run_validation_SHOCK_PRANDTL_MEYER_SDToolbox_2     81        11       1.00e-05     0.94038

𝗦𝘂𝗺𝗺𝗮𝗿𝘆 𝗕𝗲𝗻𝗰𝗵𝗺𝗮𝗿𝗸𝗶𝗻𝗴

Module          Problem          GroupCount    sum_Cases    mean_Cases    sum_Species    mean_Species    sum_AvgTime    mean_AvgTime
______    ___________________    __________    _________    __________    ___________    ____________    ___________    ____________

CT-SD     SHOCK_PRANDTL_MEYER        2            82            41            22              11           2.1594          1.0797   

@AlbertoCuadra AlbertoCuadra added the enhancement New feature or request label Oct 16, 2025
@github-project-automation github-project-automation Bot moved this to In progress in v2.0.0 Oct 16, 2025
@AlbertoCuadra AlbertoCuadra moved this to 2025 Q4 – Oct-Dec in Roadmap Oct 16, 2025
@AlbertoCuadra AlbertoCuadra moved this from In progress to Done in v2.0.0 Oct 16, 2025
@AlbertoCuadra AlbertoCuadra merged commit f827113 into master Oct 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: 2025 Q4 – Oct-Dec
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant