Skip to content

Matlab papercuts#2031

Merged
ischoegl merged 21 commits intoCantera:mainfrom
ischoegl:matlab-papercuts
Nov 6, 2025
Merged

Matlab papercuts#2031
ischoegl merged 21 commits intoCantera:mainfrom
ischoegl:matlab-papercuts

Conversation

@ischoegl
Copy link
Copy Markdown
Member

@ischoegl ischoegl commented Nov 2, 2025

Changes proposed in this pull request

  • Add prefix m to functions wrapped by MATLAB to disambiguate from CLib (most of the churn) .. see MATLAB toolbox changes CLib signatures #2006
  • Improve formatting of MATLAB samples ... MATLAB block %% creates h1 level header in sphinx-gallery (also a lot of churn)
  • Fix flame1.m, which erroneously used a strained flow domain (!)
  • Remove redundant 1D samples and make names consistent with Python
  • Improve handling of MATLAB execution mode (inprocess vs outofprocess)
  • Consolidate ctBuildInterface into a single file
  • Implement Inlet1D::updateState to ensure an inlet can be fully set up prior to Sim1D assembly

If applicable, fill in the issue number this pull request is fixing

Closes #2006, partially addresses #2030

If applicable, provide an example illustrating new features this pull request is introducing

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

@ischoegl ischoegl added the Matlab label Nov 2, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 2, 2025

Codecov Report

❌ Patch coverage is 45.50669% with 285 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.41%. Comparing base (aaf11b4) to head (fae1039).
⚠️ Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
...ces/matlab_experimental/cantera/ctBuildInterface.m 0.00% 56 Missing ⚠️
interfaces/matlab_experimental/OneDim/Domain1D.m 0.00% 34 Missing ⚠️
interfaces/matlab_experimental/OneDim/Flow1D.m 0.00% 21 Missing ⚠️
interfaces/matlab_experimental/OneDim/Sim1D.m 0.00% 18 Missing ⚠️
...ab_experimental/OneDim/CounterFlowDiffusionFlame.m 0.00% 16 Missing ⚠️
interfaces/matlab_experimental/Base/Mixture.m 44.44% 15 Missing ⚠️
interfaces/matlab_experimental/Base/ThermoPhase.m 82.95% 15 Missing ⚠️
src/oneD/Boundary1D.cpp 55.55% 8 Missing and 4 partials ⚠️
interfaces/matlab_experimental/Utility/ctLoad.m 15.38% 11 Missing ⚠️
interfaces/matlab_experimental/OneDim/Boundary1D.m 0.00% 8 Missing ⚠️
... and 36 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2031      +/-   ##
==========================================
- Coverage   76.45%   76.41%   -0.05%     
==========================================
  Files         464      463       -1     
  Lines       54949    54945       -4     
  Branches     9305     9308       +3     
==========================================
- Hits        42013    41985      -28     
- Misses       9810     9829      +19     
- Partials     3126     3131       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ischoegl ischoegl force-pushed the matlab-papercuts branch 3 times, most recently from 21951d3 to 397048e Compare November 2, 2025 14:58
@ischoegl ischoegl marked this pull request as ready for review November 2, 2025 16:12
@ischoegl ischoegl requested a review from a team November 2, 2025 16:12
@ischoegl
Copy link
Copy Markdown
Member Author

ischoegl commented Nov 4, 2025

While this is ready, it should probably be merged/rebased after adoption of #1974.

Copy link
Copy Markdown
Member

@speth speth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @ischoegl. No significant comments here, just one question on the Boundary1D changes.

Comment on lines +135 to 142
if (m_solution) {
auto thermo = m_solution->thermo();
thermo->setMoleFractionsByName(xin);
thermo->getMassFractions(m_yin.data());
needJacUpdate();
} else {
m_xstr = xin;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I understand the direction this is going -- I imagine by Cantera 3.3 we'll be requiring the Solution object to initialize the Domain1D object, so this will always be available. But I'm a little confused at what in the Matlab interface made this necessary to tackle now and could use a little clarification.

Copy link
Copy Markdown
Member Author

@ischoegl ischoegl Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're correct that in Cantera 3.3, we'll always have the Solution and will have this ability, i.e., the if clause can be removed.

The reason I included it here is that I really disliked the interface for the CounterFlowDiffusionFlame object (the only Python-FlameBase-like composite object that is currently implemented). It required the phases to be passed separately from the boundary objects, and the phases had to be separate copies of the same mechanism to work correctly. There wasn't a clean way to simplify this in MATLAB, so I decided to add this capability in C++. As you see in the flamespeed.cpp sample, this means that you no longer have to reset some of the states before starting to solve.

@ischoegl ischoegl merged commit 0ba504a into Cantera:main Nov 6, 2025
59 of 61 checks passed
@ischoegl ischoegl deleted the matlab-papercuts branch November 6, 2025 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MATLAB toolbox changes CLib signatures

2 participants