Files
FESADev/docs/hht-implicit-dynamics/implementation-numerical-review.md
T
2026-09-22 21:38:42 +09:00

50 lines
11 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# HHT 관성 구현 독립 수치 검토
- Owner: `numerical-review-agent`; date: `2026-09-22`.
- 상태: `source-delta-reviewed; runtime-verification-pending`. 수식/API 중간 검토이며 전체 구현 gate 통과 판정이 아니다.
- 범위: [관성 API](../../include/fesa/elements/nonlinear_mitc4_inertia.h), [관성 구현](../../src/fesa/elements/nonlinear_mitc4_inertia.cpp), [관성 tests](../../tests/unit/elements/nonlinear_mitc4_inertia_test.cpp), [비선형 내력](../../src/fesa/elements/nonlinear_mitc4_shell.cpp)의 directional third-derivative, [초기화·null algebra](../../src/fesa/analysis/hht_dynamic_algebra.cpp), [동적 조립](../../src/fesa/analysis/hht_dynamic_assembly.cpp), [HHT procedure](../../src/fesa/analysis/hht_dynamic_procedure.cpp).
- 기준: [정식화](formulation.md), [관성 상세](formulation-inertia.md), [N1–N7](numerical-controls.md), [C01–C12](verification-cases.md). Source/tests/상위 계약은 읽기 전용이다.
## 첫 검토 findings
아래는 작업 중 최초로 관찰한 내용이다. Owner 수정 뒤의 대조·실행 evidence는 별도로 갱신한다.
| ID | 심각도·상태 | 관찰·수정과 필요한 검증 |
| --- | --- | --- |
| HHT-IMP-NR-001 | **P1; source corrected, execution pending** | `Inverse(JetMatrix)`의 cyclic minor에 이미 포함된 cofactor 부호를 다시 적용하던 오류가 제거됐다. 새 test가 독립 `Jl^-T`와 현재 null, finite rotation의 `M n=0`을 대조한다. 실행 evidence 확인 전이다. |
| HHT-IMP-NR-002 | **P2; corrected, focused regression passed** | `convective_force=force-M*a` cancellation을 직접 `∫rho Hᵀ B_x[v,v]dV0` 누적으로 수정했다. 같은 q/v에서 a를 `1e15`배 변경해도 c가 동일한지 검사하는 test의 통과 로그를 확인했다. |
| HHT-IMP-NR-003 | **P2; corrected, focused sweep passed** | 최초 raw mixed-unit direction/`1e-5` test를 D scaling/단위 direction, N5 `1e-6`·연속한 두 내부 sweep 점으로 수정했다. Position/velocity/acceleration partial 및 두 h의 dependent-rate effective inertia tangent, pure translation/rotation/mixed 방향과 해당 실행 통과를 확인했다. |
| HHT-IMP-NR-004 | **미완료 coverage; 실행 대기** | 새 N4 guard는 analytic null의 20차원 직교 여공간에서 scaled symmetry/null, positive Cholesky와 `rcond_inf>=2^-32`를 검사한다. 물리 DOF를 numeric rank cutoff로 삭제하지 않는다. C05/C06의 finite rotation·warped/oracle·D3·단위변환 test와 실행 evidence는 owner 완료 후 확인한다. |
| HHT-IMP-NR-005 | **P2; corrected, threshold regression passed** | 작은 각에서 기존 직접 삼각함수 D3의 cancellation 위험을 안정 series로 수정했다. `|phi|<.5`의 squared-norm 9차 coefficient recurrence와 최종 회전행렬 extras 복사를 대조했으며 작은각 경계 양쪽을 포함한 4개 C++ sweep의 통과를 확인했다. |
| HHT-IMP-NR-006 | **P2; closed, exact scale restored** | 기존 `Σe |D²f_e[v,v]|`는 element 내부 coordinate-pair 상쇄를 잃어 N3와 달랐다. 수정본은 아래 exact scalar ψ Hessian을 global `(q_j,q_k)` identity로 합친 **뒤** `Σjk |ψ_qq,jk v_j v_k|`를 누적하고 algebra가 이를 소비한다. N3/[I/O 계약](io-contract.md) 의미와 일치한다. Finite/warped ψ·gradient·Hessian 독립 test 통과도 확인했다. |
| HHT-IMP-NR-007 | **P2; source corrected, execution pending** | 최초 `BuildPhysicalSpace`에 없던 N4 `PᵀZ` 및 `[P Z]` Gram guard가 추가됐다. Nodal sparse block의 실제 free dimension과 global Frobenius 오차, normalized null Gram을 검사하며 `1e-12` 기준을 유지한다. 수정본 실행 evidence는 대기다. |
| HHT-IMP-NR-008 | **수치 절차 변경; 문서 정합성 필요** | Reference의 큰 DIRECT step에서 constant-A 초기 추정이 geometry를 벗어나, Newton 시작 좌표를 `q_n`으로 변경했다. HHT predictor/종속 rates/endpoint 식은 그대로이며 cutback/retry도 없어 수식 변경은 아니다. 다만 N2가 기존 시작값을 명시하므로 새 deterministic 시작값과 실패 동작을 N2에 명시해야 한다. 기존 문구 상태로 계약 일치를 주장하지 않는다. |
NR-001의 독립 scalar 반례: `phi=(.5,0,0)`, `d0=eZ`, Jl의 yz block은 `[[sin(.5)/.5,−(1−cos(.5))/.5],[(1−cos(.5))/.5,sin(.5)/.5]]`다. 관찰한 inverse 식을 적용하면 unit null의 yz 성분이 `(-.6816387600,.7316888689)`이고 `||B n||=||(Jl n)×d||=.4744471057`이다. Python 표준 산술로 실제 계산했다. 이는 zero rotation에서 숨는 부호 오류이며 같은 잘못된 n을 미분한 finite-difference test만으로는 검출되지 않는다.
## 일치한 수식과 남은 대조
최초 snapshot의 `H`, `B_x`, `C_x` 조립과 `I=∫rho Hᵀ(Ha+B_x[v,v])`, `DqI`, `DvI=2∫rho HᵀB_x[v,p]`, `M`의 표시된 index contraction은 정식화와 일치했다. `P/L` 및 `Pdot/Ldot`는 같은 현재 x와 물리적 acceleration을 사용하고 `Ldot=∫rho x×xddot`의 `v×v=0` 항등식과 맞는다. Referenced density/measure, 3³ mass quadrature, current geometry 검사와 fixed-global rate 의미도 대조했다. 이것은 runtime 통과 판정이 아니다.
Internal Jet의 product 6항 및 Compose의 `f''' x_i x_v²+f''(2x_iv x_v+x_i x_vv)+f' x_ivv`를 독립 대조했다. Atan2의 bounded-ratio 미분은 quadrant 상수의 미분이 0인 점과 맞으며 기존 first/second reduction을 유지한다. 반환 `force_directional_second=D²f_int[v,v]`, `drilling_metric=Σkd gradγ⊗gradγ` 및 physical/drilling force·energy 분리는 정식화와 일치한다. 실제 procedure의 hidden-constraint 연결은 이 kernel 범위 밖이며 별도 검증이 필요하다.
NR-005의 독립 scalar 검산은 `phi=(θ,0,0), d0=eZ`에 대해 `D³d_x[eX,eX,eZ]=cosθ/θ−2sinθ/θ²+2(1−cosθ)/θ³`와 안정 전개 `−θ/4+θ³/36−θ⁵/960+θ⁷/50400`를 Python binary64로 비교했다. `θ=1e-4`에서 각각 `−7.7441382018e-5`, `−2.4999999972e-5`, 대칭 상대오차 `0.512`이고 `θ=1e-4*(1+2^-10)`에서 `0.339`다. 이는 algebraic scalar cancellation의 재현이며 수정 전 C++ Jet 출력 자체를 실행했다고 주장하지 않는다. 관성 rotation kernel의 32항 matrix exponential series에는 같은 직접 뺄셈이 없다. `|phi|<pi`에서 그 D3 truncation tail의 exact-arithmetic 상계는 `pi^30/30!/(1−pi/31)<3.45e-18`이며 binary64 roundoff 검증은 별개다.
NR-006의 최소 exact 구현 경로는 공개 moment-load가 0이고 동일 nodal initial director를 공유하는 현 범위에서 `κ_i=||Jl^-1d_i||`, `σ_i=1/κ_i`, `ψ_i=σ_i Σ_(e∋i)kd_e γ_ei`를 2차 미분하는 것이다. `δphi_i=n_i`는 `δtheta_i=σ_i d_i`를 만들어 모든 director와 element polar rotation을 고정하고 nodal R을 오른쪽 drilling 회전시킨다. 따라서 `Dγ_ej[n_i]=δij σ_i`, `n_iᵀf_phys=0`이다. σ는 현재 phi의 함수이므로 Hessian에서 동결하지 않는다. `Jl^-1d=Jr^-1d0=d0+.5 phi×d0+a(phi²)phi×(phi×d0)`로 σ를 안정 계산할 수 있다. 이 scalar ψ의 element-local Hessian을 source identity로 합친 뒤 `Σjk|ψ_i,qjqk||v_j||v_k|`를 계산하면 full energy D3 tensor 없이 N3 분모를 얻는다. 이는 승인 정식화의 항등식이며 scale 계약 변경이 아니다. 실제 code에서는 finite/warped 상태의 `nᵀf` 및 ψ gradient/Hessian과 독립 대조하고 수치 polar가 proper rotation으로 수렴하는 범위를 확인해야 한다.
## 초기화·procedure delta와 실행 evidence
`a_P=D P (Pᵀ DᵀM D P)^-1 PᵀDᵀ(F−f−c)` 뒤 `W^-1 ψ_q N W^-1` solve와 `N W^-1` 복원으로 null acceleration을 구하는 구현은 부호·단위와 맞는다. `ψ_q=DNᵀg+NᵀK`, raw hidden2의 `D²N[v,v]ᵀg+2DN[v]ᵀKv+NᵀD²f[v,v]+ψ_q a`도 일치한다. Null은 현재 `Jl^-1d`와 실제 free BC의 exact intersection으로 결정하며 작은 비영 constrained 성분을 버리지 않는다. Accepted null inventory 변경은 실패한다. Scaled physical mass factor와 W-scaled algebraic rcond 검사에는 epsilon mass/numeric rank deletion이 없다.
Newmark의 q/v는 A를 사용하고 물리 a는 `(A+alpha*a_old)/(1+alpha)`로 회복한다. Effective tangent의 rate 계수, force/moment 별 uncancelled Newton scale, 네 correction gate, 100번째 correction 뒤 재평가, fixed DIRECT `n*h`, endpoint reaction 및 현재 arm/`Jl^-T` spatial moment balance를 대조했다. Constant STEP load의 work `F·q`와 `T+Uphys+Udrill−E0−W`는 현 하중 범위와 맞으며 energy 감소를 강제하지 않는다. 이것은 실제 moving-shell 시간 정확도 인증이 아니다.
메인 실행 로그를 독립 열람했다. [focused.log](../../.harness/build/hht-numerical/focused.log)는 관성 8 tests와 일반 finite-rotation internal D3 sweep, HHT helper 3 tests의 통과를 보인다. 같은 실행 전체는 당시 mapper/writer 7 failures가 있어 전체 PASS가 아니다. `DynamicRotation.*`의 inverse/null/D3 oracle suite는 이 로그에 없어 별도 실행 확인이 필요하다. 당시 없었던 internal 작은각 threshold fixture는 아래 후속 로그에서 통과했다.
[focused-procedure.log](../../.harness/build/hht-numerical/focused-procedure.log)는 algebra 7/8, all-fixed procedure, state/writer/log 통과와 총 37개 중 2개 실패를 보인다. Algebra 경계 fixture는 이후 `W=I`, `diag(1,2^-k)`로 binary-exact threshold를 검사하도록 고쳤으나 이 보고서 시점 재실행 evidence는 대기다. 나머지 실패는 mapper diagnostic fixture다. 기존 로그를 새 소스 전체 통과로 소급하지 않는다.
후속 [focused-exact-constraint.log](../../.harness/build/hht-numerical/focused-exact-constraint.log)는 internal residual 7 tests의 통과를 보이며, NR-005의 작은각 4 fixtures와 NR-006의 finite/warped exact ψ·gradient·Hessian 검사를 포함한다. [zero-trial-red.log](../../.harness/build/hht-numerical/zero-trial-red.log)의 기존 영변형 spurious force 실패도 확인했다. 수정 `CovariantIncrement`의 `2E=G·δg+δg·G+δg·δg`, drilling `F=I+δg⊗Gdual`는 큰 기준값의 뺄셈을 피하는 동일 수식이다. `q=0`의 exact-zero 회복은 force clamp나 tolerance 완화가 아니다. 새 zero-trial test의 통과를 확인했다. Recovery·기존 정적 영향은 전체 회귀 검사 대상이다.
C04a는 판정을 분리한다. 위 로그에서 finest binary64 full/reduced acceleration 차이 약 `3.079e-10`이 `1e-10`을 넘었지만 N7 해상도 약 `6.296e-10` 이하다. q/v/physical-a의 시간차수·오차/noise 검사와 coarse reduction은 별개다. N7에 따라 finest reduction은 **INCONCLUSIVE**로 남길 수 있으며 threshold를 바꾸지 않는다. [decimal80 독립 검산](../../.harness/build/hht-numerical/c04a-decimal-reduction.json)의 full 2×2/scalar recurrence 차이 `<=1.70e-73`은 수학적 reduction을 지지하지만 FESA binary64의 `1e-10` 통과를 대신하지 않는다. 새 test는 시간수렴/coarse gate와 finest `GTEST_SKIP`을 분리했으며 이 보고서에서는 새 바이너리 재실행을 아직 확인하지 않았다. C04a 전체를 무조건 PASS로 합치지 않는다.
Build/CTest는 메인/구현 owner가 담당하며 reviewer가 별도 C++ 실행을 했다고 주장하지 않는다. 문서 `git diff --check`는 exit 0이다. NR-008 문서 정합성, 새 algebra/rotation oracle 실행, 실제 shell의 시간수렴·energy·moving-null·reference 검증이 남는다. 본 보고서는 전체 기능/물리 gate 통과 판정이 아니다.