diff --git a/CMakeLists.txt b/CMakeLists.txt index 219efbc..5454acb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -496,6 +496,48 @@ if(Python3_Interpreter_FOUND) LABELS "example_smoke" ) + add_test(NAME example_scordelis_lo_s4_smoke + COMMAND "${Python3_EXECUTABLE}" + "${CMAKE_SOURCE_DIR}/tests/scripts/run_example_smoke.py" + "${CMAKE_SOURCE_DIR}" + "$" + "${CMAKE_BINARY_DIR}" + "scordelis_lo_s4" + "examples/scordelis_lo_roof/scordelis_lo_s4_static.inp" + "static-linear" + "--output-interval" "1" + "--probe-node" "4" + "--probe-field" "uz" + "--min-abs-displacement" "0.05" + "--sign" "negative" + ) + set_tests_properties(example_scordelis_lo_s4_smoke PROPERTIES + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + LABELS "example_smoke" + TIMEOUT 60 + ) + + add_test(NAME example_scordelis_lo_s3_smoke + COMMAND "${Python3_EXECUTABLE}" + "${CMAKE_SOURCE_DIR}/tests/scripts/run_example_smoke.py" + "${CMAKE_SOURCE_DIR}" + "$" + "${CMAKE_BINARY_DIR}" + "scordelis_lo_s3" + "examples/scordelis_lo_roof/scordelis_lo_s3_static.inp" + "static-linear" + "--output-interval" "1" + "--probe-node" "4" + "--probe-field" "uz" + "--min-abs-displacement" "0.05" + "--sign" "negative" + ) + set_tests_properties(example_scordelis_lo_s3_smoke PROPERTIES + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + LABELS "example_smoke" + TIMEOUT 60 + ) + add_test(NAME example_pressure_pulse_s4_smoke COMMAND "${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/tests/scripts/run_example_smoke.py" diff --git a/docs/03_detailed_design.md b/docs/03_detailed_design.md index 985fcd6..76cdb3d 100644 --- a/docs/03_detailed_design.md +++ b/docs/03_detailed_design.md @@ -633,6 +633,14 @@ end subroutine - 支持壳单元静力应力、应变和节点反力输出。 - Scordelis-Lo 屋面壳体作为壳静力基准验收模型。 +V4.7 壳稳定与塑性验证增强: + +- `fem_control` 提供 drilling 稳定系数、S3 剪切锁定折减系数和最小折减比例,默认保持第三版数值。 +- `fem_element_stiffness` 在壳刚度装配后记录 sample count、最近单元、最近 drilling 刚度、最近 S3 剪切折减、最小剪切折减和最大 drilling 刚度,供敏感性测试和外部诊断查询。 +- S4/S3/S6/S8 section tangent 对 J2/J2_JC 继续从当前积分点算法切线映射到膜、弯曲和横向剪切块。 +- 壳 J2 内力路径将膜应变、横向剪切应变和 `0.5 * thickness * bending strain` 外纤维弯曲近似组合成代表性三维小应变,用于触发弯曲/剪切塑性状态更新,并将弯曲应变写入 `statev(13:15)`。 +- 当前弯曲塑性是代表性外纤维近似,不是完整厚度方向 section integration;后续若引入多层壳积分点,应保持 trial/rollback 和 section tangent 接口兼容。 + ## 14. 边界与载荷模块 模块:fem_boundary.f90 @@ -863,6 +871,7 @@ end subroutine - 静力和非线性 Newmark 均支持线搜索;可选步长缩减在失败时恢复增量起点状态后重试。 - V4.5 起,`fem_control` 保存最近一次求解收敛快照、relative residual、contact gap residual、combined norm、cutback 诊断、最后有效时间和失败原因码,供 Fortran API、C ABI 和测试直接查询。 - V4.6 起,隐式求解器通过线性求解器分发层求解 CSR 方程;默认 CG + Jacobi,可切换 BiCGSTAB + none/Jacobi,并记录最近一次线性求解方法、预条件器、迭代数、残差和状态。 +- V4.7 起,壳 drilling/S3 剪切锁定参数可配置并提供稳定性统计;壳 J2 剪切和代表性弯曲塑性路径纳入 trial/rollback 回归。 ## 17. 稀疏矩阵模块 diff --git a/docs/04_mathematical_model_and_algorithms.md b/docs/04_mathematical_model_and_algorithms.md index f70fcef..6dd3f18 100644 --- a/docs/04_mathematical_model_and_algorithms.md +++ b/docs/04_mathematical_model_and_algorithms.md @@ -394,6 +394,19 @@ kappa_s = 5 / 6 - S3、S6、S8 第二版实现。 - 壳单元线性静力刚度第三版实现并用于 Scordelis-Lo 验证。 +V4.7 壳 J2 塑性验证路径采用代表性外纤维近似: + +```text +epsilon_rep = [eps_m1 + h/2 kappa_1, + eps_m2 + h/2 kappa_2, + 0, + gamma_m12 + h/2 kappa_12, + gamma_13, + gamma_23] +``` + +其中 `h` 为壳厚度,`eps_m` 为膜应变,`kappa` 为弯曲曲率,`gamma_13/gamma_23` 为横向剪切工程应变。该代表性应变进入已有小应变 J2/J2_JC 返回映射,用于触发膜、剪切和弯曲塑性状态更新;弯矩由外纤维应力按 `h^2 / 6` 近似映射回 section resultant。该方法不是完整厚度方向积分,后续多层 section integration 需要替换此近似并保持 trial/rollback 语义。 + S4 删除默认规则: ```text @@ -700,7 +713,7 @@ for each load increment: 当前 V3.4/V3.5 阶段实现采用 Newton 形式: - 残差使用当前位移下的非线性内力 `F_int(u,state)`。 -- 实体单元切线使用当前积分点弹性/J2 算法切线;壳单元膜内、弯曲和横向剪切 section tangent 对 J2/J2_JC 使用当前积分点算法切线映射。 +- 实体单元切线使用当前积分点弹性/J2 算法切线;壳单元膜内、弯曲和横向剪切 section tangent 对 J2/J2_JC 使用当前积分点算法切线映射。V4.7 中壳剪切和弯曲塑性状态由代表性外纤维应变驱动,切线仍复用当前积分点算法切线进行 section block 映射。 - Dirichlet、CLOAD、DLOAD、Robin、MPC、SPH/contact 外力向量进入静力残差。 - Robin、MPC、刚性平面 penalty contact 和面-面 contact pair 切线进入 Newton 切线矩阵。 - 材料状态和单元删除标志采用增量级 trial/restore/commit;非收敛时恢复到增量起点。 diff --git a/docs/05_interface_control_document.md b/docs/05_interface_control_document.md index bf7cfc1..b0319c6 100644 --- a/docs/05_interface_control_document.md +++ b/docs/05_interface_control_document.md @@ -44,6 +44,7 @@ - contact pair active-set、gap residual 和 augmented penalty 诊断接口。 - contact pair 搜索统计接口,用于 V4.4 搜索/并行性能验收。 - 线性求解器设置和最近一次线性求解统计接口,用于 V4.6 内部/外部求解路径切换验收。 +- 壳 drilling/S3 剪切锁定控制和稳定性统计接口,用于 V4.7 壳基准验收。 ## 3. 接口设计原则 @@ -618,7 +619,64 @@ end subroutine - `LSOLVER_EXTERNAL` 仅作为外部稀疏求解器预留路径;当前配置可记录,但实际求解返回 unsupported。 - 静力、隐式 Newmark 和非线性 Newton 修正方程均通过同一分发层求解。 -### 12.7 接触状态 +### 12.7 壳稳定控制 + +V4.7 提供壳单元稳定参数设置和最近一次壳刚度装配统计查询: + +```fortran +subroutine fem_set_shell_stabilization(drilling_factor, s3_shear_factor, & + s3_shear_min_scale, ierr) + real(rk), intent(in) :: drilling_factor + real(rk), intent(in) :: s3_shear_factor + real(rk), intent(in) :: s3_shear_min_scale + integer, intent(out) :: ierr +end subroutine + +subroutine fem_get_shell_stabilization(drilling_factor, s3_shear_factor, & + s3_shear_min_scale, ierr) + real(rk), intent(out) :: drilling_factor + real(rk), intent(out) :: s3_shear_factor + real(rk), intent(out) :: s3_shear_min_scale + integer, intent(out) :: ierr +end subroutine + +subroutine fem_get_shell_stability_stats(sample_count, last_element, & + last_drilling_stiffness, & + last_shear_scale, min_shear_scale, & + max_drilling_stiffness, ierr) + integer, intent(out) :: sample_count + integer, intent(out) :: last_element + real(rk), intent(out) :: last_drilling_stiffness + real(rk), intent(out) :: last_shear_scale + real(rk), intent(out) :: min_shear_scale + real(rk), intent(out) :: max_drilling_stiffness + integer, intent(out) :: ierr +end subroutine +``` + +C ABI 对应函数为: + +```c +int femlite_set_shell_stabilization(double drilling_factor, + double s3_shear_factor, + double s3_shear_min_scale); +int femlite_get_shell_stabilization(double *drilling_factor, + double *s3_shear_factor, + double *s3_shear_min_scale); +int femlite_get_shell_stability_stats(int *sample_count, int *last_element, + double *last_drilling_stiffness, + double *last_shear_scale, + double *min_shear_scale, + double *max_drilling_stiffness); +``` + +说明: + +- 默认值为 `drilling_factor=1.0e-4`、`s3_shear_factor=0.0625`、`s3_shear_min_scale=1.0e-4`。 +- `drilling_factor` 取值范围为 `[0,1]`,`s3_shear_factor >= 0`,`s3_shear_min_scale` 取值范围为 `(0,1]`。 +- 统计量在 `control_set_defaults` 时清零;每次壳单元刚度装配后记录最近样本,并累计最小 S3 剪切折减和最大 drilling 刚度。 + +### 12.8 接触状态 第三版提供接触结果查询接口: diff --git a/docs/06_test_and_verification_plan.md b/docs/06_test_and_verification_plan.md index 31b28f0..ec86e09 100644 --- a/docs/06_test_and_verification_plan.md +++ b/docs/06_test_and_verification_plan.md @@ -61,6 +61,7 @@ Python 环境约定: - 摩擦正则化、摩擦功和最大累计滑移输出测试。 - 接触示例 smoke 测试应覆盖刚性平面压入、两实体块面-面压缩和壳-刚性平面接触。 - 线性求解器分发测试应覆盖 CG、BiCGSTAB、none/Jacobi 预条件、外部求解器占位和最近一次求解统计。 +- 壳 V4.7 测试应覆盖 drilling 稳定参数、S3 剪切锁定折减诊断、J2 剪切/弯曲塑性、trial/rollback 和 Scordelis-Lo 静力基准 smoke。 ## 4. 测试目录结构 @@ -242,6 +243,7 @@ SPH总力映射测试 relative tolerance 1.0e-10 to 1.0e-8 - S4 patch test。 - S3/S4/S6/S8 线性静力刚度测试。 - S4 J2/J2_JC 膜内塑性状态更新和膜内/弯曲/剪切 section tangent 对称性测试。 +- V4.7 增加 drilling 稳定参数敏感性、S3 剪切锁定诊断、S4 J2 剪切塑性、代表性外纤维弯曲塑性和 trial rollback 回归。 - Scordelis-Lo 壳静力位移基准测试。 - 板壳弯曲静力基准测试。 @@ -312,11 +314,11 @@ SPH总力映射测试 relative tolerance 1.0e-10 to 1.0e-8 壳基准扩展矩阵: -- Scordelis-Lo:记录 S3/S4 网格收敛、中心位移误差、静力求解迭代数。 +- Scordelis-Lo:输入位于 `examples/scordelis_lo_roof/`,S3/S4 smoke 检查自由角竖向位移符号和最小量级;网格收敛和参考误差记录作为后续长跑扩展。 - Kirsch plate:记录 S3/S4 孔边应力集中和远场应力误差。 - shell patch test:记录 S3/S4 位移误差和局部应力误差,作为线性精度回归。 - clamped square plate pressure pulse:记录 S3/S4 中心位移峰值、能量历史和稳定时间步。 -- 后续补充剪切锁定敏感算例和钻转稳定参数敏感性检查。 +- V4.7 模块回归已覆盖剪切锁定折减和钻转稳定参数敏感性;后续补充更密网格基准误差表。 接触验证扩展矩阵: @@ -335,7 +337,7 @@ SPH总力映射测试 relative tolerance 1.0e-10 to 1.0e-8 - 法向接触功、摩擦功、stick/slip 计数、mortar 积分点历史槽、正则化摩擦切线和累计滑移 sanity check。 - V4.2 新增示例:rigid plane indentation、two blocks compression、shell rigid plane contact;每个示例应可通过目录内 `run_case.bat` 自动运行和检查结果。 - V4.3 新增示例:contact block sliding friction;检查正则化参数、累计滑移、切向力、摩擦功非负和 VTK 输出。 -- 已接入 `example_smoke` CTest 分组:shell patch S3/S4 静力 smoke、clamped square plate pressure pulse S4 短步数动力 smoke、rigid sphere impact plate S3/S4 短步数动力 smoke、contact block sliding friction 短步数动力 smoke;rigid impact smoke 需要 final contact CSV 中出现 active contact,sliding friction smoke 需要 final contact CSV 中出现正摩擦耗散。 +- 已接入 `example_smoke` CTest 分组:shell patch S3/S4 静力 smoke、Scordelis-Lo S3/S4 静力 smoke、clamped square plate pressure pulse S4 短步数动力 smoke、rigid sphere impact plate S3/S4 短步数动力 smoke、contact block sliding friction 短步数动力 smoke;rigid impact smoke 需要 final contact CSV 中出现 active contact,sliding friction smoke 需要 final contact CSV 中出现正摩擦耗散,Scordelis-Lo smoke 需要自由角竖向位移为负且超过最小量级。 - rigid sphere impact plate 的长步数结果保留为示例复现实验。 ## 11. 输入解析测试 diff --git a/docs/07_user_manual.md b/docs/07_user_manual.md index 3db8216..b8cd6de 100644 --- a/docs/07_user_manual.md +++ b/docs/07_user_manual.md @@ -120,7 +120,7 @@ build-win-gcc-16\femlite.exe input.inp [analysis-mode] [options] 示例: ```powershell -build-win-gcc-16\femlite.exe examples\ScordelisLo\scordelislo_tri_static.inp --output-dir examples\ScordelisLo\results\tri_static --static-linear +build-win-gcc-16\femlite.exe examples\scordelis_lo_roof\scordelis_lo_s4_static.inp --output-dir examples\scordelis_lo_roof\results\s4_static --static-linear ``` ```powershell @@ -240,7 +240,7 @@ kind,pair_id,active_count,max_penetration,force_norm,work_estimate,cumulative_wo `search_*` 字段在 `SUMMARY` 行给出最近一次 contact pair 力评估的全局搜索统计、BVH 候选缓存使用情况和 `cpu_time` 口径秒数;逐 `PAIR` 行给出对应接触对的搜索、缓存和计时统计。`cpu_time` 是轻量趋势诊断,小算例中可能显示为 0。 -Fortran95 API 可通过 `fem_get_convergence_status` 查询最近一次求解的增量、迭代、残差、位移修正范数和收敛标志,通过 `fem_get_convergence_metrics` 查询相对残差、contact gap residual 和 combined norm,通过 `fem_get_convergence_diagnostics` 查询 cutback 次数、最后步长、最后有效时间、状态码和失败原因码。`fem_set_linear_solver` 可选择 `CG` 或 `BiCGSTAB` 与 `none/Jacobi` 预条件,`fem_get_linear_solver_stats` 查询最近一次线性求解迭代数、残差和状态。C ABI 提供同名 `femlite_get_*`/`femlite_set_*` 包装,`converged` 使用 0/1 整数返回。 +Fortran95 API 可通过 `fem_get_convergence_status` 查询最近一次求解的增量、迭代、残差、位移修正范数和收敛标志,通过 `fem_get_convergence_metrics` 查询相对残差、contact gap residual 和 combined norm,通过 `fem_get_convergence_diagnostics` 查询 cutback 次数、最后步长、最后有效时间、状态码和失败原因码。`fem_set_linear_solver` 可选择 `CG` 或 `BiCGSTAB` 与 `none/Jacobi` 预条件,`fem_get_linear_solver_stats` 查询最近一次线性求解迭代数、残差和状态。V4.7 起,`fem_set_shell_stabilization` 可设置壳 drilling 系数、S3 剪切锁定折减系数和最小折减比例,默认分别为 `1.0e-4`、`0.0625`、`1.0e-4`;`fem_get_shell_stability_stats` 可查询最近壳刚度装配诊断。C ABI 提供同名 `femlite_get_*`/`femlite_set_*` 包装,`converged` 使用 0/1 整数返回。 建议把大型结果输出到 `examples/.../results/...` 或独立 `output/` 目录。仓库 `.gitignore` 默认忽略大规模结果文件。 @@ -253,6 +253,7 @@ Fortran95 API 可通过 `fem_get_convergence_status` 查询最近一次求解的 | `examples/uniaxialTension3D` | 3D 圆柱单轴拉伸,tet/hex | | `examples/tension2D` | 板壳拉伸,tri/quad | | `examples/ScordelisLo` | Scordelis-Lo 屋面壳体基准 | +| `examples/scordelis_lo_roof` | V4.7 Scordelis-Lo S3/S4 独立基准目录 | | `examples/Kirsch` | Kirsch 带孔板静力基准 | | `examples/shell_patch_test` | 壳单元 patch test | | `examples/clamped_square_plate_pressure_pulse` | 固支方板压力脉冲 | @@ -262,7 +263,7 @@ Fortran95 API 可通过 `fem_get_convergence_status` 查询最近一次求解的 | `examples/shell_rigid_plane_contact` | S4 壳-刚性平面接触算例 | | `examples/contact_block_sliding` | 两实体块正则化摩擦滑移接触算例 | -每个示例目录中的 `README.md` 给出几何、材料、边界、生成脚本和运行命令。第四版新增接触示例提供 `run_case.bat`,可在 Windows 下双击自动运行并检查结果。 +每个示例目录中的 `README.md` 给出几何、材料、边界、生成脚本和运行命令。新增基准测试应放在 `examples/` 下,并为每个基准案例建立独立文件夹;旧目录可为兼容保留,但新的 CTest 和文档应优先指向独立目录。第四版新增接触示例提供 `run_case.bat`,可在 Windows 下双击自动运行并检查结果。 ## 11. 测试 diff --git a/docs/08_developer_manual.md b/docs/08_developer_manual.md index c15b44d..46bdeb1 100644 --- a/docs/08_developer_manual.md +++ b/docs/08_developer_manual.md @@ -76,7 +76,7 @@ src/interface C ABI 和 Fortran-C bridge |---|---| | `fem_precision` | 全局精度、维度、版本常量 | | `fem_error` | 错误码和错误消息 | -| `fem_control` | 时间步、求解控制、输出控制、V4.5 收敛诊断和 V4.6 线性求解器状态 | +| `fem_control` | 时间步、求解控制、输出控制、V4.5 收敛诊断、V4.6 线性求解器状态和 V4.7 壳稳定参数 | | `fem_api` | Fortran95 公共 API | | `fem_inp_reader` | 两遍 INP 读取主流程 | | `fem_inp_defs` | INP 模式常量 | @@ -235,6 +235,13 @@ V4.6 起,隐式求解器内部不再直调 CG,而是通过 `linear_solver_so - Newmark 运动学量。 - 线搜索失败和步长缩减后的 rollback。 +V4.7 壳稳定和壳塑性维护约定: + +- drilling 稳定系数、S3 剪切折减系数和最小折减比例放在 `fem_control`,公共接口通过 `fem_api` 和 C ABI 追加,不改变旧函数签名。 +- 壳刚度装配后的稳定性统计也放在 `fem_control`,测试中通过 `test_element_stiffness` 和 `test_c_api` 同时覆盖内部变量和外部接口。 +- 当前 J2 弯曲塑性使用代表性外纤维应变近似,不是完整厚度方向积分;任何多层 section integration 扩展都必须保留 trial/rollback 的状态一致性。 +- 壳 benchmark smoke 优先放在 `example_smoke` CTest 分组,长跑或网格收敛结果不提交全量 CSV/VTK。 + ## 10. 输出扩展 输出文件由 `src/output` 管理: @@ -311,7 +318,7 @@ ctest --test-dir build-win-gcc-16 -R "^(contact|contact_omp1|contact_omp4|restar - 模块测试:数据库、facet、接触、输出、restart、INP。 - 接口测试:C ABI、Python debug。 - CLI 测试:静力、隐式 Newmark 等命令行入口。 -- 示例 smoke:shell patch、pressure pulse、rigid sphere impact。 +- 示例 smoke:shell patch、Scordelis-Lo、pressure pulse、rigid sphere impact。 - 性能测试:`perf_p1`、`perf_contact_pair`、`perf_contact_pair_omp_consistency`。 0.4.3 基线 CTest 包含 34 项;V4.4 开发态加入 `contact_omp1`、`contact_omp4`、`perf_contact_pair_smoke`、`perf_contact_pair_medium` 和 `perf_contact_pair_omp_consistency` 后,在 Python 可用时包含 39 项。 @@ -360,6 +367,8 @@ python tests\scripts\check_source_size.py . --warn-file-lines 1500 --max-file-li - 可选结果检查脚本。 - Windows 双击自动运行脚本可命名为 `run_case.bat`;脚本应把结果写入示例目录下的 `results` 子目录,并支持自动检查失败码。 +新增基准测试案例应放在 `examples/` 下,并为每个案例建立独立文件夹;旧兼容目录不作为新测试入口。 + 示例目录不应提交: - 每一步全场 CSV。 diff --git a/docs/v4_development_plan.md b/docs/v4_development_plan.md index bd6c07f..797c958 100644 --- a/docs/v4_development_plan.md +++ b/docs/v4_development_plan.md @@ -587,10 +587,10 @@ FemLite 0.4.x 定位为: | S4 | 面-面 penalty/mortar 近似接触 | A 类。升级为 active set + augmented penalty/mortar 残差 + 更一致切线;旧 penalty/mortar 路径保留为调试 fallback | V4.2 | | S5 | contact-pair 级摩擦历史 | DONE。已推进到 mortar 积分点级历史,补充粘滑状态、正则化摩擦、摩擦功输出和 restart 保存 | V4.3 | | S6 | BVH/OpenMP 装配依赖 critical | A 类。降低锁竞争,增加候选缓存、线程私有累加或分块装配,并建立串并行一致性测试 | V4.4 | -| S7 | 固定 drilling 稳定系数 | B 类。改为可配置参数,增加默认推荐值、敏感性测试、失稳诊断和用户手册说明 | V4.7 | -| S8 | S3 剪切锁定经验缩放 | B 类。通过壳基准验证误差;必要时增加改进减缩、MITC/ANS 预研路径或更明确适用范围 | V4.7 | -| S9 | 壳局部平面几何近似 | B 类。用曲壳基准矩阵约束误差,补充法向、曲率和局部坐标诊断;不承诺完整有限转动壳最终形态 | V4.7 | -| S10 | 壳塑性 section tangent 基准不足 | A 类。补充弯曲/剪切塑性切线验证、卸载路径、长跑基准和 trial/rollback 回归 | V4.7 | +| S7 | 固定 drilling 稳定系数 | DONE。已改为可配置参数,增加默认推荐值、敏感性测试、稳定性统计、Fortran/C 查询接口和用户手册说明 | V4.7 | +| S8 | S3 剪切锁定经验缩放 | DONE。已参数化经验缩放和最小折减,补充诊断统计与 Scordelis-Lo smoke;MITC/ANS 仍作为后续精化方向 | V4.7 | +| S9 | 壳局部平面几何近似 | DONE/PARTIAL。Scordelis-Lo 曲壳 S3/S4 静力 smoke 已接入独立基准目录;完整 pinched cylinder/hemisphere/twisted beam 矩阵进入 V4.8 验收扩展 | V4.7 | +| S10 | 壳塑性 section tangent 基准不足 | DONE/PARTIAL。已补充 S4 J2 剪切塑性、代表性外纤维弯曲塑性、trial/rollback 和 tangent 对称性回归;完整厚度积分壳塑性和卸载长跑进入后续 | V4.7 | | S11 | 集中质量和壳转动惯量对角近似 | B 类。显式继续默认集中质量;隐式路径增加一致质量或改进转动惯量选项的设计和小算例验证 | V4.5, V4.6 | | S12 | CG + Jacobi 单一路径 | DONE。已建立线性求解器分发层,支持 CG、BiCGSTAB、none/Jacobi 预条件、统计查询和外部求解器占位 | V4.6 | | S13 | MPC penalty 约束 | C 类。0.4.x 保留 penalty MPC,补充病态诊断和回归;严格 Lagrange multiplier 或 multiplier-augmented MPC 进入后续 | V4.5 | @@ -842,3 +842,35 @@ FemLite 0.4.x 定位为: - 在 V4.6 后续或 V4.8 中补充更大规模非对称/病态矩阵求解器基准。 - 预留 ILU/SSOR 或外部库后端适配,不影响当前 CG/BiCGSTAB 默认路径。 + +## 28. 0.4.7 开发记录 + +### V4.7 壳稳定、壳塑性与壳基准完善 + +完成状态:V4.7 壳稳定参数化、壳 J2 剪切/代表性弯曲塑性回归、trial/rollback 和 Scordelis-Lo 小型基准 smoke 已形成阶段完善基线;完整厚度方向 section integration 和更大曲壳基准矩阵继续进入 V4.8 验收扩展。 + +已完成: + +- `fem_control` 新增壳 drilling 稳定系数、S3 剪切锁定折减系数、最小折减比例和壳稳定性统计状态。 +- `fem_element_stiffness` 将 drilling 稳定系数和 S3 剪切折减改为可配置参数,并在每次壳刚度装配后记录 sample count、最近单元、最近 drilling 刚度、最近剪切折减、最小剪切折减和最大 drilling 刚度。 +- 壳 J2 内力路径将膜、横向剪切和 `0.5 * thickness * bending strain` 外纤维弯曲近似组合为代表性三维小应变,使剪切和弯曲加载均可触发塑性状态更新。 +- S4 J2 弯曲应变写入 `statev(13:15)`,便于回归检查和后续 section integration 迁移。 +- 新增 Fortran API `fem_set_shell_stabilization`、`fem_get_shell_stabilization` 和 `fem_get_shell_stability_stats`。 +- C ABI 新增 `femlite_set_shell_stabilization`、`femlite_get_shell_stabilization` 和 `femlite_get_shell_stability_stats`。 +- `tests/scripts/run_example_smoke.py` 新增可选节点位移探针,用于 benchmark smoke 检查位移方向和最小量级。 +- 新增 `examples/scordelis_lo_roof/` 独立基准目录,包含 S4/S3 Scordelis-Lo 静力输入和 README;旧 `examples/ScordelisLo/` 保留兼容。 +- CTest 新增 `example_scordelis_lo_s4_smoke` 和 `example_scordelis_lo_s3_smoke`,检查自由角节点 `uz` 为负且超过最小量级。 + +已补充测试: + +- `element_stiffness` 回归覆盖 drilling 稳定系数默认/关闭/提高的刚度敏感性,以及 S3 剪切折减诊断统计。 +- `shell_internal` 回归覆盖 S4 J2 膜内塑性、剪切塑性、代表性弯曲塑性、section tangent 对称性和 trial rollback 状态恢复。 +- `c_api` 回归覆盖壳稳定参数默认值、空模型统计、参数切换和恢复默认。 +- `source_size` 定向 CTest 已通过,新增接口和测试未触发源码规模硬阈值。 +- `example_scordelis_lo_s4_smoke` 和 `example_scordelis_lo_s3_smoke` 已通过,确认新增 benchmark 目录和节点位移探针可用。 + +后续: + +- 在 V4.8 中补充 pinched cylinder、hemisphere、twisted beam 和更密 Scordelis-Lo 网格收敛矩阵。 +- 将代表性外纤维弯曲塑性扩展为可选多层壳厚度积分时,保持现有 trial/rollback、section tangent 和外部诊断接口兼容。 +- 补充更长时间 pressure pulse 与壳接触长跑验证,形成第四版阶段验收报告。 diff --git a/examples/scordelis_lo_roof/README.md b/examples/scordelis_lo_roof/README.md new file mode 100644 index 0000000..8fa1063 --- /dev/null +++ b/examples/scordelis_lo_roof/README.md @@ -0,0 +1,15 @@ +# Scordelis-Lo Roof Benchmark + +This folder contains the V4.7 curved shell static benchmark cases. Each +benchmark keeps its input files in a dedicated directory under `examples/`. + +Cases: + +- `scordelis_lo_s4_static.inp`: quadrilateral S4 roof mesh. +- `scordelis_lo_s3_static.inp`: triangular S3 roof mesh. + +The smoke tests run these cases with `--static-linear` and probe the vertical +displacement at the free corner to catch sign or stiffness regressions. The +inputs are intentionally small enough for routine CTest coverage; denser mesh +convergence studies should be generated outside the repository or committed as +separate lightweight input decks only. diff --git a/examples/scordelis_lo_roof/scordelis_lo_s3_static.inp b/examples/scordelis_lo_roof/scordelis_lo_s3_static.inp new file mode 100644 index 0000000..585fe25 --- /dev/null +++ b/examples/scordelis_lo_roof/scordelis_lo_s3_static.inp @@ -0,0 +1,425 @@ +*HEADING +FemLite Scordelis-Lo roof S3 static +** quarter model: R=2.5000000000E+01, 2L=5.0000000000E+01, angle_rad=6.9813170080E-01 +** thickness=2.5000000000E-01, area=4.3619387365E+02, face_load_z=-9.0000000000E+01, total_Fz=-3.9257448629E+04 +*NODE +1, 0.0000000000E+00, 0.0000000000E+00, 2.5000000000E+01 +2, 2.5000000000E+01, 0.0000000000E+00, 2.5000000000E+01 +3, 2.5000000000E+01, 1.6069690242E+01, 1.9151111078E+01 +4, 0.0000000000E+00, 1.6069690242E+01, 1.9151111078E+01 +5, 2.2727272727E+00, 0.0000000000E+00, 2.5000000000E+01 +6, 4.5454545454E+00, 0.0000000000E+00, 2.5000000000E+01 +7, 6.8181818182E+00, 0.0000000000E+00, 2.5000000000E+01 +8, 9.0909090909E+00, 0.0000000000E+00, 2.5000000000E+01 +9, 1.1363636364E+01, 0.0000000000E+00, 2.5000000000E+01 +10, 1.3636363636E+01, 0.0000000000E+00, 2.5000000000E+01 +11, 1.5909090909E+01, 0.0000000000E+00, 2.5000000000E+01 +12, 1.8181818182E+01, 0.0000000000E+00, 2.5000000000E+01 +13, 2.0454545455E+01, 0.0000000000E+00, 2.5000000000E+01 +14, 2.2727272727E+01, 0.0000000000E+00, 2.5000000000E+01 +15, 2.5000000000E+01, 2.1788935687E+00, 2.4904867452E+01 +16, 2.5000000000E+01, 4.3412044417E+00, 2.4620193825E+01 +17, 2.5000000000E+01, 6.4704761275E+00, 2.4148145657E+01 +18, 2.5000000000E+01, 8.5505035831E+00, 2.3492315520E+01 +19, 2.5000000000E+01, 1.0565456544E+01, 2.2657694676E+01 +20, 2.5000000000E+01, 1.2500000000E+01, 2.1650635095E+01 +21, 2.5000000000E+01, 1.4339410909E+01, 2.0478801107E+01 +22, 2.2727272727E+01, 1.6069690242E+01, 1.9151111078E+01 +23, 2.0454545455E+01, 1.6069690242E+01, 1.9151111078E+01 +24, 1.8181818182E+01, 1.6069690242E+01, 1.9151111078E+01 +25, 1.5909090909E+01, 1.6069690242E+01, 1.9151111078E+01 +26, 1.3636363636E+01, 1.6069690242E+01, 1.9151111078E+01 +27, 1.1363636364E+01, 1.6069690242E+01, 1.9151111078E+01 +28, 9.0909090910E+00, 1.6069690242E+01, 1.9151111078E+01 +29, 6.8181818182E+00, 1.6069690242E+01, 1.9151111078E+01 +30, 4.5454545455E+00, 1.6069690242E+01, 1.9151111078E+01 +31, 2.2727272727E+00, 1.6069690242E+01, 1.9151111078E+01 +32, 0.0000000000E+00, 1.4339410909E+01, 2.0478801107E+01 +33, 0.0000000000E+00, 1.2500000000E+01, 2.1650635095E+01 +34, 0.0000000000E+00, 1.0565456544E+01, 2.2657694676E+01 +35, 0.0000000000E+00, 8.5505035832E+00, 2.3492315520E+01 +36, 0.0000000000E+00, 6.4704761276E+00, 2.4148145657E+01 +37, 0.0000000000E+00, 4.3412044417E+00, 2.4620193825E+01 +38, 0.0000000000E+00, 2.1788935687E+00, 2.4904867452E+01 +39, 2.2727272727E+00, 2.1788935687E+00, 2.4904867452E+01 +40, 2.2727272727E+00, 4.3412044417E+00, 2.4620193825E+01 +41, 2.2727272727E+00, 6.4704761276E+00, 2.4148145657E+01 +42, 2.2727272727E+00, 8.5505035832E+00, 2.3492315520E+01 +43, 2.2727272727E+00, 1.0565456544E+01, 2.2657694676E+01 +44, 2.2727272727E+00, 1.2500000000E+01, 2.1650635095E+01 +45, 2.2727272727E+00, 1.4339410909E+01, 2.0478801107E+01 +46, 4.5454545454E+00, 2.1788935687E+00, 2.4904867452E+01 +47, 4.5454545454E+00, 4.3412044417E+00, 2.4620193825E+01 +48, 4.5454545455E+00, 6.4704761276E+00, 2.4148145657E+01 +49, 4.5454545455E+00, 8.5505035832E+00, 2.3492315520E+01 +50, 4.5454545455E+00, 1.0565456544E+01, 2.2657694676E+01 +51, 4.5454545455E+00, 1.2500000000E+01, 2.1650635095E+01 +52, 4.5454545455E+00, 1.4339410909E+01, 2.0478801107E+01 +53, 6.8181818182E+00, 2.1788935687E+00, 2.4904867452E+01 +54, 6.8181818182E+00, 4.3412044417E+00, 2.4620193825E+01 +55, 6.8181818182E+00, 6.4704761276E+00, 2.4148145657E+01 +56, 6.8181818182E+00, 8.5505035832E+00, 2.3492315520E+01 +57, 6.8181818182E+00, 1.0565456544E+01, 2.2657694676E+01 +58, 6.8181818182E+00, 1.2500000000E+01, 2.1650635095E+01 +59, 6.8181818182E+00, 1.4339410909E+01, 2.0478801107E+01 +60, 9.0909090909E+00, 2.1788935687E+00, 2.4904867452E+01 +61, 9.0909090909E+00, 4.3412044417E+00, 2.4620193825E+01 +62, 9.0909090909E+00, 6.4704761276E+00, 2.4148145657E+01 +63, 9.0909090909E+00, 8.5505035831E+00, 2.3492315520E+01 +64, 9.0909090909E+00, 1.0565456544E+01, 2.2657694676E+01 +65, 9.0909090909E+00, 1.2500000000E+01, 2.1650635095E+01 +66, 9.0909090910E+00, 1.4339410909E+01, 2.0478801107E+01 +67, 1.1363636364E+01, 2.1788935687E+00, 2.4904867452E+01 +68, 1.1363636364E+01, 4.3412044417E+00, 2.4620193825E+01 +69, 1.1363636364E+01, 6.4704761276E+00, 2.4148145657E+01 +70, 1.1363636364E+01, 8.5505035831E+00, 2.3492315520E+01 +71, 1.1363636364E+01, 1.0565456544E+01, 2.2657694676E+01 +72, 1.1363636364E+01, 1.2500000000E+01, 2.1650635095E+01 +73, 1.1363636364E+01, 1.4339410909E+01, 2.0478801107E+01 +74, 1.3636363636E+01, 2.1788935687E+00, 2.4904867452E+01 +75, 1.3636363636E+01, 4.3412044417E+00, 2.4620193825E+01 +76, 1.3636363636E+01, 6.4704761276E+00, 2.4148145657E+01 +77, 1.3636363636E+01, 8.5505035831E+00, 2.3492315520E+01 +78, 1.3636363636E+01, 1.0565456544E+01, 2.2657694676E+01 +79, 1.3636363636E+01, 1.2500000000E+01, 2.1650635095E+01 +80, 1.3636363636E+01, 1.4339410909E+01, 2.0478801107E+01 +81, 1.5909090909E+01, 2.1788935687E+00, 2.4904867452E+01 +82, 1.5909090909E+01, 4.3412044417E+00, 2.4620193825E+01 +83, 1.5909090909E+01, 6.4704761276E+00, 2.4148145657E+01 +84, 1.5909090909E+01, 8.5505035831E+00, 2.3492315520E+01 +85, 1.5909090909E+01, 1.0565456544E+01, 2.2657694676E+01 +86, 1.5909090909E+01, 1.2500000000E+01, 2.1650635095E+01 +87, 1.5909090909E+01, 1.4339410909E+01, 2.0478801107E+01 +88, 1.8181818182E+01, 2.1788935687E+00, 2.4904867452E+01 +89, 1.8181818182E+01, 4.3412044417E+00, 2.4620193825E+01 +90, 1.8181818182E+01, 6.4704761276E+00, 2.4148145657E+01 +91, 1.8181818182E+01, 8.5505035831E+00, 2.3492315520E+01 +92, 1.8181818182E+01, 1.0565456544E+01, 2.2657694676E+01 +93, 1.8181818182E+01, 1.2500000000E+01, 2.1650635095E+01 +94, 1.8181818182E+01, 1.4339410909E+01, 2.0478801107E+01 +95, 2.0454545455E+01, 2.1788935687E+00, 2.4904867452E+01 +96, 2.0454545455E+01, 4.3412044417E+00, 2.4620193825E+01 +97, 2.0454545455E+01, 6.4704761276E+00, 2.4148145657E+01 +98, 2.0454545455E+01, 8.5505035831E+00, 2.3492315520E+01 +99, 2.0454545455E+01, 1.0565456544E+01, 2.2657694676E+01 +100, 2.0454545455E+01, 1.2500000000E+01, 2.1650635095E+01 +101, 2.0454545455E+01, 1.4339410909E+01, 2.0478801107E+01 +102, 2.2727272727E+01, 2.1788935687E+00, 2.4904867452E+01 +103, 2.2727272727E+01, 4.3412044417E+00, 2.4620193825E+01 +104, 2.2727272727E+01, 6.4704761275E+00, 2.4148145657E+01 +105, 2.2727272727E+01, 8.5505035831E+00, 2.3492315520E+01 +106, 2.2727272727E+01, 1.0565456544E+01, 2.2657694676E+01 +107, 2.2727272727E+01, 1.2500000000E+01, 2.1650635095E+01 +108, 2.2727272727E+01, 1.4339410909E+01, 2.0478801107E+01 +*ELEMENT, TYPE=S3, ELSET=ROOF +1, 1, 5, 38 +2, 38, 5, 39 +3, 38, 39, 37 +4, 37, 39, 40 +5, 37, 40, 36 +6, 36, 40, 41 +7, 36, 41, 35 +8, 35, 41, 42 +9, 35, 42, 34 +10, 34, 42, 43 +11, 34, 43, 33 +12, 33, 43, 44 +13, 33, 44, 32 +14, 32, 44, 45 +15, 32, 45, 4 +16, 4, 45, 31 +17, 5, 6, 39 +18, 39, 6, 46 +19, 39, 46, 40 +20, 40, 46, 47 +21, 40, 47, 41 +22, 41, 47, 48 +23, 41, 48, 42 +24, 42, 48, 49 +25, 42, 49, 43 +26, 43, 49, 50 +27, 43, 50, 44 +28, 44, 50, 51 +29, 44, 51, 45 +30, 45, 51, 52 +31, 45, 52, 31 +32, 31, 52, 30 +33, 6, 7, 46 +34, 46, 7, 53 +35, 46, 53, 47 +36, 47, 53, 54 +37, 47, 54, 48 +38, 48, 54, 55 +39, 48, 55, 49 +40, 49, 55, 56 +41, 49, 56, 50 +42, 50, 56, 57 +43, 50, 57, 51 +44, 51, 57, 58 +45, 51, 58, 52 +46, 52, 58, 59 +47, 52, 59, 30 +48, 30, 59, 29 +49, 7, 8, 53 +50, 53, 8, 60 +51, 53, 60, 54 +52, 54, 60, 61 +53, 54, 61, 55 +54, 55, 61, 62 +55, 55, 62, 56 +56, 56, 62, 63 +57, 56, 63, 57 +58, 57, 63, 64 +59, 57, 64, 58 +60, 58, 64, 65 +61, 58, 65, 59 +62, 59, 65, 66 +63, 59, 66, 29 +64, 29, 66, 28 +65, 8, 9, 60 +66, 60, 9, 67 +67, 60, 67, 61 +68, 61, 67, 68 +69, 61, 68, 62 +70, 62, 68, 69 +71, 62, 69, 63 +72, 63, 69, 70 +73, 63, 70, 64 +74, 64, 70, 71 +75, 64, 71, 65 +76, 65, 71, 72 +77, 65, 72, 66 +78, 66, 72, 73 +79, 66, 73, 28 +80, 28, 73, 27 +81, 9, 10, 67 +82, 67, 10, 74 +83, 67, 74, 68 +84, 68, 74, 75 +85, 68, 75, 69 +86, 69, 75, 76 +87, 69, 76, 70 +88, 70, 76, 77 +89, 70, 77, 71 +90, 71, 77, 78 +91, 71, 78, 72 +92, 72, 78, 79 +93, 72, 79, 73 +94, 73, 79, 80 +95, 73, 80, 27 +96, 27, 80, 26 +97, 10, 11, 74 +98, 74, 11, 81 +99, 74, 81, 75 +100, 75, 81, 82 +101, 75, 82, 76 +102, 76, 82, 83 +103, 76, 83, 77 +104, 77, 83, 84 +105, 77, 84, 78 +106, 78, 84, 85 +107, 78, 85, 79 +108, 79, 85, 86 +109, 79, 86, 80 +110, 80, 86, 87 +111, 80, 87, 26 +112, 26, 87, 25 +113, 11, 12, 81 +114, 81, 12, 88 +115, 81, 88, 82 +116, 82, 88, 89 +117, 82, 89, 83 +118, 83, 89, 90 +119, 83, 90, 84 +120, 84, 90, 91 +121, 84, 91, 85 +122, 85, 91, 92 +123, 85, 92, 86 +124, 86, 92, 93 +125, 86, 93, 87 +126, 87, 93, 94 +127, 87, 94, 25 +128, 25, 94, 24 +129, 12, 13, 88 +130, 88, 13, 95 +131, 88, 95, 89 +132, 89, 95, 96 +133, 89, 96, 90 +134, 90, 96, 97 +135, 90, 97, 91 +136, 91, 97, 98 +137, 91, 98, 92 +138, 92, 98, 99 +139, 92, 99, 93 +140, 93, 99, 100 +141, 93, 100, 94 +142, 94, 100, 101 +143, 94, 101, 24 +144, 24, 101, 23 +145, 13, 14, 95 +146, 95, 14, 102 +147, 95, 102, 96 +148, 96, 102, 103 +149, 96, 103, 97 +150, 97, 103, 104 +151, 97, 104, 98 +152, 98, 104, 105 +153, 98, 105, 99 +154, 99, 105, 106 +155, 99, 106, 100 +156, 100, 106, 107 +157, 100, 107, 101 +158, 101, 107, 108 +159, 101, 108, 23 +160, 23, 108, 22 +161, 14, 2, 102 +162, 102, 2, 15 +163, 102, 15, 103 +164, 103, 15, 16 +165, 103, 16, 104 +166, 104, 16, 17 +167, 104, 17, 105 +168, 105, 17, 18 +169, 105, 18, 106 +170, 106, 18, 19 +171, 106, 19, 107 +172, 107, 19, 20 +173, 107, 20, 108 +174, 108, 20, 21 +175, 108, 21, 22 +176, 22, 21, 3 +*NSET, NSET=CURVED_INNER_SYM +1, 4, 32, 33, 34, 35, 36, 37, 38 +*NSET, NSET=CURVED_OUTER_SUPPORT +2, 3, 15, 16, 17, 18, 19, 20, 21 +*NSET, NSET=STRAIGHT_TOP_SYM +1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 +*NSET, NSET=STRAIGHT_FREE +3, 4, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 +*MATERIAL, NAME=ALUMINUM +*DENSITY +1.0000000000E+00 +*ELASTIC +4.3200000000E+08, 0.0000000000E+00 +*SHELL SECTION, ELSET=ROOF, MATERIAL=ALUMINUM +2.5000000000E-01 +*BOUNDARY +CURVED_OUTER_SUPPORT, 2, 3, 0.0 +CURVED_INNER_SYM, 1, 1, 0.0 +CURVED_INNER_SYM, 5, 6, 0.0 +STRAIGHT_TOP_SYM, 2, 2, 0.0 +STRAIGHT_TOP_SYM, 4, 4, 0.0 +STRAIGHT_TOP_SYM, 6, 6, 0.0 +*CLOAD +1, 3, -7.4351228464E+01 +2, 3, -1.4870245693E+02 +3, 3, -7.4351228463E+01 +4, 3, -1.4870245693E+02 +5, 3, -2.2305368539E+02 +6, 3, -2.2305368539E+02 +7, 3, -2.2305368539E+02 +8, 3, -2.2305368539E+02 +9, 3, -2.2305368539E+02 +10, 3, -2.2305368539E+02 +11, 3, -2.2305368539E+02 +12, 3, -2.2305368539E+02 +13, 3, -2.2305368539E+02 +14, 3, -2.2305368539E+02 +15, 3, -2.2305368539E+02 +16, 3, -2.2305368539E+02 +17, 3, -2.2305368539E+02 +18, 3, -2.2305368539E+02 +19, 3, -2.2305368539E+02 +20, 3, -2.2305368539E+02 +21, 3, -2.2305368539E+02 +22, 3, -2.2305368539E+02 +23, 3, -2.2305368539E+02 +24, 3, -2.2305368539E+02 +25, 3, -2.2305368539E+02 +26, 3, -2.2305368539E+02 +27, 3, -2.2305368539E+02 +28, 3, -2.2305368539E+02 +29, 3, -2.2305368539E+02 +30, 3, -2.2305368539E+02 +31, 3, -2.2305368539E+02 +32, 3, -2.2305368539E+02 +33, 3, -2.2305368539E+02 +34, 3, -2.2305368539E+02 +35, 3, -2.2305368539E+02 +36, 3, -2.2305368539E+02 +37, 3, -2.2305368539E+02 +38, 3, -2.2305368539E+02 +39, 3, -4.4610737078E+02 +40, 3, -4.4610737078E+02 +41, 3, -4.4610737078E+02 +42, 3, -4.4610737078E+02 +43, 3, -4.4610737078E+02 +44, 3, -4.4610737078E+02 +45, 3, -4.4610737078E+02 +46, 3, -4.4610737078E+02 +47, 3, -4.4610737078E+02 +48, 3, -4.4610737078E+02 +49, 3, -4.4610737078E+02 +50, 3, -4.4610737078E+02 +51, 3, -4.4610737078E+02 +52, 3, -4.4610737078E+02 +53, 3, -4.4610737078E+02 +54, 3, -4.4610737078E+02 +55, 3, -4.4610737078E+02 +56, 3, -4.4610737078E+02 +57, 3, -4.4610737078E+02 +58, 3, -4.4610737078E+02 +59, 3, -4.4610737078E+02 +60, 3, -4.4610737078E+02 +61, 3, -4.4610737078E+02 +62, 3, -4.4610737078E+02 +63, 3, -4.4610737078E+02 +64, 3, -4.4610737078E+02 +65, 3, -4.4610737078E+02 +66, 3, -4.4610737078E+02 +67, 3, -4.4610737078E+02 +68, 3, -4.4610737078E+02 +69, 3, -4.4610737078E+02 +70, 3, -4.4610737078E+02 +71, 3, -4.4610737078E+02 +72, 3, -4.4610737078E+02 +73, 3, -4.4610737078E+02 +74, 3, -4.4610737078E+02 +75, 3, -4.4610737078E+02 +76, 3, -4.4610737078E+02 +77, 3, -4.4610737078E+02 +78, 3, -4.4610737078E+02 +79, 3, -4.4610737078E+02 +80, 3, -4.4610737078E+02 +81, 3, -4.4610737078E+02 +82, 3, -4.4610737078E+02 +83, 3, -4.4610737078E+02 +84, 3, -4.4610737078E+02 +85, 3, -4.4610737078E+02 +86, 3, -4.4610737078E+02 +87, 3, -4.4610737078E+02 +88, 3, -4.4610737078E+02 +89, 3, -4.4610737078E+02 +90, 3, -4.4610737078E+02 +91, 3, -4.4610737078E+02 +92, 3, -4.4610737078E+02 +93, 3, -4.4610737078E+02 +94, 3, -4.4610737078E+02 +95, 3, -4.4610737078E+02 +96, 3, -4.4610737078E+02 +97, 3, -4.4610737078E+02 +98, 3, -4.4610737078E+02 +99, 3, -4.4610737078E+02 +100, 3, -4.4610737078E+02 +101, 3, -4.4610737078E+02 +102, 3, -4.4610737078E+02 +103, 3, -4.4610737078E+02 +104, 3, -4.4610737078E+02 +105, 3, -4.4610737078E+02 +106, 3, -4.4610737078E+02 +107, 3, -4.4610737078E+02 +108, 3, -4.4610737078E+02 +*STEP +*STATIC +1.0000000000E+00, 1.0000000000E+00, 1.0000000000E-01, 1.0000000000E+00 +*END STEP diff --git a/examples/scordelis_lo_roof/scordelis_lo_s4_static.inp b/examples/scordelis_lo_roof/scordelis_lo_s4_static.inp new file mode 100644 index 0000000..bb73583 --- /dev/null +++ b/examples/scordelis_lo_roof/scordelis_lo_s4_static.inp @@ -0,0 +1,279 @@ +*HEADING +FemLite Scordelis-Lo roof S4 static +** quarter model: R=2.5000000000E+01, 2L=5.0000000000E+01, angle_rad=6.9813170080E-01 +** thickness=2.5000000000E-01, area=4.3615149953E+02, face_load_z=-9.0000000000E+01, total_Fz=-3.9253634958E+04 +*NODE +1, 0.0000000000E+00, 0.0000000000E+00, 2.5000000000E+01 +2, 2.5000000000E+01, 0.0000000000E+00, 2.5000000000E+01 +3, 2.5000000000E+01, 1.6069690242E+01, 1.9151111078E+01 +4, 0.0000000000E+00, 1.6069690242E+01, 1.9151111078E+01 +5, 2.5000000000E+00, 0.0000000000E+00, 2.5000000000E+01 +6, 5.0000000000E+00, 0.0000000000E+00, 2.5000000000E+01 +7, 7.5000000000E+00, 0.0000000000E+00, 2.5000000000E+01 +8, 1.0000000000E+01, 0.0000000000E+00, 2.5000000000E+01 +9, 1.2500000000E+01, 0.0000000000E+00, 2.5000000000E+01 +10, 1.5000000000E+01, 0.0000000000E+00, 2.5000000000E+01 +11, 1.7500000000E+01, 0.0000000000E+00, 2.5000000000E+01 +12, 2.0000000000E+01, 0.0000000000E+00, 2.5000000000E+01 +13, 2.2500000000E+01, 0.0000000000E+00, 2.5000000000E+01 +14, 2.5000000000E+01, 2.4891961649E+00, 2.4875769384E+01 +15, 2.5000000000E+01, 4.9536535800E+00, 2.4504312196E+01 +16, 2.5000000000E+01, 7.3688793603E+00, 2.3889320145E+01 +17, 2.5000000000E+01, 9.7108699068E+00, 2.3036905297E+01 +18, 2.5000000000E+01, 1.1956349466E+01, 2.1955539334E+01 +19, 2.5000000000E+01, 1.4083001452E+01, 2.0655969358E+01 +20, 2.2500000000E+01, 1.6069690242E+01, 1.9151111078E+01 +21, 2.0000000000E+01, 1.6069690242E+01, 1.9151111078E+01 +22, 1.7500000000E+01, 1.6069690242E+01, 1.9151111078E+01 +23, 1.5000000000E+01, 1.6069690242E+01, 1.9151111078E+01 +24, 1.2500000000E+01, 1.6069690242E+01, 1.9151111078E+01 +25, 1.0000000000E+01, 1.6069690242E+01, 1.9151111078E+01 +26, 7.5000000001E+00, 1.6069690242E+01, 1.9151111078E+01 +27, 5.0000000000E+00, 1.6069690242E+01, 1.9151111078E+01 +28, 2.5000000000E+00, 1.6069690242E+01, 1.9151111078E+01 +29, 0.0000000000E+00, 1.4083001452E+01, 2.0655969358E+01 +30, 0.0000000000E+00, 1.1956349466E+01, 2.1955539334E+01 +31, 0.0000000000E+00, 9.7108699069E+00, 2.3036905297E+01 +32, 0.0000000000E+00, 7.3688793603E+00, 2.3889320145E+01 +33, 0.0000000000E+00, 4.9536535800E+00, 2.4504312196E+01 +34, 0.0000000000E+00, 2.4891961649E+00, 2.4875769384E+01 +35, 2.5000000000E+00, 2.4891961649E+00, 2.4875769384E+01 +36, 2.5000000000E+00, 4.9536535800E+00, 2.4504312196E+01 +37, 2.5000000000E+00, 7.3688793603E+00, 2.3889320145E+01 +38, 2.5000000000E+00, 9.7108699069E+00, 2.3036905297E+01 +39, 2.5000000000E+00, 1.1956349466E+01, 2.1955539334E+01 +40, 2.5000000000E+00, 1.4083001452E+01, 2.0655969358E+01 +41, 5.0000000000E+00, 2.4891961649E+00, 2.4875769384E+01 +42, 5.0000000000E+00, 4.9536535800E+00, 2.4504312196E+01 +43, 5.0000000000E+00, 7.3688793603E+00, 2.3889320145E+01 +44, 5.0000000000E+00, 9.7108699069E+00, 2.3036905297E+01 +45, 5.0000000000E+00, 1.1956349466E+01, 2.1955539334E+01 +46, 5.0000000000E+00, 1.4083001452E+01, 2.0655969358E+01 +47, 7.5000000000E+00, 2.4891961649E+00, 2.4875769384E+01 +48, 7.5000000000E+00, 4.9536535800E+00, 2.4504312196E+01 +49, 7.5000000000E+00, 7.3688793603E+00, 2.3889320145E+01 +50, 7.5000000000E+00, 9.7108699069E+00, 2.3036905297E+01 +51, 7.5000000000E+00, 1.1956349466E+01, 2.1955539334E+01 +52, 7.5000000000E+00, 1.4083001452E+01, 2.0655969358E+01 +53, 1.0000000000E+01, 2.4891961649E+00, 2.4875769384E+01 +54, 1.0000000000E+01, 4.9536535800E+00, 2.4504312196E+01 +55, 1.0000000000E+01, 7.3688793603E+00, 2.3889320145E+01 +56, 1.0000000000E+01, 9.7108699069E+00, 2.3036905297E+01 +57, 1.0000000000E+01, 1.1956349466E+01, 2.1955539334E+01 +58, 1.0000000000E+01, 1.4083001452E+01, 2.0655969358E+01 +59, 1.2500000000E+01, 2.4891961649E+00, 2.4875769384E+01 +60, 1.2500000000E+01, 4.9536535800E+00, 2.4504312196E+01 +61, 1.2500000000E+01, 7.3688793603E+00, 2.3889320145E+01 +62, 1.2500000000E+01, 9.7108699069E+00, 2.3036905297E+01 +63, 1.2500000000E+01, 1.1956349466E+01, 2.1955539334E+01 +64, 1.2500000000E+01, 1.4083001452E+01, 2.0655969358E+01 +65, 1.5000000000E+01, 2.4891961649E+00, 2.4875769384E+01 +66, 1.5000000000E+01, 4.9536535800E+00, 2.4504312196E+01 +67, 1.5000000000E+01, 7.3688793603E+00, 2.3889320145E+01 +68, 1.5000000000E+01, 9.7108699069E+00, 2.3036905297E+01 +69, 1.5000000000E+01, 1.1956349466E+01, 2.1955539334E+01 +70, 1.5000000000E+01, 1.4083001452E+01, 2.0655969358E+01 +71, 1.7500000000E+01, 2.4891961649E+00, 2.4875769384E+01 +72, 1.7500000000E+01, 4.9536535800E+00, 2.4504312196E+01 +73, 1.7500000000E+01, 7.3688793603E+00, 2.3889320145E+01 +74, 1.7500000000E+01, 9.7108699069E+00, 2.3036905297E+01 +75, 1.7500000000E+01, 1.1956349466E+01, 2.1955539334E+01 +76, 1.7500000000E+01, 1.4083001452E+01, 2.0655969358E+01 +77, 2.0000000000E+01, 2.4891961649E+00, 2.4875769384E+01 +78, 2.0000000000E+01, 4.9536535800E+00, 2.4504312196E+01 +79, 2.0000000000E+01, 7.3688793603E+00, 2.3889320145E+01 +80, 2.0000000000E+01, 9.7108699069E+00, 2.3036905297E+01 +81, 2.0000000000E+01, 1.1956349466E+01, 2.1955539334E+01 +82, 2.0000000000E+01, 1.4083001452E+01, 2.0655969358E+01 +83, 2.2500000000E+01, 2.4891961649E+00, 2.4875769384E+01 +84, 2.2500000000E+01, 4.9536535800E+00, 2.4504312196E+01 +85, 2.2500000000E+01, 7.3688793603E+00, 2.3889320145E+01 +86, 2.2500000000E+01, 9.7108699069E+00, 2.3036905297E+01 +87, 2.2500000000E+01, 1.1956349466E+01, 2.1955539334E+01 +88, 2.2500000000E+01, 1.4083001452E+01, 2.0655969358E+01 +*ELEMENT, TYPE=S4, ELSET=ROOF +1, 1, 5, 35, 34 +2, 34, 35, 36, 33 +3, 33, 36, 37, 32 +4, 32, 37, 38, 31 +5, 31, 38, 39, 30 +6, 30, 39, 40, 29 +7, 29, 40, 28, 4 +8, 5, 6, 41, 35 +9, 35, 41, 42, 36 +10, 36, 42, 43, 37 +11, 37, 43, 44, 38 +12, 38, 44, 45, 39 +13, 39, 45, 46, 40 +14, 40, 46, 27, 28 +15, 6, 7, 47, 41 +16, 41, 47, 48, 42 +17, 42, 48, 49, 43 +18, 43, 49, 50, 44 +19, 44, 50, 51, 45 +20, 45, 51, 52, 46 +21, 46, 52, 26, 27 +22, 7, 8, 53, 47 +23, 47, 53, 54, 48 +24, 48, 54, 55, 49 +25, 49, 55, 56, 50 +26, 50, 56, 57, 51 +27, 51, 57, 58, 52 +28, 52, 58, 25, 26 +29, 8, 9, 59, 53 +30, 53, 59, 60, 54 +31, 54, 60, 61, 55 +32, 55, 61, 62, 56 +33, 56, 62, 63, 57 +34, 57, 63, 64, 58 +35, 58, 64, 24, 25 +36, 9, 10, 65, 59 +37, 59, 65, 66, 60 +38, 60, 66, 67, 61 +39, 61, 67, 68, 62 +40, 62, 68, 69, 63 +41, 63, 69, 70, 64 +42, 64, 70, 23, 24 +43, 10, 11, 71, 65 +44, 65, 71, 72, 66 +45, 66, 72, 73, 67 +46, 67, 73, 74, 68 +47, 68, 74, 75, 69 +48, 69, 75, 76, 70 +49, 70, 76, 22, 23 +50, 11, 12, 77, 71 +51, 71, 77, 78, 72 +52, 72, 78, 79, 73 +53, 73, 79, 80, 74 +54, 74, 80, 81, 75 +55, 75, 81, 82, 76 +56, 76, 82, 21, 22 +57, 12, 13, 83, 77 +58, 77, 83, 84, 78 +59, 78, 84, 85, 79 +60, 79, 85, 86, 80 +61, 80, 86, 87, 81 +62, 81, 87, 88, 82 +63, 82, 88, 20, 21 +64, 13, 2, 14, 83 +65, 83, 14, 15, 84 +66, 84, 15, 16, 85 +67, 85, 16, 17, 86 +68, 86, 17, 18, 87 +69, 87, 18, 19, 88 +70, 88, 19, 3, 20 +*NSET, NSET=CURVED_INNER_SYM +1, 4, 29, 30, 31, 32, 33, 34 +*NSET, NSET=CURVED_OUTER_SUPPORT +2, 3, 14, 15, 16, 17, 18, 19 +*NSET, NSET=STRAIGHT_TOP_SYM +1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13 +*NSET, NSET=STRAIGHT_FREE +3, 4, 20, 21, 22, 23, 24, 25, 26, 27, 28 +*MATERIAL, NAME=ALUMINUM +*DENSITY +1.0000000000E+00 +*ELASTIC +4.3200000000E+08, 0.0000000000E+00 +*SHELL SECTION, ELSET=ROOF, MATERIAL=ALUMINUM +2.5000000000E-01 +*BOUNDARY +CURVED_OUTER_SUPPORT, 2, 3, 0.0 +CURVED_INNER_SYM, 1, 1, 0.0 +CURVED_INNER_SYM, 5, 6, 0.0 +STRAIGHT_TOP_SYM, 2, 2, 0.0 +STRAIGHT_TOP_SYM, 4, 4, 0.0 +STRAIGHT_TOP_SYM, 6, 6, 0.0 +*CLOAD +1, 3, -1.4019155342E+02 +2, 3, -1.4019155342E+02 +3, 3, -1.4019155342E+02 +4, 3, -1.4019155342E+02 +5, 3, -2.8038310684E+02 +6, 3, -2.8038310684E+02 +7, 3, -2.8038310684E+02 +8, 3, -2.8038310684E+02 +9, 3, -2.8038310684E+02 +10, 3, -2.8038310684E+02 +11, 3, -2.8038310684E+02 +12, 3, -2.8038310684E+02 +13, 3, -2.8038310684E+02 +14, 3, -2.8038310684E+02 +15, 3, -2.8038310684E+02 +16, 3, -2.8038310684E+02 +17, 3, -2.8038310684E+02 +18, 3, -2.8038310684E+02 +19, 3, -2.8038310684E+02 +20, 3, -2.8038310684E+02 +21, 3, -2.8038310684E+02 +22, 3, -2.8038310684E+02 +23, 3, -2.8038310684E+02 +24, 3, -2.8038310684E+02 +25, 3, -2.8038310684E+02 +26, 3, -2.8038310684E+02 +27, 3, -2.8038310684E+02 +28, 3, -2.8038310684E+02 +29, 3, -2.8038310684E+02 +30, 3, -2.8038310684E+02 +31, 3, -2.8038310684E+02 +32, 3, -2.8038310684E+02 +33, 3, -2.8038310684E+02 +34, 3, -2.8038310684E+02 +35, 3, -5.6076621368E+02 +36, 3, -5.6076621368E+02 +37, 3, -5.6076621368E+02 +38, 3, -5.6076621368E+02 +39, 3, -5.6076621368E+02 +40, 3, -5.6076621368E+02 +41, 3, -5.6076621368E+02 +42, 3, -5.6076621368E+02 +43, 3, -5.6076621368E+02 +44, 3, -5.6076621368E+02 +45, 3, -5.6076621368E+02 +46, 3, -5.6076621369E+02 +47, 3, -5.6076621368E+02 +48, 3, -5.6076621368E+02 +49, 3, -5.6076621368E+02 +50, 3, -5.6076621368E+02 +51, 3, -5.6076621368E+02 +52, 3, -5.6076621368E+02 +53, 3, -5.6076621368E+02 +54, 3, -5.6076621368E+02 +55, 3, -5.6076621368E+02 +56, 3, -5.6076621368E+02 +57, 3, -5.6076621368E+02 +58, 3, -5.6076621368E+02 +59, 3, -5.6076621368E+02 +60, 3, -5.6076621368E+02 +61, 3, -5.6076621368E+02 +62, 3, -5.6076621368E+02 +63, 3, -5.6076621368E+02 +64, 3, -5.6076621368E+02 +65, 3, -5.6076621368E+02 +66, 3, -5.6076621368E+02 +67, 3, -5.6076621368E+02 +68, 3, -5.6076621368E+02 +69, 3, -5.6076621368E+02 +70, 3, -5.6076621368E+02 +71, 3, -5.6076621368E+02 +72, 3, -5.6076621368E+02 +73, 3, -5.6076621368E+02 +74, 3, -5.6076621368E+02 +75, 3, -5.6076621368E+02 +76, 3, -5.6076621368E+02 +77, 3, -5.6076621368E+02 +78, 3, -5.6076621368E+02 +79, 3, -5.6076621368E+02 +80, 3, -5.6076621368E+02 +81, 3, -5.6076621368E+02 +82, 3, -5.6076621368E+02 +83, 3, -5.6076621368E+02 +84, 3, -5.6076621368E+02 +85, 3, -5.6076621368E+02 +86, 3, -5.6076621368E+02 +87, 3, -5.6076621368E+02 +88, 3, -5.6076621368E+02 +*STEP +*STATIC +1.0000000000E+00, 1.0000000000E+00, 1.0000000000E-01, 1.0000000000E+00 +*END STEP diff --git a/include/femlite_c_api.h b/include/femlite_c_api.h index e627ad7..0b03012 100644 --- a/include/femlite_c_api.h +++ b/include/femlite_c_api.h @@ -37,6 +37,18 @@ int femlite_get_linear_solver_stats(int *method, int *iteration, double *residual_norm, int *status_code); +int femlite_set_shell_stabilization(double drilling_factor, + double s3_shear_factor, + double s3_shear_min_scale); +int femlite_get_shell_stabilization(double *drilling_factor, + double *s3_shear_factor, + double *s3_shear_min_scale); +int femlite_get_shell_stability_stats(int *sample_count, + int *last_element, + double *last_drilling_stiffness, + double *last_shear_scale, + double *min_shear_scale, + double *max_drilling_stiffness); int femlite_get_contact_summary(int *active_count, double *work_step, double *work_total, diff --git a/src/base/fem_api.f90 b/src/base/fem_api.f90 index a3e093b..b18824c 100644 --- a/src/base/fem_api.f90 +++ b/src/base/fem_api.f90 @@ -671,6 +671,92 @@ contains residual_norm, status_code, ierr) end subroutine fem_get_linear_solver_stats + subroutine fem_set_shell_stabilization(drilling_factor, s3_shear_factor, & + s3_shear_min_scale, ierr) + real(rk), intent(in) :: drilling_factor + real(rk), intent(in) :: s3_shear_factor + real(rk), intent(in) :: s3_shear_min_scale + integer, intent(out) :: ierr + + if (.not. api_initialized) then + call error_set(FEM_ERR_INTERNAL, & + 'fem_set_shell_stabilization called before fem_initialize', ierr) + return + end if + if (drilling_factor .lt. ZERO .or. drilling_factor .gt. ONE) then + call error_set(FEM_ERR_INPUT, 'shell drilling factor is out of range', ierr) + return + end if + if (s3_shear_factor .lt. ZERO) then + call error_set(FEM_ERR_INPUT, 'S3 shear locking factor is negative', ierr) + return + end if + if (s3_shear_min_scale .le. ZERO .or. s3_shear_min_scale .gt. ONE) then + call error_set(FEM_ERR_INPUT, 'S3 shear minimum scale is out of range', ierr) + return + end if + + shell_drilling_stiffness_factor = drilling_factor + shell3_shear_locking_factor = s3_shear_factor + shell3_shear_locking_min_scale = s3_shear_min_scale + ierr = FEM_SUCCESS + end subroutine fem_set_shell_stabilization + + subroutine fem_get_shell_stabilization(drilling_factor, s3_shear_factor, & + s3_shear_min_scale, ierr) + real(rk), intent(out) :: drilling_factor + real(rk), intent(out) :: s3_shear_factor + real(rk), intent(out) :: s3_shear_min_scale + integer, intent(out) :: ierr + + drilling_factor = 1.0e-4_rk + s3_shear_factor = 0.0625_rk + s3_shear_min_scale = 1.0e-4_rk + if (.not. api_initialized) then + call error_set(FEM_ERR_INTERNAL, & + 'fem_get_shell_stabilization called before fem_initialize', ierr) + return + end if + + drilling_factor = shell_drilling_stiffness_factor + s3_shear_factor = shell3_shear_locking_factor + s3_shear_min_scale = shell3_shear_locking_min_scale + ierr = FEM_SUCCESS + end subroutine fem_get_shell_stabilization + + subroutine fem_get_shell_stability_stats(sample_count, last_element, & + last_drilling_stiffness, & + last_shear_scale, min_shear_scale, & + max_drilling_stiffness, ierr) + integer, intent(out) :: sample_count + integer, intent(out) :: last_element + real(rk), intent(out) :: last_drilling_stiffness + real(rk), intent(out) :: last_shear_scale + real(rk), intent(out) :: min_shear_scale + real(rk), intent(out) :: max_drilling_stiffness + integer, intent(out) :: ierr + + sample_count = 0 + last_element = 0 + last_drilling_stiffness = ZERO + last_shear_scale = ONE + min_shear_scale = ONE + max_drilling_stiffness = ZERO + if (.not. api_initialized) then + call error_set(FEM_ERR_INTERNAL, & + 'fem_get_shell_stability_stats called before fem_initialize', ierr) + return + end if + + sample_count = shell_stability_sample_count + last_element = shell_stability_last_elem + last_drilling_stiffness = shell_stability_last_drilling + last_shear_scale = shell_stab_last_shear_scale + min_shear_scale = shell_stability_min_shear_scale + max_drilling_stiffness = shell_stability_max_drilling + ierr = FEM_SUCCESS + end subroutine fem_get_shell_stability_stats + subroutine fem_get_boundary_facet_count(num_facets, max_face_nodes, ierr) integer, intent(out) :: num_facets integer, intent(out) :: max_face_nodes diff --git a/src/base/fem_control.f90 b/src/base/fem_control.f90 index c581d19..b6e76cd 100644 --- a/src/base/fem_control.f90 +++ b/src/base/fem_control.f90 @@ -45,6 +45,9 @@ module fem_control real(rk) :: line_search_reduction = 0.5_rk real(rk) :: line_search_accept_ratio = 0.95_rk real(rk) :: cutback_factor = 0.5_rk + real(rk) :: shell_drilling_stiffness_factor = 1.0e-4_rk + real(rk) :: shell3_shear_locking_factor = 0.0625_rk + real(rk) :: shell3_shear_locking_min_scale = 1.0e-4_rk integer :: current_step = 0 integer :: nstep_max = 0 integer :: analysis_type = ANALYSIS_EXPLICIT_DYNAMIC @@ -58,6 +61,8 @@ module fem_control integer :: linear_solver_last_prec = LPRECOND_JACOBI integer :: linear_solver_last_iter = 0 integer :: linear_solver_last_status = LS_STATUS_IDLE + integer :: shell_stability_sample_count = 0 + integer :: shell_stability_last_elem = 0 integer :: convergence_increment = 0 integer :: convergence_iteration = 0 integer :: convergence_cutback_count = 0 @@ -69,6 +74,10 @@ module fem_control real(rk) :: convergence_contact_gap_norm = ZERO real(rk) :: convergence_combined_norm = ZERO real(rk) :: linear_solver_last_resid = ZERO + real(rk) :: shell_stability_last_drilling = ZERO + real(rk) :: shell_stab_last_shear_scale = ONE + real(rk) :: shell_stability_min_shear_scale = ONE + real(rk) :: shell_stability_max_drilling = ZERO real(rk) :: convergence_last_dt = ZERO real(rk) :: convergence_last_accepted_time = ZERO logical :: convergence_converged = .false. @@ -101,6 +110,9 @@ contains line_search_reduction = 0.5_rk line_search_accept_ratio = 0.95_rk cutback_factor = 0.5_rk + shell_drilling_stiffness_factor = 1.0e-4_rk + shell3_shear_locking_factor = 0.0625_rk + shell3_shear_locking_min_scale = 1.0e-4_rk current_step = 0 nstep_max = 0 analysis_type = ANALYSIS_EXPLICIT_DYNAMIC @@ -114,6 +126,8 @@ contains linear_solver_last_prec = LPRECOND_JACOBI linear_solver_last_iter = 0 linear_solver_last_status = LS_STATUS_IDLE + shell_stability_sample_count = 0 + shell_stability_last_elem = 0 convergence_increment = 0 convergence_iteration = 0 convergence_cutback_count = 0 @@ -125,6 +139,10 @@ contains convergence_contact_gap_norm = ZERO convergence_combined_norm = ZERO linear_solver_last_resid = ZERO + shell_stability_last_drilling = ZERO + shell_stab_last_shear_scale = ONE + shell_stability_min_shear_scale = ONE + shell_stability_max_drilling = ZERO convergence_last_dt = ZERO convergence_last_accepted_time = ZERO convergence_converged = .false. diff --git a/src/element/fem_element_internal.f90 b/src/element/fem_element_internal.f90 index b375e5e..630a7a8 100644 --- a/src/element/fem_element_internal.f90 +++ b/src/element/fem_element_internal.f90 @@ -1553,9 +1553,9 @@ contains end if eps = ZERO - eps(1) = strain_mem(1) - eps(2) = strain_mem(2) - eps(4) = strain_mem(3) + eps(1) = strain_mem(1) + HALF * thickness * strain_ben(1) + eps(2) = strain_mem(2) + HALF * thickness * strain_ben(2) + eps(4) = strain_mem(3) + HALF * thickness * strain_ben(3) eps(5) = strain_shr(1) eps(6) = strain_shr(2) deps = eps - strain(:,gp) @@ -1576,6 +1576,11 @@ contains force_mem(3) = thickness * sig(4) force_shr(1) = (5.0_rk / 6.0_rk) * thickness * sig(5) force_shr(2) = (5.0_rk / 6.0_rk) * thickness * sig(6) + if (maxval(abs(strain_ben)) .gt. tiny(ONE)) then + force_ben(1) = thickness * thickness * sig(1) / 6.0_rk + force_ben(2) = thickness * thickness * sig(2) / 6.0_rk + force_ben(3) = thickness * thickness * sig(4) / 6.0_rk + end if if (state_new(4) .ge. HALF) then elem_status(elem) = 1 diff --git a/src/element/fem_element_stiffness.f90 b/src/element/fem_element_stiffness.f90 index 774f580..9eb2e76 100644 --- a/src/element/fem_element_stiffness.f90 +++ b/src/element/fem_element_stiffness.f90 @@ -1,6 +1,7 @@ module fem_element_stiffness use fem_precision use fem_error + use fem_control use fem_database use fem_element_topology use fem_quadrature @@ -10,8 +11,6 @@ module fem_element_stiffness private - real(rk), parameter :: SHELL_DRILLING_STIFFNESS_FACTOR = 1.0e-4_rk - public :: element_linear_stiffness contains @@ -195,7 +194,10 @@ contains ke(1:n_elem_dof,1:n_elem_dof) = matmul(transpose(transform), tmp) call add_shell_drilling_stiffness(NLOCAL, basis, & coeff_mem * weight * & - SHELL_DRILLING_STIFFNESS_FACTOR, ke) + shell_drilling_stiffness_factor, ke) + call record_shell_stability(elem, coeff_mem * weight * & + shell_drilling_stiffness_factor, & + shell3_shear_locking_scale(thickness, weight)) ierr = FEM_SUCCESS end subroutine shell3_linear_stiffness @@ -306,7 +308,9 @@ contains ke(1:n_elem_dof,1:n_elem_dof) = matmul(transpose(transform), tmp) call add_shell_drilling_stiffness(NLOCAL, basis, & coeff_mem * area * & - SHELL_DRILLING_STIFFNESS_FACTOR, ke) + shell_drilling_stiffness_factor, ke) + call record_shell_stability(elem, coeff_mem * area * & + shell_drilling_stiffness_factor, ONE) ierr = FEM_SUCCESS end subroutine shell4_linear_stiffness @@ -404,7 +408,9 @@ contains ke(1:n_elem_dof,1:n_elem_dof) = matmul(transpose(transform), tmp) call add_shell_drilling_stiffness(nlocal, basis, & coeff_mem * area * & - SHELL_DRILLING_STIFFNESS_FACTOR, ke) + shell_drilling_stiffness_factor, ke) + call record_shell_stability(elem, coeff_mem * area * & + shell_drilling_stiffness_factor, ONE) ierr = FEM_SUCCESS end subroutine shell_general_linear_stiffness @@ -929,10 +935,26 @@ contains ! Linear triangular Mindlin shells are prone to thin-shell shear locking. ratio = thickness / hchar - shell3_shear_locking_scale = min(ONE, max(1.0e-4_rk, & - 0.0625_rk * ratio * ratio)) + shell3_shear_locking_scale = min(ONE, & + max(shell3_shear_locking_min_scale, & + shell3_shear_locking_factor * ratio * ratio)) end function shell3_shear_locking_scale + subroutine record_shell_stability(elem, drilling_stiffness, shear_scale) + integer, intent(in) :: elem + real(rk), intent(in) :: drilling_stiffness + real(rk), intent(in) :: shear_scale + + shell_stability_sample_count = shell_stability_sample_count + 1 + shell_stability_last_elem = elem + shell_stability_last_drilling = drilling_stiffness + shell_stab_last_shear_scale = shear_scale + shell_stability_min_shear_scale = & + min(shell_stability_min_shear_scale, shear_scale) + shell_stability_max_drilling = & + max(shell_stability_max_drilling, drilling_stiffness) + end subroutine record_shell_stability + subroutine shell_apply_section_tangent(mat, thickness, gp, dmem, dben, dshr, ierr) integer, intent(in) :: mat real(rk), intent(in) :: thickness diff --git a/src/interface/fem_c_api.c b/src/interface/fem_c_api.c index e86a056..663e777 100644 --- a/src/interface/fem_c_api.c +++ b/src/interface/fem_c_api.c @@ -26,6 +26,9 @@ #define F_SET_LINSOL FC_GLOBAL(femlite_f_set_linsol, FEMLITE_F_SET_LINSOL) #define F_GET_LINSOL_SETTINGS FC_GLOBAL(femlite_f_get_linsol_settings, FEMLITE_F_GET_LINSOL_SETTINGS) #define F_GET_LINSOL_STATS FC_GLOBAL(femlite_f_get_linsol_stats, FEMLITE_F_GET_LINSOL_STATS) +#define F_SET_SHELL_STAB FC_GLOBAL(femlite_f_set_shell_stab, FEMLITE_F_SET_SHELL_STAB) +#define F_GET_SHELL_STAB FC_GLOBAL(femlite_f_get_shell_stab, FEMLITE_F_GET_SHELL_STAB) +#define F_GET_SHELL_STAB_STATS FC_GLOBAL(femlite_f_get_shell_stab_stats, FEMLITE_F_GET_SHELL_STAB_STATS) #define F_GET_CONTACT_SUMMARY FC_GLOBAL(femlite_f_get_contact_summary, FEMLITE_F_GET_CONTACT_SUMMARY) #define F_GET_CONTACT_DIAG FC_GLOBAL(femlite_f_get_contact_diag, FEMLITE_F_GET_CONTACT_DIAG) #define F_GET_CONTACT_FRICTION FC_GLOBAL(femlite_f_get_contact_friction, FEMLITE_F_GET_CONTACT_FRICTION) @@ -78,6 +81,21 @@ extern void F_GET_LINSOL_STATS(int *method, double *residual_norm, int *status_code, int *ierr); +extern void F_SET_SHELL_STAB(double *drilling_factor, + double *s3_shear_factor, + double *s3_shear_min_scale, + int *ierr); +extern void F_GET_SHELL_STAB(double *drilling_factor, + double *s3_shear_factor, + double *s3_shear_min_scale, + int *ierr); +extern void F_GET_SHELL_STAB_STATS(int *sample_count, + int *last_element, + double *last_drilling_stiffness, + double *last_shear_scale, + double *min_shear_scale, + double *max_drilling_stiffness, + int *ierr); extern void F_GET_CONTACT_SUMMARY(int *active_count, double *work_step, double *work_total, @@ -348,6 +366,47 @@ int femlite_get_linear_solver_stats(int *method, return ierr; } +int femlite_set_shell_stabilization(double drilling_factor, + double s3_shear_factor, + double s3_shear_min_scale) +{ + int ierr = 0; + F_SET_SHELL_STAB(&drilling_factor, &s3_shear_factor, + &s3_shear_min_scale, &ierr); + return ierr; +} + +int femlite_get_shell_stabilization(double *drilling_factor, + double *s3_shear_factor, + double *s3_shear_min_scale) +{ + int ierr = 0; + if (!drilling_factor || !s3_shear_factor || !s3_shear_min_scale) { + return -1; + } + F_GET_SHELL_STAB(drilling_factor, s3_shear_factor, + s3_shear_min_scale, &ierr); + return ierr; +} + +int femlite_get_shell_stability_stats(int *sample_count, + int *last_element, + double *last_drilling_stiffness, + double *last_shear_scale, + double *min_shear_scale, + double *max_drilling_stiffness) +{ + int ierr = 0; + if (!sample_count || !last_element || !last_drilling_stiffness || + !last_shear_scale || !min_shear_scale || !max_drilling_stiffness) { + return -1; + } + F_GET_SHELL_STAB_STATS(sample_count, last_element, + last_drilling_stiffness, last_shear_scale, + min_shear_scale, max_drilling_stiffness, &ierr); + return ierr; +} + int femlite_get_contact_summary(int *active_count, double *work_step, double *work_total, diff --git a/src/interface/fem_fortran_bridge.f90 b/src/interface/fem_fortran_bridge.f90 index 73a8ac2..5d04ba2 100644 --- a/src/interface/fem_fortran_bridge.f90 +++ b/src/interface/fem_fortran_bridge.f90 @@ -248,6 +248,55 @@ subroutine femlite_f_get_linsol_stats(method, preconditioner, iteration, & residual_norm, status_code, ierr) end subroutine femlite_f_get_linsol_stats +subroutine femlite_f_set_shell_stab(drilling_factor, s3_shear_factor, & + s3_shear_min_scale, ierr) + use fem_api + use fem_precision + implicit none + real(rk), intent(in) :: drilling_factor + real(rk), intent(in) :: s3_shear_factor + real(rk), intent(in) :: s3_shear_min_scale + integer, intent(out) :: ierr + + call fem_set_shell_stabilization(drilling_factor, s3_shear_factor, & + s3_shear_min_scale, ierr) +end subroutine femlite_f_set_shell_stab + +subroutine femlite_f_get_shell_stab(drilling_factor, s3_shear_factor, & + s3_shear_min_scale, ierr) + use fem_api + use fem_precision + implicit none + real(rk), intent(out) :: drilling_factor + real(rk), intent(out) :: s3_shear_factor + real(rk), intent(out) :: s3_shear_min_scale + integer, intent(out) :: ierr + + call fem_get_shell_stabilization(drilling_factor, s3_shear_factor, & + s3_shear_min_scale, ierr) +end subroutine femlite_f_get_shell_stab + +subroutine femlite_f_get_shell_stab_stats(sample_count, last_element, & + last_drilling_stiffness, & + last_shear_scale, min_shear_scale, & + max_drilling_stiffness, ierr) + use fem_api + use fem_precision + implicit none + integer, intent(out) :: sample_count + integer, intent(out) :: last_element + real(rk), intent(out) :: last_drilling_stiffness + real(rk), intent(out) :: last_shear_scale + real(rk), intent(out) :: min_shear_scale + real(rk), intent(out) :: max_drilling_stiffness + integer, intent(out) :: ierr + + call fem_get_shell_stability_stats(sample_count, last_element, & + last_drilling_stiffness, & + last_shear_scale, min_shear_scale, & + max_drilling_stiffness, ierr) +end subroutine femlite_f_get_shell_stab_stats + subroutine femlite_f_clear_sph(ierr) use fem_api implicit none diff --git a/tests/interface/test_c_api.c b/tests/interface/test_c_api.c index 134242b..8a86c3c 100644 --- a/tests/interface/test_c_api.c +++ b/tests/interface/test_c_api.c @@ -51,6 +51,8 @@ int main(void) int linsol_preconditioner = -1; int linsol_iteration = -1; int linsol_status = -999; + int shell_sample_count = -1; + int shell_last_element = -1; int node_ids[1] = {2}; int facet_id[8]; int elem_id[8]; @@ -91,6 +93,13 @@ int main(void) double conv_contact_gap = -1.0; double conv_combined_norm = -1.0; double linsol_residual = -1.0; + double shell_drilling_factor = -1.0; + double shell_s3_shear_factor = -1.0; + double shell_s3_shear_min_scale = -1.0; + double shell_last_drilling = -1.0; + double shell_last_shear_scale = -1.0; + double shell_min_shear_scale = -1.0; + double shell_max_drilling = -1.0; ierr = femlite_initialize(); if (ierr != 0) return check_ierr(ierr, 1); @@ -130,6 +139,35 @@ int main(void) ierr = femlite_set_linear_solver(1, 1); if (ierr != 0) return check_ierr(ierr, 51); + ierr = femlite_get_shell_stabilization(&shell_drilling_factor, + &shell_s3_shear_factor, + &shell_s3_shear_min_scale); + if (ierr != 0) return check_ierr(ierr, 52); + if (fabs(shell_drilling_factor - 1.0e-4) > 1.0e-16 || + fabs(shell_s3_shear_factor - 0.0625) > 1.0e-16 || + fabs(shell_s3_shear_min_scale - 1.0e-4) > 1.0e-16) return 53; + ierr = femlite_get_shell_stability_stats(&shell_sample_count, + &shell_last_element, + &shell_last_drilling, + &shell_last_shear_scale, + &shell_min_shear_scale, + &shell_max_drilling); + if (ierr != 0) return check_ierr(ierr, 54); + if (shell_sample_count != 0 || shell_last_element != 0 || + shell_last_drilling != 0.0 || shell_last_shear_scale != 1.0 || + shell_min_shear_scale != 1.0 || shell_max_drilling != 0.0) return 55; + ierr = femlite_set_shell_stabilization(1.0e-3, 0.125, 1.0e-5); + if (ierr != 0) return check_ierr(ierr, 56); + ierr = femlite_get_shell_stabilization(&shell_drilling_factor, + &shell_s3_shear_factor, + &shell_s3_shear_min_scale); + if (ierr != 0) return check_ierr(ierr, 57); + if (fabs(shell_drilling_factor - 1.0e-3) > 1.0e-16 || + fabs(shell_s3_shear_factor - 0.125) > 1.0e-16 || + fabs(shell_s3_shear_min_scale - 1.0e-5) > 1.0e-16) return 58; + ierr = femlite_set_shell_stabilization(1.0e-4, 0.0625, 1.0e-4); + if (ierr != 0) return check_ierr(ierr, 59); + ierr = femlite_get_convergence_status(&conv_increment, &conv_iteration, &conv_residual_norm, &conv_correction_norm, diff --git a/tests/module/test_element_stiffness.f90 b/tests/module/test_element_stiffness.f90 index b35f918..b1af19b 100644 --- a/tests/module/test_element_stiffness.f90 +++ b/tests/module/test_element_stiffness.f90 @@ -1,6 +1,7 @@ program test_element_stiffness use fem_precision use fem_error + use fem_control use fem_database use fem_element_stiffness implicit none @@ -16,6 +17,8 @@ program test_element_stiffness call check_s4_stiff() call check_s6_stiff() call check_s8_stiff() + call check_shell_stab_controls() + call check_s3_shear_lock_diag() call check_bad_stiff_type() contains @@ -204,6 +207,75 @@ contains if (ierr .ne. FEM_SUCCESS) call fail(109) end subroutine check_s8_stiff + subroutine check_shell_stab_controls() + integer :: ierr + integer :: elem_dofs(MAX_TEST_DOF) + integer :: n_elem_dof + real(rk) :: ke(MAX_TEST_DOF,MAX_TEST_DOF) + real(rk) :: default_energy + real(rk) :: zero_energy + real(rk) :: high_energy + + call control_set_defaults() + call setup_s4(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(110) + call element_linear_stiffness(1, elem_dofs, n_elem_dof, ke, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(111) + default_energy = shell_drilling_energy(ke, n_elem_dof) + if (default_energy .le. TOL) call fail(112) + if (shell_stability_sample_count .ne. 1) call fail(113) + if (shell_stability_last_elem .ne. 1) call fail(114) + if (shell_stability_last_drilling .le. ZERO) call fail(115) + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(116) + + call control_set_defaults() + shell_drilling_stiffness_factor = ZERO + call setup_s4(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(117) + call element_linear_stiffness(1, elem_dofs, n_elem_dof, ke, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(118) + zero_energy = shell_drilling_energy(ke, n_elem_dof) + if (zero_energy .gt. TOL) call fail(119) + if (abs(shell_stability_last_drilling) .gt. TOL) call fail(120) + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(121) + + call control_set_defaults() + shell_drilling_stiffness_factor = 1.0e-3_rk + call setup_s4(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(122) + call element_linear_stiffness(1, elem_dofs, n_elem_dof, ke, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(123) + high_energy = shell_drilling_energy(ke, n_elem_dof) + if (high_energy .le. 5.0_rk * default_energy) call fail(124) + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(125) + call control_set_defaults() + end subroutine check_shell_stab_controls + + subroutine check_s3_shear_lock_diag() + integer :: ierr + integer :: elem_dofs(MAX_TEST_DOF) + integer :: n_elem_dof + real(rk) :: ke(MAX_TEST_DOF,MAX_TEST_DOF) + + call control_set_defaults() + call setup_s3(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(130) + section_thickness(1) = 0.01_rk + call element_linear_stiffness(1, elem_dofs, n_elem_dof, ke, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(131) + if (shell_stability_sample_count .ne. 1) call fail(132) + if (shell_stab_last_shear_scale .ge. ONE) call fail(133) + if (abs(shell_stability_min_shear_scale - shell_stab_last_shear_scale) .gt. TOL) & + call fail(134) + if (shell_stability_max_drilling .le. ZERO) call fail(135) + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(136) + call control_set_defaults() + end subroutine check_s3_shear_lock_diag + subroutine check_bad_stiff_type() integer :: ierr integer :: elem_dofs(MAX_TEST_DOF) @@ -593,6 +665,24 @@ contains if (dot_product(x(1:n), y(1:n)) .le. TOL) call fail(code) end subroutine check_positive_energy + real(rk) function shell_drilling_energy(ke, n) + real(rk), intent(in) :: ke(MAX_TEST_DOF,MAX_TEST_DOF) + integer, intent(in) :: n + real(rk) :: x(MAX_TEST_DOF) + real(rk) :: y(MAX_TEST_DOF) + integer :: local_node + integer :: pos + + x = ZERO + y = ZERO + do local_node = 1, n / NDOF_NODE + pos = NDOF_NODE * (local_node - 1) + 6 + x(pos) = ONE + end do + y(1:n) = matmul(ke(1:n,1:n), x(1:n)) + shell_drilling_energy = dot_product(x(1:n), y(1:n)) + end function shell_drilling_energy + subroutine fail(code) integer, intent(in) :: code diff --git a/tests/module/test_shell_internal.f90 b/tests/module/test_shell_internal.f90 index 3e78ac2..f6fb35c 100644 --- a/tests/module/test_shell_internal.f90 +++ b/tests/module/test_shell_internal.f90 @@ -4,6 +4,7 @@ program test_shell_internal use fem_database use fem_element_internal use fem_element_stiffness + use fem_element_state use fem_quadrature use fem_shape_functions implicit none @@ -19,6 +20,9 @@ program test_shell_internal call check_s3_membrane_patch() call check_s4_membrane_patch() call check_s4_j2_membrane_plastic() + call check_s4_j2_shear_plastic() + call check_s4_j2_bending_plastic() + call check_s4_j2_trial_rollback() call check_s6_membrane_patch() call check_s8_membrane_patch() call check_shear_patch('S3', 1, 200) @@ -103,6 +107,108 @@ contains if (ierr .ne. FEM_SUCCESS) call fail(460) end subroutine check_s4_j2_membrane_plastic + subroutine check_s4_j2_shear_plastic() + integer :: ierr + integer, parameter :: MAX_SHELL_TEST_DOF = 60 + integer :: elem_dofs(MAX_SHELL_TEST_DOF) + integer :: n_elem_dof + real(rk) :: ke(MAX_SHELL_TEST_DOF,MAX_SHELL_TEST_DOF) + real(rk) :: ke_elastic(MAX_SHELL_TEST_DOF,MAX_SHELL_TEST_DOF) + real(rk) :: gamma_large + real(rk) :: elastic_shear + real(rk) :: shear_mod + + gamma_large = 0.20_rk + shear_mod = YOUNG / (2.0_rk * (ONE + POISSON)) + elastic_shear = shear_mod * gamma_large + + call setup_s4_j2(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(470) + call element_linear_stiffness(1, elem_dofs, n_elem_dof, ke_elastic, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(471) + call apply_xz_shear(gamma_large) + + call element_compute_internal_force(ierr, 0.1_rk) + if (ierr .ne. FEM_SUCCESS) call fail(472) + if (elem_status(1) .ne. 0) call fail(473) + if (statev(1,1) .le. ZERO) call fail(474) + if (statev(22,1) .le. ZERO) call fail(475) + if (abs(stress(5,1)) .ge. elastic_shear) call fail(476) + + call element_linear_stiffness(1, elem_dofs, n_elem_dof, ke, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(477) + if (n_elem_dof .ne. 24) call fail(478) + call check_matrix_symmetric(ke, n_elem_dof, 479) + if (ke(3,3) .ge. ke_elastic(3,3)) call fail(480) + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(481) + end subroutine check_s4_j2_shear_plastic + + subroutine check_s4_j2_bending_plastic() + integer :: ierr + integer, parameter :: MAX_SHELL_TEST_DOF = 60 + integer :: elem_dofs(MAX_SHELL_TEST_DOF) + integer :: n_elem_dof + real(rk) :: ke(MAX_SHELL_TEST_DOF,MAX_SHELL_TEST_DOF) + real(rk) :: ke_elastic(MAX_SHELL_TEST_DOF,MAX_SHELL_TEST_DOF) + real(rk) :: kappa_large + + kappa_large = 0.80_rk + + call setup_s4_j2(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(490) + call element_linear_stiffness(1, elem_dofs, n_elem_dof, ke_elastic, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(491) + call apply_x_bending(kappa_large) + + call element_compute_internal_force(ierr, 0.1_rk) + if (ierr .ne. FEM_SUCCESS) call fail(492) + if (elem_status(1) .ne. 0) call fail(493) + if (statev(1,1) .le. ZERO) call fail(494) + if (statev(22,1) .le. ZERO) call fail(495) + if (abs(statev(13,1) - kappa_large) .gt. 1.0e-8_rk) call fail(496) + if (abs(stress(1,1)) .le. ZERO) call fail(497) + + call element_linear_stiffness(1, elem_dofs, n_elem_dof, ke, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(498) + if (n_elem_dof .ne. 24) call fail(499) + call check_matrix_symmetric(ke, n_elem_dof, 500) + if (ke(5,5) .ge. ke_elastic(5,5)) call fail(501) + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(502) + end subroutine check_s4_j2_bending_plastic + + subroutine check_s4_j2_trial_rollback() + integer :: ierr + + call setup_s4_j2(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(510) + call element_state_begin_trial(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(511) + + call apply_xz_shear(0.20_rk) + call element_compute_internal_force(ierr, 0.1_rk) + if (ierr .ne. FEM_SUCCESS) call fail(512) + if (statev(1,1) .le. ZERO) call fail(513) + if (statev(22,1) .le. ZERO) call fail(514) + + call element_state_abort_trial(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(515) + if (maxval(abs(statev)) .gt. TOL) call fail(516) + if (maxval(abs(stress)) .gt. TOL) call fail(517) + if (maxval(abs(strain)) .gt. TOL) call fail(518) + + u = ZERO + call element_compute_internal_force(ierr, 0.1_rk) + if (ierr .ne. FEM_SUCCESS) call fail(519) + if (maxval(abs(fint)) .gt. TOL) call fail(520) + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(521) + end subroutine check_s4_j2_trial_rollback + subroutine check_s6_membrane_patch() integer :: ierr diff --git a/tests/scripts/run_example_smoke.py b/tests/scripts/run_example_smoke.py index 6f8e1ab..d043f69 100644 --- a/tests/scripts/run_example_smoke.py +++ b/tests/scripts/run_example_smoke.py @@ -19,6 +19,10 @@ def parse_args() -> argparse.Namespace: parser.add_argument("--output-interval", type=int, default=0) parser.add_argument("--require-contact", action="store_true") parser.add_argument("--require-friction", action="store_true") + parser.add_argument("--probe-node", type=int) + parser.add_argument("--probe-field", choices=("ux", "uy", "uz")) + parser.add_argument("--min-abs-displacement", type=float, default=0.0) + parser.add_argument("--sign", choices=("negative", "positive", "either"), default="either") return parser.parse_args() @@ -122,6 +126,41 @@ def check_friction_output(build_dir: Path, case_name: str, step: int) -> None: raise RuntimeError(f"{contact_file} did not record positive friction work") +def check_node_probe(args: argparse.Namespace, step: int) -> None: + if args.probe_node is None: + return + if args.probe_field is None: + raise RuntimeError("--probe-field is required when --probe-node is set") + + build_dir = Path(args.build_dir).resolve() + node_file = build_dir / "example_smoke" / args.case_name / f"nodes_{step:08d}.csv" + if not node_file.exists(): + raise RuntimeError(f"missing node output: {node_file}") + + with node_file.open(newline="", encoding="utf-8") as handle: + rows = list(csv.DictReader(handle)) + row = next( + (item for item in rows if int(item["node_id"]) == args.probe_node), + None, + ) + if row is None: + raise RuntimeError(f"{node_file} does not contain node {args.probe_node}") + + value = float(row[args.probe_field]) + if abs(value) < args.min_abs_displacement: + raise RuntimeError( + f"{args.probe_field} at node {args.probe_node} is too small: {value}" + ) + if args.sign == "negative" and value >= 0.0: + raise RuntimeError( + f"{args.probe_field} at node {args.probe_node} is not negative: {value}" + ) + if args.sign == "positive" and value <= 0.0: + raise RuntimeError( + f"{args.probe_field} at node {args.probe_node} is not positive: {value}" + ) + + def main() -> int: args = parse_args() _, steps = run_case(args) @@ -129,6 +168,7 @@ def main() -> int: check_contact_output(Path(args.build_dir).resolve(), args.case_name, steps) if args.require_friction: check_friction_output(Path(args.build_dir).resolve(), args.case_name, steps) + check_node_probe(args, steps) return 0