Repository navigation
CalculiX target: dlopen'd .so material (no ccx recompile per material) - #127
Conversation
…iff), not a self-oracle
…d emit() in EXPECT_THROW
…o tests/calculix harness (#128)
# Conflicts: # tests/calculix/linear_elastic/gold/gen_gold_shear.inp # tests/calculix/linear_elastic/gold/gen_gold_uniaxial.inp # tests/calculix/linear_elastic/shear.inp # tests/calculix/linear_elastic/uniaxial.inp
# Conflicts: # tests/calculix/linear_elastic/gold/gen_gold_shear.inp # tests/calculix/linear_elastic/gold/gen_gold_uniaxial.inp # tests/calculix/linear_elastic/shear.inp # tests/calculix/linear_elastic/uniaxial.inp
6b4d04b to
bc0c084
Compare
…ceptions, export entry, reserve ncg_ names
C++ reviewVerdict: the ABI, naming, symbol and packing are correct (confirmed against a real external-enabled ccx 2.22), but the plugin silently returned wrong answers for
#162 item 3 ( Tests added (all fail on the pre-fix code, verified by reverting Checked and held up: entry argument list vs Outside this PR (pre-existing, all targets): the generated Final verification: commit 2322676; gcc-14 Debug Open decision: |
Adds
CalculiXExternalTarget(make_target("calculix")) — codegen's first target whose output runs in a real external FE solver. It emits<Model>_ext.cppcompiling tolib<MODEL>.so, which CalculiX loads at runtime viadlopen: buildccxonce with external-behaviour support, then each new material is just a new.soselected by name in the deck — noccxrecompile per material.Supersedes the earlier two-PR split (#125 compiled-in
umat_user_+ #126 external): the compiled-in approach needed accxrelink per material and is dropped in favour of the.sopath.Mechanism (verified against ccx 2.22 source)
A deck
*MATERIAL, NAME=@<LIB>_<FUNC>makes ccx (which uppercases the name)dlopen("lib<LIB>.so")+dlsym("<FUNC>")(external.c,-DCALCULIX_EXTERNAL_BEHAVIOURS_SUPPORT -ldl). The STANDARD interface passes native quantities under Abaqus-flavored names —STRAN1=emec(tensorial),STRESS=stre,DDSDDE=stiff(21)packed — handled by a tmechabq_stdVoigt boundary + column-majorstiff(21)packing (src/targets/calculix_boundary.h). The emitted plugin is a per-thread lifecycle: athread_localstateless evaluator (ccx runs the element loop multi-threaded) that reads the material constants fromMPROPSon every call (ccx interpolates them by temperature).Verification
calculix_check_drivercalls the emittedNCG_UMATthrough the exactcalculixptrABI and checksstre/stiffvs an independent isotropic oracle + a packing-order negative control + a read-constants-every-call regression + theicmd==3stress-only path. Full suite 275 + 7 green.examples/calculix/): build ccx once with external support, compile the codegen'd.so, run by@-name. Confirmed S11=0.027, S22=S33=0.013 (uniaxial) and S12=0.007 (simple shear — pins the tensorial convention).Review
Went through a 3-lens review (architecture · C++/ABI · correctness);
REVIEW.mdhas the findings. Fixes folded in: per-callMPROPS(was a stalethread_localcache — CRITICAL), symmetry guard (reject non-symmetric deformation-gradient inputs), shared boundary helper, shear-convention validation deck, single-table factory, and hardened build scripts.Scope
Stateless (elastic). The
STATEVround-trip for stateful J2 (numsim-materials-backedevaluate()) is the next step; the per-thread evaluator scaffold is already in place for it.🤖 Generated with Claude Code