initial commit FESurrogateModelTutorial

This commit is contained in:
김경종
2026-05-21 17:03:51 +09:00
parent 93665d9ee6
commit 43b86669fa
122 changed files with 7929 additions and 0 deletions
@@ -0,0 +1,30 @@
{
"project": "FEMSurrogateTutorial",
"phase": "1-beam2d-solver",
"steps": [
{
"step": 0,
"name": "beamexamples-parser",
"status": "completed",
"summary": "Added BeamExamples parser dataclasses and tests for cantilever input and displacement fixtures."
},
{
"step": 1,
"name": "frame-element",
"status": "completed",
"summary": "Added 2D Euler-Bernoulli frame local stiffness and transformation matrix tests and implementation."
},
{
"step": 2,
"name": "assembly-and-solver",
"status": "completed",
"summary": "Added sparse global stiffness assembly, load vector assembly, constrained DOF handling, and linear static solve."
},
{
"step": 3,
"name": "fixture-regression",
"status": "completed",
"summary": "Added BeamExamples displacement regression, analytical cantilever tip check, and clockwise-positive Rz convention alignment."
}
]
}
@@ -0,0 +1,32 @@
# Step 0: beamexamples-parser
## 읽어야 할 파일
- `/AGENTS.md`
- `/PROGRESS.md`
- `/WORKNOTES.md`
- `/docs/ARCHITECTURE.md`
- `/BeamExamples/CantileverBeam.txt`
- `/BeamExamples/CantileverBeam_Displacements.txt`
## 작업
TDD로 `BeamExamples` parser를 구현한다.
- `/tests/test_beamexamples_io.py`를 먼저 작성한다.
- `read_beam_example()`은 metadata, 6 nodes, 5 beams, fixed node 1, node 6 load를 읽는다.
- `read_expected_displacements()`는 node별 `Ux`, `Uy`, `Rz` 기준값을 읽는다.
- parser는 comment, blank line, trailing comma, `Poisson'sRatio` label을 처리한다.
- 구현 파일: `/src/femsurrogate/fea/model.py`, `/src/femsurrogate/fea/io.py`.
## Acceptance Criteria
```powershell
uv run pytest tests/test_beamexamples_io.py -q
uv run ruff check .
```
## 금지사항
- solver 구현을 이 step에 넣지 마라.
- fixture 파일을 수정하지 마라.
@@ -0,0 +1,28 @@
# Step 1: frame-element
## 읽어야 할 파일
- `/AGENTS.md`
- `/docs/ARCHITECTURE.md`
- `/src/femsurrogate/fea/model.py`
- `/src/femsurrogate/fea/io.py`
## 작업
TDD로 2-node 2D Euler-Bernoulli frame element 행렬을 구현한다.
- `/tests/test_frame_element.py`를 먼저 작성한다.
- `local_frame_stiffness(E, A, I, L)`의 shape, symmetry, axial/bending 계수를 검증한다.
- `transformation_matrix(x1, y1, x2, y2)`의 shape와 orthogonality를 검증한다.
- 구현 파일: `/src/femsurrogate/fea/element.py`.
## Acceptance Criteria
```powershell
uv run pytest tests/test_frame_element.py tests/test_beamexamples_io.py -q
uv run ruff check .
```
## 금지사항
- Timoshenko beam, 3D beam DOF를 추가하지 마라.
@@ -0,0 +1,31 @@
# Step 2: assembly-and-solver
## 읽어야 할 파일
- `/AGENTS.md`
- `/docs/ARCHITECTURE.md`
- `/src/femsurrogate/fea/model.py`
- `/src/femsurrogate/fea/io.py`
- `/src/femsurrogate/fea/element.py`
## 작업
TDD로 global assembly와 constrained linear static solver를 구현한다.
- `/tests/test_beam_solver.py`를 먼저 작성한다.
- BeamExamples model의 global stiffness shape `(18, 18)`을 검증한다.
- fixed node 1의 3 DOF가 constrained 처리되는지 검증한다.
- `solve_linear_static(model)`이 모든 node displacement를 finite 값으로 반환하는지 검증한다.
- 구현 파일: `/src/femsurrogate/fea/assembly.py`, `/src/femsurrogate/fea/solver.py`.
- solver는 `scipy.sparse``scipy.sparse.linalg.spsolve`를 사용한다.
## Acceptance Criteria
```powershell
uv run pytest tests/test_beam_solver.py tests/test_frame_element.py tests/test_beamexamples_io.py -q
uv run ruff check .
```
## 금지사항
- expected displacement 값을 solver에 hard-code하지 마라.
@@ -0,0 +1,30 @@
# Step 3: fixture-regression
## 읽어야 할 파일
- `/AGENTS.md`
- `/docs/PRD.md`
- `/docs/ARCHITECTURE.md`
- `/BeamExamples/CantileverBeam.txt`
- `/BeamExamples/CantileverBeam_Displacements.txt`
- `/src/femsurrogate/fea/`
## 작업
TDD로 BeamExamples displacement regression을 완성한다.
- `/tests/test_cantilever_fixture_regression.py`를 먼저 작성한다.
- solver 결과의 모든 node별 `Ux`, `Uy`, `Rz`를 기준 displacement file과 `atol=5e-7`, `rtol=1e-6`으로 비교한다.
- tip displacement 부호와 해석해 `P L^3 / (3 E I)` 대비 크기를 검증한다.
- 필요한 helper는 `/src/femsurrogate/fea/benchmark.py`, `/src/femsurrogate/fea/responses.py`에 둔다.
## Acceptance Criteria
```powershell
uv run pytest tests/test_cantilever_fixture_regression.py tests/test_beam_solver.py tests/test_frame_element.py tests/test_beamexamples_io.py -q
uv run ruff check .
```
## 금지사항
- 허용오차를 문서 기준보다 느슨하게 키우지 마라.