Skip to content

Chemical Synthetic Turbulence#77

Open
cxflyer wants to merge 174 commits into
exapde:masterfrom
MIT-PSAAP-IV:Kitesurf-Coupling
Open

Chemical Synthetic Turbulence#77
cxflyer wants to merge 174 commits into
exapde:masterfrom
MIT-PSAAP-IV:Kitesurf-Coupling

Conversation

@cxflyer

@cxflyer cxflyer commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Need copilot to review

exapde and others added 30 commits November 26, 2025 12:00
Merge from exapde/Exasim
Merge Teo's model template into master and update exasim APIs
… with the Poisson operator. The mapping as a first step is analytical but in the future it should come from the mesh deformation solver. Implementation follows Persson, Bonet and Peraire, 2009 and should be easily extensible to other flux terms.
… and Peraire, 2009. excellent agreement with exact solution. next step is to get the mapping, its deformation gradient and velocity from the mesh motion solver. this will enable solution of coupled problems where the fluid-solid interface is moving (due to deformation or ablation).
wraith1995 and others added 30 commits June 10, 2026 09:50
Per user request, the generated model is now a SHARED provider library
(libfrontend_model.{so,dylib}) instead of a static archive:

- exasim_add_external_builtin_model() gains a SHARED flag: the provider
  takes Kokkos as compile flags/includes only and resolves Kokkos symbols
  from the host executable at load time (-undefined dynamic_lookup on
  macOS; host sets ENABLE_EXPORTS) — exactly one Kokkos runtime, avoiding
  the duplicate-global-state double-free the static design guarded against
  (see backend/Model/BuiltIn/CMakeLists.txt). The builtin fallthrough
  archive (already PIC) is embedded in the provider.
- frontend-app template uses SHARED + ENABLE_EXPORTS +
  CMAKE_LINK_DEPENDS_NO_SHARED, so a model change recompiles one TU and
  relinks only the small provider library; exasimapp is never rebuilt.
- cmakecompile (all three languages) computes a SHA-256 over the kernel
  set and rendered app sources and skips the build system entirely when it
  matches the last successful build (.exasim_model_hash stamp): an
  unchanged app goes straight to the solver run (~0.5s overhead).
  Python: hashlib; Julia: SHA stdlib (added to Project.toml); MATLAB:
  java.security.MessageDigest.

Validated: unchanged rerun = 0 TUs/0 links, cmake skipped; physics change =
1 TU + provider relink only (exasimapp mtime unchanged), wrong physics
correctly fails the QoI gate; frontend_{python,julia,matlab} all pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…gs and testing

- EXASIM_PIP_INSTALL=ON: cmake --install runs pip install on
  frontends/Python with the configured interpreter and bakes the install
  prefix into the package (_installed_prefix.py, read by config.py), so
  'import exasim' needs no PYTHONPATH or EXASIM_PREFIX afterwards.
- EXASIM_JULIA_DEVELOP=ON: cmake --install runs Pkg.develop on the
  installed Exasim.jl, so 'using Exasim' needs no LOAD_PATH setup.
  Both OFF by default (they mutate user environments); forwarded through
  the superbuild along with EXASIM_FRONTENDS.
- README: full feature-flag table with defaults, an everything-on configure
  line, and a 'Testing the install' section (run-tests.sh, per-test ctest
  invocations, running frontend tests by hand against any prefix, skip
  conditions, QoI gate).

Validated: with both hooks ON, 'import exasim' resolves the baked prefix
with no environment setup and 'using Exasim' loads via the developed
package.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Upstream d440207 moved the legacy frontend flow to examples/build with a
shared exasimfe executable and untracked the FrontendGenerated placeholder
kernels. This branch's installed-package + external-model flow supersedes
the frontend helper changes, so for the frontend flow files (cmakecompile/
runcode/exasim/preprocessing/initializepde across all three languages) the
package versions are kept; upstream's multi-model compilecode->cmakecompile
fix had already been applied / merges cleanly into the moved files.

Taken from upstream: examples/CMakeLists.txt + exasimfeapp.cpp (legacy-flow
consumer app, kept as-is), exasimapptest.m, the apps/builtinlibrary
find_package modernization, the exasim_set_default_kokkos_dir() discovery
helper, the FrontendGenerated kernel untracking + .gitignore additions, and
the metis.h tweak. install/cmakecompile.{jl,m} and the pre-move frontend
helper paths stay deleted.

Full suite green after merge (consumers + all three frontends).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The repo is never written to by a build or install:
- the superbuild rejects any binary dir inside the source tree (fatal, with
  the sibling-dir suggestion); the old lenient warning is gone
- EXASIM_LIB_DIR moves from <repo>/lib to <binary-dir>/lib (Exasim/lib is
  deleted); the built-in model archives follow; exported link directories
  are wrapped in BUILD_INTERFACE/INSTALL_INTERFACE genexes so install(EXPORT)
  accepts the build-dir path
