Skip to content

해석 속도(PARDISO·과도 열·비선형)와 KStruct 로고 - #13

Open
knoxxr wants to merge 27 commits into
mainfrom
ccr-da6cba6f-qulklh
Open

knoxxr wants to merge 27 commits into
mainfrom
ccr-da6cba6f-qulklh

Conversation

@knoxxr

@knoxxr knoxxr commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

1. 해석 속도

예제 모델로 해석 종류별 시간을 프로파일링했더니, 시간 대부분이 Python이 아니라 SciPy SuperLU 희소 분해(C, 단일 스레드, 3D 메시에 채움이 큰 MMD 순서)였습니다. 같은 행렬로 비교:

행렬 SuperLU(현재) SuperLU + METIS 순서 PARDISO
진동 85k DOF 분해 16.2 s 6.1 s 0.9 s
볼트 접촉 73k DOF 분해 52.2 s 8.2 s 1.2 s

(METIS 순서는 pymetis에 Windows 휠이 없어 제외, 직접 짠 중첩 분할은 오히려 나빴음)

PARDISO 직접 솔버 (fem/pardiso.py, fem/assembly.py)

  • MKL PARDISO를 ctypes로 직접 바인딩(pypardiso는 풀이마다 행렬을 해시·변환해서 사용 안 함). SPD(mtype 2), METIS 병렬 순서, 0-기반 인덱스, 여러 우변 한 번에.
  • make_solver가 2천~30만 DOF에서 PARDISO를 먼저 쓰고, 다음이면 None → 기존 SuperLU/AMG로: MKL 없음(macOS), 분해 실패(부정치, 예: 좌굴 이동), 상대 피벗 < 1e-12(특이: 안 붙잡힌 부품; 정확히 특이 1.7e-14, 1e-9 안정화 스프링 5e-10으로 구분 확인). 그래서 "unstable" 진단은 예전과 똑같습니다.
  • 재현성: MKL_CBWR_Set(COMPATIBLE)로 실행·프로세스마다 비트 단위 동일(마찰 결과가 반올림 경로에 민감했던 이력 때문). 확인함.
  • 같은 희소 패턴의 순서(분해 시간의 ~75 %)를 패턴 해시로 4개까지 캐시.
  • KSTRUCT_NO_PARDISO=1로 대체 경로 강제 가능.

의존성·패키징

  • mkl을 Windows/Linux x86-64에만 추가(macOS는 그대로 SuperLU).
  • kstruct.spec: PARDISO가 실제로 여는 MKL 라이브러리만 번들(MKL_KEEP). GPU 오프로드·MPI·ScaLAPACK 등 ~1 GB는 제외.
  • 배포본 --selftest가 사용 솔버를 출력하고, Windows/Linux x86-64 배포본에서 PARDISO를 못 열면 실패 → 번들 누락을 CI가 잡음. 이 PR의 Windows·Linux CI 통과(= 번들된 MKL로 PARDISO 동작).
  • CI 결과물 크기: Windows 설치 파일 약 183 → 270 MB, Linux tar.gz 417 → 604 MB.

과도 열·비선형

  • 과도 열: 요소 전도 행렬을 k=1로 한 번 만들고 단계마다 배율만 곱함. k(T) 재료가 없으면 K0 재사용. lil 변환 제거.
  • 비선형: 접선 행렬의 CSR 패턴과 요소 항목 위치를 한 번만 계산하고 값만 bincount로 더함. 내력은 np.add.at → bincount.

측정 (같은 머신 4코어, 예제 모델)

해석 (DOF) 전 후
강도 94k 4.0 s 3.3 s
진동 94k 25.0 s 6.6 s
좌굴 94k 46.9 s 28.2 s
열(복사) 94k 12.0 s 2.7 s
과도 열 94k 168 s 28 s
볼트+접촉 82k 174 s 15 s
볼트+마찰 82k 608 s 115 s

2. KStruct 로고

