diff --git a/CMakeLists.txt b/CMakeLists.txt index 9cb40a5..2a445c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1750,3 +1750,14 @@ foreach(_femlite_test IN LISTS _femlite_v5_acceptance_tests) set_property(TEST ${_femlite_test} APPEND PROPERTY LABELS v5_acceptance) endif() endforeach() + +if(WIN32 AND CMAKE_Fortran_COMPILER_ID MATCHES "IntelLLVM") + get_filename_component(_femlite_ifx_runtime_dir "${CMAKE_Fortran_COMPILER}" DIRECTORY) + get_property(_femlite_all_tests DIRECTORY PROPERTY TESTS) + if(_femlite_all_tests) + set_tests_properties(${_femlite_all_tests} PROPERTIES + ENVIRONMENT_MODIFICATION + "PATH=path_list_prepend:${_femlite_ifx_runtime_dir}" + ) + endif() +endif() diff --git a/docs/v5_development_plan.md b/docs/v5_development_plan.md index 123e0ad..3b701b1 100644 --- a/docs/v5_development_plan.md +++ b/docs/v5_development_plan.md @@ -158,8 +158,8 @@ FemLite 0.5.x 定位为: | V5.6 高保真滚压成形 | PARTIAL | 已有刚体圆柱/辊、运动调度、滚压指标、roller kinematics benchmark 和紧凑多层 J2 springback benchmark;示例输出 slip、traction、friction energy、pressure、torque、plastic work、plastic zone、residual displacement 和 springback ratio。 | 主求解器通用滚压成形 step、完整三维工件网格滚压、restart 驱动多 step 工艺流和更大规模长跑。 | | V5.7 cohesive 粘附/脱粘 | PARTIAL | 已有 cohesive law/state/metrics 模块;`test_cohesive_contact` 覆盖单积分点 bonded loading、mixed-mode damage、unloading、reload、complete decohesion、非负耗散、损伤不可逆和 restart 状态保持;`examples/ball_adhesion_decohesion` 已新增 compact cohesive ring benchmark,输出力-位移、耗散能和脱粘面积。 | 主求解器通用 cohesive contact 切换、切线、restart 段和完整球-膜 FE 长跑。 | | V5.8 颗粒耦合 | PASS | 已有颗粒状态、搜索、接触、配置、step、facet/FEM coupling 模块和测试;`particle_acceptance` 覆盖自由落体、墙碰撞、颗粒堆和颗粒-facet 耦合,并通过 `pstep_diag_values` 查询质量、动量、动能、步耗散能和最大重叠;`examples/Dynamic_Grain_Packing_of_a_Flexible_Container` 新增真实粒子-柔性容器双向 benchmark。 | 已完成;当前 Release 全量 CTest 106/106 通过。 | -| V5.9 Benchmark 与性能 | PARTIAL | 已新增 `docs/v5_benchmark_matrix.md`,将 V5.2-V5.8 已完成能力映射到 CTest、示例目录、参考指标和容差;已为相关测试追加 `v5_acceptance` 标签。 | longrun、多平台回归、性能矩阵和最终验收报告仍需收束。 | -| V5.10 验收与发布 | PARTIAL | 已新增 `docs/v5_acceptance_report.md`,记录当前 V5 开发态范围、测试环境、命令、结果、已完成内容、仍需完善内容和暂缓边界;`todo.md` 已全部标记为 `[x]`;本地 release hygiene 已完成并提交 `a01a4fd Complete V5 acceptance milestone`;20.1 发布确认已完成,发布确认测试节点 `9f577c0` 已推送至 `main`,annotated tag `v0.5.0-v5-acceptance-checkpoint` 已推送并指向该节点,clean clone Windows GCC 16 Release 全量 CTest 106/106、`v5_acceptance` 35/35 通过。 | WSL/Intel 多平台复测和更大规模 longrun 仍建议在最终发布前执行。 | +| V5.9 Benchmark 与性能 | PARTIAL | 已新增 `docs/v5_benchmark_matrix.md`,将 V5.2-V5.8 已完成能力映射到 CTest、示例目录、参考指标和容差;已为相关测试追加 `v5_acceptance` 标签;WSL GNU 13.3 和 Windows IntelLLVM 2026.0/MSVC 19.44 多平台默认回归、`v5_acceptance` 子集和 OpenMP contact/performance smoke 已通过。 | 更大规模 longrun、完整性能矩阵和最终验收报告仍需收束。 | +| V5.10 验收与发布 | PARTIAL | 已新增 `docs/v5_acceptance_report.md`,记录当前 V5 开发态范围、测试环境、命令、结果、已完成内容、仍需完善内容和暂缓边界;`todo.md` 已全部标记为 `[x]`;本地 release hygiene 已完成并提交 `a01a4fd Complete V5 acceptance milestone`;20.1 发布确认已完成,发布确认测试节点 `9f577c0` 已推送至 `main`,annotated tag `v0.5.0-v5-acceptance-checkpoint` 已推送并指向该节点,clean clone Windows GCC 16 Release 全量 CTest 106/106、`v5_acceptance` 35/35 通过;20.2 多平台复测已完成并记录 WSL、Intel/MSVC 和 OpenMP 结果。 | 更大规模 longrun 仍建议在最终发布前执行。 | V5 benchmark 示例当前标记: @@ -189,6 +189,9 @@ V5 benchmark 示例当前标记: | TODO 状态 | `todo.md` 中 V5.2 至 V5.10 所有事项均已用 `[x]` 标记完成 | | 默认回归 | 本地原工作树和 clean clone 均记录为 `ctest --test-dir build-win-gcc-16 -C Release --output-on-failure` 106/106 passed | | V5 验收子集 | 本地原工作树和 clean clone 均记录为 `ctest --test-dir build-win-gcc-16 -C Release -L v5_acceptance --output-on-failure` 35/35 passed | +| WSL 多平台复测 | Ubuntu 24.04 / GNU Fortran 13.3.0 / GNU C 13.3.0 / CMake 3.28.3,`build-wsl-gfortran-v5-20-2` 默认 CTest 106/106 passed,`v5_acceptance` 35/35 passed | +| Windows Intel 多平台复测 | VS DevCmd 17.14.33 / MSVC 19.44.35227.0 / IntelLLVM ifx 2026.0.0,`build-win-ifx-v5-20-2` 默认 CTest 106/106 passed,`v5_acceptance` 35/35 passed | +| OpenMP smoke | `contact_omp1`、`contact_omp4` 和 `perf_contact_pair_omp_consistency` 通过;`perf_contact_pair.exe 64 1` 在 1/4 线程下非计时统计一致 | | 发布卫生 | 根目录生成结果文件已清理;README 和版本元数据保持 `0.5.0` 一致 | | 验收文档 | 新增 `docs/v5_acceptance_report.md` 和 `docs/v5_benchmark_matrix.md` | | solver 边界 | 第三方/外部求解器接口、工具和测试已移除;内部 CG/BiCGSTAB/GMRES 为当前生产 solver 路径 | @@ -204,7 +207,7 @@ V5 benchmark 示例当前标记: - V5.7 cohesive 单积分点和 ball adhesion/decohesion compact benchmark。 - V5.8 内置离散球颗粒、颗粒-facet/FEM 映射和动态颗粒柔性容器 benchmark。 - V5.9 benchmark 矩阵、`v5_acceptance` CTest 标签和文档矩阵。 -- V5.10 当前验收报告、根目录结果清理、本地提交和 release hygiene checkpoint。 +- V5.10 当前验收报告、根目录结果清理、本地提交、release hygiene checkpoint 和 20.2 多平台复测。 ## 6. V5.1 架构冻结与验收矩阵 @@ -713,6 +716,13 @@ V5 benchmark 示例当前标记: 该命令已在 2026-06-26 通过,记录为 35/35 passed。 - 默认回归仍为 `ctest --test-dir build-win-gcc-16 -C Release --output-on-failure`; 当前 Windows GCC 16 Release 记录为 106/106 passed。 +- 20.2 多平台复测已在 2026-06-26 完成: + - WSL Ubuntu 24.04 / GNU Fortran 13.3.0 默认 CTest 106/106 passed, + `v5_acceptance` 35/35 passed。 + - Windows IntelLLVM ifx 2026.0.0 / MSVC 19.44.35227.0 默认 CTest 106/106 + passed,`v5_acceptance` 35/35 passed。 + - Windows GCC 16 OpenMP contact/performance smoke 通过,并记录 1/4 线程 + 非计时统计一致性。 ## 15. V5.10 验收与发布 @@ -831,8 +841,8 @@ ctest --test-dir build-win-gcc-16 --output-on-failure ## 20. 下一步建议 -当前本地 checkpoint 已完成,但仍建议按“发布确认 -> 多平台复测 -> 工程化补强” -三层推进。 +当前本地 checkpoint、20.1 发布确认和 20.2 多平台复测已完成;后续建议转入 +工程化补强和更大规模 longrun。 ### 20.1 发布确认 @@ -865,10 +875,39 @@ ctest --test-dir build-win-gcc-16 -C Release -L v5_acceptance --output-on-failur ### 20.2 多平台复测 -1. 在 WSL gfortran 环境复测默认 CTest 和 `v5_acceptance` 标签。 -2. 在 Windows Intel oneAPI ifx/MSVC 环境复测默认 CTest,记录编译器版本和任何 - 数值差异。 -3. 对 OpenMP contact/performance smoke 单独记录线程数、耗时和非计时统计一致性。 +状态:DONE(2026-06-26)。 + +执行记录: + +| 平台 | 构建目录 | 工具链 | 命令 | 结果 | +|---|---|---|---|---| +| WSL Ubuntu 24.04 | `build-wsl-gfortran-v5-20-2` | GNU Fortran 13.3.0、GNU C 13.3.0、CMake 3.28.3 | `ctest --test-dir build-wsl-gfortran-v5-20-2 -C Release --output-on-failure` | 106/106 passed,55.53 s | +| WSL Ubuntu 24.04 | `build-wsl-gfortran-v5-20-2` | 同上 | `ctest --test-dir build-wsl-gfortran-v5-20-2 -C Release -L v5_acceptance --output-on-failure` | 35/35 passed,7.33 s | +| Windows Intel/MSVC | `build-win-ifx-v5-20-2` | VS DevCmd 17.14.33、MSVC 19.44.35227.0、IntelLLVM ifx 2026.0.0 | `ctest --test-dir build-win-ifx-v5-20-2 -C Release --output-on-failure` | 106/106 passed,33.46 s | +| Windows Intel/MSVC | `build-win-ifx-v5-20-2` | 同上 | `ctest --test-dir build-win-ifx-v5-20-2 -C Release -L v5_acceptance --output-on-failure` | 35/35 passed,2.60 s | +| Windows GCC 16 OpenMP | `build-win-gcc-16` | GNU Fortran 16.1.0,OpenMP enabled | `ctest --test-dir build-win-gcc-16 -C Release -R "contact_omp1|contact_omp4|perf_contact_pair_omp_consistency" --output-on-failure -V` | 3/3 passed,1.14 s | + +OpenMP contact/performance smoke 记录: + +| 项 | 线程 | 耗时/计时输出 | 非计时统计 | +|---|---:|---|---| +| `contact_omp1` | 1 | CTest 0.35 s | `test_contact.exe` PASS | +| `contact_omp4` | 4 | CTest 0.04 s | `test_contact.exe` PASS | +| `perf_contact_pair_omp_consistency` | checker 内部对比 | CTest 0.72 s | PASS,`active_count=32`、`search_facets=64`、`search_masters=32`、`search_broad=128`、`search_active=32`、`bvh_nodes=15`、`cache_used=32` | +| `perf_contact_pair.exe 64 1` | 1 | `search_cpu=0.00000E+00`、`force_cpu=0.00000E+00`、`tangent_cpu=1.56250E-02`、`wall_force_cpu=0.000000` | `active_count=64`、`search_facets=128`、`search_masters=64`、`search_broad=256`、`search_active=64`、`bvh_nodes=31`、`cache_used=64` | +| `perf_contact_pair.exe 64 1` | 4 | `search_cpu=1.56250E-02`、`force_cpu=3.12500E-02`、`tangent_cpu=1.56250E-02`、`wall_force_cpu=0.031250` | 与 1 线程样本完全一致 | + +修复和差异说明: + +- WSL 下 7 个 benchmark 初次失败的根因是工具侧 `join_path` 使用 Windows + 反斜杠,Linux 文件系统将其解释为文件名字符;benchmark 工具已统一输出 + POSIX 可接受的 `/` 分隔路径,WSL 和 Windows 均可通过。 +- Windows Intel 初次全量 CTest 报 `__acospia` 入口点缺失,根因是 oneAPI + `setvars.bat` 将 VTune/Advisor 的 `libmmd.dll` 排在 compiler runtime 前面; + CMake 现对 Windows IntelLLVM CTest 统一 prepend ifx compiler runtime 目录。 +- Intel/MSVC 暴露出 Mohr-Coulomb 包络边界分类在精确边界附近的舍入差异; + `mc_envelope_classify` 已增加 `1.0e-10` 相对 margin 容差。复测后无未解释 + 数值差异。 ### 20.3 工程化补强优先级 diff --git a/src/material/fem_material_mc_envelope.f90 b/src/material/fem_material_mc_envelope.f90 index 6589ff0..a19681e 100644 --- a/src/material/fem_material_mc_envelope.f90 +++ b/src/material/fem_material_mc_envelope.f90 @@ -309,12 +309,18 @@ contains real(rk), intent(in) :: shear_margin real(rk), intent(in) :: tension_margin integer, intent(out) :: branch + real(rk) :: margin_tol - if (shear_margin .ge. ZERO .and. tension_margin .ge. ZERO) then + margin_tol = 1.0e-10_rk * max(ONE, abs(shear_margin), & + abs(tension_margin)) + + if (shear_margin .ge. -margin_tol .and. & + tension_margin .ge. -margin_tol) then branch = MC_BRANCH_ELASTIC - else if (shear_margin .lt. ZERO .and. tension_margin .lt. ZERO) then + else if (shear_margin .lt. -margin_tol .and. & + tension_margin .lt. -margin_tol) then branch = MC_BRANCH_MIXED - else if (tension_margin .lt. ZERO) then + else if (tension_margin .lt. -margin_tol) then branch = MC_BRANCH_TENSION else branch = MC_BRANCH_SHEAR diff --git a/tools/benchmarks/ball_adhesion_cohesive_benchmark.f90 b/tools/benchmarks/ball_adhesion_cohesive_benchmark.f90 index 42805dd..a178856 100644 --- a/tools/benchmarks/ball_adhesion_cohesive_benchmark.f90 +++ b/tools/benchmarks/ball_adhesion_cohesive_benchmark.f90 @@ -576,7 +576,7 @@ contains else if (dir(n:n) .eq. '\' .or. dir(n:n) .eq. '/') then path = trim(dir)//trim(name) else - path = trim(dir)//'\'//trim(name) + path = trim(dir)//'/'//trim(name) end if end function join_path diff --git a/tools/benchmarks/corrugated_shell_buckling_benchmark.f90 b/tools/benchmarks/corrugated_shell_buckling_benchmark.f90 index b3f9b62..202f384 100644 --- a/tools/benchmarks/corrugated_shell_buckling_benchmark.f90 +++ b/tools/benchmarks/corrugated_shell_buckling_benchmark.f90 @@ -517,7 +517,7 @@ contains else if (dir(n:n) .eq. '\' .or. dir(n:n) .eq. '/') then path = trim(dir)//trim(name) else - path = trim(dir)//'\'//trim(name) + path = trim(dir)//'/'//trim(name) end if end function join_path diff --git a/tools/benchmarks/dynamic_grain_container_benchmark.f90 b/tools/benchmarks/dynamic_grain_container_benchmark.f90 index e6586b3..03746f0 100644 --- a/tools/benchmarks/dynamic_grain_container_benchmark.f90 +++ b/tools/benchmarks/dynamic_grain_container_benchmark.f90 @@ -567,7 +567,7 @@ contains else if (dir(n:n) .eq. '/' .or. dir(n:n) .eq. '\') then path = trim(dir) // trim(name) else - path = trim(dir) // '\' // trim(name) + path = trim(dir) // '/' // trim(name) end if end function join_path diff --git a/tools/benchmarks/euler_column_buckling_benchmark.f90 b/tools/benchmarks/euler_column_buckling_benchmark.f90 index 561ea33..2ade841 100644 --- a/tools/benchmarks/euler_column_buckling_benchmark.f90 +++ b/tools/benchmarks/euler_column_buckling_benchmark.f90 @@ -357,7 +357,7 @@ contains else if (dir(n:n) .eq. '\' .or. dir(n:n) .eq. '/') then path = trim(dir)//trim(name) else - path = trim(dir)//'\'//trim(name) + path = trim(dir)//'/'//trim(name) end if end function join_path diff --git a/tools/benchmarks/roll_forming_kinematics_benchmark.f90 b/tools/benchmarks/roll_forming_kinematics_benchmark.f90 index dabedfd..b69336e 100644 --- a/tools/benchmarks/roll_forming_kinematics_benchmark.f90 +++ b/tools/benchmarks/roll_forming_kinematics_benchmark.f90 @@ -386,7 +386,7 @@ contains else if (dir(n:n) .eq. '\' .or. dir(n:n) .eq. '/') then path = trim(dir)//trim(name) else - path = trim(dir)//'\'//trim(name) + path = trim(dir)//'/'//trim(name) end if end function join_path diff --git a/tools/benchmarks/roll_forming_springback_benchmark.f90 b/tools/benchmarks/roll_forming_springback_benchmark.f90 index c97e71d..17ee771 100644 --- a/tools/benchmarks/roll_forming_springback_benchmark.f90 +++ b/tools/benchmarks/roll_forming_springback_benchmark.f90 @@ -844,7 +844,7 @@ contains else if (dir(n:n) .eq. '\' .or. dir(n:n) .eq. '/') then path = trim(dir)//trim(name) else - path = trim(dir)//'\'//trim(name) + path = trim(dir)//'/'//trim(name) end if end function join_path diff --git a/tools/benchmarks/strength_reduction_benchmark.f90 b/tools/benchmarks/strength_reduction_benchmark.f90 index fcba07b..3e43777 100644 --- a/tools/benchmarks/strength_reduction_benchmark.f90 +++ b/tools/benchmarks/strength_reduction_benchmark.f90 @@ -352,7 +352,7 @@ contains else if (dir(n:n) .eq. '\' .or. dir(n:n) .eq. '/') then path = trim(dir)//trim(name) else - path = trim(dir)//'\'//trim(name) + path = trim(dir)//'/'//trim(name) end if end function join_path