- text2code lands in <superbuild-bin>/bin/text2code (EXASIM_T2C_OUTPUT_DIR);
  its location is forwarded to the inner build as EXASIM_TEXT2CODE for the
  builtin-model codegen and the bin/ install rule (no more <repo>/build)
- tests default to the sibling build dir <repo>-build (run-tests.sh,
  run-consumer-tests.sh, frontend test wrapper, which now also honors
  EXASIM_PREFIX); the frontend prefix resolvers learn the sibling-build
  fallback (legacy <repo>/build/install kept as a last resort)
- .gitignore: per-app .exasim/ dirs from pdeapps run inside the repo

Validated: full cold build in ../Exasim-build, suite 5/5, repo clean,
hygiene green; Exasim/lib and Exasim/build removed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
-std=c++17 -> -std=c++20 on all solver targets, cxx_std_20 on the exported
Exasim::headers interface (consumers now compile as C++20), and
CMAKE_CXX_STANDARD 20 in the frontend-app template, the consumer tests,
examples/, apps/builtinlibrary, and text2code. Vendored dependency builds
(Kokkos, SymEngine, METIS) are unchanged. No removed-in-C++20 constructs in
the tree; full suite green at C++20.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CI (smoke-cpu): explicit Configure+Build, Test, and Test-summary steps —
failures are attributable to a stage at a glance, and every run's summary
page shows a per-test pass/fail/skip table (ctest --output-junit rendered
into GITHUB_STEP_SUMMARY). Builds out of tree into ../Exasim-build; dep
caches follow (new -oot cache keys).

README: feature-flag table gains a consequences column (esp. what each
option means for using the frontends); a test-inventory table marks exactly
what runs on CI vs locally; 'The install prefix, in one place' documents the
single prefix notion, who writes/reads it, and the EXASIM_PREFIX override;
all build commands shown out-of-tree (cmake -S Exasim -B Exasim-build).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pip/setuptools drops build/ and exasim.egg-info/ next to the package source
when installing from a directory; remove them in the install step and
gitignore them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
cache-warm.yml restores the vendored Kokkos (serial) and SymEngine caches
twice a week (rebuilding only on a key miss), refreshing GitHub's 7-day
eviction clock so smoke-cpu never pays the ~15-20 min cold dependency
build. Scheduled workflows run from the default branch only and only
default-branch caches are repo-global, so the schedule takes effect once
this reaches master; until then it is manually dispatchable. Keys are
shared with smoke-cpu.yml (cross-referenced in both files).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…utes

The out-of-tree move silently broke dep caching: actions/cache rejects
relative paths containing '..' ('Invalid pattern ... not allowed' in the
post-job save), so every run rebuilt Kokkos and SymEngine cold. Point
BUILD_DIR and both cache paths at runner.workspace/Exasim-build (the
workspace parent, absolute, dot-free) in smoke-cpu and cache-warm.

docs: tighten the pip wording in the README/example Python usage notes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Per-user cache (task: reuse model dynamic libraries across app dirs):
- every successful build stores the (libfrontend_model, exasimapp) pair
  under ~/.exasim/cache/<modelID>/<digest>/ (EXASIM_CACHE_DIR overrides);
  any app directory with the same digest reuses it with zero compilation
- relocatable pairs: the SHARED provider gets an @rpath install name and
  exasimapp gets @loader_path/$ORIGIN BUILD_RPATH
- the digest hashes the kernel set, the app TEMPLATES (not the rendered
  files, which embed absolute paths and would be directory-specific), the
  variant + model ID, and the install identity (prefix + ExasimTargets
  mtime) — implemented in all three frontends
- new ctest frontend_python_modelcache: a second app dir must hit the
  cache with no compilation; the test wrapper now exports a hermetic
  EXASIM_CACHE_DIR so tests never touch ~/.exasim
- pyproject: include-package-data + exasim/**/*.bin (a pip install was
  missing masternodes.bin/gaussnodes.bin)

CI: the runner.workspace expression context does not exist and
actions/cache rejects '..' paths, so the previous layout broke workflow
parsing / silently skipped cache saves. Both workflows now check the repo
out into src/ with the build in build/ beside it — everything
workspace-relative and dot-free.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rce change

readpdeapp trimmed even an explicitly-set exasimpath at the last 'Exasim'
substring, mangling any path that doesn't end in Exasim — on CI the
checkout lives at .../Exasim/Exasim/src, so the builtin-model codegen got
-I<workspace>/backend/... and failed to find SymEngineFunctionWrappers.hpp.
An explicit path that already looks like an Exasim root (has backend/) is
now used verbatim; the substring trim remains only as a fallback for
inside-the-tree paths, and the cwd derivation still applies when no path
was set. (Local runs never tripped this because the repo dir name ends in
'Exasim', making the trim a no-op.)

Also give text2code_build BUILD_ALWAYS like exasim_build, so text2code
source changes actually propagate into existing build dirs instead of
being frozen by the ExternalProject stamp.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…c-cleanup