트러스(부재·가새·핀 이음)로 그린 K. 시안 3개 중 선택.

  • 원본 src/kstruct/resources/icons/kstruct.svg, packaging/make_icons.py가 PNG 크기별·Windows .ico·macOS .icns·docs/logo.png를 만듦(Qt SVG Tiny라 clipPath 없이 그림).
  • 창·작업 표시줄 아이콘, 상단 바의 이름 옆, KStruct.exe, 설치 파일과 제거 항목, macOS 앱 번들, README에 적용. Windows 소스 실행에서도 python.exe 아이콘 대신 로고가 보이도록 AppUserModelID 설정.
  • 스토어 스크린샷 18장을 로고가 보이게 다시 찍음(해석 결과는 이전과 동일).

확인

  • 전체 테스트 198 passed(새 tests/test_fem_pardiso.py 5 포함: SuperLU와 일치, 특이/부정치 → SuperLU, 안 붙잡힌 부품 여전히 "unstable", 비트 재현성).
  • ruff check/format 통과, kstruct --selftest 결과 동일(127.0 MPa, solver=PARDISO).

🤖 Generated with Claude Code

https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh

Raise the release version to 0.2.0 (pyproject, RELEASE_VERSION, Inno Setup
default, lockfile) so the v0.2.0 tag matches and installed 0.1.0.x builds
are offered the update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
….2.1

The v0.2.0 tag build was the first CI run that got runners, and 28 UI tests
failed on Windows and Linux: the headless-display action sets
PYVISTA_OFF_SCREEN=true, so QtInteractor created no interactor and
plotter.iren was None. The viewer now always asks for an interactive one.

With that fixed, the UI tests crashed in VTK render() under Xvfb/Mesa after
about twenty windows: a closed window never released its OpenGL render
window. MainWindow.closeEvent now calls viewer.shutdown(), which stops the
animation timer and closes the plotter. Full suite with CI's environment:
183 passed.

The macOS job was cancelled the moment it was created (no runner), and the
release job needs every build job, so it was skipped. It now runs unless a
build failed, and refuses to publish an empty release.

Version 0.2.1 so the fixed commit gets a fresh tag instead of moving v0.2.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
A manual run of the build workflow on main now builds as usual and the
release job creates the v<pyproject version> tag and the GitHub Release at
that commit (it refuses when the tag already exists). Tag pushes work as
before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
…ux; 0.2.2

Windows CI failed test_contact_solver_reuses_the_factorization: the solver's
answer differed from a fresh factorization by 1.3e-6 of the peak displacement
(limit 1e-6). The Woodbury update alone is only as accurate as cond(S)*eps:
on the lap joint cond(S) ~ 8.5e5 left 8.3e-7, while two direct solves with
different orderings agree to 6e-10. One step of iterative refinement with the
same operator brings it to 9.3e-10; the step is kept only when it is a small
correction.

The v0.2.1 run still published a Release although the Windows build failed:
with one leg failed and another (macOS, no runner) cancelled,
needs.build.result reads 'cancelled'. The release job now also requires the
Windows installer and the Linux archive to be present.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
…, checks

kstruct.i18n.tr(korean, **values) returns the Korean source unchanged (and
str.format-ed when values are given) or its English entry from
resources/i18n/en/*.json; N_() marks module-level constants, tr_data()
translates built-in data labels and leaves user-entered names alone. The
language is read from prefs (or KSTRUCT_LANG) when the main window starts;
the info menu gets a 언어 / Language submenu (applies after restart). Help
falls back to Korean per topic.

tests/test_i18n.py fails until the translation lands: it finds every Korean
literal outside tr()/N_()/log calls, every tr() text without an English
entry, mismatched placeholders, and missing English help topics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
test_i18n opens the window in English, solves the sample bracket (static,
modal, thermal), visits every step and fails on any Hangul in widget texts,
tooltips, list/combo/table items, menus, colour-bar titles or the report.
packaging/all_store_screenshots.sh ko|en shoots every scene at both sizes
(English into docs/screenshots/en/); README gets English captions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
en.json mirrors all 88 topics of ko.json (same keys, HTML and related
links). In both languages: thermal help no longer says transient analysis is
unsupported, the steps are at the top (not on the left), and fatigue help
mentions the surface/reliability settings instead of assuming a machined
surface.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
Report HTML in Korean is byte-identical to before for static, modal, buckling and
thermal runs. Also a test that catalog files agree on shared texts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
…lver/data groups)

Snapshot of files the translation agents are still editing; completed by the
following commits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
Module label tables are N_()-marked and shown through tr(); data and user labels
through tr_data(). Korean output unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
…ument i18n

report/summary.py and describe.py build whole sentences per tr() text; verdict
labels translate on lookup. Shared keys get one English each (Part, Custom
material, Bolted joint); the singularity kind is translated where the main window
shows it. CLAUDE.md describes tr/N_/tr_data, the catalogs and the checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
… top

Long English radio/checkbox/form labels made the step panels wider than the side
bar (up to 476 px vs 399 in Korean) and clipped text and help buttons; they are
shortened, with help and notes quoting the new labels. US spelling throughout.
The welcome text (both languages) now says the steps are at the top, and the
modal note names the 'operating speed' field as it is labelled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
All nine scenes at 1920x1080 and 2880x1800 shot with KSTRUCT_LANG=en; the Korean
welcome screenshots are reshot for the corrected 'steps at the top' text. Labels
that were clipped in the English shots are shorter (plastic strain field, mode
shape colour bar, mode list entries).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
docs/screenshots/<size>/ now holds the English screenshots (moved from en/);
all_store_screenshots.sh writes English there by default and Korean to ko/ on
request; README updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
…eat assembly

fem/pardiso.py binds MKL PARDISO (SPD, METIS ordering, multithreaded, bit-reproducible
via MKL_CBWR) through ctypes. make_solver uses it for 2k-300k DOF on Windows/Linux
x86-64 and falls back to SuperLU/AMG when MKL is missing (macOS), the factorization
fails (indefinite) or a pivot falls below 1e-12 of its diagonal (singular: a part not
held), so those cases are diagnosed exactly as before. Measured on the same matrices:
85k-DOF bracket 16.2 s -> 0.9 s, 73k-DOF bolted joint 52 s -> 1.2 s, answers within 1e-11.

Transient heat: element conduction matrices are built once and rescaled (k is constant
per element), K0 is reused when no material has k(T), and no lil conversions.

The installer bundles only the MKL libraries PARDISO loads; the frozen selftest fails on
Windows/Linux x86-64 if PARDISO is not available.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
…te fallback, reproducibility

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
… into a fixed pattern

PARDISO: METIS ordering is ~75 % of a factorization and depends only on the sparsity
pattern, so the last four orderings are kept by pattern hash (0.85 -> 0.6 s at 85k DOF);
parallel nested dissection (0.76 -> 0.45 s), same ordering and bit-identical results
across processes.

Nonlinear: the tangent's CSR pattern and every element entry's slot are computed once;
each Newton iteration sums element values into place (np.bincount) instead of building
and adding sparse matrices, and internal forces use bincount instead of np.add.at.

CLAUDE.md describes the PARDISO path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
resources/icons/kstruct.svg is the source; packaging/make_icons.py renders the PNG
sizes, the Windows .ico and the macOS .icns (Qt SVG Tiny, so no clipPath). Used as the
window/taskbar icon, beside the name in the header bar, for KStruct.exe, the installer
and its uninstall entry, the macOS app bundle and the README. On Windows the process gets
its own AppUserModelID so a source run shows the logo instead of python.exe's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9NzuHPqp7Wrrs8zF7CMvh
@knoxxr knoxxr changed the title 해석 속도: PARDISO(MKL) 직접 솔버, 과도 열·비선형 조립 개선 해석 속도(PARDISO·과도 열·비선형)와 KStruct 로고 Nov 21, 2026
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.

2 participants