Frontends as installed packages: import exasim / using Exasim / exasim_setup.m on the external-model build path
Python (24 files): drop the cwd/setpath.py exec hack; import exasim and
use exasim.* / exasim.<Subpackage>.* call sites per the package exports.
Julia (23 files): drop setpath.jl + bare submodule usings for 'using
Exasim'; qualify Mesh/Gencode helpers not re-exported at top level.
MATLAB (112 files): replace the strfind(cdir)/setpath.m header with
exasim_setup.m via a depth-correct relative run(fullfile(...)).

Mechanical migration only; no behavioral changes intended. Flagged
oddballs kept working as-is (gpucompiler paths derived from cwd in
poisson3d/test3d, preprocess_mesh6.m cdir reuse, ConvectionDiffusion/1D
references a mesh1D that never existed in the new frontend).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Convert the MATLAB pdemodels (3D Poisson, axisymmetric Poisson, ALE
Euler vortex, linear elasticity) to pdemodel{N}.txt + pdeapp{N}.txt so
the build regenerates them via text2code instead of using the legacy
checked-in kernels (the existing pdeapp{N}.txt-presence switch in
backend/Model/BuiltIn/CMakeLists.txt picks them up automatically).
Generated kernels spot-verified equivalent to the checked-in ones.

Also remove the redundant pow(Expression, Expression) wrapper from
SymEngineFunctionWrappers.hpp: symengine/expression.h already defines
that exact signature (found via ADL), so every unqualified pow call in
a model was ambiguous — model 5 is the first builtin source to use pow.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Convert the MATLAB 2D axisymmetric 5-species reacting Navier-Stokes
model (fluxaxial2d/sourceaxial2d/eosnd/fbouhdgaxialnd + the CNS5air
thermo, transport, and kinetics stack) to pdemodel4.txt: NASA9
thermodynamics with tanh range switches, Blottner viscosity, Gupta
diffusion, Wilke mixing, 5-reaction Park kinetics, and 9 HDG boundary
conditions (incl. the partial-catalytic wall family, reproducing the
legacy double-counted gamma*mdot quirk in BC9 verbatim).

text2code: teach the generator to emit EoS and Sourcew kernels
(KokkosEoS/EoSdu/EoSdw/HdgEoS, KokkosSourcew/HdgSourcew/
HdgSourcewonly) with the element-DG npe-layout ABI the discretization
drivers expect; these outputs had never been exercised by the txt
pipeline. Model 1 regenerates byte-identical; model 12 regenerates
cleanly.

Validation: generated kernels match the checked-in MATLAB-generated
ones at machine precision (35 kernel comparisons incl. all analytic
jacobians at a 4500 K test state); full suite 6/6.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…on CI)

Promote the model 4 conversion harness to a first-class ctest: compile
the legacy MATLAB-generated kernels (backend/Model/BuiltIn/model4/,
kept as the reference) and the kernels THIS build regenerated from
pdemodel4.txt into one binary (Kokkos parallel_for shimmed to a serial
loop) and compare 35 outputs at a physical reacting-flow state
(T~4500 K, reentry reference scales): every kernel family, all 9 HDG
boundary conditions, and the analytic jacobians. Gate rtol 2e-9;
observed agreement ~1e-13. Documented in tests/README.md and the
workflow header so the verification is visible to reviewers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Migrate examples to the frontend packages; complete builtin models 2-6 as text2code sources
Also update examples/exasimfe/CMakeLists.txt to prefer the PSAAP repo-local
Exasim package under local/lib/cmake/Exasim before calling
find_package(Exasim). This fixes the standalone exasimfe build by avoiding
ABI mismatches caused by CMake resolving an older Exasim package from a
different checkout.
…upling"

This reverts commit 9beb313, reversing
changes made to 6f49e45.
…ging

Unify Matlab, Python, and Julia frontend build behavior around the shared
examples/exasimfe app and the local Exasim package layout.

- simplify frontend cmakecompile flows to build the example app directly
  instead of rendering installed frontend-app templates
- add shared/local build directory helpers and sharedbuild state across
  Matlab, Python, and Julia frontends
- improve Exasim prefix discovery in source-tree workflows, including
  repo-local installs under Exasim/local
- update Matlab, Python, and Julia startup/entry-point code to populate
  EXASIM_PREFIX automatically when missing
- make backend runtime data lookup honor EXASIM_PREFIX before falling back
  to the compiled install path
- update builtinlibrary and exasimfe CMake configuration to resolve the
  intended local Exasim package and support current frontend app linkage
- revise exasimapptest to run Matlab/Julia/Python frontend smoke tests and
  builtinlibrary checks against the local package layout
- adjust install rules to generate frontend setup/entry files with the
  install-time prefix for Matlab, Python, and Julia
- stop the superbuild from installing exasim_build during cmake --build and
  route installation through the outer cmake --install step
- add a new shared-library example app under apps/sharedlibrary
- add shared-library provider wiring for ExasimSolver setup
- fix shared-library ABI selection to use the text2code ABI table
- update Exasim solver headers for shared-library/provider support
- refresh text2code-generated model sources and generated helper code
- update text2code compiler logic to match the new generated interfaces
- adjust Matlab setup output and ignore generated shared-library build artifacts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants