diff --git a/.gitignore b/.gitignore index 6a8468b..b5ee747 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ Testing/ history.csv nodes_*.csv elements_*.csv +reactions_*.csv result_*.vtk restart_*.frs /output/ diff --git a/CMakeLists.txt b/CMakeLists.txt index a947dd4..6fb829d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.20) project(FemLite - VERSION 0.2.0 + VERSION 0.3.0 LANGUAGES C Fortran ) @@ -367,8 +367,50 @@ set_tests_properties(implicit_inp PROPERTIES ) add_test(NAME cli_implicit_linear - COMMAND femlite tests/data/c3d4_implicit_pull.inp --implicit-linear + COMMAND femlite tests/data/c3d4_implicit_pull.inp --implicit-linear --output-interval 0 ) set_tests_properties(cli_implicit_linear PROPERTIES WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" ) + +file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/cli_static_linear_output") +add_test(NAME cli_static_linear + COMMAND femlite tests/data/c3d4_static_pull.inp --static-linear + --output-dir "${CMAKE_BINARY_DIR}/cli_static_linear_output" +) +set_tests_properties(cli_static_linear PROPERTIES + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" +) + +file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/cli_static_nonlinear_output") +add_test(NAME cli_static_nonlinear + COMMAND femlite tests/data/c3d4_static_nonlinear_elastic.inp + --static-nonlinear + --output-dir "${CMAKE_BINARY_DIR}/cli_static_nonlinear_output" + --output-interval 1 +) +set_tests_properties(cli_static_nonlinear PROPERTIES + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" +) + +file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/cli_implicit_newmark_output") +add_test(NAME cli_implicit_newmark + COMMAND femlite tests/data/c3d4_implicit_newmark_pull.inp + --implicit-newmark + --output-dir "${CMAKE_BINARY_DIR}/cli_implicit_newmark_output" + --output-interval 1 +) +set_tests_properties(cli_implicit_newmark PROPERTIES + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" +) + +file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/cli_implicit_newmark_nonlinear_output") +add_test(NAME cli_implicit_newmark_nonlinear + COMMAND femlite tests/data/c3d4_implicit_newmark_pull.inp + --implicit-newmark-nonlinear + --output-dir "${CMAKE_BINARY_DIR}/cli_implicit_newmark_nonlinear_output" + --output-interval 1 +) +set_tests_properties(cli_implicit_newmark_nonlinear PROPERTIES + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" +) diff --git a/docs/01_requirements_specification.md b/docs/01_requirements_specification.md index ab41708..765e735 100644 --- a/docs/01_requirements_specification.md +++ b/docs/01_requirements_specification.md @@ -6,18 +6,18 @@ ## 1. 文档目的 -本文档用于定义 FEM 软件模块的功能需求、非功能需求、输入输出要求、约束条件、阶段开发范围和第一版验收标准。 +本文档用于定义 FEM 软件模块的功能需求、非功能需求、输入输出要求、约束条件、阶段开发范围和阶段验收标准。 本文档将需求划分为四类: - MUST:第一版必须实现,作为第一阶段验收依据 -- SHOULD:第二版或后续版本应实现,第一版架构需预留扩展能力 +- SHOULD:第二版或第三版应实现,第一版架构需预留扩展能力 - COULD:可选增强功能,不作为近期验收条件 - OUT OF SCOPE:当前阶段明确不实现 ## 2. 项目目标 -本软件面向船舶接触爆炸问题中的船体结构响应分析,支持三维线弹性、弹塑性和瞬态动力学计算。 +本软件面向船舶接触爆炸问题中的船体结构响应分析,支持三维线弹性、弹塑性、瞬态动力学和后续静力学计算。 目标包括: @@ -26,7 +26,8 @@ - MUST:暴露与 SPH 方法进行边界耦合的力学接口 - MUST:第一版支持显式瞬态动力学分析 - MUST:第一版支持实体单元 C3D4、C3D8 和基础壳单元 S4 -- SHOULD:第二版支持更完整的壳单元、接触和隐式非线性求解 +- SHOULD:第二版支持更完整的壳单元、CSR、隐式线弹性最小流程、基础接触、VTK 和 restart 能力 +- SHOULD:第三版正式支持线性静力学、非线性静力学、壳单元静力学、隐式 Newmark + Newton 非线性动力学和通用接触 - SHOULD:第二版支持 VTK 输出和 restart 能力 ## 3. 应用场景 @@ -39,7 +40,8 @@ - MUST:基础 S4 壳单元参与的板结构动力响应分析 - SHOULD:壳-实体混合模型瞬态响应分析 - SHOULD:接触冲击和复杂边界约束分析 -- SHOULD:隐式非线性增量迭代分析 +- SHOULD:线性静力和非线性静力分析 +- SHOULD:隐式非线性动力学增量迭代分析 ## 4. 阶段范围 @@ -59,17 +61,31 @@ ### 4.2 第二版范围 -第二版应完成: +第二版应完成最小可用工程扩展: - C3D10、C3D20、S3、S6、S8 单元 - Robin 边界 - MPC 约束方程 -- 接触算法 -- 隐式 Newmark + Newton 非线性求解 +- 基础 penalty 接触算法 +- 隐式线弹性小变形求解最小流程 - CSR 全局矩阵格式 - VTK 结果输出 - restart 能力 +### 4.3 第三版范围 + +第三版应正式完成静力学和隐式非线性主线: + +- 线性静力学求解 +- 非线性静力学求解 +- 壳单元线性静力刚度 +- Scordelis-Lo 等壳静力基准算例 +- 隐式 Newmark + Newton 非线性动力学框架 +- 实体和壳的弹塑性隐式路径 +- 通用接触搜索和节点-面、面-面接触框架 +- Newton 线搜索、失败回滚和可选步长缩减控制 +- 静力学反力、收敛历史和 VTK/CSV 输出 + ## 5. 功能需求 ### 5.1 物理模型 @@ -85,7 +101,9 @@ - MUST:材料失效与单元删除 - MUST:Johnson-Cook 应变率效应 - MUST:温度效应 -- SHOULD:隐式非线性增量迭代 +- SHOULD:线性静力学 +- SHOULD:非线性静力学 +- SHOULD:隐式非线性动力学增量迭代 说明: @@ -145,11 +163,19 @@ 第二版求解要求: -- SHOULD:隐式 Newmark + Newton 非线性求解 +- SHOULD:隐式线弹性小变形求解最小流程 - SHOULD:CSR 作为隐式求解的主稀疏矩阵格式 - COULD:skyline 格式作为低优先级调试或小规模验证格式 - COULD:外部稀疏线性求解器接口 +第三版求解要求: + +- SHOULD:线性静力学求解,方程形式为 K u = f +- SHOULD:非线性静力学求解,方程形式为 R(u) = 0 +- SHOULD:隐式 Newmark + Newton 非线性动力学求解 +- SHOULD:载荷步、增量步、Newton 迭代、线搜索、收敛准则、失败回退和可选步长缩减控制 +- SHOULD:实体和壳单元均可参与线性静力学求解 + ### 5.6 边界条件与载荷 第一版必须支持: @@ -163,7 +189,13 @@ - SHOULD:Robin 弹簧/阻尼边界 - SHOULD:MPC 约束方程 -- SHOULD:接触边界 +- SHOULD:基础接触边界 + +第三版应支持: + +- SHOULD:通用节点-面接触 +- SHOULD:通用面-面接触框架 +- SHOULD:接触对、接触面、接触状态、接触力和接触功输出 ### 5.7 SPH-FEM 耦合接口 @@ -224,6 +256,19 @@ FEM 更新边界状态并进入下一耦合步 - MUST:关键数据缺失时返回 error 并终止当前分析 - MUST:输入解析日志应记录已识别 keyword、不支持 keyword 和错误位置 +第三版应扩展支持以下 Abaqus inp keyword 或其 FemLite 子集: + +- SHOULD:*STATIC +- SHOULD:*CONTROLS +- SHOULD:*SURFACE +- SHOULD:*CONTACT PAIR +- SHOULD:*TIE +- SHOULD:*OUTPUT +- SHOULD:*NODE PRINT +- SHOULD:*EL PRINT +- SHOULD:*NODE FILE +- SHOULD:*EL FILE + ### 5.9 输出需求 第一版必须支持: @@ -243,6 +288,14 @@ FEM 更新边界状态并进入下一耦合步 - SHOULD:VTK 结果文件输出 - SHOULD:restart 文件输出与读取 +第三版静力学输出应支持: + +- SHOULD:静力步和增量历史 +- SHOULD:Newton 残差范数和迭代次数 +- SHOULD:节点反力 +- SHOULD:静力 VTK 结果 +- SHOULD:静力 CSV 历史量 + ### 5.10 错误诊断 软件应诊断并报告: @@ -326,14 +379,26 @@ FEM 更新边界状态并进入下一耦合步 - 二次实体单元 - 更多壳单元 -- 接触 +- 基础接触 - Robin 和 MPC -- 隐式非线性求解 +- 隐式线弹性最小流程 - CSR 稀疏矩阵 - VTK 输出 - restart -### 8.3 后续阶段 +### 8.3 第三阶段 + +第三阶段目标是形成可验收的静力学和隐式非线性能力: + +- 线性静力和非线性静力求解 +- 实体单元和壳单元静力刚度 +- Scordelis-Lo 壳静力基准 +- 隐式 Newmark + Newton 动力学 +- 通用接触搜索与接触输出 +- 静力学反力和收敛历史输出 +- 第三版验收算例和回归测试 + +### 8.4 后续阶段 后续可考虑: @@ -362,3 +427,17 @@ FEM 更新边界状态并进入下一耦合步 - 允许误差 - 日志检查项 - 回归测试判据 + +## 10. 第三版验收标准 + +第三版必须通过以下验收项: + +- SHOULD:实体单元线弹性静力 patch test +- SHOULD:实体单元单轴拉伸静力 +- SHOULD:实体单元 J2 弹塑性静力加载卸载 +- SHOULD:Scordelis-Lo 壳静力基准 +- SHOULD:板壳弯曲静力基准 +- SHOULD:隐式动力弹性波 +- SHOULD:简化接触静力压入 +- SHOULD:简化接触动力冲击 +- SHOULD:第一版和第二版已验收测试无回退 diff --git a/docs/02_software_architecture_design.md b/docs/02_software_architecture_design.md index 24eb7b5..0e72d33 100644 --- a/docs/02_software_architecture_design.md +++ b/docs/02_software_architecture_design.md @@ -22,7 +22,8 @@ - Fortran95 过程式模块组织,不采用面向对象类型绑定 - 集中式数据库管理网格、材料、状态变量和全局向量 - 单元、材料、求解器、耦合和输出模块保持职责分离 -- 第二版预留壳单元扩展、接触、隐式非线性和 CSR 稀疏矩阵能力 +- 第二版形成壳单元扩展、CSR、隐式线弹性、基础接触、VTK、restart 和外部接口的最小可用框架 +- 第三版正式支持线性静力、非线性静力、壳单元静力、隐式非线性动力学和通用接触 ## 3. 交付形态 @@ -41,6 +42,13 @@ - 更完整后处理工具链 - 外部求解器适配层 +第三版交付应补充: + +- 静力学命令行分析模式 +- 静力学核心库接口 +- 壳静力和非线性静力验证算例 +- 静力学收敛历史、反力和 VTK/CSV 输出 + ## 4. 目录结构 建议目录结构: @@ -51,8 +59,8 @@ src/input Abaqus inp 读取与输入数据预处理 src/mesh 网格、集合、facet、自由度编号 src/material 材料模型与状态变量更新 src/element 实体单元、壳单元、形函数、积分规则 -src/solver 显式求解器、隐式求解器预留、稀疏矩阵预留 -src/boundary 边界条件、载荷、约束、接触预留 +src/solver 显式求解器、静力求解器、隐式动力求解器、稀疏矩阵 +src/boundary 边界条件、载荷、约束、接触 src/coupling FEM 外部耦合接口和 SPH 力映射 src/output 日志、CSV、VTK 预留、restart 预留 src/app femlite 命令行程序 @@ -99,8 +107,10 @@ Core FEM Layer Solver Layer explicit central difference solver - implicit solver placeholder - CSR matrix placeholder + linear static solver + nonlinear static solver + implicit Newmark solver + CSR matrix layer Input/Output Layer Abaqus inp reader @@ -274,20 +284,57 @@ for each time step: end for ``` -第二版隐式控制流预留: +第二版隐式线弹性控制流: + +```text +initialize model +build CSR sparsity +assemble linear elastic stiffness +assemble external load vector +apply Dirichlet and constraint equations +solve K u = f +recover strain and stress +write output +``` + +第三版非线性静力控制流: ```text initialize model build CSR sparsity for each increment: - predict displacement and velocity + apply load factor and prescribed displacement increment Newton iteration: - assemble residual + assemble internal force and external force + assemble residual R = F_ext - F_int assemble tangent matrix apply boundary and constraint equations solve correction + optionally perform line search update trial state check convergence + if failed and allowed, restore state and cut back increment + commit state + write output +end for +``` + +第三版隐式 Newmark 动力学控制流: + +```text +initialize model +build CSR sparsity +for each time increment: + Newmark predict displacement and velocity + Newton iteration: + assemble effective residual + assemble effective tangent K_eff + apply boundary, MPC and contact equations + solve correction + optionally perform line search + update trial displacement, velocity and acceleration + check convergence + if failed and allowed, restore kinematics/state and cut back step commit state write output end for @@ -338,6 +385,15 @@ coupling 层职责: - VTK 结果文件 - restart 文件 +第三版输出: + +- 静力学收敛历史文件 +- 节点反力输出 +- 接触状态、接触力和接触功输出 +- 隐式增量残差和迭代次数输出 + +第三版当前接触模块保留刚性平面接触,并新增基于边界 facet 的面-面 contact pair force/tangent 路径。完整接触状态、接触功和搜索加速仍属于后续输出与算法增强项。 + 输出控制: - 输出频率由 fem_control 统一管理。 diff --git a/docs/03_detailed_design.md b/docs/03_detailed_design.md index 3a0ba2e..39c0350 100644 --- a/docs/03_detailed_design.md +++ b/docs/03_detailed_design.md @@ -61,6 +61,21 @@ src/output/fem_output_vtk.f90 src/output/fem_restart.f90 ``` +第三版重点完善或增加: + +```text +src/solver/fem_solver_static.f90 +src/solver/fem_solver_newmark.f90 +src/element/fem_element_stiffness.f90 +src/output/fem_output_convergence.f90 +``` + +说明: + +- 静力求解可独立放在 fem_solver_static.f90,也可在 fem_solver_implicit.f90 中分子程序实现。 +- 单元静力刚度应由 fem_element_stiffness.f90 统一调度实体和壳单元。 +- 输出模块应统一显式、静力和隐式动力结果字段。 + ## 4. 全局精度与常量模块 模块:fem_precision.f90 @@ -166,6 +181,25 @@ logical :: use_user_dt logical :: large_deformation ``` +第三版静力和隐式控制变量: + +```fortran +character(len=32) :: analysis_type ! EXPLICIT / STATIC_LINEAR / STATIC_NONLINEAR / IMPLICIT_DYNAMIC +integer :: max_increment +integer :: max_newton_iter +integer :: current_increment +real(rk) :: static_time +real(rk) :: load_factor +real(rk) :: newton_tol_force +real(rk) :: newton_tol_disp +real(rk) :: newmark_beta +real(rk) :: newmark_gamma +real(rk) :: rayleigh_alpha_mass +real(rk) :: rayleigh_beta_stiffness +logical :: use_line_search +logical :: allow_step_cutback +``` + 显式求解默认: - large_deformation = .true. @@ -506,6 +540,8 @@ end subroutine - 计算 C3D4、C3D8 集中质量。 - 计算单元内力。 +- 计算线性静力单元刚度。 +- 为非线性静力和隐式动力提供切线刚度或近似切线刚度。 - 更新高斯点应力和状态变量。 - 估算稳定时间步。 - 处理材料点失效并向单元删除逻辑报告。 @@ -529,6 +565,14 @@ subroutine solid_stable_dt(elem, dtcrit, ierr) real(rk), intent(out) :: dtcrit integer, intent(out) :: ierr end subroutine + +subroutine solid_linear_stiffness(elem, elem_dofs, n_elem_dof, ke, ierr) + integer, intent(in) :: elem + integer, intent(out) :: elem_dofs(:) + integer, intent(out) :: n_elem_dof + real(rk), intent(out) :: ke(:,:) + integer, intent(out) :: ierr +end subroutine ``` 单元删除策略: @@ -558,7 +602,21 @@ end subroutine - S4 作为可计算单元纳入第一版。 - 壳大变形和有限转动能力在第一版中保持受限实现。 -- 更完整壳理论、hourglass 控制和二次壳单元在第二版完善。 +- 二次壳单元和基础壳响应在第二版扩展,hourglass 控制、drilling DOF 稳定和壳静力刚度在第三版继续完善。 + +第二版状态: + +- S3、S6、S8 纳入基础能力。 +- S4 膜、弯曲、横向剪切和压力路径增强。 +- 壳单元仍优先服务显式动力学。 + +第三版要求: + +- 提供 S3、S4、S6、S8 线性静力刚度。 +- 支持 Mindlin-Reissner 壳膜、弯曲和横向剪切刚度装配。 +- 提供 drilling DOF 稳定处理。 +- 支持壳单元静力应力、应变和节点反力输出。 +- Scordelis-Lo 屋面壳体作为壳静力基准验收模型。 ## 14. 边界与载荷模块 @@ -686,6 +744,87 @@ write output if requested 第一版只保留接口占位,不要求装配全局刚度矩阵。 +第三版静力求解接口建议: + +```fortran +subroutine fem_solve_static_linear(max_iter, tol, iter, res_norm, ierr) + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr +end subroutine + +subroutine fem_solve_static_nonlinear(max_increment, max_iter, tol, & + iter, res_norm, ierr) + integer, intent(in) :: max_increment + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr +end subroutine + +subroutine fem_get_static_convergence(nincrement, niter, residual, ierr) + integer, intent(out) :: nincrement + integer, intent(out) :: niter + real(rk), intent(out) :: residual + integer, intent(out) :: ierr +end subroutine +``` + +第三版隐式动力接口建议: + +```fortran +subroutine fem_advance_implicit_newmark(dt, max_iter, tol, iter, res_norm, ierr) + real(rk), intent(in) :: dt + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr +end subroutine + +subroutine fem_run_implicit_newmark(max_iter, tol, iter_total, res_norm, ierr) + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter_total + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr +end subroutine + +subroutine fem_advance_newmark_nonlinear(dt, max_iter, tol, iter, res_norm, ierr) + real(rk), intent(in) :: dt + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr +end subroutine + +subroutine fem_run_newmark_nonlinear(max_iter, tol, iter_total, res_norm, ierr) + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter_total + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr +end subroutine + +subroutine fem_set_rayleigh_damping(alpha_mass, beta_stiffness, ierr) + real(rk), intent(in) :: alpha_mass + real(rk), intent(in) :: beta_stiffness + integer, intent(out) :: ierr +end subroutine +``` + +当前非线性 Newmark-Newton 实现约定: + +- 实体单元切线从当前积分点材料状态取得弹性/J2 算法切线。 +- 壳单元膜内项对 J2/J2_JC 使用当前积分点算法切线,弯曲和横向剪切项暂用弹性近似切线。 +- 每个非线性增量保存材料状态和单元状态备份,迭代试算前恢复,收敛后提交,失败后回滚。 +- Robin、MPC、刚性平面 penalty contact 和面-面 contact pair 的切线进入 Newton 有效刚度。 +- 静力和非线性 Newmark 均支持线搜索;可选步长缩减在失败时恢复增量起点状态后重试。 + ## 17. 稀疏矩阵模块 模块:fem_sparse_csr.f90 @@ -753,6 +892,13 @@ elements_step_xxxxx.csv 至少包含: - VTK 输出 - restart 输出与读取 +第三版增加: + +- `convergence.csv`:静力和隐式动力增量迭代历史。 +- `reactions_step_xxxxx.csv`:节点反力。 +- `contact_step_xxxxx.csv`:接触状态、接触力和接触功。 +- 静力求解结束后必须写出与显式结果一致的 VTK 场文件。 + ## 19. 主程序模块 模块:fem_program.f90 @@ -780,6 +926,21 @@ femlite input.inp femlite input.inp --dt 1.0e-8 --time 1.0e-4 --output-interval 10 ``` +第三版命令行建议: + +```text +femlite input.inp --static-linear +femlite input.inp --static-nonlinear --max-increment 20 --max-iter 25 --tol 1.0e-6 +femlite input.inp --implicit-newmark --dt 1.0e-5 --time 1.0e-2 +femlite input.inp --implicit-newmark-nonlinear --dt 1.0e-5 --time 1.0e-2 +``` + +兼容性约定: + +- `--implicit-linear` 可作为 `--static-linear` 的兼容别名。 +- `--run` 保持显式动力学默认流程。 +- 静力模式和显式动力学模式不得在同一命令中同时启用。 + ## 20. 内存分配与释放 内存策略: @@ -797,4 +958,3 @@ subroutine database_allocate(ierr) subroutine database_initialize(ierr) subroutine database_finalize(ierr) ``` - diff --git a/docs/04_mathematical_model_and_algorithms.md b/docs/04_mathematical_model_and_algorithms.md index b02a8dd..f5ffeda 100644 --- a/docs/04_mathematical_model_and_algorithms.md +++ b/docs/04_mathematical_model_and_algorithms.md @@ -29,14 +29,21 @@ - 可选线性和二次 bulk viscosity。 - SPH 压力、剪切力和节点力映射。 -第二版应补充: +第二版应补充或形成最小可用框架: -- 基于 F = Fe Fp 的有限应变塑性。 -- Rayleigh 阻尼。 -- 接触算法。 -- 隐式 Newmark + Newton 非线性算法。 +- 基础 penalty 接触算法。 +- 隐式线弹性小变形求解最小流程。 - C3D10、C3D20、S3、S6、S8。 -- 更完整的壳 hourglass 控制。 + +第三版应补充: + +- 线性静力学算法。 +- 非线性静力学 Newton-Raphson 算法。 +- 壳单元线性静力刚度。 +- 隐式 Newmark + Newton 非线性动力学算法。 +- Rayleigh 阻尼在隐式路径中的一致接入。 +- 通用接触搜索、节点-面接触和面-面接触框架。 +- 更完整的壳 hourglass 控制、drilling DOF 稳定和壳塑性路径。 ## 3. 符号与约定 @@ -98,6 +105,18 @@ t = -p n + tau_s on Gamma_sph M a + C v + F_int(u, state) = F_ext + F_sph + F_contact ``` +线性静力方程: + +```text +K u = F_ext +``` + +非线性静力平衡方程: + +```text +R(u, state) = F_ext - F_int(u, state) - F_contact(u) = 0 +``` + 第一版不实现接触,故实际显式残差为: ```text @@ -205,7 +224,7 @@ I_i += rho A_e h^3 / (12 nnode) - 第一版默认无 Rayleigh 阻尼。 - 第一版支持可选线性和二次 bulk viscosity。 -- 第二版实现 Rayleigh 阻尼。 +- 第三版在隐式动力路径中实现 Rayleigh 阻尼。 bulk viscosity 可写为等效附加压力: @@ -371,8 +390,9 @@ kappa_s = 5 / 6 - S4 可用于板受压力脉冲等基础动力响应。 - S4 大转动能力有限。 -- hourglass 控制第二版完善。 +- hourglass 控制第三版完善。 - S3、S6、S8 第二版实现。 +- 壳单元线性静力刚度第三版实现并用于 Scordelis-Lo 验证。 S4 删除默认规则: @@ -464,7 +484,7 @@ W = skew(L) 应力更新采用 Cauchy 应力和 Jaumann 客观率。塑性修正仍采用 J2 偏应力返回思想。 -第二版应补充: +第三版或后续应补充: ```text F = Fe Fp @@ -640,31 +660,147 @@ Delta_W_ext = 0.5 (F_ext_n + F_ext_(n+1)) . Delta_u SPH 功按 fsph 单独累计。 -## 16. 隐式算法预留 +## 16. 静力与隐式算法 -第二版隐式算法采用 Newmark + Newton。 +第二版提供隐式线弹性小变形求解最小流程: -预留方程: +```text +K u = F_ext +``` + +该流程用于验证 CSR 装配、线性求解器、Dirichlet 约束和小型实体静力算例。 + +第三版线性静力算法正式支持实体和壳单元: + +```text +assemble K +assemble F_ext +apply Dirichlet, MPC and Robin terms +solve K u = F_ext +recover strain, stress and reaction +write static output +``` + +第三版非线性静力算法采用 Newton-Raphson: + +```text +for each load increment: + predict u + for each Newton iteration: + compute F_int(u, state_trial) + compute R = F_ext - F_int - F_contact + assemble K_tangent + apply constraints + solve K_tangent Delta_u = R + update u + check force and displacement convergence + commit state +``` + +当前 V3.4/V3.5 阶段实现采用 Newton 形式: + +- 残差使用当前位移下的非线性内力 `F_int(u,state)`。 +- 实体单元切线使用当前积分点弹性/J2 算法切线;壳单元膜内项对 J2/J2_JC 使用当前积分点算法切线,壳弯曲和横向剪切项暂保留弹性近似。 +- Dirichlet、CLOAD、DLOAD、Robin、MPC、SPH/contact 外力向量进入静力残差。 +- Robin、MPC、刚性平面 penalty contact 和面-面 contact pair 切线进入 Newton 切线矩阵。 +- 材料状态和单元删除标志采用增量级 trial/restore/commit;非收敛时恢复到增量起点。 +- Newton 线搜索默认启用;可选步长缩减在增量失败时回退到增量起点并缩小当前增量。 + +第三版隐式动力算法采用 Newmark + Newton。 + +有效残差方程: ```text R(u) = F_ext - F_int(u,state) - M a - C v K_eff Delta_u = R ``` +当前 V3.5 阶段实现提供线性 Newmark 和非线性 Newmark-Newton 骨架。默认参数: + +```text +beta = 1/4 +gamma = 1/2 +``` + +预测量: + +```text +u_pred = u_n + dt v_n + dt^2 (1/2 - beta) a_n +v_pred = v_n + dt (1 - gamma) a_n +``` + +当前线性有效方程: + +```text +a0 = 1 / (beta dt^2) +K_eff = K + a0 M +K_eff u_{n+1} = F_{n+1} + a0 M u_pred +a_{n+1} = a0 (u_{n+1} - u_pred) +v_{n+1} = v_pred + gamma dt a_{n+1} +``` + +Rayleigh 阻尼: + +```text +C = alpha_M M + beta_K K +K_eff = K + a0 M + a1 C +``` + +非线性 Newmark-Newton 骨架: + +```text +u_trial = u_pred + Delta_u +a_trial = a0 (u_trial - u_pred) +v_trial = v_pred + gamma dt a_trial +R = F_ext(t_{n+1}) - F_int(u_trial,state) - M a_trial - C v_trial +K_eff Delta_u = R +``` + +当前实现中 `K_eff` 使用当前实体材料算法切线、壳膜内塑性算法切线或壳弹性近似切线、集中质量矩阵、Rayleigh 阻尼和外部约束/接触切线形成。收敛判据使用绝对力残差和相对力残差,Dirichlet 约束自由度的位移增量残差置零。非线性 Newmark 支持线搜索;可选步长缩减在单步失败时恢复运动学量和材料 trial 状态后重试。 + +当前限制: + +- Rayleigh 阻尼已在线性 Newmark 和非线性 Newmark-Newton 骨架中接入。 +- 实体 J2 非线性 Newmark 使用当前积分点算法切线,壳膜内 J2/J2_JC 使用当前积分点算法切线,壳弯曲/剪切塑性切线仍为后续增强项。 +- 材料状态和单元删除标志已具备 trial/restore/commit 机制。 +- Robin 和 MPC 的非线性动力切线已接入 `K_eff`。 +- 刚性平面 contact 和面-面 contact pair 的 penalty/damping 切线已接入 `K_eff`。 +- 主要用于验证质量矩阵、CSR 有效刚度、Dirichlet 约束和命令行流程。 + 第一版不装配全局刚度矩阵,不要求算法切线用于求解。 -## 17. 接触算法预留 +第三版应记录: -第二版实现接触。 +- 每个增量的 Newton 迭代次数。 +- 初始残差、当前残差和相对残差。 +- 线性求解器迭代次数。 +- 收敛、失败和步长缩减状态。 -预留方向: +## 17. 接触算法 + +第二版实现基础 penalty 接触。 + +第三版接触算法方向: - penalty 接触。 -- 接触搜索。 +- 通用接触搜索。 +- 节点-面接触。 +- 面-面接触框架。 - 接触法向与穿透量。 - 接触阻尼。 +- 摩擦接口预留。 +- 静力接触和动力接触统一残差接口。 - 接触功输出。 +当前第三版阶段实现: + +- 刚性平面接触仍采用节点到平面的 penalty/damping 法向接触。 +- 面-面 contact pair 使用边界 facet 的当前构形坐标、速度、法向和面积。 +- slave facet 质心投影到 master facet 平面,投影点落在 master facet 等效半径和搜索距离内且法向间隙为负时激活。 +- 接触力为 `penalty * penetration * area` 加可选法向阻尼项,均分到 slave 和 master facet 节点。 +- 接触切线采用法向 penalty/damping 块,装配 slave-slave、slave-master、master-slave 和 master-master 四类自由度耦合。 +- 当前尚未实现摩擦、mortar 积分、精确面内投影裁剪、空间加速搜索和完整接触功统计。 + 第一版不实现接触,只保留 fcontact 向量和接口位置。 ## 18. 稳定性与误差控制 @@ -700,6 +836,17 @@ K_eff Delta_u = R - 板受压力脉冲。 - 简化 SPH-FEM 边界力传递接口。 +第三版验收算例: + +- 实体单元线弹性静力 patch test。 +- 实体单元单轴拉伸静力。 +- 实体单元 J2 弹塑性静力加载卸载。 +- Scordelis-Lo 壳静力基准。 +- 板壳弯曲静力基准。 +- 隐式动力弹性波传播。 +- 简化接触静力压入。 +- 简化接触动力冲击。 + 算法专项验证: - 小应变 J2 单点返回映射。 @@ -708,4 +855,3 @@ K_eff Delta_u = R - 绝热温升单点测试。 - 单元删除规则测试。 - 压力符号测试。 - diff --git a/docs/05_interface_control_document.md b/docs/05_interface_control_document.md index adc7225..3f3a3b2 100644 --- a/docs/05_interface_control_document.md +++ b/docs/05_interface_control_document.md @@ -29,6 +29,15 @@ - 高斯点结果查询接口。 - VTK 和 restart 相关接口。 +第三版提供: + +- 线性静力求解接口。 +- 非线性静力求解接口。 +- 隐式 Newmark 动力学推进接口。 +- 静力收敛历史查询接口。 +- 节点反力查询接口。 +- 接触状态、接触力和接触功查询接口。 + ## 3. 接口设计原则 接口设计遵循: @@ -220,6 +229,79 @@ fem_advance_explicit(dt) 在 SPH 驱动模式下,时间步长由外部程序传入。 +第三版静力和隐式动力接口: + +```fortran +subroutine fem_solve_static_linear(max_iter, tol, iter, res_norm, ierr) + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr +end subroutine + +subroutine fem_solve_static_nonlinear(max_increment, max_iter, tol, & + iter, res_norm, ierr) + integer, intent(in) :: max_increment + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr +end subroutine + +subroutine fem_advance_implicit_newmark(dt, max_iter, tol, iter, res_norm, ierr) + real(rk), intent(in) :: dt + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr +end subroutine + +subroutine fem_run_implicit_newmark(max_iter, tol, iter_total, res_norm, ierr) + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter_total + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr +end subroutine + +subroutine fem_advance_newmark_nonlinear(dt, max_iter, tol, iter, res_norm, ierr) + real(rk), intent(in) :: dt + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr +end subroutine + +subroutine fem_run_newmark_nonlinear(max_iter, tol, iter_total, res_norm, ierr) + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter_total + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr +end subroutine + +subroutine fem_set_rayleigh_damping(alpha_mass, beta_stiffness, ierr) + real(rk), intent(in) :: alpha_mass + real(rk), intent(in) :: beta_stiffness + integer, intent(out) :: ierr +end subroutine +``` + +说明: + +- 静力接口不要求调用 `fem_compute_lumped_mass`。 +- 隐式动力接口可复用质量矩阵、阻尼矩阵、CSR 矩阵和边界条件数据库。 +- `fem_solve_static_linear` 与命令行 `--static-linear` 对应。 +- `--implicit-linear` 保留为 `--static-linear` 的兼容别名。 +- `fem_run_implicit_newmark` 使用输入文件中的时间控制运行到 `time_end`。 +- `fem_run_newmark_nonlinear` 使用输入文件中的时间控制运行到 `time_end`,对应命令行 `--implicit-newmark-nonlinear`。 +- `fem_set_rayleigh_damping` 设置 `C = alpha_mass M + beta_stiffness K`。 +- 非线性 Newmark Fortran95 接口当前接入实体 J2 算法切线、壳膜内 J2/J2_JC 切线、trial/restore/commit、线搜索、可选步长缩减、Robin/MPC 切线、刚性平面 penalty contact 切线和面-面 contact pair 切线;C ABI 和 Python 调试接口跟随扩展。 + ## 10. 载荷接口 ### 10.1 外力清零 @@ -422,6 +504,73 @@ end subroutine - 第一版返回单元平均值。 - 高斯点查询作为第二版高级接口实现。 +### 12.4 节点反力 + +第三版提供节点反力查询: + +```fortran +subroutine fem_get_nodal_reactions(nnode_in, node_id, reaction, ierr) + integer, intent(in) :: nnode_in + integer, intent(in) :: node_id(nnode_in) + real(rk), intent(out) :: reaction(6,nnode_in) + integer, intent(out) :: ierr +end subroutine +``` + +说明: + +- `reaction(1:3,:)` 为平动反力。 +- `reaction(4:6,:)` 为转动反力或力矩。 +- 实体单元未激活转动自由度时,对应分量返回 0。 + +### 12.5 静力收敛历史 + +第三版提供当前或最近一次静力/隐式求解收敛状态查询: + +```fortran +subroutine fem_get_convergence_status(increment, iteration, residual_norm, & + correction_norm, converged, ierr) + integer, intent(out) :: increment + integer, intent(out) :: iteration + real(rk), intent(out) :: residual_norm + real(rk), intent(out) :: correction_norm + logical, intent(out) :: converged + integer, intent(out) :: ierr +end subroutine +``` + +### 12.6 接触状态 + +第三版提供接触结果查询接口: + +```fortran +subroutine fem_get_contact_summary(nactive_contact, contact_work, max_penetration, ierr) + integer, intent(out) :: nactive_contact + real(rk), intent(out) :: contact_work + real(rk), intent(out) :: max_penetration + integer, intent(out) :: ierr +end subroutine +``` + +第三版当前 contact pair 采用 Fortran95 核心数据库接口配置: + +```fortran +subroutine database_allocate_contact_pair(num_pairs, ierr) + integer, intent(in) :: num_pairs + integer, intent(out) :: ierr +end subroutine +``` + +配置数组包括: + +- `contact_pair_slave(pair)`:slave 接触目标,可为 elset 名称、element id 字符串或 `ALL`。 +- `contact_pair_master(pair)`:master 接触目标,可为 elset 名称、element id 字符串或 `ALL`。 +- `contact_pair_penalty(pair)`:法向 penalty 刚度,必须大于 0。 +- `contact_pair_damping(pair)`:法向阻尼,必须非负。 +- `contact_pair_search(pair)`:搜索距离,0 表示只按 facet 等效半径过滤。 + +当前 contact pair 查询统计仍以 `fem_get_contact_summary` 为目标接口,完整激活数量、最大穿透量和接触功统计将在接触输出阶段补齐。 + ## 13. 输出控制接口 ```fortran @@ -446,6 +595,7 @@ end subroutine - 第一版输出 CSV 和日志。 - 第二版扩展 VTK 和 restart。 +- 第三版扩展静力收敛历史、反力和接触结果输出。 - 外部程序可关闭自动输出并显式调用 `fem_write_output`。 ## 14. 版本与错误查询接口 @@ -559,3 +709,7 @@ fem_finalize - 对三维数组接口提供扁平化视图。 - 包装层单独测试,不污染 FEM 核心。 +第三版包装层扩展: + +- C ABI 暴露静力求解、反力查询和收敛状态查询。 +- Python 调试接口支持运行静力算例并导出关键位移、反力和残差历史。 diff --git a/docs/06_test_and_verification_plan.md b/docs/06_test_and_verification_plan.md index ed648c2..7f45cc1 100644 --- a/docs/06_test_and_verification_plan.md +++ b/docs/06_test_and_verification_plan.md @@ -6,9 +6,9 @@ ## 1. 文档目的 -本文档定义 FemLite 第一版的测试层级、测试工具、验证算例、确认算例、回归测试、性能测试、误差容限和发布阻断条件。 +本文档定义 FemLite 各阶段的测试层级、测试工具、验证算例、确认算例、回归测试、性能测试、误差容限和发布阻断条件。 -本文档用于判断第一版是否达到可开发、可联调、可回归和可验收状态。 +本文档用于判断各阶段是否达到可开发、可联调、可回归和可验收状态。 ## 2. 测试目标 @@ -45,6 +45,14 @@ Python 环境约定: - Python 调试接口测试。 - C ABI 包装层接口测试。 +第三版扩展: + +- 线性静力和非线性静力测试。 +- 壳单元静力基准测试。 +- 隐式 Newmark 动力学测试。 +- 通用接触测试。 +- 静力反力、收敛历史和 VTK 输出测试。 + ## 4. 测试目录结构 建议目录结构: @@ -96,6 +104,7 @@ P1 包括: - 第一版验收验证算例。 - 中等规模动力学回归测试。 +- 小型线性静力和非线性静力回归测试。 - 阶段性能测试。 - 跨平台编译检查。 @@ -103,6 +112,7 @@ P2 包括: - 性能长跑。 - 长时间动力学稳定测试。 +- Scordelis-Lo 壳静力基准和网格收敛测试。 - Abaqus/Explicit 可选对比。 - 复杂耦合流程测试。 @@ -221,6 +231,31 @@ SPH总力映射测试 relative tolerance 1.0e-10 to 1.0e-8 - S4 横向剪切响应。 - S4 选择性减缩积分路径。 - S4 patch test。 +- S3/S4/S6/S8 线性静力刚度测试。 +- S4 J2/J2_JC 膜内塑性状态更新和膜内算法切线对称性测试。 +- Scordelis-Lo 壳静力位移基准测试。 +- 板壳弯曲静力基准测试。 + +静力与隐式求解测试: + +- CSR 线性静力装配。 +- Dirichlet 约束施加后的反力平衡。 +- 线性静力实体 patch test。 +- 线性静力壳 patch test。 +- 非线性静力 Newton 收敛。 +- 非线性静力步长缩减。 +- 非线性静力线搜索和失败回滚测试。 +- 隐式 Newmark 单步预测校正。 +- C3D4 单步隐式 Newmark 拉伸解析对照。 +- Rayleigh 质量比例阻尼解析对照。 +- `--implicit-newmark` 命令行回归测试。 +- 非线性 Newmark-Newton 线弹性退化解析对照。 +- 实体 J2 算法切线基本性质测试。 +- 非线性 Newmark-Newton 失败后 trial rollback 测试。 +- 非线性 Newmark-Newton Robin/MPC/contact 切线解析对照。 +- 非线性 Newmark-Newton 线搜索和动态步长缩减测试。 +- `--implicit-newmark-nonlinear` 命令行回归测试。 +- 隐式动力弹性波传播。 边界与载荷测试: @@ -228,6 +263,8 @@ SPH总力映射测试 relative tolerance 1.0e-10 to 1.0e-8 - 节点力施加。 - 面压力等效节点力。 - amplitude 常值和表格插值。 +- 刚性平面 contact penalty/damping 力和切线。 +- 面-面 contact pair 法向力、阻尼项、CSR 图案和切线块。 输出测试: @@ -257,6 +294,19 @@ SPH总力映射测试 relative tolerance 1.0e-10 to 1.0e-8 - *STEP - *DYNAMIC +第三版新增 keyword 测试: + +- *STATIC +- *CONTROLS +- *SURFACE +- *CONTACT PAIR +- *TIE +- *OUTPUT +- *NODE PRINT +- *EL PRINT +- *NODE FILE +- *EL FILE + 集合测试: - *NSET, GENERATE。 @@ -329,6 +379,9 @@ facet 导出测试: - 错误日志检查。 - 独立 femlite 程序运行。 - 外部 SPH 驱动式调用流程。 +- 静力线性完整求解流程。 +- 静力非线性完整求解流程。 +- 隐式 Newmark 动力学完整求解流程。 典型流程测试: @@ -354,6 +407,19 @@ fem_advance_explicit fem_get_nodal_kinematics ``` +第三版静力流程测试: + +```text +fem_initialize +fem_read_inp +fem_build_model +fem_solve_static_linear / fem_solve_static_nonlinear +fem_get_nodal_reactions +fem_get_convergence_status +fem_write_output +fem_finalize +``` + ## 15. 第一版验证算例 第一版验收算例: @@ -399,6 +465,16 @@ fem_get_nodal_kinematics - 壳-实体混合模型响应。 - Abaqus/Explicit 对比算例。 +第三版确认算例: + +- Scordelis-Lo 屋面壳体静力基准。 +- 板壳弯曲静力基准。 +- 实体单元线弹性静力 patch test。 +- 实体单元 J2 弹塑性静力加载卸载。 +- 隐式动力弹性波传播。 +- 简化接触静力压入。 +- 简化接触动力冲击。 + ## 17. 回归测试 基准结果目录: @@ -517,6 +593,13 @@ tests/reference - 增加 C ABI 和 Python 接口测试。 - 增加 VTK/restart 回归测试。 +第三版: + +- CI 增加静力学和隐式求解 P0/P1 测试。 +- CI 增加壳静力小型基准测试。 +- 本地发布前运行 Scordelis-Lo 和接触 P2 测试。 +- 保留 Windows GCC、WSL gfortran 和 Intel Fortran 兼容性检查记录。 + ## 21. 发布阻断条件 以下任一情况应阻断第一版发布: @@ -546,3 +629,17 @@ tests/reference - CSV 输出符合接口文档。 - 所有第一版文档更新到与实现一致。 +## 23. 第三版验收准则 + +第三版完成条件: + +- 第一版和第二版全部 P0/P1 测试无回退。 +- 线性静力实体单元 patch test 通过。 +- 线性静力壳单元 patch test 通过。 +- Scordelis-Lo 壳静力基准通过参考位移容限检查。 +- 实体单元 J2 弹塑性静力加载卸载通过。 +- 非线性静力 Newton 收敛历史和失败回退测试通过。 +- 隐式 Newmark 动力学小算例通过。 +- 简化接触静力和动力算例通过。 +- 静力 VTK、CSV、反力和收敛历史输出字段完整。 +- Windows 和 Linux 均可编译并通过第三版 P0 测试。 diff --git a/docs/v2_acceptance_report.md b/docs/v2_acceptance_report.md index db95fd3..cf11487 100644 --- a/docs/v2_acceptance_report.md +++ b/docs/v2_acceptance_report.md @@ -15,13 +15,14 @@ FemLite 0.2.0 定位为第二版最小可用/阶段验收版。 -本次验收依据 `docs/07_v2_development_plan.md` 的第二版完成准则,重点确认: +本次验收依据 `docs/v2_development_plan.md` 的第二版完成准则,重点确认: - 0.1.0 第一版验收能力无回退。 - 第二版关键框架能力已经进入可编译、可测试、可扩展状态。 - C3D10、C3D20、S3、S6、S8、CSR、隐式线弹性、Robin、MPC、基础接触、VTK、restart、C ABI、Python 调试接口和 CI 均具备最小可用能力。 本次验收不等价于完整工程级隐式非线性求解器或通用接触算法验收。 +本次验收也不等价于完整静力学能力验收;壳单元静力刚度、非线性静力和工程级静力输出列入 0.3.0。 ## 3. 验收环境 @@ -126,6 +127,7 @@ ctest --test-dir build-wsl-debug --output-on-failure ## 8. 已知限制 - 隐式求解当前为线性静力/准静力最小流程,不是完整 Newmark + Newton 非线性瞬态框架。 +- 当前线性静力最小流程主要覆盖实体单元;壳单元静力刚度和 Scordelis-Lo 静力基准列入 0.3.0。 - 接触当前为基础 penalty 刚性平面接触,不是通用面-面接触,也未实现完整接触搜索优化。 - VTK 输出为 legacy ASCII 格式,已覆盖字段生成测试;正式工程可视化仍建议补充 ParaView 人工检查记录。 - restart 当前恢复同一模型上的显式状态,不保存完整 inp 模型数据库。 @@ -136,11 +138,16 @@ ctest --test-dir build-wsl-debug --output-on-failure 0.3.0 建议重点推进: +- 正式静力学计算支持,包括 `*STATIC`、`--static-linear` 和 `--static-nonlinear`。 +- 实体单元和壳单元线性静力刚度,重点补齐 S3、S4、S6、S8 壳静力。 +- Scordelis-Lo 屋面壳体静力基准和板壳弯曲静力基准。 +- 非线性静力 Newton-Raphson 增量迭代。 - 完整隐式 Newmark + Newton 非线性增量迭代。 - 一致切线或有效切线策略。 - 通用接触搜索和面-面接触。 - 更完整接触输出,包括接触力、接触功和接触状态。 - 壳单元 hourglass 控制和更完整壳塑性路径。 +- 静力学反力、收敛历史、VTK 和 CSV 输出。 - Windows、Linux、Intel Fortran 多平台持续验证。 - ParaView VTK 可视化人工验收记录。 @@ -148,4 +155,4 @@ ctest --test-dir build-wsl-debug --output-on-failure FemLite 0.2.0 已达到第二版最小可用/阶段验收版标准。 -建议将当前 `dev/v0.2` 状态作为 0.2.0 阶段验收基线,并将完整隐式非线性求解和通用接触能力列入 FemLite 0.3.0。 +建议将当前 `dev/v0.2` 状态作为 0.2.0 阶段验收基线,并将静力学计算、壳静力基准、完整隐式非线性求解和通用接触能力列入 FemLite 0.3.0。 diff --git a/docs/07_v2_development_plan.md b/docs/v2_development_plan.md similarity index 100% rename from docs/07_v2_development_plan.md rename to docs/v2_development_plan.md diff --git a/docs/v3_acceptance_report.md b/docs/v3_acceptance_report.md new file mode 100644 index 0000000..e2d5970 --- /dev/null +++ b/docs/v3_acceptance_report.md @@ -0,0 +1,133 @@ +# FemLite 0.3.0 第三版验收报告 + +日期:2026-06-23 + +## 1. 版本信息 + +- 软件名称:FemLite +- 软件版本:0.3.0 +- 交付形态:静态库、命令行程序、C ABI 静态库、Python 调试脚本、测试程序和示例算例 +- 语言标准:Fortran 95 核心代码,C ABI 包装层使用 C +- 默认平台:WSL Ubuntu + gfortran 13.3 + CMake +- 发布分支:main + +## 2. 验收口径 + +FemLite 0.3.0 定位为第三版阶段验收版。 + +本次验收依据 `docs/v3_development_plan.md` 的第三版完成准则,重点确认: + +- 0.1.0 和 0.2.0 已验收能力无回退。 +- 线性静力、非线性静力、壳静力、隐式 Newmark 和非线性 Newmark-Newton 主流程可编译、可测试、可由命令行进入。 +- 实体和壳单元静力刚度、材料 trial/rollback、J2 算法切线、Robin/MPC/contact 切线、Rayleigh 阻尼、VTK/CSV 输出和示例算例进入阶段可用状态。 +- 通用接触推进到刚性平面接触和朴素面-面 contact pair force/tangent 框架。 + +本次验收不等价于完整工程级隐式非线性求解器或通用接触算法最终验收。完整 mortar/摩擦接触、空间加速搜索、壳弯曲/剪切塑性一致切线和更完整接触输出仍列入后续版本。 + +## 3. 验收环境 + +Windows 本地验证: + +- 工具链:C:\gcc-16.1.0-64,GNU C/GNU Fortran 16.1.0 +- 构建系统:CMake +- 构建目录:build-win-gcc-16 +- 测试结果:27/27 passed + +WSL Linux 验证: + +- 操作系统:WSL Ubuntu +- 编译器:GNU Fortran 13.3.0、GNU C 13.3.0 +- 构建系统:CMake +- 构建目录:build-wsl +- 测试结果:27/27 passed + +## 4. 第三版范围 + +0.3.0 已实现或完善: + +- `*STATIC`、`--static-linear` 和 `--static-nonlinear` 静力求解入口。 +- C3D4、C3D8、C3D10、C3D20 实体单元线性静力刚度。 +- S3、S4、S6、S8 壳单元线性静力刚度和基础壳静力测试。 +- 非线性静力 Newton-Raphson 增量迭代。 +- 隐式 Newmark 线性动力学和非线性 Newmark-Newton 骨架。 +- 材料状态和单元删除状态 trial/restore/commit/abort。 +- 实体 J2 算法切线,以及壳膜内 J2/J2_JC 算法切线路径。 +- Newton 线搜索和可选步长缩减。 +- Rayleigh 阻尼在隐式动力路径中的接入。 +- Robin、MPC、刚性平面接触和面-面 contact pair 的非线性切线装配。 +- 静力/隐式结果输出、反力和收敛状态接口。 +- `examples` 下的单轴拉伸、板壳拉伸、Scordelis-Lo、Kirsch、强度折减和冲击类示例。 + +## 5. 验收项结果 + +| 验收项 | 结果 | 覆盖说明 | +|---|---:|---| +| 第一版和第二版能力回归 | PASS | 显式、材料、二次单元、壳单元、VTK、restart、C ABI、Python debug 测试继续通过 | +| 线性静力实体单元 | PASS | C3D4/C3D8/C3D10/C3D20 静力 patch 和 CLI 流程测试通过 | +| 线性静力壳单元 | PASS | S3/S4/S6/S8 静力刚度和壳内部响应测试通过 | +| 非线性静力 | PASS | Newton、J2 状态更新、trial rollback、线搜索和 cutback 回滚测试通过 | +| 隐式 Newmark | PASS | 线性 Newmark、Rayleigh 阻尼和 CLI 流程测试通过 | +| 非线性 Newmark-Newton | PASS | 线弹性退化、Robin/MPC/contact 切线和失败回滚测试通过 | +| 通用接触增强 | PASS | 刚性平面接触和面-面 contact pair 法向力/切线测试通过 | +| 输出与接口 | PASS | VTK、CSV、restart、C ABI、Python debug 和静力/隐式 CLI 回归测试通过 | +| 版本号 | PASS | CMake 版本和 Fortran 版本常量均为 0.3.0 | + +## 6. 回归测试 + +Windows 最近一次本地结果: + +```text +ctest --test-dir build-win-gcc-16 -C Release --output-on-failure +100% tests passed, 0 tests failed out of 27 +``` + +WSL 最近一次本地结果: + +```text +wsl ctest --test-dir /mnt/d/Codex/FemLite/build-wsl --output-on-failure +100% tests passed, 0 tests failed out of 27 +``` + +主要测试集合: + +- smoke +- material_j2 +- element_infrastructure +- facet_topology +- database_topology +- element_state +- sparse_csr +- linear_solver_cg +- assembly_csr +- element_stiffness +- quadratic_mass +- quadratic_internal +- shell_mass +- shell_pressure +- shell_internal +- solver_implicit +- contact +- vtk_output +- restart +- c_api +- python_debug +- implicit_inp +- cli_implicit_linear +- cli_static_linear +- cli_static_nonlinear +- cli_implicit_newmark +- cli_implicit_newmark_nonlinear + +## 7. 已知限制 + +- 面-面 contact pair 当前为朴素 facet-centroid penalty 框架,尚未实现 mortar 接触、摩擦、空间加速搜索和工程级接触收敛控制。 +- 壳塑性一致切线当前推进到膜内项,壳弯曲和横向剪切塑性切线仍采用弹性近似。 +- 非线性 Newmark-Newton 已具备骨架和关键切线回归,但还需要更多工程基准和长时间稳定性验证。 +- 接触状态、最大穿透、接触功和接触历史输出仍需在后续输出阶段继续完善。 +- Intel Fortran 兼容性仍建议作为后续发布前补充验证项。 + +## 8. 验收结论 + +FemLite 0.3.0 已达到第三版阶段验收标准,可作为 0.3.0 发布基线。 + +建议将当前 `main` 状态打 `v0.3.0` 标签并推送到远端仓库。后续版本重点推进完整接触算法、壳塑性切线完善、更多工程基准和并行/性能优化。 diff --git a/docs/v3_development_plan.md b/docs/v3_development_plan.md new file mode 100644 index 0000000..e6292d0 --- /dev/null +++ b/docs/v3_development_plan.md @@ -0,0 +1,460 @@ +# FemLite 0.3.0 第三版开发计划 + +文档状态:第三版开发基线草稿 + +日期:2026-06-23 + +适用对象:FemLite 0.3.0 开发、评审、测试与阶段验收 + +## 1. 文档目的 + +本文档定义 FemLite 第三版的开发目标、阶段划分、技术路线、验收准则和风险控制。 + +第三版以 0.2.0 第二版最小可用/阶段验收版为起点,在不破坏第一版显式动力学和第二版框架能力的前提下,正式补齐静力学计算、壳单元静力、隐式非线性和通用接触能力。 + +## 2. 第三版定位 + +FemLite 0.3.0 定位为: + +```text +线性/非线性静力学 + 壳静力基准 + 隐式非线性动力学基础 + 通用接触增强版 +``` + +第三版不是简单增加示例算例,而是把 0.2.0 中的最小可用框架推进到可工程验收的求解能力。 + +第三版核心目标: + +- 正式支持线性静力学计算。 +- 正式支持非线性静力学计算。 +- 补齐实体单元和壳单元静力刚度。 +- 让 Scordelis-Lo 屋面壳体成为可验收的壳静力基准。 +- 建立隐式 Newmark + Newton 非线性动力学框架。 +- 增强通用接触搜索、节点-面接触和面-面接触框架。 +- 输出静力学反力、收敛历史、接触状态和 VTK/CSV 结果。 + +## 3. 开发基线 + +0.2.0 已具备: + +- 显式瞬态动力学。 +- C3D4、C3D8、C3D10、C3D20、S3、S4、S6、S8 基础单元能力。 +- 各向同性线弹性和 J2 弹塑性材料路径。 +- Abaqus inp 子集读取。 +- CSR 稀疏矩阵、CG 线性求解器和隐式线弹性最小流程。 +- Robin、MPC 和基础刚性平面 penalty 接触。 +- VTK、restart、C ABI 和 Python 调试接口。 +- Windows GCC 和 WSL gfortran 基础构建测试。 + +0.2.0 已知限制中进入第三版的内容: + +- 线性静力仅为最小流程,尚未正式覆盖壳单元静力。 +- 隐式求解不是完整 Newmark + Newton 非线性框架。 +- 接触不是通用面-面接触,也缺少完整接触搜索和接触输出。 +- 壳单元仍需 hourglass 控制、drilling DOF 稳定和更完整壳塑性路径。 +- 静力学反力、收敛历史和静力 VTK 输出需要统一工程化。 + +## 4. 版本与分支策略 + +建议分支: + +- `main`:保持已发布稳定版本。 +- `dev/v0.3`:第三版主开发分支。 +- `feature/v3-static`:静力学求解相关开发。 +- `feature/v3-shell-static`:壳单元静力刚度和基准算例。 +- `feature/v3-contact`:通用接触增强。 + +版本号策略: + +- 开发阶段使用 `0.3.0-dev`。 +- 第三版验收通过后更新为 `0.3.0`。 +- 发布前形成 `v3_acceptance_report.md`,但该报告应在验收阶段再创建。 + +## 5. 第三版阶段划分 + +第三版分为 8 个阶段。 + +| 阶段 | 名称 | 主要内容 | 阶段结果 | +|---|---|---|---| +| V3.1 | 静力学控制与输入 | `*STATIC`、命令行、控制参数、输出字段 | 静力模式可进入求解流程 | +| V3.2 | 实体线性静力 | C3D4/C3D8/C3D10/C3D20 静力刚度和反力 | 实体线性静力算例通过 | +| V3.3 | 壳线性静力 | S3/S4/S6/S8 壳静力刚度和 Scordelis-Lo | 壳静力基准可计算 | +| V3.4 | 非线性静力 | 修正 Newton、增量加载、J2 弹塑性、线搜索和步长缩减 | 小型弹性/J2 静力算例通过 | +| V3.5 | 隐式 Newmark | 线弹性 Newmark、非线性 Newmark-Newton、有效刚度和命令行入口 | 小型隐式动力算例通过 | +| V3.6 | 通用接触增强 | 接触面、搜索、节点-面预留、面-面框架 | 接触静力/动力小算例通过 | +| V3.7 | 输出与接口 | 反力、收敛历史、接触状态、API 扩展 | 静力/隐式输出完整 | +| V3.8 | 测试与验收 | 回归、基准、文档、验收报告 | 形成 0.3.0 验收版 | + +## 6. V3.1 静力学控制与输入 + +目标: + +- 将静力学作为正式求解类型,而不是隐式线弹性调试入口。 +- 保持 `--implicit-linear` 兼容,同时新增清晰命令行。 + +开发内容: + +1. 增加分析类型控制: + - `EXPLICIT_DYNAMIC` + - `STATIC_LINEAR` + - `STATIC_NONLINEAR` + - `IMPLICIT_DYNAMIC` +2. 命令行增加: + - `--static-linear` + - `--static-nonlinear` + - `--implicit-newmark` + - `--implicit-newmark-nonlinear` +3. 保留: + - `--implicit-linear` 作为 `--static-linear` 兼容别名 + - `--run` 作为显式动力学运行入口 +4. INP 读取增加: + - `*STATIC` + - `*CONTROLS` 的 FemLite 子集 +5. 控制参数增加: + - 最大增量数 + - 最大 Newton 迭代次数 + - 力残差容限 + - 位移修正容限 + - 是否允许步长缩减 + +验收条件: + +- 静力命令行和显式命令行互斥检查正确。 +- `*STATIC` 可被读取并进入静力分析流程。 +- 不支持的 Abaqus 静力参数 warning 后跳过。 +- 静力分析日志记录步长、增量、迭代和输出设置。 + +## 7. V3.2 实体线性静力 + +目标: + +- 将实体单元线性静力求解从最小流程提升为正式功能。 + +开发内容: + +1. 完善 C3D4 线性弹性刚度矩阵。 +2. 完善 C3D8 线性弹性刚度矩阵。 +3. 接入 C3D10、C3D20 线性弹性刚度矩阵。 +4. 支持 CLOAD、DLOAD、Dirichlet、Robin 和 MPC 在静力方程中的装配。 +5. 计算节点反力。 +6. 静力求解后恢复单元应力、应变和等效结果。 +7. 静力求解后写出 VTK 和 CSV。 + +验收条件: + +- C3D4/C3D8 patch test 通过。 +- C3D10/C3D20 小型线弹性静力算例通过。 +- 单轴拉伸静力位移与解析解误差满足容限。 +- 约束反力总和与外载平衡。 + +## 8. V3.3 壳线性静力 + +目标: + +- 补齐第三版最关键缺口:壳单元静力计算。 + +开发内容: + +1. 实现 S3 线性静力刚度。 +2. 实现 S4 线性静力刚度。 +3. 实现 S6 线性静力刚度。 +4. 实现 S8 线性静力刚度。 +5. 采用 Mindlin-Reissner 壳: + - 膜刚度 + - 弯曲刚度 + - 横向剪切刚度 +6. 增加 drilling DOF 稳定处理。 +7. 处理壳单元转动自由度约束和反力矩输出。 +8. 补充 Scordelis-Lo 屋面壳体静力基准。 +9. 补充板壳弯曲静力基准。 + +验收条件: + +- S3/S4/S6/S8 壳静力 patch test 通过。 +- Scordelis-Lo 关键位移与参考结果在约定容限内。 +- 板壳弯曲基准位移趋势和数量级正确。 +- 壳静力 VTK 中位移、转角、应力和应变字段完整。 + +## 9. V3.4 非线性静力 + +目标: + +- 建立可用于弹塑性加载卸载的非线性静力框架。 + +开发内容: + +1. Newton-Raphson 主循环。 +2. 增量加载控制。 +3. 位移边界条件增量施加。 +4. 力残差和位移修正收敛准则。 +5. 失败回退和步长缩减。 +6. 小应变 J2 弹塑性静力路径。 +7. 大变形 Updated Lagrangian 静力路径。 +8. 实体 J2 算法切线,壳膜内 J2 算法切线,壳弯曲/剪切塑性切线后续完善。 +9. 材料状态 trial/commit 机制。 + +当前实现状态: + +- 已实现 `fem_solve_static_nonlinear(max_increment, max_iter, tol, iter, res_norm, ierr)`。 +- 已实现命令行 `--static-nonlinear` 入口。 +- 已实现按 `*STATIC` 时间控制分增量加载。 +- 当前残差由 CLOAD、DLOAD、Robin、MPC、SPH、contact 外力和内力共同构成。 +- 实体单元切线按积分点材料状态使用弹性/J2 算法切线;壳单元膜内项对 J2/J2_JC 使用当前积分点算法切线,弯曲和横向剪切项暂保留弹性近似。 +- 已实现材料状态和单元删除标志的 trial/restore/commit 机制,非收敛时恢复到增量起点。 +- 已接入 Robin、MPC、刚性平面 penalty contact 和面-面 contact pair 的非线性切线。 +- 已覆盖弹性非线性退化、位移控制 J2 塑性状态更新和 trial rollback 测试。 +- 已实现 Newton 线搜索;可选步长缩减支持在非收敛时回退到增量起点并缩小当前增量。 +- 壳弯曲/剪切塑性一致切线、节点-面接触、摩擦接触和接触输出统计仍需继续完善。 + +验收条件: + +- 弹性非线性静力退化到线性静力结果。 +- 小应变 J2 弹塑性加载卸载曲线合理。 +- 大变形 J2 静力小算例无明显能量或残差异常。 +- Newton 收敛历史可输出。 +- 非收敛算例能明确返回错误或执行步长缩减。 + +## 10. V3.5 隐式 Newmark 动力学 + +目标: + +- 在静力 Newton 框架基础上形成隐式动力学基础能力。 + +开发内容: + +1. Newmark 参数控制。 +2. 位移、速度、加速度预测。 +3. 有效残差: + +```text +R = F_ext - F_int - C v - M a +``` + +4. 有效切线: + +```text +K_eff = K_t + a0 M + a1 C +``` + +5. Rayleigh 阻尼接入。 +6. 隐式动力输出与显式输出字段对齐。 + +当前实现状态: + +- 已实现 `fem_advance_implicit_newmark(dt, max_iter, tol, iter, res_norm, ierr)`。 +- 已实现 `fem_run_implicit_newmark(max_iter, tol, iter_total, res_norm, ierr)`。 +- 已实现 `fem_advance_newmark_nonlinear(dt, max_iter, tol, iter, res_norm, ierr)`。 +- 已实现 `fem_run_newmark_nonlinear(max_iter, tol, iter_total, res_norm, ierr)`。 +- 已实现命令行 `--implicit-newmark` 入口。 +- 已实现命令行 `--implicit-newmark-nonlinear` 入口。 +- 默认 Newmark 参数为 `beta=0.25`、`gamma=0.5`。 +- 当前有效刚度为 `K_eff = K + a0 M + a1 C`。 +- 已接入线性 Rayleigh 阻尼 `C = alpha_M M + beta_K K`。 +- 已提供 `fem_set_rayleigh_damping(alpha_mass, beta_stiffness, ierr)`。 +- 已覆盖 C3D4 单步隐式 Newmark 拉伸、Rayleigh 阻尼、非线性 Newmark 线弹性退化和 CLI 回归测试。 +- 已覆盖非线性 Newmark 中 Robin、MPC、刚性平面接触切线、面-面 contact pair 切线和失败后 trial rollback 的解析小算例。 +- 非线性 Newmark 对实体 J2 使用当前积分点算法切线;壳膜内 J2/J2_JC 使用当前积分点算法切线,壳弯曲/剪切塑性切线和更完整隐式动力基准尚未完成。 +- 已实现非线性 Newmark 线搜索;可选动态步长缩减在单步失败时恢复运动学量和材料 trial 状态后重试。 + +验收条件: + +- 单自由度弹簧质量系统与解析解或参考解一致。 +- 小型实体弹性波传播可运行。 +- 显式和隐式在小变形弹性小算例上趋势一致。 +- 隐式动力残差和迭代历史可输出。 + +## 11. V3.6 通用接触增强 + +目标: + +- 将第二版基础刚性平面接触扩展为可用于结构接触问题的通用框架。 + +开发内容: + +1. `*SURFACE` 输入子集。 +2. `*CONTACT PAIR` 输入子集。 +3. 接触面数据结构。 +4. 朴素接触搜索,后续再优化为空间网格或 BVH。 +5. 节点-面接触。 +6. 面-面接触框架。 +7. penalty 法默认接触力。 +8. 接触阻尼。 +9. 接触状态、接触力、最大穿透量和接触功输出。 +10. 接触接口与 SPH 耦合层保持分离。 + +当前实现状态: + +- 保留第二版刚性平面 penalty 接触路径。 +- 新增 `contact_pair_slave/master/penalty/damping/search` 集中式数据库数组,可通过 elset、element id 或 `ALL` 指定接触对目标。 +- 面-面接触采用边界 facet 的质心投影、法向间隙和 penalty/damping 法向力映射,当前用于小规模接触对验证。 +- CSR 稀疏图案会为 contact pair 预留 slave-slave、slave-master、master-slave 和 master-master 切线块。 +- 已补充 contact pair 法向力和切线装配测试。 +- 当前尚未实现摩擦、mortar 接触、空间加速搜索、完整接触状态输出和工程级接触收敛控制。 + +验收条件: + +- 刚性平面接触第二版能力无回退。 +- 节点-面接触小算例通过。 +- 面-面接触框架可运行并输出接触状态。 +- 静力压入算例反力合理。 +- 动力接触冲击算例稳定运行。 + +## 12. V3.7 输出与接口 + +目标: + +- 让静力、非线性静力、隐式动力和接触结果可检查、可回归、可后处理。 + +开发内容: + +1. `convergence.csv`: + - step + - increment + - iteration + - residual_norm + - correction_norm + - converged +2. `reactions_step_xxxxx.csv`: + - node_id + - rx_force + - ry_force + - rz_force + - mx + - my + - mz +3. `contact_step_xxxxx.csv`: + - contact_id + - node_id 或 facet_id + - penetration + - normal_force + - tangential_force + - contact_status +4. 静力 VTK 输出: + - displacement + - rotation + - stress + - strain + - plastic strain + - element status +5. Fortran95 接口扩展: + - `fem_solve_static_linear` + - `fem_solve_static_nonlinear` + - `fem_advance_implicit_newmark` + - `fem_advance_newmark_nonlinear` + - `fem_run_newmark_nonlinear` + - `fem_get_nodal_reactions` + - `fem_get_convergence_status` + - `fem_get_contact_summary` +6. C ABI 和 Python 调试接口跟随扩展。 + +验收条件: + +- 静力求解结束后自动写出 VTK 和 CSV。 +- 反力总和可用于外载平衡检查。 +- 收敛历史文件字段固定且可由 Python 脚本读取。 +- 接触输出能用于判断接触激活、最大穿透和接触功。 + +## 13. V3.8 测试、文档与验收 + +目标: + +- 完成第三版验收闭环。 + +开发内容: + +1. 更新六份核心手册至第三版实现状态。 +2. 更新 CTest 测试集合。 +3. 增加第三版 P0/P1/P2 测试分组。 +4. 增加示例和验证算例 README。 +5. 形成 0.3.0 验收报告。 +6. 更新版本号为 0.3.0。 +7. 发布前完成 Windows 和 Linux 构建验证。 + +验收条件: + +- 第一版和第二版测试无回退。 +- 第三版新增 P0/P1 全部通过。 +- P2 关键基准完成并形成记录。 +- 文档、命令行帮助、示例和实现一致。 +- 形成 0.3.0 验收报告。 + +## 14. 第三版测试策略 + +第三版测试必须保留第一版和第二版回归。 + +P0 测试: + +- 编译测试。 +- CSR 和线性求解器测试。 +- 实体线性静力小算例。 +- 壳线性静力小算例。 +- 静力反力平衡测试。 +- `*STATIC` 输入解析测试。 +- 静力 VTK/CSV 输出字段测试。 + +P1 测试: + +- 实体 patch test。 +- 壳 patch test。 +- 单轴拉伸静力。 +- 弹塑性静力加载卸载。 +- 隐式 Newmark 小算例。 +- 节点-面接触小算例。 +- Windows/Linux 构建测试。 + +P2 测试: + +- Scordelis-Lo 壳静力基准。 +- 板壳弯曲静力基准。 +- 简化接触静力压入。 +- 简化接触动力冲击。 +- 10000 节点/10000 单元静力或准静力性能测试。 + +## 15. 第三版完成准则 + +第三版完成必须满足: + +- 0.1.0 和 0.2.0 已验收能力无回退。 +- `--static-linear` 可用于实体和壳单元。 +- `--static-nonlinear` 可用于小型弹塑性静力算例。 +- `--implicit-newmark` 可运行小型隐式动力算例。 +- `--implicit-newmark-nonlinear` 可运行小型非线性 Newmark-Newton 骨架算例。 +- Scordelis-Lo 壳静力基准通过。 +- 通用接触基础算例通过。 +- 静力反力、收敛历史、接触输出和 VTK 输出完整。 +- Windows GCC、WSL gfortran 至少通过 P0/P1 测试。 +- Intel Fortran 兼容性完成检查或记录明确限制。 +- 形成 `v3_acceptance_report.md` 或等价验收报告。 + +## 16. 风险与控制 + +主要风险: + +- 壳单元静力刚度和显式壳内力路径不一致。 +- drilling DOF 稳定处理不当导致壳静力奇异或过硬。 +- 非线性静力状态提交和回滚不清晰。 +- 接触搜索和接触力可能导致 Newton 迭代不收敛。 +- 静力输出和显式输出字段不一致,增加后处理负担。 +- Fortran95 限制下接口数量增加,容易造成重复代码。 + +控制措施: + +- 先实现线性静力,再实现非线性静力。 +- 先实体,再壳;先 S4/S3,再 S6/S8。 +- Scordelis-Lo 作为壳静力主基准,分网格逐步验证。 +- 非线性静力先完成实体 J2 算法切线,再推进壳膜内塑性切线,最后补齐壳弯曲/剪切塑性一致切线。 +- 接触先保留刚性平面和朴素面-面框架,再补节点-面、摩擦和搜索加速。 +- 输出字段先冻结格式,再增加内容。 +- 每个阶段均保持 CTest 可通过。 + +## 17. 与后续版本的边界 + +第三版不强制完成: + +- 高性能外部稀疏求解器绑定。 +- 并行接触搜索。 +- 完整摩擦接触模型。 +- 完整热传导求解。 +- 完整 Abaqus inp 全关键字兼容。 +- 大规模工程级隐式非线性性能优化。 + +这些内容可进入 0.4.0 或后续版本。 diff --git a/examples/Kirsch/models.sme.kirsch_plate.pdf b/examples/Kirsch/models.sme.kirsch_plate.pdf new file mode 100644 index 0000000..3d7fa13 Binary files /dev/null and b/examples/Kirsch/models.sme.kirsch_plate.pdf differ diff --git a/examples/Kirsch/models.sme.kirsch_plate.zh_CN.pdf b/examples/Kirsch/models.sme.kirsch_plate.zh_CN.pdf new file mode 100644 index 0000000..b81a75e Binary files /dev/null and b/examples/Kirsch/models.sme.kirsch_plate.zh_CN.pdf differ diff --git a/examples/ScordelisLo/README.md b/examples/ScordelisLo/README.md new file mode 100644 index 0000000..77430b6 --- /dev/null +++ b/examples/ScordelisLo/README.md @@ -0,0 +1,58 @@ +# ScordelisLo + +FemLite Scordelis-Lo cylindrical roof shell benchmark example. + +Benchmark geometry and data follow the COMSOL Scordelis-Lo roof PDF included in +this directory: + +- Radius: R = 25.0 +- Roof length: 2L = 50.0 +- Modeled length: L = 25.0, using quarter-model symmetry +- Modeled opening angle: 40 degrees +- Thickness: 0.25 +- Material: E = 4.32E8 Pa, nu = 0.0, density = 1 kg/m3 +- Surface load: fz = -90 N/m2 + +The mesh is generated in the rectangular parameter domain using the Gmsh Python +API and mapped to the cylindrical midsurface: + +```text +x in [0, 25] +theta in [0 deg, 40 deg] +y = R sin(theta) +z = R cos(theta) +``` + +FemLite notes: + +- `scordelislo_tri.inp` uses 176 linear S3 triangular shell elements. +- `scordelislo_quad.inp` uses 70 linear S4 quadrilateral shell elements. +- The PDF's surface load is represented as equivalent nodal `CLOAD` values + computed from `fz * tributary area`. +- The outer straight edge is free. +- The outer curved edge at x = 25 is constrained in global `uy` and `uz`. +- The curved inner edge at x = 0 uses a symmetry approximation: `ux = 0`, + `ry = 0`, and `rz = 0`. +- The straight top edge at theta = 0 uses a symmetry approximation: `uy = 0`, + `rx = 0`, and `rz = 0`. +- Analysis control: explicit transient, dt = 1.0E-5 s, total time = 0.1 s. +- Output: FemLite writes history CSV, nodal/element CSV, and legacy ASCII VTK + files during `--run`. + +Regenerate the decks: + +```powershell +Python\.venv\Scripts\python.exe -m pip install -r examples\ScordelisLo\requirements.txt +Python\.venv\Scripts\python.exe examples\ScordelisLo\generate_scordelis_lo.py --backend auto +``` + +Run one deck from the repository root: + +```powershell +New-Item -ItemType Directory -Force examples\ScordelisLo\results\tri | Out-Null +build-win-gcc-16\femlite.exe examples\ScordelisLo\scordelislo_tri.inp --output-dir examples\ScordelisLo\results\tri --output-interval 500 --run +``` + +The data above are taken from `models.sme.scordelis_lo_roof.pdf`. The symmetry +rotation constraints are an explicit FemLite approximation of COMSOL's shell +symmetry edge condition using the available nodal shell DOFs. diff --git a/examples/ScordelisLo/generate_scordelis_lo.py b/examples/ScordelisLo/generate_scordelis_lo.py new file mode 100644 index 0000000..e2094bf --- /dev/null +++ b/examples/ScordelisLo/generate_scordelis_lo.py @@ -0,0 +1,334 @@ +#!/usr/bin/env python3 +"""Generate FemLite Scordelis-Lo roof shell benchmark input decks. + +The topology is generated in a rectangular parameter domain by the Gmsh Python +API and then mapped to the cylindrical midsurface. +""" + +from __future__ import annotations + +import argparse +import math +from dataclasses import dataclass +from pathlib import Path +from typing import Dict, List, Sequence, Tuple + + +RADIUS = 25.0 +ROOF_LENGTH = 50.0 +MODEL_LENGTH = 0.5 * ROOF_LENGTH +MODEL_ANGLE = 40.0 * math.pi / 180.0 +THICKNESS = 0.25 +YOUNG_MODULUS = 4.32e8 +POISSON_RATIO = 0.0 +DENSITY = 1.0 +FACE_LOAD_Z = -90.0 +END_TIME = 0.10 +TIME_STEP = 1.0e-5 +TRI_NX = 11 +TRI_NTHETA = 8 +QUAD_NX = 10 +QUAD_NTHETA = 7 +SET_LINE_WIDTH = 16 + + +Point3 = Tuple[float, float, float] +Element = Tuple[int, ...] + + +@dataclass +class Mesh: + nodes: Dict[int, Point3] + elements: List[Element] + element_type: str + + +def try_import_gmsh(): + try: + import gmsh # type: ignore + except ImportError: + return None + return gmsh + + +def map_to_roof(x_param: float, theta_param: float) -> Point3: + x = x_param + theta = theta_param + y = RADIUS * math.sin(theta) + z = RADIUS * math.cos(theta) + return x, y, z + + +def build_gmsh_mesh(element_type: str) -> Mesh: + gmsh = try_import_gmsh() + if gmsh is None: + raise RuntimeError("gmsh Python module is not available") + + wanted = 2 if element_type == "S3" else 3 + nx, ntheta = mesh_divisions(element_type) + gmsh.initialize() + try: + gmsh.model.add(f"scordelis_lo_{element_type.lower()}") + geo = gmsh.model.geo + p1 = geo.addPoint(0.0, 0.0, 0.0) + p2 = geo.addPoint(MODEL_LENGTH, 0.0, 0.0) + p3 = geo.addPoint(MODEL_LENGTH, MODEL_ANGLE, 0.0) + p4 = geo.addPoint(0.0, MODEL_ANGLE, 0.0) + l1 = geo.addLine(p1, p2) + l2 = geo.addLine(p2, p3) + l3 = geo.addLine(p3, p4) + l4 = geo.addLine(p4, p1) + loop = geo.addCurveLoop([l1, l2, l3, l4]) + surface = geo.addPlaneSurface([loop]) + + geo.mesh.setTransfiniteCurve(l1, nx + 1) + geo.mesh.setTransfiniteCurve(l3, nx + 1) + geo.mesh.setTransfiniteCurve(l2, ntheta + 1) + geo.mesh.setTransfiniteCurve(l4, ntheta + 1) + geo.mesh.setTransfiniteSurface(surface) + if element_type == "S4": + geo.mesh.setRecombine(2, surface) + geo.synchronize() + gmsh.model.mesh.generate(2) + return collect_gmsh_mesh(gmsh, wanted, element_type) + finally: + gmsh.finalize() + + +def collect_gmsh_mesh(gmsh, wanted: int, element_type: str) -> Mesh: + node_tags, node_coords, _ = gmsh.model.mesh.getNodes() + tag_to_id: Dict[int, int] = {} + nodes: Dict[int, Point3] = {} + for new_id, tag in enumerate(node_tags, start=1): + tag_int = int(tag) + tag_to_id[tag_int] = new_id + i = 3 * (new_id - 1) + nodes[new_id] = map_to_roof(float(node_coords[i]), float(node_coords[i + 1])) + + elements: List[Element] = [] + elem_types, _, elem_node_tags = gmsh.model.mesh.getElements(2) + nen = 3 if wanted == 2 else 4 + for etype, conn in zip(elem_types, elem_node_tags): + if int(etype) != wanted: + continue + for i in range(0, len(conn), nen): + elem = tuple(tag_to_id[int(tag)] for tag in conn[i : i + nen]) + if element_type == "S3": + elem = orient_tri(nodes, elem) + else: + elem = orient_quad(nodes, elem) + elements.append(elem) + + if not elements: + raise RuntimeError(f"gmsh did not generate {element_type} elements") + return Mesh(nodes=nodes, elements=elements, element_type=element_type) + + +def build_internal_mesh(element_type: str) -> Mesh: + nodes: Dict[int, Point3] = {} + node_grid: List[List[int]] = [] + node_id = 1 + nx, ntheta = mesh_divisions(element_type) + for j in range(ntheta + 1): + theta_param = MODEL_ANGLE * float(j) / float(ntheta) + row: List[int] = [] + for i in range(nx + 1): + x_param = MODEL_LENGTH * float(i) / float(nx) + row.append(node_id) + nodes[node_id] = map_to_roof(x_param, theta_param) + node_id += 1 + node_grid.append(row) + + elements: List[Element] = [] + for j in range(ntheta): + for i in range(nx): + n1 = node_grid[j][i] + n2 = node_grid[j][i + 1] + n3 = node_grid[j + 1][i + 1] + n4 = node_grid[j + 1][i] + if element_type == "S4": + elements.append(orient_quad(nodes, (n1, n2, n3, n4))) + else: + elements.append(orient_tri(nodes, (n1, n2, n3))) + elements.append(orient_tri(nodes, (n1, n3, n4))) + return Mesh(nodes=nodes, elements=elements, element_type=element_type) + + +def mesh_divisions(element_type: str) -> Tuple[int, int]: + if element_type == "S3": + return TRI_NX, TRI_NTHETA + return QUAD_NX, QUAD_NTHETA + + +def build_mesh(element_type: str, backend: str) -> Mesh: + if backend == "gmsh": + return build_gmsh_mesh(element_type) + if backend == "auto" and try_import_gmsh() is not None: + return build_gmsh_mesh(element_type) + return build_internal_mesh(element_type) + + +def orient_tri(nodes: Dict[int, Point3], elem: Sequence[int]) -> Element: + if element_normal_z_hint(nodes, elem) >= 0.0: + return tuple(int(n) for n in elem) + return (int(elem[0]), int(elem[2]), int(elem[1])) + + +def orient_quad(nodes: Dict[int, Point3], elem: Sequence[int]) -> Element: + if element_normal_z_hint(nodes, elem) >= 0.0: + return tuple(int(n) for n in elem) + return (int(elem[0]), int(elem[3]), int(elem[2]), int(elem[1])) + + +def element_normal_z_hint(nodes: Dict[int, Point3], elem: Sequence[int]) -> float: + p1 = nodes[int(elem[0])] + p2 = nodes[int(elem[1])] + p3 = nodes[int(elem[2])] + v12 = sub(p2, p1) + v13 = sub(p3, p1) + normal = cross(v12, v13) + centroid = tuple(sum(nodes[int(n)][i] for n in elem) / float(len(elem)) for i in range(3)) + radial = (0.0, centroid[1], centroid[2]) + return dot(normal, radial) + + +def sub(a: Point3, b: Point3) -> Point3: + return a[0] - b[0], a[1] - b[1], a[2] - b[2] + + +def cross(a: Point3, b: Point3) -> Point3: + return ( + a[1] * b[2] - a[2] * b[1], + a[2] * b[0] - a[0] * b[2], + a[0] * b[1] - a[1] * b[0], + ) + + +def dot(a: Point3, b: Point3) -> float: + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + + +def tri_area(a: Point3, b: Point3, c: Point3) -> float: + return 0.5 * math.sqrt(dot(cross(sub(b, a), sub(c, a)), cross(sub(b, a), sub(c, a)))) + + +def element_area(nodes: Dict[int, Point3], elem: Sequence[int]) -> float: + if len(elem) == 3: + return tri_area(nodes[elem[0]], nodes[elem[1]], nodes[elem[2]]) + return tri_area(nodes[elem[0]], nodes[elem[1]], nodes[elem[2]]) + tri_area( + nodes[elem[0]], nodes[elem[2]], nodes[elem[3]] + ) + + +def nodal_vertical_loads(mesh: Mesh) -> Dict[int, float]: + loads = {nid: 0.0 for nid in mesh.nodes} + for elem in mesh.elements: + share = FACE_LOAD_Z * element_area(mesh.nodes, elem) / float(len(elem)) + for nid in elem: + loads[nid] += share + return loads + + +def curved_inner_nodes(mesh: Mesh) -> List[int]: + return [nid for nid, xyz in sorted(mesh.nodes.items()) if abs(xyz[0]) < 1.0e-10] + + +def curved_outer_nodes(mesh: Mesh) -> List[int]: + return [nid for nid, xyz in sorted(mesh.nodes.items()) if abs(xyz[0] - MODEL_LENGTH) < 1.0e-10] + + +def straight_top_nodes(mesh: Mesh) -> List[int]: + return [nid for nid, xyz in sorted(mesh.nodes.items()) if abs(xyz[1]) < 1.0e-10] + + +def straight_free_nodes(mesh: Mesh) -> List[int]: + y_free = RADIUS * math.sin(MODEL_ANGLE) + return [nid for nid, xyz in sorted(mesh.nodes.items()) if abs(xyz[1] - y_free) < 1.0e-10] + + +def write_id_set(f, ids: Sequence[int]) -> None: + for i in range(0, len(ids), SET_LINE_WIDTH): + f.write(", ".join(str(item) for item in ids[i : i + SET_LINE_WIDTH])) + f.write("\n") + + +def write_inp(path: Path, mesh: Mesh) -> None: + curved_inner = curved_inner_nodes(mesh) + curved_outer = curved_outer_nodes(mesh) + straight_top = straight_top_nodes(mesh) + straight_free = straight_free_nodes(mesh) + loads = nodal_vertical_loads(mesh) + total_load = sum(loads.values()) + total_area = sum(element_area(mesh.nodes, elem) for elem in mesh.elements) + + path.parent.mkdir(parents=True, exist_ok=True) + with path.open("w", encoding="ascii", newline="\n") as f: + f.write("*HEADING\n") + f.write(f"FemLite Scordelis-Lo roof {mesh.element_type}\n") + f.write(f"** quarter model: R={RADIUS:.10E}, 2L={ROOF_LENGTH:.10E}, angle_rad={MODEL_ANGLE:.10E}\n") + f.write(f"** thickness={THICKNESS:.10E}, area={total_area:.10E}, face_load_z={FACE_LOAD_Z:.10E}, total_Fz={total_load:.10E}\n") + f.write("*NODE\n") + for nid in sorted(mesh.nodes): + x, y, z = mesh.nodes[nid] + f.write(f"{nid}, {x:.10E}, {y:.10E}, {z:.10E}\n") + f.write(f"*ELEMENT, TYPE={mesh.element_type}, ELSET=ROOF\n") + for eid, elem in enumerate(mesh.elements, start=1): + f.write(f"{eid}, " + ", ".join(str(nid) for nid in elem) + "\n") + f.write("*NSET, NSET=CURVED_INNER_SYM\n") + write_id_set(f, curved_inner) + f.write("*NSET, NSET=CURVED_OUTER_SUPPORT\n") + write_id_set(f, curved_outer) + f.write("*NSET, NSET=STRAIGHT_TOP_SYM\n") + write_id_set(f, straight_top) + f.write("*NSET, NSET=STRAIGHT_FREE\n") + write_id_set(f, straight_free) + f.write("*MATERIAL, NAME=ALUMINUM\n") + f.write("*DENSITY\n") + f.write(f"{DENSITY:.10E}\n") + f.write("*ELASTIC\n") + f.write(f"{YOUNG_MODULUS:.10E}, {POISSON_RATIO:.10E}\n") + f.write("*SHELL SECTION, ELSET=ROOF, MATERIAL=ALUMINUM\n") + f.write(f"{THICKNESS:.10E}\n") + f.write("*BOUNDARY\n") + f.write("CURVED_OUTER_SUPPORT, 2, 3, 0.0\n") + f.write("CURVED_INNER_SYM, 1, 1, 0.0\n") + f.write("CURVED_INNER_SYM, 5, 6, 0.0\n") + f.write("STRAIGHT_TOP_SYM, 2, 2, 0.0\n") + f.write("STRAIGHT_TOP_SYM, 4, 4, 0.0\n") + f.write("STRAIGHT_TOP_SYM, 6, 6, 0.0\n") + f.write("*CLOAD\n") + for nid in sorted(loads): + f.write(f"{nid}, 3, {loads[nid]:.10E}\n") + f.write("*STEP\n") + f.write("*DYNAMIC\n") + f.write(f"{TIME_STEP:.10E}, {END_TIME:.10E}\n") + f.write("*END STEP\n") + + +def write_all(output_dir: Path, backend: str) -> None: + tri_mesh = build_mesh("S3", backend) + quad_mesh = build_mesh("S4", backend) + write_inp(output_dir / "scordelislo_tri.inp", tri_mesh) + write_inp(output_dir / "scordelislo_quad.inp", quad_mesh) + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--backend", + choices=("auto", "gmsh", "internal"), + default="auto", + help="mesh backend; auto uses gmsh when installed and otherwise falls back to internal", + ) + parser.add_argument( + "--output-dir", + type=Path, + default=Path(__file__).resolve().parent, + help="directory for generated inp files", + ) + args = parser.parse_args() + write_all(args.output_dir, args.backend) + + +if __name__ == "__main__": + main() diff --git a/examples/ScordelisLo/models.sme.scordelis_lo_roof.pdf b/examples/ScordelisLo/models.sme.scordelis_lo_roof.pdf new file mode 100644 index 0000000..bbbc37b Binary files /dev/null and b/examples/ScordelisLo/models.sme.scordelis_lo_roof.pdf differ diff --git a/examples/ScordelisLo/models.sme.scordelis_lo_roof.zh_CN.pdf b/examples/ScordelisLo/models.sme.scordelis_lo_roof.zh_CN.pdf new file mode 100644 index 0000000..e2f6920 Binary files /dev/null and b/examples/ScordelisLo/models.sme.scordelis_lo_roof.zh_CN.pdf differ diff --git a/examples/ScordelisLo/requirements.txt b/examples/ScordelisLo/requirements.txt new file mode 100644 index 0000000..a5a8180 --- /dev/null +++ b/examples/ScordelisLo/requirements.txt @@ -0,0 +1 @@ +gmsh>=4.15 diff --git a/examples/ScordelisLo/scordelislo_quad.inp b/examples/ScordelisLo/scordelislo_quad.inp new file mode 100644 index 0000000..00b2140 --- /dev/null +++ b/examples/ScordelisLo/scordelislo_quad.inp @@ -0,0 +1,279 @@ +*HEADING +FemLite Scordelis-Lo roof S4 +** 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 +*DYNAMIC +1.0000000000E-05, 1.0000000000E-01 +*END STEP diff --git a/examples/ScordelisLo/scordelislo_tri.inp b/examples/ScordelisLo/scordelislo_tri.inp new file mode 100644 index 0000000..1345ffa --- /dev/null +++ b/examples/ScordelisLo/scordelislo_tri.inp @@ -0,0 +1,425 @@ +*HEADING +FemLite Scordelis-Lo roof S3 +** 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 +*DYNAMIC +1.0000000000E-05, 1.0000000000E-01 +*END STEP diff --git a/examples/golfBallImpact/models.nsm.golf_ball_impact.pdf b/examples/golfBallImpact/models.nsm.golf_ball_impact.pdf new file mode 100644 index 0000000..4e464fa Binary files /dev/null and b/examples/golfBallImpact/models.nsm.golf_ball_impact.pdf differ diff --git a/examples/golfBallImpact/models.nsm.golf_ball_impact.zh_CN.pdf b/examples/golfBallImpact/models.nsm.golf_ball_impact.zh_CN.pdf new file mode 100644 index 0000000..d898048 Binary files /dev/null and b/examples/golfBallImpact/models.nsm.golf_ball_impact.zh_CN.pdf differ diff --git a/examples/strengthReduction/models.geomech.strength_reduction_method.pdf b/examples/strengthReduction/models.geomech.strength_reduction_method.pdf new file mode 100644 index 0000000..d470b31 Binary files /dev/null and b/examples/strengthReduction/models.geomech.strength_reduction_method.pdf differ diff --git a/examples/strengthReduction/models.geomech.strength_reduction_method.zh_CN (1).pdf b/examples/strengthReduction/models.geomech.strength_reduction_method.zh_CN (1).pdf new file mode 100644 index 0000000..2c2eabb Binary files /dev/null and b/examples/strengthReduction/models.geomech.strength_reduction_method.zh_CN (1).pdf differ diff --git a/examples/tension2D/README.md b/examples/tension2D/README.md new file mode 100644 index 0000000..066567e --- /dev/null +++ b/examples/tension2D/README.md @@ -0,0 +1,37 @@ +# tension2D + +FemLite shell tension examples for a rectangular plate. + +- Geometry: length = 0.2 m, width = 0.1 m, thickness = 0.002 m. +- Shell midsurface: global x-z plane, with y = 0. +- Material: E = 70.0E9 Pa, nu = 0.3, density = 2700 kg/m3. +- Bottom long edge: z = 0, fully fixed in DOFs 1..6. +- Top long edge: z = 0.1 m. +- Top force case: total tensile force Fz = 1000 N, distributed over top-edge nodes. +- Top displacement case: uz(t) = 0.01 t m, so uz(0.1 s) = 1.0E-3 m. +- Analysis control: explicit transient, dt = 1.0E-6 s, total time = 0.1 s. +- Output: FemLite writes history CSV, nodal/element CSV, and legacy ASCII VTK files during `--run`. + +Input decks: + +- `tension1000tri.inp`: S3 triangular shell mesh, 1000 N top force. +- `tension1000quad.inp`: S4 quadrilateral shell mesh, 1000 N top force. +- `disp0_0001tri.inp`: S3 triangular shell mesh, ramped top displacement. +- `disp0_0001quad.inp`: S4 quadrilateral shell mesh, ramped top displacement. + +Regenerate the decks: + +```powershell +Python\.venv\Scripts\python.exe -m pip install -r examples\tension2D\requirements.txt +Python\.venv\Scripts\python.exe examples\tension2D\generate_tension2d.py --backend auto +``` + +Run one deck from the repository root: + +```powershell +New-Item -ItemType Directory -Force examples\tension2D\results\tension1000tri | Out-Null +build-win-gcc-16\femlite.exe examples\tension2D\tension1000tri.inp --output-dir examples\tension2D\results\tension1000tri --output-interval 500 --run +``` + +Use separate result directories for each case so `history.csv`, `nodes_*.csv`, +`elements_*.csv`, and `result_*.vtk` do not overwrite each other. diff --git a/examples/tension2D/disp0_0001quad.inp b/examples/tension2D/disp0_0001quad.inp new file mode 100644 index 0000000..cd59e05 --- /dev/null +++ b/examples/tension2D/disp0_0001quad.inp @@ -0,0 +1,102 @@ +*HEADING +FemLite shell tension 2D S4 displacement +*NODE +1, 0.0000000000E+00, 0.0000000000E+00, 0.0000000000E+00 +2, 2.0000000000E-01, 0.0000000000E+00, 0.0000000000E+00 +3, 2.0000000000E-01, 0.0000000000E+00, 1.0000000000E-01 +4, 0.0000000000E+00, 0.0000000000E+00, 1.0000000000E-01 +5, 2.5000000000E-02, 0.0000000000E+00, 0.0000000000E+00 +6, 5.0000000000E-02, 0.0000000000E+00, 0.0000000000E+00 +7, 7.5000000000E-02, 0.0000000000E+00, 0.0000000000E+00 +8, 1.0000000000E-01, 0.0000000000E+00, 0.0000000000E+00 +9, 1.2500000000E-01, 0.0000000000E+00, 0.0000000000E+00 +10, 1.5000000000E-01, 0.0000000000E+00, 0.0000000000E+00 +11, 1.7500000000E-01, 0.0000000000E+00, 0.0000000000E+00 +12, 2.0000000000E-01, 0.0000000000E+00, 2.5000000000E-02 +13, 2.0000000000E-01, 0.0000000000E+00, 5.0000000000E-02 +14, 2.0000000000E-01, 0.0000000000E+00, 7.5000000000E-02 +15, 1.7500000000E-01, 0.0000000000E+00, 1.0000000000E-01 +16, 1.5000000000E-01, 0.0000000000E+00, 1.0000000000E-01 +17, 1.2500000000E-01, 0.0000000000E+00, 1.0000000000E-01 +18, 1.0000000000E-01, 0.0000000000E+00, 1.0000000000E-01 +19, 7.5000000000E-02, 0.0000000000E+00, 1.0000000000E-01 +20, 5.0000000000E-02, 0.0000000000E+00, 1.0000000000E-01 +21, 2.5000000000E-02, 0.0000000000E+00, 1.0000000000E-01 +22, 0.0000000000E+00, 0.0000000000E+00, 7.5000000000E-02 +23, 0.0000000000E+00, 0.0000000000E+00, 5.0000000000E-02 +24, 0.0000000000E+00, 0.0000000000E+00, 2.5000000000E-02 +25, 2.5000000000E-02, 0.0000000000E+00, 2.5000000000E-02 +26, 2.5000000000E-02, 0.0000000000E+00, 5.0000000000E-02 +27, 2.5000000000E-02, 0.0000000000E+00, 7.5000000000E-02 +28, 5.0000000000E-02, 0.0000000000E+00, 2.5000000000E-02 +29, 5.0000000000E-02, 0.0000000000E+00, 5.0000000000E-02 +30, 5.0000000000E-02, 0.0000000000E+00, 7.5000000000E-02 +31, 7.5000000000E-02, 0.0000000000E+00, 2.5000000000E-02 +32, 7.5000000000E-02, 0.0000000000E+00, 5.0000000000E-02 +33, 7.5000000000E-02, 0.0000000000E+00, 7.5000000000E-02 +34, 1.0000000000E-01, 0.0000000000E+00, 2.5000000000E-02 +35, 1.0000000000E-01, 0.0000000000E+00, 5.0000000000E-02 +36, 1.0000000000E-01, 0.0000000000E+00, 7.5000000000E-02 +37, 1.2500000000E-01, 0.0000000000E+00, 2.5000000000E-02 +38, 1.2500000000E-01, 0.0000000000E+00, 5.0000000000E-02 +39, 1.2500000000E-01, 0.0000000000E+00, 7.5000000000E-02 +40, 1.5000000000E-01, 0.0000000000E+00, 2.5000000000E-02 +41, 1.5000000000E-01, 0.0000000000E+00, 5.0000000000E-02 +42, 1.5000000000E-01, 0.0000000000E+00, 7.5000000000E-02 +43, 1.7500000000E-01, 0.0000000000E+00, 2.5000000000E-02 +44, 1.7500000000E-01, 0.0000000000E+00, 5.0000000000E-02 +45, 1.7500000000E-01, 0.0000000000E+00, 7.5000000000E-02 +*ELEMENT, TYPE=S4, ELSET=PLATE +1, 1, 5, 25, 24 +2, 24, 25, 26, 23 +3, 23, 26, 27, 22 +4, 22, 27, 21, 4 +5, 5, 6, 28, 25 +6, 25, 28, 29, 26 +7, 26, 29, 30, 27 +8, 27, 30, 20, 21 +9, 6, 7, 31, 28 +10, 28, 31, 32, 29 +11, 29, 32, 33, 30 +12, 30, 33, 19, 20 +13, 7, 8, 34, 31 +14, 31, 34, 35, 32 +15, 32, 35, 36, 33 +16, 33, 36, 18, 19 +17, 8, 9, 37, 34 +18, 34, 37, 38, 35 +19, 35, 38, 39, 36 +20, 36, 39, 17, 18 +21, 9, 10, 40, 37 +22, 37, 40, 41, 38 +23, 38, 41, 42, 39 +24, 39, 42, 16, 17 +25, 10, 11, 43, 40 +26, 40, 43, 44, 41 +27, 41, 44, 45, 42 +28, 42, 45, 15, 16 +29, 11, 2, 12, 43 +30, 43, 12, 13, 44 +31, 44, 13, 14, 45 +32, 45, 14, 3, 15 +*NSET, NSET=BOTTOM +1, 2, 5, 6, 7, 8, 9, 10, 11 +*NSET, NSET=TOP +3, 4, 15, 16, 17, 18, 19, 20, 21 +*MATERIAL, NAME=ALUMINUM +*DENSITY +2.7000000000E+03 +*ELASTIC +7.0000000000E+10, 3.0000000000E-01 +*SHELL SECTION, ELSET=PLATE, MATERIAL=ALUMINUM +2.0000000000E-03 +*BOUNDARY +BOTTOM, 1, 6, 0.0 +*AMPLITUDE, NAME=UZ_RAMP +0.0, 0.0, 1.0000000000E-01, 1.0 +*BOUNDARY, AMPLITUDE=UZ_RAMP +TOP, 3, 3, 1.0000000000E-03 +*STEP +*DYNAMIC +1.0000000000E-06, 1.0000000000E-01 +*END STEP diff --git a/examples/tension2D/disp0_0001tri.inp b/examples/tension2D/disp0_0001tri.inp new file mode 100644 index 0000000..d436c6d --- /dev/null +++ b/examples/tension2D/disp0_0001tri.inp @@ -0,0 +1,134 @@ +*HEADING +FemLite shell tension 2D S3 displacement +*NODE +1, 0.0000000000E+00, 0.0000000000E+00, 0.0000000000E+00 +2, 2.0000000000E-01, 0.0000000000E+00, 0.0000000000E+00 +3, 2.0000000000E-01, 0.0000000000E+00, 1.0000000000E-01 +4, 0.0000000000E+00, 0.0000000000E+00, 1.0000000000E-01 +5, 2.5000000000E-02, 0.0000000000E+00, 0.0000000000E+00 +6, 5.0000000000E-02, 0.0000000000E+00, 0.0000000000E+00 +7, 7.5000000000E-02, 0.0000000000E+00, 0.0000000000E+00 +8, 1.0000000000E-01, 0.0000000000E+00, 0.0000000000E+00 +9, 1.2500000000E-01, 0.0000000000E+00, 0.0000000000E+00 +10, 1.5000000000E-01, 0.0000000000E+00, 0.0000000000E+00 +11, 1.7500000000E-01, 0.0000000000E+00, 0.0000000000E+00 +12, 2.0000000000E-01, 0.0000000000E+00, 2.5000000000E-02 +13, 2.0000000000E-01, 0.0000000000E+00, 5.0000000000E-02 +14, 2.0000000000E-01, 0.0000000000E+00, 7.5000000000E-02 +15, 1.7500000000E-01, 0.0000000000E+00, 1.0000000000E-01 +16, 1.5000000000E-01, 0.0000000000E+00, 1.0000000000E-01 +17, 1.2500000000E-01, 0.0000000000E+00, 1.0000000000E-01 +18, 1.0000000000E-01, 0.0000000000E+00, 1.0000000000E-01 +19, 7.5000000000E-02, 0.0000000000E+00, 1.0000000000E-01 +20, 5.0000000000E-02, 0.0000000000E+00, 1.0000000000E-01 +21, 2.5000000000E-02, 0.0000000000E+00, 1.0000000000E-01 +22, 0.0000000000E+00, 0.0000000000E+00, 7.5000000000E-02 +23, 0.0000000000E+00, 0.0000000000E+00, 5.0000000000E-02 +24, 0.0000000000E+00, 0.0000000000E+00, 2.5000000000E-02 +25, 2.5000000000E-02, 0.0000000000E+00, 2.5000000000E-02 +26, 2.5000000000E-02, 0.0000000000E+00, 5.0000000000E-02 +27, 2.5000000000E-02, 0.0000000000E+00, 7.5000000000E-02 +28, 5.0000000000E-02, 0.0000000000E+00, 2.5000000000E-02 +29, 5.0000000000E-02, 0.0000000000E+00, 5.0000000000E-02 +30, 5.0000000000E-02, 0.0000000000E+00, 7.5000000000E-02 +31, 7.5000000000E-02, 0.0000000000E+00, 2.5000000000E-02 +32, 7.5000000000E-02, 0.0000000000E+00, 5.0000000000E-02 +33, 7.5000000000E-02, 0.0000000000E+00, 7.5000000000E-02 +34, 1.0000000000E-01, 0.0000000000E+00, 2.5000000000E-02 +35, 1.0000000000E-01, 0.0000000000E+00, 5.0000000000E-02 +36, 1.0000000000E-01, 0.0000000000E+00, 7.5000000000E-02 +37, 1.2500000000E-01, 0.0000000000E+00, 2.5000000000E-02 +38, 1.2500000000E-01, 0.0000000000E+00, 5.0000000000E-02 +39, 1.2500000000E-01, 0.0000000000E+00, 7.5000000000E-02 +40, 1.5000000000E-01, 0.0000000000E+00, 2.5000000000E-02 +41, 1.5000000000E-01, 0.0000000000E+00, 5.0000000000E-02 +42, 1.5000000000E-01, 0.0000000000E+00, 7.5000000000E-02 +43, 1.7500000000E-01, 0.0000000000E+00, 2.5000000000E-02 +44, 1.7500000000E-01, 0.0000000000E+00, 5.0000000000E-02 +45, 1.7500000000E-01, 0.0000000000E+00, 7.5000000000E-02 +*ELEMENT, TYPE=S3, ELSET=PLATE +1, 1, 5, 24 +2, 24, 5, 25 +3, 24, 25, 23 +4, 23, 25, 26 +5, 23, 26, 22 +6, 22, 26, 27 +7, 22, 27, 4 +8, 4, 27, 21 +9, 5, 6, 25 +10, 25, 6, 28 +11, 25, 28, 26 +12, 26, 28, 29 +13, 26, 29, 27 +14, 27, 29, 30 +15, 27, 30, 21 +16, 21, 30, 20 +17, 6, 7, 28 +18, 28, 7, 31 +19, 28, 31, 29 +20, 29, 31, 32 +21, 29, 32, 30 +22, 30, 32, 33 +23, 30, 33, 20 +24, 20, 33, 19 +25, 7, 8, 31 +26, 31, 8, 34 +27, 31, 34, 32 +28, 32, 34, 35 +29, 32, 35, 33 +30, 33, 35, 36 +31, 33, 36, 19 +32, 19, 36, 18 +33, 8, 9, 34 +34, 34, 9, 37 +35, 34, 37, 35 +36, 35, 37, 38 +37, 35, 38, 36 +38, 36, 38, 39 +39, 36, 39, 18 +40, 18, 39, 17 +41, 9, 10, 37 +42, 37, 10, 40 +43, 37, 40, 38 +44, 38, 40, 41 +45, 38, 41, 39 +46, 39, 41, 42 +47, 39, 42, 17 +48, 17, 42, 16 +49, 10, 11, 40 +50, 40, 11, 43 +51, 40, 43, 41 +52, 41, 43, 44 +53, 41, 44, 42 +54, 42, 44, 45 +55, 42, 45, 16 +56, 16, 45, 15 +57, 11, 2, 43 +58, 43, 2, 12 +59, 43, 12, 44 +60, 44, 12, 13 +61, 44, 13, 45 +62, 45, 13, 14 +63, 45, 14, 15 +64, 15, 14, 3 +*NSET, NSET=BOTTOM +1, 2, 5, 6, 7, 8, 9, 10, 11 +*NSET, NSET=TOP +3, 4, 15, 16, 17, 18, 19, 20, 21 +*MATERIAL, NAME=ALUMINUM +*DENSITY +2.7000000000E+03 +*ELASTIC +7.0000000000E+10, 3.0000000000E-01 +*SHELL SECTION, ELSET=PLATE, MATERIAL=ALUMINUM +2.0000000000E-03 +*BOUNDARY +BOTTOM, 1, 6, 0.0 +*AMPLITUDE, NAME=UZ_RAMP +0.0, 0.0, 1.0000000000E-01, 1.0 +*BOUNDARY, AMPLITUDE=UZ_RAMP +TOP, 3, 3, 1.0000000000E-03 +*STEP +*DYNAMIC +1.0000000000E-06, 1.0000000000E-01 +*END STEP diff --git a/examples/tension2D/generate_tension2d.py b/examples/tension2D/generate_tension2d.py new file mode 100644 index 0000000..0093457 --- /dev/null +++ b/examples/tension2D/generate_tension2d.py @@ -0,0 +1,267 @@ +#!/usr/bin/env python3 +"""Generate FemLite shell tension 2D example input decks. + +The mesh backend is the Gmsh Python API. If gmsh is not available, the script +uses a small deterministic structured fallback mesh with the same node ordering. +""" + +from __future__ import annotations + +import argparse +from dataclasses import dataclass +from pathlib import Path +from typing import Dict, List, Sequence, Tuple + + +LENGTH = 0.20 +WIDTH = 0.10 +THICKNESS = 0.002 +YOUNG_MODULUS = 70.0e9 +POISSON_RATIO = 0.30 +DENSITY = 2700.0 +TOTAL_FORCE_Z = 1000.0 +END_TIME = 0.10 +TIME_STEP = 1.0e-6 +DISPLACEMENT_RATE = 0.01 +FINAL_DISPLACEMENT_Z = DISPLACEMENT_RATE * END_TIME +NX = 8 +NZ = 4 +SET_LINE_WIDTH = 16 + + +Point3 = Tuple[float, float, float] +Element = Tuple[int, ...] + + +@dataclass +class Mesh: + nodes: Dict[int, Point3] + elements: List[Element] + element_type: str + + +def try_import_gmsh(): + try: + import gmsh # type: ignore + except ImportError: + return None + return gmsh + + +def build_gmsh_mesh(element_type: str) -> Mesh: + gmsh = try_import_gmsh() + if gmsh is None: + raise RuntimeError("gmsh Python module is not available") + + wanted = 2 if element_type == "S3" else 3 + gmsh.initialize() + try: + gmsh.model.add(f"tension2d_{element_type.lower()}") + geo = gmsh.model.geo + p1 = geo.addPoint(0.0, 0.0, 0.0) + p2 = geo.addPoint(LENGTH, 0.0, 0.0) + p3 = geo.addPoint(LENGTH, WIDTH, 0.0) + p4 = geo.addPoint(0.0, WIDTH, 0.0) + l1 = geo.addLine(p1, p2) + l2 = geo.addLine(p2, p3) + l3 = geo.addLine(p3, p4) + l4 = geo.addLine(p4, p1) + loop = geo.addCurveLoop([l1, l2, l3, l4]) + surface = geo.addPlaneSurface([loop]) + + geo.mesh.setTransfiniteCurve(l1, NX + 1) + geo.mesh.setTransfiniteCurve(l3, NX + 1) + geo.mesh.setTransfiniteCurve(l2, NZ + 1) + geo.mesh.setTransfiniteCurve(l4, NZ + 1) + geo.mesh.setTransfiniteSurface(surface) + if element_type == "S4": + geo.mesh.setRecombine(2, surface) + geo.synchronize() + gmsh.model.mesh.generate(2) + return collect_gmsh_mesh(gmsh, wanted, element_type) + finally: + gmsh.finalize() + + +def collect_gmsh_mesh(gmsh, wanted: int, element_type: str) -> Mesh: + node_tags, node_coords, _ = gmsh.model.mesh.getNodes() + tag_to_id: Dict[int, int] = {} + nodes: Dict[int, Point3] = {} + for new_id, tag in enumerate(node_tags, start=1): + tag_int = int(tag) + tag_to_id[tag_int] = new_id + i = 3 * (new_id - 1) + x = float(node_coords[i]) + z = float(node_coords[i + 1]) + nodes[new_id] = (x, 0.0, z) + + elements: List[Element] = [] + elem_types, _, elem_node_tags = gmsh.model.mesh.getElements(2) + nen = 3 if wanted == 2 else 4 + for etype, conn in zip(elem_types, elem_node_tags): + if int(etype) != wanted: + continue + for i in range(0, len(conn), nen): + elem = tuple(tag_to_id[int(tag)] for tag in conn[i : i + nen]) + if element_type == "S3": + elem = orient_tri(nodes, elem) + else: + elem = orient_quad(nodes, elem) + elements.append(elem) + + if not elements: + raise RuntimeError(f"gmsh did not generate {element_type} elements") + return Mesh(nodes=nodes, elements=elements, element_type=element_type) + + +def build_internal_mesh(element_type: str) -> Mesh: + nodes: Dict[int, Point3] = {} + node_grid: List[List[int]] = [] + node_id = 1 + for j in range(NZ + 1): + z = WIDTH * float(j) / float(NZ) + row: List[int] = [] + for i in range(NX + 1): + x = LENGTH * float(i) / float(NX) + row.append(node_id) + nodes[node_id] = (x, 0.0, z) + node_id += 1 + node_grid.append(row) + + elements: List[Element] = [] + for j in range(NZ): + for i in range(NX): + n1 = node_grid[j][i] + n2 = node_grid[j][i + 1] + n3 = node_grid[j + 1][i + 1] + n4 = node_grid[j + 1][i] + if element_type == "S4": + elements.append((n1, n2, n3, n4)) + else: + elements.append((n1, n2, n3)) + elements.append((n1, n3, n4)) + return Mesh(nodes=nodes, elements=elements, element_type=element_type) + + +def orient_tri(nodes: Dict[int, Point3], elem: Sequence[int]) -> Element: + area = signed_area_xz(nodes, elem) + if area >= 0.0: + return tuple(int(n) for n in elem) + return (int(elem[0]), int(elem[2]), int(elem[1])) + + +def orient_quad(nodes: Dict[int, Point3], elem: Sequence[int]) -> Element: + area = signed_area_xz(nodes, elem) + if area >= 0.0: + return tuple(int(n) for n in elem) + return (int(elem[0]), int(elem[3]), int(elem[2]), int(elem[1])) + + +def signed_area_xz(nodes: Dict[int, Point3], elem: Sequence[int]) -> float: + area2 = 0.0 + for i, nid in enumerate(elem): + x0, _, z0 = nodes[int(nid)] + x1, _, z1 = nodes[int(elem[(i + 1) % len(elem)])] + area2 += x0 * z1 - x1 * z0 + return 0.5 * area2 + + +def build_mesh(element_type: str, backend: str) -> Mesh: + if backend == "gmsh": + return build_gmsh_mesh(element_type) + if backend == "auto" and try_import_gmsh() is not None: + return build_gmsh_mesh(element_type) + return build_internal_mesh(element_type) + + +def bottom_nodes(mesh: Mesh) -> List[int]: + return [nid for nid, xyz in sorted(mesh.nodes.items()) if abs(xyz[2]) < 1.0e-10] + + +def top_nodes(mesh: Mesh) -> List[int]: + return [nid for nid, xyz in sorted(mesh.nodes.items()) if abs(xyz[2] - WIDTH) < 1.0e-10] + + +def write_id_set(f, ids: Sequence[int]) -> None: + for i in range(0, len(ids), SET_LINE_WIDTH): + f.write(", ".join(str(item) for item in ids[i : i + SET_LINE_WIDTH])) + f.write("\n") + + +def write_inp(path: Path, mesh: Mesh, load_case: str) -> None: + bottoms = bottom_nodes(mesh) + tops = top_nodes(mesh) + if not bottoms or not tops: + raise RuntimeError("failed to identify top or bottom edge node set") + + path.parent.mkdir(parents=True, exist_ok=True) + with path.open("w", encoding="ascii", newline="\n") as f: + f.write("*HEADING\n") + f.write(f"FemLite shell tension 2D {mesh.element_type} {load_case}\n") + f.write("*NODE\n") + for nid in sorted(mesh.nodes): + x, y, z = mesh.nodes[nid] + f.write(f"{nid}, {x:.10E}, {y:.10E}, {z:.10E}\n") + f.write(f"*ELEMENT, TYPE={mesh.element_type}, ELSET=PLATE\n") + for eid, elem in enumerate(mesh.elements, start=1): + f.write(f"{eid}, " + ", ".join(str(nid) for nid in elem) + "\n") + f.write("*NSET, NSET=BOTTOM\n") + write_id_set(f, bottoms) + f.write("*NSET, NSET=TOP\n") + write_id_set(f, tops) + f.write("*MATERIAL, NAME=ALUMINUM\n") + f.write("*DENSITY\n") + f.write(f"{DENSITY:.10E}\n") + f.write("*ELASTIC\n") + f.write(f"{YOUNG_MODULUS:.10E}, {POISSON_RATIO:.10E}\n") + f.write("*SHELL SECTION, ELSET=PLATE, MATERIAL=ALUMINUM\n") + f.write(f"{THICKNESS:.10E}\n") + f.write("*BOUNDARY\n") + f.write("BOTTOM, 1, 6, 0.0\n") + if load_case == "force": + force_per_node = TOTAL_FORCE_Z / float(len(tops)) + f.write("*CLOAD\n") + for nid in tops: + f.write(f"{nid}, 3, {force_per_node:.10E}\n") + elif load_case == "displacement": + f.write("*AMPLITUDE, NAME=UZ_RAMP\n") + f.write(f"0.0, 0.0, {END_TIME:.10E}, 1.0\n") + f.write("*BOUNDARY, AMPLITUDE=UZ_RAMP\n") + f.write(f"TOP, 3, 3, {FINAL_DISPLACEMENT_Z:.10E}\n") + else: + raise ValueError(f"unknown load case: {load_case}") + f.write("*STEP\n") + f.write("*DYNAMIC\n") + f.write(f"{TIME_STEP:.10E}, {END_TIME:.10E}\n") + f.write("*END STEP\n") + + +def write_all(output_dir: Path, backend: str) -> None: + tri_mesh = build_mesh("S3", backend) + quad_mesh = build_mesh("S4", backend) + write_inp(output_dir / "tension1000tri.inp", tri_mesh, "force") + write_inp(output_dir / "tension1000quad.inp", quad_mesh, "force") + write_inp(output_dir / "disp0_0001tri.inp", tri_mesh, "displacement") + write_inp(output_dir / "disp0_0001quad.inp", quad_mesh, "displacement") + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--backend", + choices=("auto", "gmsh", "internal"), + default="auto", + help="mesh backend; auto uses gmsh when installed and otherwise falls back to internal", + ) + parser.add_argument( + "--output-dir", + type=Path, + default=Path(__file__).resolve().parent, + help="directory for generated inp files", + ) + args = parser.parse_args() + write_all(args.output_dir, args.backend) + + +if __name__ == "__main__": + main() diff --git a/examples/tension2D/requirements.txt b/examples/tension2D/requirements.txt new file mode 100644 index 0000000..a5a8180 --- /dev/null +++ b/examples/tension2D/requirements.txt @@ -0,0 +1 @@ +gmsh>=4.15 diff --git a/examples/tension2D/tension1000quad.inp b/examples/tension2D/tension1000quad.inp new file mode 100644 index 0000000..5e9b8f2 --- /dev/null +++ b/examples/tension2D/tension1000quad.inp @@ -0,0 +1,108 @@ +*HEADING +FemLite shell tension 2D S4 force +*NODE +1, 0.0000000000E+00, 0.0000000000E+00, 0.0000000000E+00 +2, 2.0000000000E-01, 0.0000000000E+00, 0.0000000000E+00 +3, 2.0000000000E-01, 0.0000000000E+00, 1.0000000000E-01 +4, 0.0000000000E+00, 0.0000000000E+00, 1.0000000000E-01 +5, 2.5000000000E-02, 0.0000000000E+00, 0.0000000000E+00 +6, 5.0000000000E-02, 0.0000000000E+00, 0.0000000000E+00 +7, 7.5000000000E-02, 0.0000000000E+00, 0.0000000000E+00 +8, 1.0000000000E-01, 0.0000000000E+00, 0.0000000000E+00 +9, 1.2500000000E-01, 0.0000000000E+00, 0.0000000000E+00 +10, 1.5000000000E-01, 0.0000000000E+00, 0.0000000000E+00 +11, 1.7500000000E-01, 0.0000000000E+00, 0.0000000000E+00 +12, 2.0000000000E-01, 0.0000000000E+00, 2.5000000000E-02 +13, 2.0000000000E-01, 0.0000000000E+00, 5.0000000000E-02 +14, 2.0000000000E-01, 0.0000000000E+00, 7.5000000000E-02 +15, 1.7500000000E-01, 0.0000000000E+00, 1.0000000000E-01 +16, 1.5000000000E-01, 0.0000000000E+00, 1.0000000000E-01 +17, 1.2500000000E-01, 0.0000000000E+00, 1.0000000000E-01 +18, 1.0000000000E-01, 0.0000000000E+00, 1.0000000000E-01 +19, 7.5000000000E-02, 0.0000000000E+00, 1.0000000000E-01 +20, 5.0000000000E-02, 0.0000000000E+00, 1.0000000000E-01 +21, 2.5000000000E-02, 0.0000000000E+00, 1.0000000000E-01 +22, 0.0000000000E+00, 0.0000000000E+00, 7.5000000000E-02 +23, 0.0000000000E+00, 0.0000000000E+00, 5.0000000000E-02 +24, 0.0000000000E+00, 0.0000000000E+00, 2.5000000000E-02 +25, 2.5000000000E-02, 0.0000000000E+00, 2.5000000000E-02 +26, 2.5000000000E-02, 0.0000000000E+00, 5.0000000000E-02 +27, 2.5000000000E-02, 0.0000000000E+00, 7.5000000000E-02 +28, 5.0000000000E-02, 0.0000000000E+00, 2.5000000000E-02 +29, 5.0000000000E-02, 0.0000000000E+00, 5.0000000000E-02 +30, 5.0000000000E-02, 0.0000000000E+00, 7.5000000000E-02 +31, 7.5000000000E-02, 0.0000000000E+00, 2.5000000000E-02 +32, 7.5000000000E-02, 0.0000000000E+00, 5.0000000000E-02 +33, 7.5000000000E-02, 0.0000000000E+00, 7.5000000000E-02 +34, 1.0000000000E-01, 0.0000000000E+00, 2.5000000000E-02 +35, 1.0000000000E-01, 0.0000000000E+00, 5.0000000000E-02 +36, 1.0000000000E-01, 0.0000000000E+00, 7.5000000000E-02 +37, 1.2500000000E-01, 0.0000000000E+00, 2.5000000000E-02 +38, 1.2500000000E-01, 0.0000000000E+00, 5.0000000000E-02 +39, 1.2500000000E-01, 0.0000000000E+00, 7.5000000000E-02 +40, 1.5000000000E-01, 0.0000000000E+00, 2.5000000000E-02 +41, 1.5000000000E-01, 0.0000000000E+00, 5.0000000000E-02 +42, 1.5000000000E-01, 0.0000000000E+00, 7.5000000000E-02 +43, 1.7500000000E-01, 0.0000000000E+00, 2.5000000000E-02 +44, 1.7500000000E-01, 0.0000000000E+00, 5.0000000000E-02 +45, 1.7500000000E-01, 0.0000000000E+00, 7.5000000000E-02 +*ELEMENT, TYPE=S4, ELSET=PLATE +1, 1, 5, 25, 24 +2, 24, 25, 26, 23 +3, 23, 26, 27, 22 +4, 22, 27, 21, 4 +5, 5, 6, 28, 25 +6, 25, 28, 29, 26 +7, 26, 29, 30, 27 +8, 27, 30, 20, 21 +9, 6, 7, 31, 28 +10, 28, 31, 32, 29 +11, 29, 32, 33, 30 +12, 30, 33, 19, 20 +13, 7, 8, 34, 31 +14, 31, 34, 35, 32 +15, 32, 35, 36, 33 +16, 33, 36, 18, 19 +17, 8, 9, 37, 34 +18, 34, 37, 38, 35 +19, 35, 38, 39, 36 +20, 36, 39, 17, 18 +21, 9, 10, 40, 37 +22, 37, 40, 41, 38 +23, 38, 41, 42, 39 +24, 39, 42, 16, 17 +25, 10, 11, 43, 40 +26, 40, 43, 44, 41 +27, 41, 44, 45, 42 +28, 42, 45, 15, 16 +29, 11, 2, 12, 43 +30, 43, 12, 13, 44 +31, 44, 13, 14, 45 +32, 45, 14, 3, 15 +*NSET, NSET=BOTTOM +1, 2, 5, 6, 7, 8, 9, 10, 11 +*NSET, NSET=TOP +3, 4, 15, 16, 17, 18, 19, 20, 21 +*MATERIAL, NAME=ALUMINUM +*DENSITY +2.7000000000E+03 +*ELASTIC +7.0000000000E+10, 3.0000000000E-01 +*SHELL SECTION, ELSET=PLATE, MATERIAL=ALUMINUM +2.0000000000E-03 +*BOUNDARY +BOTTOM, 1, 6, 0.0 +*CLOAD +3, 3, 1.1111111111E+02 +4, 3, 1.1111111111E+02 +15, 3, 1.1111111111E+02 +16, 3, 1.1111111111E+02 +17, 3, 1.1111111111E+02 +18, 3, 1.1111111111E+02 +19, 3, 1.1111111111E+02 +20, 3, 1.1111111111E+02 +21, 3, 1.1111111111E+02 +*STEP +*DYNAMIC +1.0000000000E-06, 1.0000000000E-01 +*END STEP diff --git a/examples/tension2D/tension1000tri.inp b/examples/tension2D/tension1000tri.inp new file mode 100644 index 0000000..d86fc0b --- /dev/null +++ b/examples/tension2D/tension1000tri.inp @@ -0,0 +1,140 @@ +*HEADING +FemLite shell tension 2D S3 force +*NODE +1, 0.0000000000E+00, 0.0000000000E+00, 0.0000000000E+00 +2, 2.0000000000E-01, 0.0000000000E+00, 0.0000000000E+00 +3, 2.0000000000E-01, 0.0000000000E+00, 1.0000000000E-01 +4, 0.0000000000E+00, 0.0000000000E+00, 1.0000000000E-01 +5, 2.5000000000E-02, 0.0000000000E+00, 0.0000000000E+00 +6, 5.0000000000E-02, 0.0000000000E+00, 0.0000000000E+00 +7, 7.5000000000E-02, 0.0000000000E+00, 0.0000000000E+00 +8, 1.0000000000E-01, 0.0000000000E+00, 0.0000000000E+00 +9, 1.2500000000E-01, 0.0000000000E+00, 0.0000000000E+00 +10, 1.5000000000E-01, 0.0000000000E+00, 0.0000000000E+00 +11, 1.7500000000E-01, 0.0000000000E+00, 0.0000000000E+00 +12, 2.0000000000E-01, 0.0000000000E+00, 2.5000000000E-02 +13, 2.0000000000E-01, 0.0000000000E+00, 5.0000000000E-02 +14, 2.0000000000E-01, 0.0000000000E+00, 7.5000000000E-02 +15, 1.7500000000E-01, 0.0000000000E+00, 1.0000000000E-01 +16, 1.5000000000E-01, 0.0000000000E+00, 1.0000000000E-01 +17, 1.2500000000E-01, 0.0000000000E+00, 1.0000000000E-01 +18, 1.0000000000E-01, 0.0000000000E+00, 1.0000000000E-01 +19, 7.5000000000E-02, 0.0000000000E+00, 1.0000000000E-01 +20, 5.0000000000E-02, 0.0000000000E+00, 1.0000000000E-01 +21, 2.5000000000E-02, 0.0000000000E+00, 1.0000000000E-01 +22, 0.0000000000E+00, 0.0000000000E+00, 7.5000000000E-02 +23, 0.0000000000E+00, 0.0000000000E+00, 5.0000000000E-02 +24, 0.0000000000E+00, 0.0000000000E+00, 2.5000000000E-02 +25, 2.5000000000E-02, 0.0000000000E+00, 2.5000000000E-02 +26, 2.5000000000E-02, 0.0000000000E+00, 5.0000000000E-02 +27, 2.5000000000E-02, 0.0000000000E+00, 7.5000000000E-02 +28, 5.0000000000E-02, 0.0000000000E+00, 2.5000000000E-02 +29, 5.0000000000E-02, 0.0000000000E+00, 5.0000000000E-02 +30, 5.0000000000E-02, 0.0000000000E+00, 7.5000000000E-02 +31, 7.5000000000E-02, 0.0000000000E+00, 2.5000000000E-02 +32, 7.5000000000E-02, 0.0000000000E+00, 5.0000000000E-02 +33, 7.5000000000E-02, 0.0000000000E+00, 7.5000000000E-02 +34, 1.0000000000E-01, 0.0000000000E+00, 2.5000000000E-02 +35, 1.0000000000E-01, 0.0000000000E+00, 5.0000000000E-02 +36, 1.0000000000E-01, 0.0000000000E+00, 7.5000000000E-02 +37, 1.2500000000E-01, 0.0000000000E+00, 2.5000000000E-02 +38, 1.2500000000E-01, 0.0000000000E+00, 5.0000000000E-02 +39, 1.2500000000E-01, 0.0000000000E+00, 7.5000000000E-02 +40, 1.5000000000E-01, 0.0000000000E+00, 2.5000000000E-02 +41, 1.5000000000E-01, 0.0000000000E+00, 5.0000000000E-02 +42, 1.5000000000E-01, 0.0000000000E+00, 7.5000000000E-02 +43, 1.7500000000E-01, 0.0000000000E+00, 2.5000000000E-02 +44, 1.7500000000E-01, 0.0000000000E+00, 5.0000000000E-02 +45, 1.7500000000E-01, 0.0000000000E+00, 7.5000000000E-02 +*ELEMENT, TYPE=S3, ELSET=PLATE +1, 1, 5, 24 +2, 24, 5, 25 +3, 24, 25, 23 +4, 23, 25, 26 +5, 23, 26, 22 +6, 22, 26, 27 +7, 22, 27, 4 +8, 4, 27, 21 +9, 5, 6, 25 +10, 25, 6, 28 +11, 25, 28, 26 +12, 26, 28, 29 +13, 26, 29, 27 +14, 27, 29, 30 +15, 27, 30, 21 +16, 21, 30, 20 +17, 6, 7, 28 +18, 28, 7, 31 +19, 28, 31, 29 +20, 29, 31, 32 +21, 29, 32, 30 +22, 30, 32, 33 +23, 30, 33, 20 +24, 20, 33, 19 +25, 7, 8, 31 +26, 31, 8, 34 +27, 31, 34, 32 +28, 32, 34, 35 +29, 32, 35, 33 +30, 33, 35, 36 +31, 33, 36, 19 +32, 19, 36, 18 +33, 8, 9, 34 +34, 34, 9, 37 +35, 34, 37, 35 +36, 35, 37, 38 +37, 35, 38, 36 +38, 36, 38, 39 +39, 36, 39, 18 +40, 18, 39, 17 +41, 9, 10, 37 +42, 37, 10, 40 +43, 37, 40, 38 +44, 38, 40, 41 +45, 38, 41, 39 +46, 39, 41, 42 +47, 39, 42, 17 +48, 17, 42, 16 +49, 10, 11, 40 +50, 40, 11, 43 +51, 40, 43, 41 +52, 41, 43, 44 +53, 41, 44, 42 +54, 42, 44, 45 +55, 42, 45, 16 +56, 16, 45, 15 +57, 11, 2, 43 +58, 43, 2, 12 +59, 43, 12, 44 +60, 44, 12, 13 +61, 44, 13, 45 +62, 45, 13, 14 +63, 45, 14, 15 +64, 15, 14, 3 +*NSET, NSET=BOTTOM +1, 2, 5, 6, 7, 8, 9, 10, 11 +*NSET, NSET=TOP +3, 4, 15, 16, 17, 18, 19, 20, 21 +*MATERIAL, NAME=ALUMINUM +*DENSITY +2.7000000000E+03 +*ELASTIC +7.0000000000E+10, 3.0000000000E-01 +*SHELL SECTION, ELSET=PLATE, MATERIAL=ALUMINUM +2.0000000000E-03 +*BOUNDARY +BOTTOM, 1, 6, 0.0 +*CLOAD +3, 3, 1.1111111111E+02 +4, 3, 1.1111111111E+02 +15, 3, 1.1111111111E+02 +16, 3, 1.1111111111E+02 +17, 3, 1.1111111111E+02 +18, 3, 1.1111111111E+02 +19, 3, 1.1111111111E+02 +20, 3, 1.1111111111E+02 +21, 3, 1.1111111111E+02 +*STEP +*DYNAMIC +1.0000000000E-06, 1.0000000000E-01 +*END STEP diff --git a/examples/uniaxialTension3D/README.md b/examples/uniaxialTension3D/README.md new file mode 100644 index 0000000..9c61742 --- /dev/null +++ b/examples/uniaxialTension3D/README.md @@ -0,0 +1,38 @@ +# uniaxialTension3D + +FemLite 3D uniaxial tension examples for a solid cylinder. + +- Geometry: cylinder diameter 0.1 m, height 0.2 m. +- Material: E = 70.0E9 Pa, nu = 0.3, density = 2700 kg/m3. +- Bottom boundary: fixed in translational DOFs 1..3. +- Top force case: total tensile force Fz = 1000 N, distributed over top nodes. +- Top displacement case: uz(t) = 0.01 t m, so uz(0.1 s) = 1.0E-3 m. +- Analysis control: explicit transient, total time = 0.1 s. +- C3D4 decks use a conservative user time step of 1.0E-6 s; C3D8 decks use FemLite's automatic stable time step estimate. +- Output: FemLite writes history CSV, nodal/element CSV, and legacy ASCII VTK files during `--run`. + +Input decks: + +- `tension1000tet.inp`: C3D4 tetrahedral mesh, 1000 N top force. +- `tension1000hex.inp`: C3D8 hexahedral mesh, 1000 N top force. +- `disp0_0001tet.inp`: C3D4 tetrahedral mesh, ramped top displacement. +- `disp0_0001hex.inp`: C3D8 hexahedral mesh, ramped top displacement. + +Regenerate the decks: + +```powershell +Python\.venv\Scripts\python.exe -m pip install -r examples\uniaxialTension3D\requirements.txt +Python\.venv\Scripts\python.exe examples\uniaxialTension3D\generate_uniaxial_tension3d.py --backend auto +``` + +The generator prefers the Gmsh Python API. If `gmsh` is not installed, `--backend auto` +uses the built-in low-order O-grid fallback so the example remains reproducible. + +Run one deck from the repository root: + +```powershell +build-win-gcc-16\femlite.exe examples\uniaxialTension3D\tension1000tet.inp --run +``` + +For full runs, use a clean working directory or remove old `history.csv`, `nodes_*.csv`, +`elements_*.csv`, and `result_*.vtk` files first. diff --git a/examples/uniaxialTension3D/disp0_0001hex.inp b/examples/uniaxialTension3D/disp0_0001hex.inp new file mode 100644 index 0000000..55099ab --- /dev/null +++ b/examples/uniaxialTension3D/disp0_0001hex.inp @@ -0,0 +1,161 @@ +*HEADING +FemLite uniaxial tension 3D C3D8 displacement +*NODE +1, 0.0000000000E+00, 0.0000000000E+00, 0.0000000000E+00 +2, 2.5000000000E-02, 2.5000000000E-02, 0.0000000000E+00 +3, -2.5000000000E-02, 2.5000000000E-02, 0.0000000000E+00 +4, -2.5000000000E-02, -2.5000000000E-02, 0.0000000000E+00 +5, 2.5000000000E-02, -2.5000000000E-02, 0.0000000000E+00 +6, 3.5355339059E-02, 3.5355339059E-02, 0.0000000000E+00 +7, -3.5355339059E-02, 3.5355339059E-02, 0.0000000000E+00 +8, -3.5355339059E-02, -3.5355339059E-02, 0.0000000000E+00 +9, 3.5355339059E-02, -3.5355339059E-02, 0.0000000000E+00 +10, 2.5000000000E-02, -2.5000000000E-02, 2.0000000000E-01 +11, 2.5000000000E-02, 2.5000000000E-02, 2.0000000000E-01 +12, -2.5000000000E-02, 2.5000000000E-02, 2.0000000000E-01 +13, -2.5000000000E-02, -2.5000000000E-02, 2.0000000000E-01 +14, 3.5355339059E-02, -3.5355339059E-02, 2.0000000000E-01 +15, 0.0000000000E+00, 0.0000000000E+00, 2.0000000000E-01 +16, 3.5355339059E-02, 3.5355339059E-02, 2.0000000000E-01 +17, -3.5355339059E-02, 3.5355339059E-02, 2.0000000000E-01 +18, -3.5355339059E-02, -3.5355339059E-02, 2.0000000000E-01 +19, 2.5000000000E-02, -6.6436439683E-14, 0.0000000000E+00 +20, 6.6436439683E-14, 2.5000000000E-02, 0.0000000000E+00 +21, -2.5000000000E-02, 6.6436439683E-14, 0.0000000000E+00 +22, -6.6436439683E-14, -2.5000000000E-02, 0.0000000000E+00 +23, 5.0000000000E-02, 1.1959808838E-10, 0.0000000000E+00 +24, -1.2100757549E-10, 5.0000000000E-02, 0.0000000000E+00 +25, -5.0000000000E-02, -9.1919114681E-11, 0.0000000000E+00 +26, 1.0485229351E-10, -5.0000000000E-02, 0.0000000000E+00 +27, 2.5000000000E-02, -6.6436439683E-14, 2.0000000000E-01 +28, 6.6436439683E-14, 2.5000000000E-02, 2.0000000000E-01 +29, -2.5000000000E-02, 6.6436439683E-14, 2.0000000000E-01 +30, -6.6436439683E-14, -2.5000000000E-02, 2.0000000000E-01 +31, 2.5000000000E-02, -2.5000000000E-02, 5.0000000000E-02 +32, 2.5000000000E-02, -2.5000000000E-02, 1.0000000000E-01 +33, 2.5000000000E-02, -2.5000000000E-02, 1.5000000000E-01 +34, 2.5000000000E-02, 2.5000000000E-02, 5.0000000000E-02 +35, 2.5000000000E-02, 2.5000000000E-02, 1.0000000000E-01 +36, 2.5000000000E-02, 2.5000000000E-02, 1.5000000000E-01 +37, -2.5000000000E-02, 2.5000000000E-02, 5.0000000000E-02 +38, -2.5000000000E-02, 2.5000000000E-02, 1.0000000000E-01 +39, -2.5000000000E-02, 2.5000000000E-02, 1.5000000000E-01 +40, -2.5000000000E-02, -2.5000000000E-02, 5.0000000000E-02 +41, -2.5000000000E-02, -2.5000000000E-02, 1.0000000000E-01 +42, -2.5000000000E-02, -2.5000000000E-02, 1.5000000000E-01 +43, 5.0000000000E-02, 1.1959808838E-10, 2.0000000000E-01 +44, 3.5355339059E-02, -3.5355339059E-02, 5.0000000000E-02 +45, 3.5355339059E-02, -3.5355339059E-02, 1.0000000000E-01 +46, 3.5355339059E-02, -3.5355339059E-02, 1.5000000000E-01 +47, 3.5355339059E-02, 3.5355339059E-02, 5.0000000000E-02 +48, 3.5355339059E-02, 3.5355339059E-02, 1.0000000000E-01 +49, 3.5355339059E-02, 3.5355339059E-02, 1.5000000000E-01 +50, -1.2100757549E-10, 5.0000000000E-02, 2.0000000000E-01 +51, -3.5355339059E-02, 3.5355339059E-02, 5.0000000000E-02 +52, -3.5355339059E-02, 3.5355339059E-02, 1.0000000000E-01 +53, -3.5355339059E-02, 3.5355339059E-02, 1.5000000000E-01 +54, -5.0000000000E-02, -9.1919114681E-11, 2.0000000000E-01 +55, -3.5355339059E-02, -3.5355339059E-02, 5.0000000000E-02 +56, -3.5355339059E-02, -3.5355339059E-02, 1.0000000000E-01 +57, -3.5355339059E-02, -3.5355339059E-02, 1.5000000000E-01 +58, 1.0485229351E-10, -5.0000000000E-02, 2.0000000000E-01 +59, 0.0000000000E+00, 0.0000000000E+00, 0.0000000000E+00 +60, 2.5000000000E-02, -6.6436439683E-14, 5.0000000000E-02 +61, 2.5000000000E-02, -6.6436439683E-14, 1.0000000000E-01 +62, 2.5000000000E-02, -6.6436439683E-14, 1.5000000000E-01 +63, 6.6436439683E-14, 2.5000000000E-02, 5.0000000000E-02 +64, 6.6436439683E-14, 2.5000000000E-02, 1.0000000000E-01 +65, 6.6436439683E-14, 2.5000000000E-02, 1.5000000000E-01 +66, -2.5000000000E-02, 6.6436439683E-14, 5.0000000000E-02 +67, -2.5000000000E-02, 6.6436439683E-14, 1.0000000000E-01 +68, -2.5000000000E-02, 6.6436439683E-14, 1.5000000000E-01 +69, -6.6436439683E-14, -2.5000000000E-02, 5.0000000000E-02 +70, -6.6436439683E-14, -2.5000000000E-02, 1.0000000000E-01 +71, -6.6436439683E-14, -2.5000000000E-02, 1.5000000000E-01 +72, 0.0000000000E+00, 0.0000000000E+00, 2.0000000000E-01 +73, 5.0000000000E-02, 1.1959808838E-10, 5.0000000000E-02 +74, 5.0000000000E-02, 1.1959808838E-10, 1.0000000000E-01 +75, 5.0000000000E-02, 1.1959808838E-10, 1.5000000000E-01 +76, -1.2100757549E-10, 5.0000000000E-02, 5.0000000000E-02 +77, -1.2100757549E-10, 5.0000000000E-02, 1.0000000000E-01 +78, -1.2100757549E-10, 5.0000000000E-02, 1.5000000000E-01 +79, -5.0000000000E-02, -9.1919114681E-11, 5.0000000000E-02 +80, -5.0000000000E-02, -9.1919114681E-11, 1.0000000000E-01 +81, -5.0000000000E-02, -9.1919114681E-11, 1.5000000000E-01 +82, 1.0485229351E-10, -5.0000000000E-02, 5.0000000000E-02 +83, 1.0485229351E-10, -5.0000000000E-02, 1.0000000000E-01 +84, 1.0485229351E-10, -5.0000000000E-02, 1.5000000000E-01 +85, 0.0000000000E+00, 0.0000000000E+00, 5.0000000000E-02 +86, 0.0000000000E+00, 0.0000000000E+00, 1.0000000000E-01 +87, 0.0000000000E+00, 0.0000000000E+00, 1.5000000000E-01 +*ELEMENT, TYPE=C3D8, ELSET=EALL +1, 5, 19, 59, 22, 31, 60, 85, 69 +2, 31, 60, 85, 69, 32, 61, 86, 70 +3, 32, 61, 86, 70, 33, 62, 87, 71 +4, 33, 62, 87, 71, 10, 27, 72, 30 +5, 22, 59, 21, 4, 69, 85, 66, 40 +6, 69, 85, 66, 40, 70, 86, 67, 41 +7, 70, 86, 67, 41, 71, 87, 68, 42 +8, 71, 87, 68, 42, 30, 72, 29, 13 +9, 19, 2, 20, 59, 60, 34, 63, 85 +10, 60, 34, 63, 85, 61, 35, 64, 86 +11, 61, 35, 64, 86, 62, 36, 65, 87 +12, 62, 36, 65, 87, 27, 11, 28, 72 +13, 59, 20, 3, 21, 85, 63, 37, 66 +14, 85, 63, 37, 66, 86, 64, 38, 67 +15, 86, 64, 38, 67, 87, 65, 39, 68 +16, 87, 65, 39, 68, 72, 28, 12, 29 +17, 5, 9, 23, 19, 31, 44, 73, 60 +18, 31, 44, 73, 60, 32, 45, 74, 61 +19, 32, 45, 74, 61, 33, 46, 75, 62 +20, 33, 46, 75, 62, 10, 14, 43, 27 +21, 19, 23, 6, 2, 60, 73, 47, 34 +22, 60, 73, 47, 34, 61, 74, 48, 35 +23, 61, 74, 48, 35, 62, 75, 49, 36 +24, 62, 75, 49, 36, 27, 43, 16, 11 +25, 2, 6, 24, 20, 34, 47, 76, 63 +26, 34, 47, 76, 63, 35, 48, 77, 64 +27, 35, 48, 77, 64, 36, 49, 78, 65 +28, 36, 49, 78, 65, 11, 16, 50, 28 +29, 20, 24, 7, 3, 63, 76, 51, 37 +30, 63, 76, 51, 37, 64, 77, 52, 38 +31, 64, 77, 52, 38, 65, 78, 53, 39 +32, 65, 78, 53, 39, 28, 50, 17, 12 +33, 3, 7, 25, 21, 37, 51, 79, 66 +34, 37, 51, 79, 66, 38, 52, 80, 67 +35, 38, 52, 80, 67, 39, 53, 81, 68 +36, 39, 53, 81, 68, 12, 17, 54, 29 +37, 21, 25, 8, 4, 66, 79, 55, 40 +38, 66, 79, 55, 40, 67, 80, 56, 41 +39, 67, 80, 56, 41, 68, 81, 57, 42 +40, 68, 81, 57, 42, 29, 54, 18, 13 +41, 4, 8, 26, 22, 40, 55, 82, 69 +42, 40, 55, 82, 69, 41, 56, 83, 70 +43, 41, 56, 83, 70, 42, 57, 84, 71 +44, 42, 57, 84, 71, 13, 18, 58, 30 +45, 22, 26, 9, 5, 69, 82, 44, 31 +46, 69, 82, 44, 31, 70, 83, 45, 32 +47, 70, 83, 45, 32, 71, 84, 46, 33 +48, 71, 84, 46, 33, 30, 58, 14, 10 +*NSET, NSET=BOTTOM +1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 20, 21, 22, 23, 24, 25 +26, 59 +*NSET, NSET=TOP +10, 11, 12, 13, 14, 15, 16, 17, 18, 27, 28, 29, 30, 43, 50, 54 +58, 72 +*MATERIAL, NAME=ALUMINUM +*DENSITY +2.7000000000E+03 +*ELASTIC +7.0000000000E+10, 3.0000000000E-01 +*SOLID SECTION, ELSET=EALL, MATERIAL=ALUMINUM +*BOUNDARY +BOTTOM, 1, 3, 0.0 +*AMPLITUDE, NAME=UZ_RAMP +0.0, 0.0, 1.0000000000E-01, 1.0 +*BOUNDARY, AMPLITUDE=UZ_RAMP +TOP, 3, 3, 1.0000000000E-03 +*STEP +*DYNAMIC +1.0000000000E-01 +*END STEP diff --git a/examples/uniaxialTension3D/disp0_0001tet.inp b/examples/uniaxialTension3D/disp0_0001tet.inp new file mode 100644 index 0000000..c1d6908 --- /dev/null +++ b/examples/uniaxialTension3D/disp0_0001tet.inp @@ -0,0 +1,867 @@ +*HEADING +FemLite uniaxial tension 3D C3D4 displacement +*NODE +1, 5.0000000000E-02, -1.2246063538E-17, 2.0000000000E-01 +2, 5.0000000000E-02, -1.2246063538E-17, 0.0000000000E+00 +3, 4.4272801283E-02, 2.3236158602E-02, 2.0000000000E-01 +4, 2.8403237337E-02, 4.1149193295E-02, 2.0000000000E-01 +5, 6.0268340128E-03, 4.9635443705E-02, 2.0000000000E-01 +6, -1.7730244352E-02, 4.6750812134E-02, 2.0000000000E-01 +7, -3.7425537409E-02, 3.3156132912E-02, 2.0000000000E-01 +8, -4.8547090871E-02, 1.1965783214E-02, 2.0000000000E-01 +9, -4.8547090871E-02, -1.1965783214E-02, 2.0000000000E-01 +10, -3.7425537409E-02, -3.3156132912E-02, 2.0000000000E-01 +11, -1.7730244352E-02, -4.6750812134E-02, 2.0000000000E-01 +12, 6.0268340128E-03, -4.9635443705E-02, 2.0000000000E-01 +13, 2.8403237337E-02, -4.1149193295E-02, 2.0000000000E-01 +14, 4.4272801283E-02, -2.3236158602E-02, 2.0000000000E-01 +15, 5.0000000000E-02, -1.2246063538E-17, 2.5000000000E-02 +16, 5.0000000000E-02, -1.2246063538E-17, 5.0000000000E-02 +17, 5.0000000000E-02, -1.2246063538E-17, 7.5000000000E-02 +18, 5.0000000000E-02, -1.2246063538E-17, 1.0000000000E-01 +19, 5.0000000000E-02, -1.2246063538E-17, 1.2500000000E-01 +20, 5.0000000000E-02, -1.2246063538E-17, 1.5000000000E-01 +21, 5.0000000000E-02, -1.2246063538E-17, 1.7500000000E-01 +22, 4.4272801283E-02, 2.3236158602E-02, 0.0000000000E+00 +23, 2.8403237337E-02, 4.1149193295E-02, 0.0000000000E+00 +24, 6.0268340128E-03, 4.9635443705E-02, 0.0000000000E+00 +25, -1.7730244352E-02, 4.6750812134E-02, 0.0000000000E+00 +26, -3.7425537409E-02, 3.3156132912E-02, 0.0000000000E+00 +27, -4.8547090871E-02, 1.1965783214E-02, 0.0000000000E+00 +28, -4.8547090871E-02, -1.1965783214E-02, 0.0000000000E+00 +29, -3.7425537409E-02, -3.3156132912E-02, 0.0000000000E+00 +30, -1.7730244352E-02, -4.6750812134E-02, 0.0000000000E+00 +31, 6.0268340128E-03, -4.9635443705E-02, 0.0000000000E+00 +32, 2.8403237337E-02, -4.1149193295E-02, 0.0000000000E+00 +33, 4.4272801283E-02, -2.3236158602E-02, 0.0000000000E+00 +34, -2.8389714770E-02, -4.1158523969E-02, 2.0603536038E-02 +35, -2.7760571157E-02, 4.1585462473E-02, 1.7787435822E-01 +36, -4.4580791871E-02, 2.2639633305E-02, 2.0175720624E-02 +37, -4.3953032403E-02, -2.3835497531E-02, 1.7651909130E-01 +38, 4.5312500000E-02, 2.1137108216E-02, 8.7500000000E-02 +39, 4.5292474335E-02, -2.1179985095E-02, 1.1275123680E-01 +40, 4.5281246666E-02, -2.1203978410E-02, 6.2399419893E-02 +41, 4.5312500000E-02, 2.1137108216E-02, 1.3750000000E-01 +42, 1.7730244352E-02, -4.6750812134E-02, 1.7932564490E-01 +43, 1.7157001014E-02, 4.6964213144E-02, 1.7224058806E-02 +44, 1.7544413016E-02, 4.6820866843E-02, 1.7492556959E-01 +45, 1.7326840274E-02, -4.6901818793E-02, 1.8488914854E-02 +46, 4.5312500000E-02, -2.1137108217E-02, 1.6250000000E-01 +47, 4.5312500000E-02, 2.1137108216E-02, 3.7500000000E-02 +48, 4.5318261855E-02, -2.1124751891E-02, 1.3763666785E-01 +49, 3.2297177849E-02, -3.8169258612E-02, 1.2511543647E-01 +50, 3.2240640371E-02, -3.8217026421E-02, 9.9965582624E-02 +51, 1.3327798030E-02, -4.8190972180E-02, 1.1278644126E-01 +52, 1.3406227656E-02, -4.8169212782E-02, 8.7765649880E-02 +53, -7.7741989084E-03, -4.9391920709E-02, 1.0071104278E-01 +54, -7.6804187492E-03, -4.9406590328E-02, 1.2505353663E-01 +55, -2.7323229484E-02, -4.1874110505E-02, 1.1299229123E-01 +56, -2.7450185985E-02, -4.1790995314E-02, 8.8825400841E-02 +57, -4.2100514232E-02, -2.6973073636E-02, 1.0099353424E-01 +58, -4.2246127920E-02, -2.6744432613E-02, 7.9842731398E-02 +59, -4.9448428242E-02, -7.4062773655E-03, 8.9052176597E-02 +60, -4.9431414862E-02, -7.5189909409E-03, 1.1311560773E-01 +61, -4.8200355113E-02, 1.3293824393E-02, 1.0118202373E-01 +62, -4.8224868880E-02, 1.3204621217E-02, 1.2521069271E-01 +63, -3.8617168343E-02, 3.1760263053E-02, 1.1324431077E-01 +64, -3.8537531651E-02, 3.1856846269E-02, 8.9130553907E-02 +65, -2.2140541490E-02, 4.4830753089E-02, 1.0134342593E-01 +66, -2.2065713781E-02, 4.4867630596E-02, 7.7087153567E-02 +67, -2.2234507498E-02, 4.4784223520E-02, 1.2557804005E-01 +68, -1.8254934899E-03, 4.9966664623E-02, 1.1350528389E-01 +69, -4.9470124697E-02, -7.2599423214E-03, 6.5011962777E-02 +70, -2.7241340410E-02, -4.1927429836E-02, 1.3718958019E-01 +71, -2.7624946018E-02, -4.1675680648E-02, 6.4673938762E-02 +72, -3.8296619174E-02, 3.2146056676E-02, 6.6192793288E-02 +73, -2.2015623357E-02, 4.4892230154E-02, 5.2978462616E-02 +74, -1.7307609719E-03, 4.9970035686E-02, 6.5030786771E-02 +75, -4.9415624831E-02, -7.6220746882E-03, 1.3711844216E-01 +76, -1.7280864848E-03, 4.9970128248E-02, 1.3393249380E-01 +77, -4.8265282789E-02, 1.3056127960E-02, 1.4918302997E-01 +78, -7.6953531843E-03, -4.9404266409E-02, 1.4916697769E-01 +79, 1.8851074877E-02, 4.6310225393E-02, 1.2543767416E-01 +80, 1.8754430253E-02, 4.6349448172E-02, 1.0447894145E-01 +81, -2.2332547801E-02, 4.4735414480E-02, 1.4982131280E-01 +82, -2.7310446012E-02, -4.1882449053E-02, 1.5972143640E-01 +83, 1.8850845488E-02, 4.6310318768E-02, 1.5012475493E-01 +84, 3.6477810739E-02, 3.4196042515E-02, 1.1359120262E-01 +85, -1.6733195544E-03, 4.9971992172E-02, 4.0827746771E-02 +86, 1.8736863264E-02, 4.6356552450E-02, 5.8727441172E-02 +87, -2.1338553014E-02, 4.5217984865E-02, 3.6094217209E-02 +88, -7.6009484564E-03, -4.9418878807E-02, 1.7340878756E-01 +89, 4.5287703476E-02, -2.1190184375E-02, 8.7506139505E-02 +90, 3.2159201268E-02, -3.8285581801E-02, 1.4443070183E-01 +91, 4.5328997840E-02, 2.1101705023E-02, 6.2566052381E-02 +92, 3.2285829080E-02, 3.8178858556E-02, 7.5000179121E-02 +93, -4.9397642421E-02, -7.7377595766E-03, 1.6112147645E-01 +94, -4.8388367027E-02, 1.2592296711E-02, 1.7184734585E-01 +95, 4.5332579180E-02, -2.1094010166E-02, 3.7580407145E-02 +96, 3.2050975967E-02, -3.8376228834E-02, 5.5516247365E-02 +97, 3.2157338001E-02, -3.8287146834E-02, 7.7594361959E-02 +98, 1.3280334751E-02, -4.8204073572E-02, 6.6710738657E-02 +99, 4.5332579180E-02, 2.1094010166E-02, 1.6241959285E-01 +100, -4.2103716268E-02, -2.6968075134E-02, 1.2495080172E-01 +101, -7.9014622158E-03, -4.9371721611E-02, 7.9262421468E-02 +102, -3.8758440556E-02, 3.1587707826E-02, 1.3694334129E-01 +103, 1.3220017844E-02, -4.8220650433E-02, 1.3526725984E-01 +104, -4.8132156848E-02, 1.3538666005E-02, 8.0434707810E-02 +105, -1.8264115312E-03, 4.9966631074E-02, 8.9324233085E-02 +106, -4.2127985639E-02, -2.6930147158E-02, 1.4899703600E-01 +107, -3.8176299609E-02, 3.2288854860E-02, 4.1462011990E-02 +108, -4.8787966434E-02, 1.0942318368E-02, 4.0611271329E-02 +109, -4.9999965506E-02, -5.8731678424E-05, 2.0125185027E-02 +110, -4.8354012129E-02, -1.2723580903E-02, 4.1879088224E-02 +111, -3.8999760943E-02, 3.1289273663E-02, 1.6086724161E-01 +112, -6.2436212825E-03, 4.9608640309E-02, 1.6931869626E-01 +113, -6.2112615617E-03, -4.9612702303E-02, 2.0089297456E-02 +114, -1.8279625609E-02, -4.6538750387E-02, 4.0588840299E-02 +115, -4.4274618641E-02, -2.3232695585E-02, 2.0600939671E-02 +116, 6.8734004515E-03, -4.9525310360E-02, 4.1374475792E-02 +117, -3.6846056251E-02, -3.3798936947E-02, 4.0901254687E-02 +118, 3.7425537409E-02, 3.3156132912E-02, 1.8041910809E-01 +119, 3.7419879686E-02, -3.3162518064E-02, 1.6384468742E-02 +120, 3.7345188530E-02, 3.3246607250E-02, 1.8752690745E-02 +121, 3.7441058074E-02, -3.3138605437E-02, 1.8333558814E-01 +122, -3.5213506384E-03, 4.9875846757E-02, 1.9289585146E-02 +123, 1.1806169255E-02, -4.8586154072E-02, 1.5862270570E-01 +124, -2.8403237337E-02, -4.1149193295E-02, 1.8262235008E-01 +125, 2.8734771129E-02, 4.0918369080E-02, 3.7116764404E-02 +126, 3.5889674519E-02, 3.4812803146E-02, 1.4999108621E-01 +127, 4.6689761631E-02, 1.7890392921E-02, 1.1196238036E-01 +128, 1.7007325258E-02, 4.7018622774E-02, 8.2195117854E-02 +129, -5.5645959794E-03, -4.9689387917E-02, 5.6810099400E-02 +130, -4.3384466754E-02, -2.4855342372E-02, 6.0119196744E-02 +131, -4.9795255754E-02, -4.5202327816E-03, 1.8183212485E-01 +132, 3.4469536600E-02, 3.6219484350E-02, 9.4222384732E-02 +133, 3.4983369793E-02, 3.5723435416E-02, 5.5591584759E-02 +134, -4.7365722901E-02, 1.6015251921E-02, 6.0713695289E-02 +135, -4.1511314772E-02, 2.7871324796E-02, 1.8232279392E-01 +136, 4.7027657411E-02, 1.6982327239E-02, 1.7626503805E-02 +137, 4.7027657411E-02, -1.6982327239E-02, 1.8237349620E-01 +138, 4.7026423655E-02, 1.6985743383E-02, 1.8237006468E-01 +139, 4.7026423655E-02, -1.6985743383E-02, 1.7629935317E-02 +140, 2.9680712271E-02, 4.0237486491E-02, 1.6498981765E-01 +141, 3.3934040089E-02, 3.6721668307E-02, 1.3298671980E-01 +142, -3.3493941431E-02, 3.7123522023E-02, 1.7562297569E-02 +143, -6.0427637812E-03, 4.9633506887E-02, 1.8703268653E-01 +144, 2.8887999028E-02, -4.0810335850E-02, 1.6708167894E-01 +145, 2.8879448336E-02, -4.0816387197E-02, 3.2842735842E-02 +146, 2.0896316440E-03, 4.9956315312E-02, 1.5340696599E-01 +147, -3.1274711417E-03, -2.9146629938E-02, 2.0000000000E-01 +148, -3.3535409490E-03, 2.7618894536E-02, 2.0000000000E-01 +149, 2.7013297005E-02, -6.6581797194E-03, 2.0000000000E-01 +150, -2.7103215353E-02, 9.3677420306E-04, 2.0000000000E-01 +151, 2.0824876207E-02, 1.8449230424E-02, 2.0000000000E-01 +152, 1.2797474394E-02, -3.3744166707E-02, 2.0000000000E-01 +153, 1.0427986921E-02, -1.5913464098E-02, 2.0000000000E-01 +154, -8.6322070724E-03, -7.6474681417E-03, 2.0000000000E-01 +155, 5.6559510934E-03, 4.4642446325E-03, 2.0000000000E-01 +156, -2.1784016079E-02, -2.1806952658E-02, 2.0000000000E-01 +157, -1.1308875794E-02, 1.0518889161E-02, 2.0000000000E-01 +158, -2.4244750788E-02, 2.1824547693E-02, 2.0000000000E-01 +159, 2.7013297005E-02, -2.3931692847E-02, 2.0000000000E-01 +160, 3.5527743624E-02, 8.7568023267E-03, 2.0000000000E-01 +161, 1.2975351652E-02, 3.4213190490E-02, 2.0000000000E-01 +162, -2.3369875385E-03, -2.7018518050E-02, 0.0000000000E+00 +163, -3.3535409490E-03, 2.7618894536E-02, 0.0000000000E+00 +164, 2.7013297005E-02, -6.6581797194E-03, 0.0000000000E+00 +165, -2.9311093179E-02, 4.0856965750E-04, 0.0000000000E+00 +166, 2.0824876207E-02, 1.8449230424E-02, 0.0000000000E+00 +167, -2.0501110718E-02, 2.9700986465E-02, 0.0000000000E+00 +168, -1.4540482103E-02, 1.2270111289E-02, 0.0000000000E+00 +169, -8.6322070724E-03, -7.6474681417E-03, 0.0000000000E+00 +170, 5.1134448313E-03, 5.0766076141E-03, 0.0000000000E+00 +171, -2.4273728402E-02, -1.8996648396E-02, 0.0000000000E+00 +172, 9.0790602704E-03, -1.2494333337E-02, 0.0000000000E+00 +173, 1.8743040395E-02, -2.6698637785E-02, 0.0000000000E+00 +174, 3.5527743624E-02, 8.7568023267E-03, 0.0000000000E+00 +175, -3.1955568660E-02, 1.6771576230E-02, 0.0000000000E+00 +176, 1.2975351652E-02, 3.4213190490E-02, 0.0000000000E+00 +177, -1.3547620074E-04, 1.7749647571E-05, 1.1914625256E-01 +178, -8.5064451229E-04, -3.0457196365E-04, 5.1028326636E-02 +179, -9.0397861519E-03, 1.5728499214E-03, 1.5959461764E-01 +180, -7.8751818874E-03, 1.1820753400E-02, 8.5108182054E-02 +181, 1.9892914484E-02, 8.0629950522E-03, 1.4999121122E-01 +182, 9.6623385613E-03, -1.5499208832E-02, 9.1592369497E-02 +183, -2.1093300436E-02, 5.3026839319E-03, 2.8940906742E-02 +184, 4.9297603692E-03, -2.0981586905E-02, 2.9156276328E-02 +185, 1.4732169256E-02, -1.4135913376E-02, 1.7001908882E-01 +186, 6.8107957733E-03, 1.8575403068E-02, 2.7768329393E-02 +187, 3.8397106397E-03, -1.9898771776E-02, 1.4202124731E-01 +188, 1.9953186627E-02, 6.7425049689E-03, 7.2730040817E-02 +189, -1.4753292657E-02, -1.5417375786E-02, 7.3460642605E-02 +190, -1.1949807178E-02, 1.9918267444E-02, 1.3701451221E-01 +191, -2.2806041720E-02, -5.6810466883E-03, 1.0237968813E-01 +192, -2.1194298761E-02, -8.2480185099E-03, 1.3606232491E-01 +193, 8.4989804890E-03, 1.9441255162E-02, 1.7393204539E-01 +194, 2.1032247005E-02, 9.2263651771E-03, 1.0159928483E-01 +195, 2.4306805738E-02, -1.7599040429E-03, 3.7579329831E-02 +196, -1.1344174742E-02, -2.1219777899E-02, 1.7465592661E-01 +197, -6.0033435431E-03, -2.5475319670E-02, 1.1289006546E-01 +198, -7.0495549391E-03, 2.3968348101E-02, 1.0907810975E-01 +199, 1.0608267907E-02, -2.1020167064E-02, 6.4788971562E-02 +200, 2.4214293047E-02, -7.2316097815E-03, 1.2820034559E-01 +201, -7.1867373361E-03, 2.3892700082E-02, 6.1034066725E-02 +202, -1.6149431496E-02, 1.8033760113E-02, 1.7680755421E-01 +203, 1.3860487419E-02, 2.0586669236E-02, 1.2766752538E-01 +204, -2.3845827882E-02, -1.1773642972E-02, 4.9665153464E-02 +205, 2.6830276192E-02, 4.7583509465E-03, 1.7814311096E-01 +206, 1.5837127777E-02, 1.9711460370E-02, 5.1387603170E-02 +207, -1.9431825800E-02, -1.9096468812E-02, 2.6637383748E-02 +*ELEMENT, TYPE=C3D4, ELSET=EALL +1, 180, 189, 134, 201 +2, 134, 201, 189, 204 +3, 131, 93, 179, 196 +4, 131, 196, 179, 202 +5, 142, 183, 167, 186 +6, 62, 190, 191, 198 +7, 163, 167, 168, 183 +8, 62, 191, 190, 192 +9, 104, 134, 180, 189 +10, 62, 191, 63, 198 +11, 62, 63, 190, 198 +12, 167, 163, 122, 186 +13, 150, 196, 131, 202 +14, 182, 197, 50, 200 +15, 49, 50, 197, 200 +16, 129, 199, 184, 204 +17, 183, 201, 134, 204 +18, 179, 185, 154, 196 +19, 180, 194, 128, 198 +20, 154, 179, 155, 185 +21, 166, 174, 136, 195 +22, 170, 184, 172, 195 +23, 131, 93, 94, 179 +24, 175, 168, 167, 183 +25, 180, 188, 128, 194 +26, 51, 49, 50, 197 +27, 77, 111, 179, 190 +28, 129, 184, 114, 204 +29, 106, 179, 93, 196 +30, 170, 183, 169, 184 +31, 146, 190, 181, 193 +32, 146, 190, 193, 202 +33, 134, 72, 180, 201 +34, 131, 179, 94, 202 +35, 163, 167, 183, 186 +36, 107, 134, 183, 201 +37, 93, 77, 179, 192 +38, 80, 128, 194, 198 +39, 53, 189, 56, 197 +40, 170, 172, 164, 195 +41, 166, 164, 174, 195 +42, 104, 59, 189, 191 +43, 104, 189, 180, 191 +44, 128, 188, 180, 201 +45, 106, 93, 179, 192 +46, 77, 179, 111, 202 +47, 64, 61, 191, 198 +48, 106, 192, 179, 196 +49, 146, 181, 83, 193 +50, 53, 182, 189, 197 +51, 146, 193, 112, 202 +52, 77, 190, 179, 192 +53, 104, 134, 72, 180 +54, 90, 187, 185, 200 +55, 155, 179, 154, 202 +56, 147, 153, 152, 185 +57, 53, 101, 56, 189 +58, 105, 180, 128, 198 +59, 64, 191, 180, 198 +60, 175, 167, 142, 183 +61, 39, 182, 50, 200 +62, 190, 191, 177, 192 +63, 177, 191, 190, 198 +64, 129, 189, 199, 204 +65, 64, 63, 61, 198 +66, 178, 189, 201, 204 +67, 53, 182, 101, 189 +68, 46, 185, 181, 200 +69, 183, 184, 170, 186 +70, 185, 187, 181, 200 +71, 179, 155, 185, 193 +72, 131, 37, 93, 196 +73, 168, 163, 183, 186 +74, 157, 155, 154, 202 +75, 147, 185, 152, 196 +76, 121, 152, 159, 185 +77, 153, 159, 152, 185 +78, 77, 94, 93, 179 +79, 62, 61, 63, 191 +80, 172, 170, 169, 184 +81, 179, 193, 190, 202 +82, 152, 185, 42, 196 +83, 188, 201, 128, 206 +84, 69, 134, 189, 204 +85, 179, 190, 111, 202 +86, 39, 194, 182, 200 +87, 104, 69, 134, 189 +88, 81, 190, 146, 202 +89, 147, 152, 42, 196 +90, 89, 182, 39, 194 +91, 63, 191, 61, 198 +92, 49, 197, 187, 200 +93, 178, 201, 183, 204 +94, 172, 184, 164, 195 +95, 92, 188, 128, 206 +96, 179, 192, 187, 196 +97, 136, 174, 15, 195 +98, 170, 186, 184, 195 +99, 89, 182, 188, 199 +100, 187, 192, 82, 196 +101, 81, 146, 112, 202 +102, 77, 94, 179, 202 +103, 89, 188, 182, 194 +104, 189, 191, 56, 197 +105, 89, 39, 18, 194 +106, 184, 199, 178, 204 +107, 164, 184, 119, 195 +108, 188, 195, 40, 199 +109, 174, 164, 15, 195 +110, 179, 196, 154, 202 +111, 39, 50, 49, 200 +112, 181, 190, 179, 193 +113, 103, 187, 49, 197 +114, 80, 105, 128, 198 +115, 166, 136, 186, 195 +116, 155, 193, 179, 202 +117, 89, 188, 40, 199 +118, 128, 180, 105, 201 +119, 77, 62, 190, 192 +120, 164, 119, 139, 195 +121, 103, 49, 51, 197 +122, 179, 181, 177, 190 +123, 77, 111, 94, 202 +124, 169, 184, 183, 207 +125, 132, 128, 188, 194 +126, 177, 181, 179, 187 +127, 150, 154, 196, 202 +128, 170, 164, 186, 195 +129, 114, 204, 184, 207 +130, 60, 191, 62, 192 +131, 16, 40, 188, 195 +132, 129, 71, 189, 204 +133, 166, 186, 164, 195 +134, 70, 82, 187, 192 +135, 92, 132, 128, 188 +136, 154, 155, 153, 185 +137, 64, 104, 72, 180 +138, 120, 186, 136, 195 +139, 108, 183, 134, 204 +140, 102, 77, 62, 190 +141, 178, 189, 180, 201 +142, 185, 187, 123, 196 +143, 169, 170, 168, 183 +144, 170, 164, 166, 186 +145, 154, 185, 153, 196 +146, 69, 104, 59, 189 +147, 120, 136, 47, 195 +148, 86, 128, 201, 206 +149, 177, 197, 182, 200 +150, 120, 47, 186, 195 +151, 164, 172, 173, 184 +152, 123, 187, 78, 196 +153, 164, 173, 119, 184 +154, 107, 134, 108, 183 +155, 106, 82, 192, 196 +156, 166, 136, 120, 186 +157, 177, 187, 179, 192 +158, 179, 190, 177, 192 +159, 64, 72, 66, 180 +160, 70, 192, 187, 197 +161, 178, 184, 183, 186 +162, 96, 195, 184, 199 +163, 86, 92, 128, 206 +164, 77, 102, 111, 190 +165, 62, 63, 102, 190 +166, 157, 154, 150, 202 +167, 80, 128, 132, 194 +168, 89, 50, 39, 182 +169, 153, 185, 147, 196 +170, 178, 186, 183, 201 +171, 66, 65, 64, 180 +172, 180, 178, 188, 189 +173, 72, 134, 107, 201 +174, 89, 17, 40, 188 +175, 129, 114, 71, 204 +176, 89, 97, 182, 199 +177, 101, 189, 182, 199 +178, 70, 187, 54, 197 +179, 81, 111, 190, 202 +180, 105, 65, 66, 180 +181, 168, 183, 170, 186 +182, 66, 180, 72, 201 +183, 182, 191, 189, 197 +184, 37, 106, 93, 196 +185, 180, 188, 182, 189 +186, 116, 184, 129, 199 +187, 66, 105, 180, 201 +188, 100, 191, 192, 197 +189, 182, 189, 188, 199 +190, 188, 189, 178, 199 +191, 96, 145, 184, 195 +192, 57, 56, 191, 197 +193, 16, 195, 188, 206 +194, 70, 100, 192, 197 +195, 78, 187, 82, 196 +196, 46, 181, 185, 205 +197, 64, 180, 65, 198 +198, 87, 183, 186, 201 +199, 93, 75, 77, 192 +200, 65, 180, 105, 198 +201, 145, 119, 184, 195 +202, 91, 16, 188, 206 +203, 70, 82, 78, 187 +204, 121, 42, 152, 185 +205, 101, 182, 52, 199 +206, 175, 142, 36, 183 +207, 70, 55, 100, 197 +208, 57, 55, 56, 197 +209, 53, 52, 101, 182 +210, 42, 185, 123, 196 +211, 74, 128, 105, 201 +212, 87, 183, 142, 186 +213, 120, 176, 166, 186 +214, 146, 190, 76, 203 +215, 89, 40, 97, 199 +216, 126, 140, 83, 181 +217, 20, 181, 46, 205 +218, 58, 57, 56, 191 +219, 177, 190, 181, 203 +220, 58, 56, 189, 191 +221, 182, 194, 177, 200 +222, 175, 109, 165, 183 +223, 159, 149, 137, 185 +224, 39, 18, 194, 200 +225, 80, 198, 194, 203 +226, 144, 123, 185, 187 +227, 159, 137, 121, 185 +228, 38, 188, 17, 194 +229, 180, 182, 177, 191 +230, 16, 40, 17, 188 +231, 83, 126, 181, 203 +232, 101, 129, 189, 199 +233, 83, 181, 140, 193 +234, 115, 165, 109, 207 +235, 38, 17, 18, 194 +236, 185, 193, 155, 205 +237, 177, 182, 180, 194 +238, 62, 60, 61, 191 +239, 165, 183, 109, 207 +240, 100, 191, 60, 192 +241, 144, 185, 90, 187 +242, 184, 186, 178, 195 +243, 77, 75, 62, 192 +244, 131, 94, 150, 202 +245, 129, 116, 114, 184 +246, 175, 36, 109, 183 +247, 78, 54, 70, 187 +248, 96, 40, 195, 199 +249, 163, 176, 122, 186 +250, 178, 195, 188, 199 +251, 52, 182, 53, 197 +252, 146, 76, 83, 203 +253, 75, 60, 62, 192 +254, 87, 107, 183, 201 +255, 58, 189, 59, 191 +256, 186, 195, 47, 206 +257, 19, 194, 18, 200 +258, 64, 65, 63, 198 +259, 140, 181, 99, 193 +260, 145, 95, 119, 195 +261, 181, 187, 177, 200 +262, 67, 190, 63, 198 +263, 15, 164, 139, 195 +264, 99, 193, 181, 205 +265, 153, 185, 155, 205 +266, 70, 106, 82, 192 +267, 52, 53, 51, 197 +268, 140, 126, 99, 181 +269, 184, 195, 178, 199 +270, 179, 187, 185, 196 +271, 47, 195, 16, 206 +272, 91, 47, 16, 206 +273, 127, 194, 200, 203 +274, 86, 128, 74, 201 +275, 140, 193, 99, 205 +276, 140, 99, 118, 205 +277, 181, 185, 179, 187 +278, 180, 189, 182, 191 +279, 59, 104, 61, 191 +280, 183, 184, 178, 207 +281, 161, 118, 151, 193 +282, 66, 74, 105, 201 +283, 120, 43, 176, 186 +284, 178, 199, 189, 204 +285, 144, 90, 123, 187 +286, 39, 19, 18, 200 +287, 103, 54, 187, 197 +288, 21, 20, 46, 205 +289, 169, 183, 165, 207 +290, 139, 119, 95, 195 +291, 153, 149, 159, 185 +292, 187, 197, 177, 200 +293, 140, 118, 193, 205 +294, 96, 95, 145, 195 +295, 161, 148, 143, 193 +296, 177, 194, 180, 198 +297, 165, 168, 175, 183 +298, 147, 42, 88, 196 +299, 180, 188, 178, 201 +300, 110, 109, 183, 207 +301, 71, 101, 129, 189 +302, 88, 123, 78, 196 +303, 110, 115, 109, 207 +304, 113, 162, 34, 207 +305, 99, 181, 20, 205 +306, 172, 169, 162, 184 +307, 67, 102, 63, 190 +308, 165, 169, 168, 183 +309, 38, 132, 188, 194 +310, 127, 200, 41, 203 +311, 88, 42, 123, 196 +312, 179, 185, 181, 193 +313, 44, 118, 161, 193 +314, 80, 79, 68, 203 +315, 80, 68, 198, 203 +316, 190, 198, 76, 203 +317, 16, 17, 91, 188 +318, 161, 143, 44, 193 +319, 113, 184, 162, 207 +320, 96, 184, 116, 199 +321, 182, 188, 180, 194 +322, 137, 185, 149, 205 +323, 135, 150, 94, 202 +324, 95, 96, 40, 195 +325, 92, 38, 132, 188 +326, 69, 59, 58, 189 +327, 68, 76, 198, 203 +328, 101, 52, 98, 199 +329, 43, 122, 176, 186 +330, 177, 191, 182, 197 +331, 127, 19, 41, 200 +332, 80, 194, 84, 203 +333, 83, 141, 126, 203 +334, 85, 201, 186, 206 +335, 90, 49, 187, 200 +336, 73, 72, 107, 201 +337, 21, 99, 20, 205 +338, 180, 191, 177, 198 +339, 76, 190, 67, 198 +340, 52, 182, 97, 199 +341, 96, 145, 116, 184 +342, 154, 153, 147, 196 +343, 106, 75, 93, 192 +344, 75, 100, 60, 192 +345, 181, 200, 177, 203 +346, 171, 165, 115, 207 +347, 188, 195, 178, 206 +348, 103, 51, 54, 197 +349, 184, 204, 178, 207 +350, 144, 46, 90, 185 +351, 127, 194, 19, 200 +352, 162, 184, 169, 207 +353, 152, 12, 147, 42 +354, 57, 60, 100, 191 +355, 114, 184, 113, 207 +356, 142, 107, 36, 183 +357, 156, 150, 154, 196 +358, 120, 47, 125, 186 +359, 178, 186, 201, 206 +360, 89, 97, 50, 182 +361, 41, 200, 181, 203 +362, 19, 127, 18, 194 +363, 45, 162, 113, 184 +364, 149, 185, 153, 205 +365, 20, 181, 41, 200 +366, 45, 119, 173, 184 +367, 158, 150, 135, 202 +368, 110, 183, 204, 207 +369, 112, 193, 143, 202 +370, 78, 103, 54, 187 +371, 149, 153, 155, 205 +372, 125, 186, 47, 206 +373, 92, 133, 188, 206 +374, 101, 98, 129, 199 +375, 81, 111, 102, 190 +376, 92, 133, 91, 188 +377, 183, 178, 204, 207 +378, 177, 192, 191, 197 +379, 174, 2, 15, 164 +380, 168, 170, 163, 186 +381, 68, 76, 67, 198 +382, 181, 193, 185, 205 +383, 70, 54, 55, 197 +384, 143, 193, 148, 202 +385, 133, 91, 188, 206 +386, 58, 59, 57, 191 +387, 1, 149, 160, 205 +388, 20, 41, 19, 200 +389, 68, 79, 76, 203 +390, 82, 106, 37, 196 +391, 90, 49, 103, 187 +392, 55, 53, 56, 197 +393, 1, 160, 21, 205 +394, 46, 185, 137, 205 +395, 145, 119, 45, 184 +396, 85, 87, 186, 201 +397, 71, 114, 117, 204 +398, 187, 192, 177, 197 +399, 34, 162, 171, 207 +400, 87, 73, 107, 201 +401, 38, 92, 91, 188 +402, 105, 80, 68, 198 +403, 83, 76, 79, 203 +404, 42, 144, 123, 185 +405, 52, 50, 97, 182 +406, 115, 28, 109, 165 +407, 173, 162, 45, 184 +408, 35, 81, 112, 202 +409, 146, 83, 44, 193 +410, 176, 163, 166, 186 +411, 169, 165, 171, 207 +412, 16, 95, 40, 195 +413, 87, 107, 142, 183 +414, 109, 27, 175, 165 +415, 121, 152, 13, 159 +416, 117, 204, 114, 207 +417, 35, 111, 81, 202 +418, 56, 101, 71, 189 +419, 44, 83, 140, 193 +420, 147, 88, 124, 196 +421, 131, 150, 9, 156 +422, 178, 201, 188, 206 +423, 151, 193, 118, 205 +424, 30, 34, 113, 162 +425, 109, 27, 36, 175 +426, 150, 8, 135, 94 +427, 69, 189, 130, 204 +428, 47, 136, 15, 195 +429, 44, 112, 146, 193 +430, 194, 198, 177, 203 +431, 130, 189, 71, 204 +432, 173, 172, 162, 184 +433, 177, 200, 194, 203 +434, 3, 138, 160, 118 +435, 42, 121, 144, 185 +436, 38, 91, 17, 188 +437, 58, 130, 69, 189 +438, 114, 113, 34, 207 +439, 52, 97, 98, 199 +440, 106, 70, 100, 192 +441, 67, 63, 65, 198 +442, 123, 90, 103, 187 +443, 94, 150, 8, 131 +444, 46, 137, 21, 205 +445, 151, 3, 160, 118 +446, 78, 123, 103, 187 +447, 85, 86, 201, 206 +448, 46, 121, 137, 185 +449, 88, 78, 82, 196 +450, 61, 60, 59, 191 +451, 110, 183, 108, 204 +452, 146, 81, 76, 190 +453, 98, 116, 129, 199 +454, 127, 84, 194, 203 +455, 90, 48, 49, 200 +456, 48, 20, 19, 200 +457, 114, 116, 113, 184 +458, 80, 132, 84, 194 +459, 112, 44, 143, 193 +460, 85, 186, 125, 206 +461, 1, 21, 137, 205 +462, 28, 115, 171, 165 +463, 161, 151, 148, 193 +464, 176, 23, 120, 166 +465, 58, 56, 71, 189 +466, 133, 47, 91, 206 +467, 1, 137, 149, 205 +468, 126, 41, 99, 181 +469, 73, 66, 72, 201 +470, 147, 124, 156, 196 +471, 2, 15, 164, 139 +472, 110, 109, 108, 183 +473, 37, 131, 9, 156 +474, 162, 30, 34, 171 +475, 45, 113, 162, 31 +476, 83, 79, 141, 203 +477, 158, 8, 135, 150 +478, 58, 71, 130, 189 +479, 186, 178, 195, 206 +480, 84, 41, 141, 203 +481, 35, 143, 148, 202 +482, 121, 46, 144, 185 +483, 69, 108, 134, 204 +484, 80, 84, 79, 203 +485, 35, 148, 158, 202 +486, 177, 198, 190, 203 +487, 127, 41, 84, 203 +488, 57, 59, 60, 191 +489, 74, 85, 86, 201 +490, 88, 124, 11, 147 +491, 170, 166, 163, 186 +492, 65, 105, 68, 198 +493, 39, 49, 48, 200 +494, 92, 86, 133, 206 +495, 12, 88, 147, 42 +496, 138, 21, 160, 205 +497, 99, 41, 20, 181 +498, 4, 161, 44, 118 +499, 117, 130, 71, 204 +500, 24, 122, 163, 176 +501, 135, 94, 111, 202 +502, 98, 96, 116, 199 +503, 69, 110, 108, 204 +504, 85, 87, 122, 186 +505, 42, 152, 13, 121 +506, 148, 6, 35, 158 +507, 110, 117, 115, 207 +508, 36, 107, 108, 183 +509, 124, 37, 156, 196 +510, 161, 4, 151, 118 +511, 162, 169, 171, 207 +512, 122, 43, 85, 186 +513, 47, 15, 16, 195 +514, 110, 204, 117, 207 +515, 143, 6, 35, 148 +516, 35, 112, 143, 202 +517, 106, 100, 75, 192 +518, 155, 193, 151, 205 +519, 68, 67, 65, 198 +520, 138, 118, 99, 205 +521, 81, 67, 76, 190 +522, 45, 113, 116, 184 +523, 124, 82, 37, 196 +524, 96, 97, 40, 199 +525, 140, 118, 44, 193 +526, 171, 115, 34, 207 +527, 155, 148, 151, 193 +528, 15, 139, 95, 195 +529, 43, 23, 120, 176 +530, 81, 102, 67, 190 +531, 174, 15, 2, 136 +532, 21, 1, 138, 160 +533, 38, 18, 127, 194 +534, 73, 74, 66, 201 +535, 162, 173, 45, 31 +536, 109, 36, 108, 183 +537, 43, 120, 125, 186 +538, 85, 125, 86, 206 +539, 54, 51, 53, 197 +540, 157, 150, 158, 202 +541, 164, 33, 139, 119 +542, 125, 85, 43, 186 +543, 29, 34, 171, 115 +544, 39, 48, 19, 200 +545, 161, 143, 5, 44 +546, 116, 145, 45, 184 +547, 38, 127, 132, 194 +548, 149, 151, 160, 205 +549, 85, 73, 87, 201 +550, 175, 167, 26, 142 +551, 15, 95, 16, 195 +552, 55, 54, 53, 197 +553, 14, 137, 159, 149 +554, 33, 164, 173, 119 +555, 147, 124, 11, 156 +556, 74, 73, 85, 201 +557, 122, 163, 167, 25 +558, 156, 154, 147, 196 +559, 149, 155, 151, 205 +560, 34, 117, 114, 207 +561, 125, 47, 133, 206 +562, 24, 43, 122, 176 +563, 35, 135, 111, 202 +564, 11, 12, 88, 147 +565, 99, 21, 138, 205 +566, 127, 84, 132, 194 +567, 27, 109, 28, 165 +568, 29, 34, 30, 171 +569, 22, 120, 23, 166 +570, 34, 115, 117, 207 +571, 148, 157, 158, 202 +572, 84, 141, 79, 203 +573, 161, 5, 4, 44 +574, 82, 124, 88, 196 +575, 124, 37, 10, 156 +576, 135, 35, 158, 202 +577, 27, 36, 175, 26 +578, 37, 9, 10, 156 +579, 137, 14, 1, 149 +580, 130, 117, 110, 204 +581, 26, 36, 175, 142 +582, 137, 121, 14, 159 +583, 96, 98, 97, 199 +584, 110, 69, 130, 204 +585, 113, 30, 162, 31 +586, 151, 4, 3, 118 +587, 115, 171, 29, 28 +588, 45, 173, 119, 32 +589, 33, 2, 164, 139 +590, 148, 143, 5, 161 +591, 6, 7, 35, 158 +592, 9, 8, 150, 131 +593, 138, 1, 3, 160 +594, 2, 22, 174, 136 +595, 173, 45, 31, 32 +596, 35, 7, 135, 158 +597, 86, 125, 133, 206 +598, 152, 13, 12, 42 +599, 135, 7, 8, 158 +600, 13, 14, 121, 159 +601, 119, 173, 33, 32 +602, 25, 122, 163, 24 +603, 124, 10, 11, 156 +604, 23, 43, 24, 176 +605, 143, 5, 6, 148 +606, 26, 167, 25, 142 +607, 200, 46, 90, 48 +608, 200, 90, 46, 185 +609, 50, 197, 52, 51 +610, 52, 197, 50, 182 +611, 200, 46, 20, 181 +612, 200, 20, 46, 48 +613, 191, 64, 104, 61 +614, 191, 104, 64, 180 +615, 194, 17, 89, 188 +616, 194, 89, 17, 18 +617, 203, 146, 181, 83 +618, 203, 181, 146, 190 +619, 197, 57, 100, 191 +620, 197, 100, 57, 55 +621, 202, 155, 148, 157 +622, 202, 148, 155, 193 +623, 203, 126, 41, 141 +624, 203, 41, 126, 181 +625, 131, 156, 196, 150 +626, 196, 156, 131, 37 +627, 166, 136, 22, 120 +628, 22, 136, 166, 174 +629, 160, 118, 205, 151 +630, 205, 118, 160, 138 +631, 25, 87, 167, 122 +632, 25, 167, 87, 142 +633, 186, 167, 87, 122 +634, 186, 87, 167, 142 +*NSET, NSET=BOTTOM +2, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 162, 163, 164 +165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176 +*NSET, NSET=TOP +1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 147, 148, 149 +150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161 +*MATERIAL, NAME=ALUMINUM +*DENSITY +2.7000000000E+03 +*ELASTIC +7.0000000000E+10, 3.0000000000E-01 +*SOLID SECTION, ELSET=EALL, MATERIAL=ALUMINUM +*BOUNDARY +BOTTOM, 1, 3, 0.0 +*AMPLITUDE, NAME=UZ_RAMP +0.0, 0.0, 1.0000000000E-01, 1.0 +*BOUNDARY, AMPLITUDE=UZ_RAMP +TOP, 3, 3, 1.0000000000E-03 +*STEP +*DYNAMIC +1.0000000000E-06, 1.0000000000E-01 +*END STEP diff --git a/examples/uniaxialTension3D/generate_uniaxial_tension3d.py b/examples/uniaxialTension3D/generate_uniaxial_tension3d.py new file mode 100644 index 0000000..dfa7d3b --- /dev/null +++ b/examples/uniaxialTension3D/generate_uniaxial_tension3d.py @@ -0,0 +1,477 @@ +#!/usr/bin/env python3 +"""Generate FemLite uniaxial tension 3D example input decks. + +The preferred backend is the Gmsh Python API. When gmsh is not available, the +script falls back to a deterministic low-order O-grid cylinder approximation so +that the example input decks can still be regenerated from a clean checkout. +""" + +from __future__ import annotations + +import argparse +import math +from dataclasses import dataclass +from pathlib import Path +from typing import Callable, Dict, Iterable, List, Sequence, Tuple + + +RADIUS = 0.05 +HEIGHT = 0.20 +YOUNG_MODULUS = 70.0e9 +POISSON_RATIO = 0.30 +DENSITY = 2700.0 +TOTAL_FORCE_Z = 1000.0 +END_TIME = 0.10 +DISPLACEMENT_RATE = 0.01 +FINAL_DISPLACEMENT_Z = DISPLACEMENT_RATE * END_TIME +TET_TIME_STEP = 1.0e-6 +SET_LINE_WIDTH = 16 + + +Point3 = Tuple[float, float, float] +Element = Tuple[int, ...] + + +@dataclass +class Mesh: + nodes: Dict[int, Point3] + elements: List[Element] + element_type: str + + +class NodePool2D: + def __init__(self) -> None: + self.coords: Dict[int, Tuple[float, float]] = {} + self._key_to_id: Dict[Tuple[int, int], int] = {} + + def add(self, x: float, y: float) -> int: + key = (round(x, 12), round(y, 12)) + if key in self._key_to_id: + return self._key_to_id[key] + node_id = len(self.coords) + 1 + self.coords[node_id] = (x, y) + self._key_to_id[key] = node_id + return node_id + + +def line(p0: Tuple[float, float], p1: Tuple[float, float], t: float) -> Tuple[float, float]: + return ((1.0 - t) * p0[0] + t * p1[0], (1.0 - t) * p0[1] + t * p1[1]) + + +def arc(theta0: float, theta1: float, t: float) -> Tuple[float, float]: + theta = theta0 + (theta1 - theta0) * t + return (RADIUS * math.cos(theta), RADIUS * math.sin(theta)) + + +def coons_patch( + inner: Callable[[float], Tuple[float, float]], + outer: Callable[[float], Tuple[float, float]], + side0: Callable[[float], Tuple[float, float]], + side1: Callable[[float], Tuple[float, float]], + u: float, + v: float, +) -> Tuple[float, float]: + c00 = inner(0.0) + c01 = inner(1.0) + c10 = outer(0.0) + c11 = outer(1.0) + li = inner(v) + lo = outer(v) + b0 = side0(u) + b1 = side1(u) + blend_x = ( + (1.0 - u) * (1.0 - v) * c00[0] + + u * (1.0 - v) * c10[0] + + u * v * c11[0] + + (1.0 - u) * v * c01[0] + ) + blend_y = ( + (1.0 - u) * (1.0 - v) * c00[1] + + u * (1.0 - v) * c10[1] + + u * v * c11[1] + + (1.0 - u) * v * c01[1] + ) + x = (1.0 - u) * li[0] + u * lo[0] + (1.0 - v) * b0[0] + v * b1[0] - blend_x + y = (1.0 - u) * li[1] + u * lo[1] + (1.0 - v) * b0[1] + v * b1[1] - blend_y + return x, y + + +def add_block_quads( + pool: NodePool2D, + inner: Callable[[float], Tuple[float, float]], + outer: Callable[[float], Tuple[float, float]], + side0: Callable[[float], Tuple[float, float]], + side1: Callable[[float], Tuple[float, float]], + nr: int, + nt: int, + quads: List[Tuple[int, int, int, int]], +) -> None: + grid: List[List[int]] = [] + for i in range(nr + 1): + u = float(i) / float(nr) + row: List[int] = [] + for j in range(nt + 1): + v = float(j) / float(nt) + x, y = coons_patch(inner, outer, side0, side1, u, v) + row.append(pool.add(x, y)) + grid.append(row) + + for i in range(nr): + for j in range(nt): + quads.append((grid[i][j], grid[i + 1][j], grid[i + 1][j + 1], grid[i][j + 1])) + + +def build_internal_hex_mesh(nt: int = 2, nr: int = 1, nz: int = 4) -> Mesh: + pool = NodePool2D() + quads: List[Tuple[int, int, int, int]] = [] + a = 0.5 * RADIUS + + p_ne = (a, a) + p_nw = (-a, a) + p_sw = (-a, -a) + p_se = (a, -a) + o_ne = arc(math.radians(45.0), math.radians(45.0), 0.0) + o_nw = arc(math.radians(135.0), math.radians(135.0), 0.0) + o_sw = arc(math.radians(225.0), math.radians(225.0), 0.0) + o_se = arc(math.radians(315.0), math.radians(315.0), 0.0) + + center: List[List[int]] = [] + for i in range(nt + 1): + x = -a + 2.0 * a * float(i) / float(nt) + row: List[int] = [] + for j in range(nt + 1): + y = -a + 2.0 * a * float(j) / float(nt) + row.append(pool.add(x, y)) + center.append(row) + for i in range(nt): + for j in range(nt): + quads.append((center[i][j], center[i + 1][j], center[i + 1][j + 1], center[i][j + 1])) + + add_block_quads( + pool, + lambda t: line(p_se, p_ne, t), + lambda t: arc(math.radians(-45.0), math.radians(45.0), t), + lambda t: line(p_se, o_se, t), + lambda t: line(p_ne, o_ne, t), + nr, + nt, + quads, + ) + add_block_quads( + pool, + lambda t: line(p_ne, p_nw, t), + lambda t: arc(math.radians(45.0), math.radians(135.0), t), + lambda t: line(p_ne, o_ne, t), + lambda t: line(p_nw, o_nw, t), + nr, + nt, + quads, + ) + add_block_quads( + pool, + lambda t: line(p_nw, p_sw, t), + lambda t: arc(math.radians(135.0), math.radians(225.0), t), + lambda t: line(p_nw, o_nw, t), + lambda t: line(p_sw, o_sw, t), + nr, + nt, + quads, + ) + add_block_quads( + pool, + lambda t: line(p_sw, p_se, t), + lambda t: arc(math.radians(225.0), math.radians(315.0), t), + lambda t: line(p_sw, o_sw, t), + lambda t: line(p_se, o_se, t), + nr, + nt, + quads, + ) + + nodes: Dict[int, Point3] = {} + layer_node: Dict[Tuple[int, int], int] = {} + next_node_id = 1 + for k in range(nz + 1): + z = HEIGHT * float(k) / float(nz) + for node2d in sorted(pool.coords): + x, y = pool.coords[node2d] + layer_node[(k, node2d)] = next_node_id + nodes[next_node_id] = (x, y, z) + next_node_id += 1 + + elements: List[Element] = [] + for k in range(nz): + for q in quads: + n1, n2, n3, n4 = q + elements.append( + ( + layer_node[(k, n1)], + layer_node[(k, n2)], + layer_node[(k, n3)], + layer_node[(k, n4)], + layer_node[(k + 1, n1)], + layer_node[(k + 1, n2)], + layer_node[(k + 1, n3)], + layer_node[(k + 1, n4)], + ) + ) + + return Mesh(nodes=nodes, elements=elements, element_type="C3D8") + + +def det_tet(nodes: Dict[int, Point3], tet: Sequence[int]) -> float: + a, b, c, d = (nodes[int(n)] for n in tet) + ux, uy, uz = b[0] - a[0], b[1] - a[1], b[2] - a[2] + vx, vy, vz = c[0] - a[0], c[1] - a[1], c[2] - a[2] + wx, wy, wz = d[0] - a[0], d[1] - a[1], d[2] - a[2] + return ux * (vy * wz - vz * wy) - vx * (uy * wz - uz * wy) + wx * (uy * vz - uz * vy) + + +def oriented_tet(nodes: Dict[int, Point3], tet: Sequence[int]) -> Element: + if det_tet(nodes, tet) > 0.0: + return tuple(int(n) for n in tet) + a, b, c, d = tet + swapped = (a, c, b, d) + if det_tet(nodes, swapped) <= 0.0: + raise RuntimeError("generated a zero-volume tetrahedron") + return tuple(int(n) for n in swapped) + + +def split_hex_mesh_to_tets(hex_mesh: Mesh) -> Mesh: + tets: List[Element] = [] + for hex_elem in hex_mesh.elements: + n = hex_elem + raw_tets = ( + (n[0], n[1], n[2], n[6]), + (n[0], n[2], n[3], n[6]), + (n[0], n[3], n[7], n[6]), + (n[0], n[7], n[4], n[6]), + (n[0], n[4], n[5], n[6]), + (n[0], n[5], n[1], n[6]), + ) + for tet in raw_tets: + tets.append(oriented_tet(hex_mesh.nodes, tet)) + return Mesh(nodes=dict(hex_mesh.nodes), elements=tets, element_type="C3D4") + + +def try_import_gmsh(): + try: + import gmsh # type: ignore + except ImportError: + return None + return gmsh + + +def collect_gmsh_mesh(gmsh, element_type: str) -> Mesh: + wanted = 4 if element_type == "C3D4" else 5 + node_tags, node_coords, _ = gmsh.model.mesh.getNodes() + tag_to_id: Dict[int, int] = {} + nodes: Dict[int, Point3] = {} + for new_id, tag in enumerate(node_tags, start=1): + tag_int = int(tag) + tag_to_id[tag_int] = new_id + i = 3 * (new_id - 1) + nodes[new_id] = (float(node_coords[i]), float(node_coords[i + 1]), float(node_coords[i + 2])) + + elements: List[Element] = [] + elem_types, _, elem_node_tags = gmsh.model.mesh.getElements(3) + for etype, conn in zip(elem_types, elem_node_tags): + if int(etype) != wanted: + continue + nen = 4 if wanted == 4 else 8 + for i in range(0, len(conn), nen): + elem = tuple(tag_to_id[int(tag)] for tag in conn[i : i + nen]) + if element_type == "C3D4": + elem = oriented_tet(nodes, elem) + elements.append(elem) + + if not elements: + raise RuntimeError(f"gmsh did not generate {element_type} elements") + return Mesh(nodes=nodes, elements=elements, element_type=element_type) + + +def build_gmsh_tet_mesh() -> Mesh: + gmsh = try_import_gmsh() + if gmsh is None: + raise RuntimeError("gmsh Python module is not available") + + gmsh.initialize() + try: + gmsh.model.add("uniaxial_tension_tet") + gmsh.model.occ.addCylinder(0.0, 0.0, 0.0, 0.0, 0.0, HEIGHT, RADIUS) + gmsh.model.occ.synchronize() + gmsh.option.setNumber("Mesh.MeshSizeMin", 0.025) + gmsh.option.setNumber("Mesh.MeshSizeMax", 0.025) + gmsh.model.mesh.generate(3) + return collect_gmsh_mesh(gmsh, "C3D4") + finally: + gmsh.finalize() + + +def build_gmsh_hex_mesh(nt: int = 2, nr: int = 1, nz: int = 4) -> Mesh: + gmsh = try_import_gmsh() + if gmsh is None: + raise RuntimeError("gmsh Python module is not available") + + gmsh.initialize() + try: + gmsh.model.add("uniaxial_tension_hex") + geo = gmsh.model.geo + lc = RADIUS + a = 0.5 * RADIUS + center = geo.addPoint(0.0, 0.0, 0.0, lc) + p_ne = geo.addPoint(a, a, 0.0, lc) + p_nw = geo.addPoint(-a, a, 0.0, lc) + p_sw = geo.addPoint(-a, -a, 0.0, lc) + p_se = geo.addPoint(a, -a, 0.0, lc) + o_ne = geo.addPoint(*arc(math.radians(45.0), math.radians(45.0), 0.0), 0.0, lc) + o_nw = geo.addPoint(*arc(math.radians(135.0), math.radians(135.0), 0.0), 0.0, lc) + o_sw = geo.addPoint(*arc(math.radians(225.0), math.radians(225.0), 0.0), 0.0, lc) + o_se = geo.addPoint(*arc(math.radians(315.0), math.radians(315.0), 0.0), 0.0, lc) + + l_right = geo.addLine(p_se, p_ne) + l_top = geo.addLine(p_ne, p_nw) + l_left = geo.addLine(p_nw, p_sw) + l_bottom = geo.addLine(p_sw, p_se) + r_ne = geo.addLine(p_ne, o_ne) + r_nw = geo.addLine(p_nw, o_nw) + r_sw = geo.addLine(p_sw, o_sw) + r_se = geo.addLine(p_se, o_se) + a_right = geo.addCircleArc(o_se, center, o_ne) + a_top = geo.addCircleArc(o_ne, center, o_nw) + a_left = geo.addCircleArc(o_nw, center, o_sw) + a_bottom = geo.addCircleArc(o_sw, center, o_se) + + center_loop = geo.addCurveLoop([l_right, l_top, l_left, l_bottom]) + right_loop = geo.addCurveLoop([r_se, a_right, -r_ne, -l_right]) + top_loop = geo.addCurveLoop([r_ne, a_top, -r_nw, -l_top]) + left_loop = geo.addCurveLoop([r_nw, a_left, -r_sw, -l_left]) + bottom_loop = geo.addCurveLoop([r_sw, a_bottom, -r_se, -l_bottom]) + surfaces = [ + geo.addPlaneSurface([center_loop]), + geo.addPlaneSurface([right_loop]), + geo.addPlaneSurface([top_loop]), + geo.addPlaneSurface([left_loop]), + geo.addPlaneSurface([bottom_loop]), + ] + + for curve in (l_right, l_top, l_left, l_bottom, a_right, a_top, a_left, a_bottom): + geo.mesh.setTransfiniteCurve(curve, nt + 1) + for curve in (r_ne, r_nw, r_sw, r_se): + geo.mesh.setTransfiniteCurve(curve, nr + 1) + for surface in surfaces: + geo.mesh.setTransfiniteSurface(surface) + geo.mesh.setRecombine(2, surface) + + geo.extrude([(2, surface) for surface in surfaces], 0.0, 0.0, HEIGHT, [nz], recombine=True) + geo.synchronize() + gmsh.model.mesh.generate(3) + return collect_gmsh_mesh(gmsh, "C3D8") + finally: + gmsh.finalize() + + +def build_mesh(element_type: str, backend: str) -> Mesh: + if backend == "gmsh": + return build_gmsh_tet_mesh() if element_type == "C3D4" else build_gmsh_hex_mesh() + + if backend == "auto" and try_import_gmsh() is not None: + return build_gmsh_tet_mesh() if element_type == "C3D4" else build_gmsh_hex_mesh() + + hex_mesh = build_internal_hex_mesh() + return split_hex_mesh_to_tets(hex_mesh) if element_type == "C3D4" else hex_mesh + + +def top_nodes(mesh: Mesh) -> List[int]: + return [nid for nid, xyz in sorted(mesh.nodes.items()) if abs(xyz[2] - HEIGHT) < 1.0e-10] + + +def bottom_nodes(mesh: Mesh) -> List[int]: + return [nid for nid, xyz in sorted(mesh.nodes.items()) if abs(xyz[2]) < 1.0e-10] + + +def write_id_set(f, ids: Sequence[int]) -> None: + for i in range(0, len(ids), SET_LINE_WIDTH): + f.write(", ".join(str(item) for item in ids[i : i + SET_LINE_WIDTH])) + f.write("\n") + + +def write_inp(path: Path, mesh: Mesh, load_case: str) -> None: + tops = top_nodes(mesh) + bottoms = bottom_nodes(mesh) + if not tops or not bottoms: + raise RuntimeError("failed to identify top or bottom node set") + + path.parent.mkdir(parents=True, exist_ok=True) + with path.open("w", encoding="ascii", newline="\n") as f: + f.write("*HEADING\n") + f.write(f"FemLite uniaxial tension 3D {mesh.element_type} {load_case}\n") + f.write("*NODE\n") + for nid in sorted(mesh.nodes): + x, y, z = mesh.nodes[nid] + f.write(f"{nid}, {x:.10E}, {y:.10E}, {z:.10E}\n") + f.write(f"*ELEMENT, TYPE={mesh.element_type}, ELSET=EALL\n") + for eid, elem in enumerate(mesh.elements, start=1): + f.write(f"{eid}, " + ", ".join(str(nid) for nid in elem) + "\n") + f.write("*NSET, NSET=BOTTOM\n") + write_id_set(f, bottoms) + f.write("*NSET, NSET=TOP\n") + write_id_set(f, tops) + f.write("*MATERIAL, NAME=ALUMINUM\n") + f.write("*DENSITY\n") + f.write(f"{DENSITY:.10E}\n") + f.write("*ELASTIC\n") + f.write(f"{YOUNG_MODULUS:.10E}, {POISSON_RATIO:.10E}\n") + f.write("*SOLID SECTION, ELSET=EALL, MATERIAL=ALUMINUM\n") + f.write("*BOUNDARY\n") + f.write("BOTTOM, 1, 3, 0.0\n") + if load_case == "force": + force_per_node = TOTAL_FORCE_Z / float(len(tops)) + f.write("*CLOAD\n") + for nid in tops: + f.write(f"{nid}, 3, {force_per_node:.10E}\n") + elif load_case == "displacement": + f.write("*AMPLITUDE, NAME=UZ_RAMP\n") + f.write(f"0.0, 0.0, {END_TIME:.10E}, 1.0\n") + f.write("*BOUNDARY, AMPLITUDE=UZ_RAMP\n") + f.write(f"TOP, 3, 3, {FINAL_DISPLACEMENT_Z:.10E}\n") + else: + raise ValueError(f"unknown load case: {load_case}") + f.write("*STEP\n") + f.write("*DYNAMIC\n") + if mesh.element_type == "C3D4": + f.write(f"{TET_TIME_STEP:.10E}, {END_TIME:.10E}\n") + else: + f.write(f"{END_TIME:.10E}\n") + f.write("*END STEP\n") + + +def write_all(output_dir: Path, backend: str) -> None: + tet_mesh = build_mesh("C3D4", backend) + hex_mesh = build_mesh("C3D8", backend) + write_inp(output_dir / "tension1000tet.inp", tet_mesh, "force") + write_inp(output_dir / "tension1000hex.inp", hex_mesh, "force") + write_inp(output_dir / "disp0_0001tet.inp", tet_mesh, "displacement") + write_inp(output_dir / "disp0_0001hex.inp", hex_mesh, "displacement") + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--backend", + choices=("auto", "gmsh", "internal"), + default="auto", + help="mesh backend; auto uses gmsh when installed and otherwise falls back to internal", + ) + parser.add_argument( + "--output-dir", + type=Path, + default=Path(__file__).resolve().parent, + help="directory for generated inp files", + ) + args = parser.parse_args() + write_all(args.output_dir, args.backend) + + +if __name__ == "__main__": + main() diff --git a/examples/uniaxialTension3D/requirements.txt b/examples/uniaxialTension3D/requirements.txt new file mode 100644 index 0000000..a5a8180 --- /dev/null +++ b/examples/uniaxialTension3D/requirements.txt @@ -0,0 +1 @@ +gmsh>=4.15 diff --git a/examples/uniaxialTension3D/tension1000hex.inp b/examples/uniaxialTension3D/tension1000hex.inp new file mode 100644 index 0000000..ac891c3 --- /dev/null +++ b/examples/uniaxialTension3D/tension1000hex.inp @@ -0,0 +1,176 @@ +*HEADING +FemLite uniaxial tension 3D C3D8 force +*NODE +1, 0.0000000000E+00, 0.0000000000E+00, 0.0000000000E+00 +2, 2.5000000000E-02, 2.5000000000E-02, 0.0000000000E+00 +3, -2.5000000000E-02, 2.5000000000E-02, 0.0000000000E+00 +4, -2.5000000000E-02, -2.5000000000E-02, 0.0000000000E+00 +5, 2.5000000000E-02, -2.5000000000E-02, 0.0000000000E+00 +6, 3.5355339059E-02, 3.5355339059E-02, 0.0000000000E+00 +7, -3.5355339059E-02, 3.5355339059E-02, 0.0000000000E+00 +8, -3.5355339059E-02, -3.5355339059E-02, 0.0000000000E+00 +9, 3.5355339059E-02, -3.5355339059E-02, 0.0000000000E+00 +10, 2.5000000000E-02, -2.5000000000E-02, 2.0000000000E-01 +11, 2.5000000000E-02, 2.5000000000E-02, 2.0000000000E-01 +12, -2.5000000000E-02, 2.5000000000E-02, 2.0000000000E-01 +13, -2.5000000000E-02, -2.5000000000E-02, 2.0000000000E-01 +14, 3.5355339059E-02, -3.5355339059E-02, 2.0000000000E-01 +15, 0.0000000000E+00, 0.0000000000E+00, 2.0000000000E-01 +16, 3.5355339059E-02, 3.5355339059E-02, 2.0000000000E-01 +17, -3.5355339059E-02, 3.5355339059E-02, 2.0000000000E-01 +18, -3.5355339059E-02, -3.5355339059E-02, 2.0000000000E-01 +19, 2.5000000000E-02, -6.6436439683E-14, 0.0000000000E+00 +20, 6.6436439683E-14, 2.5000000000E-02, 0.0000000000E+00 +21, -2.5000000000E-02, 6.6436439683E-14, 0.0000000000E+00 +22, -6.6436439683E-14, -2.5000000000E-02, 0.0000000000E+00 +23, 5.0000000000E-02, 1.1959808838E-10, 0.0000000000E+00 +24, -1.2100757549E-10, 5.0000000000E-02, 0.0000000000E+00 +25, -5.0000000000E-02, -9.1919114681E-11, 0.0000000000E+00 +26, 1.0485229351E-10, -5.0000000000E-02, 0.0000000000E+00 +27, 2.5000000000E-02, -6.6436439683E-14, 2.0000000000E-01 +28, 6.6436439683E-14, 2.5000000000E-02, 2.0000000000E-01 +29, -2.5000000000E-02, 6.6436439683E-14, 2.0000000000E-01 +30, -6.6436439683E-14, -2.5000000000E-02, 2.0000000000E-01 +31, 2.5000000000E-02, -2.5000000000E-02, 5.0000000000E-02 +32, 2.5000000000E-02, -2.5000000000E-02, 1.0000000000E-01 +33, 2.5000000000E-02, -2.5000000000E-02, 1.5000000000E-01 +34, 2.5000000000E-02, 2.5000000000E-02, 5.0000000000E-02 +35, 2.5000000000E-02, 2.5000000000E-02, 1.0000000000E-01 +36, 2.5000000000E-02, 2.5000000000E-02, 1.5000000000E-01 +37, -2.5000000000E-02, 2.5000000000E-02, 5.0000000000E-02 +38, -2.5000000000E-02, 2.5000000000E-02, 1.0000000000E-01 +39, -2.5000000000E-02, 2.5000000000E-02, 1.5000000000E-01 +40, -2.5000000000E-02, -2.5000000000E-02, 5.0000000000E-02 +41, -2.5000000000E-02, -2.5000000000E-02, 1.0000000000E-01 +42, -2.5000000000E-02, -2.5000000000E-02, 1.5000000000E-01 +43, 5.0000000000E-02, 1.1959808838E-10, 2.0000000000E-01 +44, 3.5355339059E-02, -3.5355339059E-02, 5.0000000000E-02 +45, 3.5355339059E-02, -3.5355339059E-02, 1.0000000000E-01 +46, 3.5355339059E-02, -3.5355339059E-02, 1.5000000000E-01 +47, 3.5355339059E-02, 3.5355339059E-02, 5.0000000000E-02 +48, 3.5355339059E-02, 3.5355339059E-02, 1.0000000000E-01 +49, 3.5355339059E-02, 3.5355339059E-02, 1.5000000000E-01 +50, -1.2100757549E-10, 5.0000000000E-02, 2.0000000000E-01 +51, -3.5355339059E-02, 3.5355339059E-02, 5.0000000000E-02 +52, -3.5355339059E-02, 3.5355339059E-02, 1.0000000000E-01 +53, -3.5355339059E-02, 3.5355339059E-02, 1.5000000000E-01 +54, -5.0000000000E-02, -9.1919114681E-11, 2.0000000000E-01 +55, -3.5355339059E-02, -3.5355339059E-02, 5.0000000000E-02 +56, -3.5355339059E-02, -3.5355339059E-02, 1.0000000000E-01 +57, -3.5355339059E-02, -3.5355339059E-02, 1.5000000000E-01 +58, 1.0485229351E-10, -5.0000000000E-02, 2.0000000000E-01 +59, 0.0000000000E+00, 0.0000000000E+00, 0.0000000000E+00 +60, 2.5000000000E-02, -6.6436439683E-14, 5.0000000000E-02 +61, 2.5000000000E-02, -6.6436439683E-14, 1.0000000000E-01 +62, 2.5000000000E-02, -6.6436439683E-14, 1.5000000000E-01 +63, 6.6436439683E-14, 2.5000000000E-02, 5.0000000000E-02 +64, 6.6436439683E-14, 2.5000000000E-02, 1.0000000000E-01 +65, 6.6436439683E-14, 2.5000000000E-02, 1.5000000000E-01 +66, -2.5000000000E-02, 6.6436439683E-14, 5.0000000000E-02 +67, -2.5000000000E-02, 6.6436439683E-14, 1.0000000000E-01 +68, -2.5000000000E-02, 6.6436439683E-14, 1.5000000000E-01 +69, -6.6436439683E-14, -2.5000000000E-02, 5.0000000000E-02 +70, -6.6436439683E-14, -2.5000000000E-02, 1.0000000000E-01 +71, -6.6436439683E-14, -2.5000000000E-02, 1.5000000000E-01 +72, 0.0000000000E+00, 0.0000000000E+00, 2.0000000000E-01 +73, 5.0000000000E-02, 1.1959808838E-10, 5.0000000000E-02 +74, 5.0000000000E-02, 1.1959808838E-10, 1.0000000000E-01 +75, 5.0000000000E-02, 1.1959808838E-10, 1.5000000000E-01 +76, -1.2100757549E-10, 5.0000000000E-02, 5.0000000000E-02 +77, -1.2100757549E-10, 5.0000000000E-02, 1.0000000000E-01 +78, -1.2100757549E-10, 5.0000000000E-02, 1.5000000000E-01 +79, -5.0000000000E-02, -9.1919114681E-11, 5.0000000000E-02 +80, -5.0000000000E-02, -9.1919114681E-11, 1.0000000000E-01 +81, -5.0000000000E-02, -9.1919114681E-11, 1.5000000000E-01 +82, 1.0485229351E-10, -5.0000000000E-02, 5.0000000000E-02 +83, 1.0485229351E-10, -5.0000000000E-02, 1.0000000000E-01 +84, 1.0485229351E-10, -5.0000000000E-02, 1.5000000000E-01 +85, 0.0000000000E+00, 0.0000000000E+00, 5.0000000000E-02 +86, 0.0000000000E+00, 0.0000000000E+00, 1.0000000000E-01 +87, 0.0000000000E+00, 0.0000000000E+00, 1.5000000000E-01 +*ELEMENT, TYPE=C3D8, ELSET=EALL +1, 5, 19, 59, 22, 31, 60, 85, 69 +2, 31, 60, 85, 69, 32, 61, 86, 70 +3, 32, 61, 86, 70, 33, 62, 87, 71 +4, 33, 62, 87, 71, 10, 27, 72, 30 +5, 22, 59, 21, 4, 69, 85, 66, 40 +6, 69, 85, 66, 40, 70, 86, 67, 41 +7, 70, 86, 67, 41, 71, 87, 68, 42 +8, 71, 87, 68, 42, 30, 72, 29, 13 +9, 19, 2, 20, 59, 60, 34, 63, 85 +10, 60, 34, 63, 85, 61, 35, 64, 86 +11, 61, 35, 64, 86, 62, 36, 65, 87 +12, 62, 36, 65, 87, 27, 11, 28, 72 +13, 59, 20, 3, 21, 85, 63, 37, 66 +14, 85, 63, 37, 66, 86, 64, 38, 67 +15, 86, 64, 38, 67, 87, 65, 39, 68 +16, 87, 65, 39, 68, 72, 28, 12, 29 +17, 5, 9, 23, 19, 31, 44, 73, 60 +18, 31, 44, 73, 60, 32, 45, 74, 61 +19, 32, 45, 74, 61, 33, 46, 75, 62 +20, 33, 46, 75, 62, 10, 14, 43, 27 +21, 19, 23, 6, 2, 60, 73, 47, 34 +22, 60, 73, 47, 34, 61, 74, 48, 35 +23, 61, 74, 48, 35, 62, 75, 49, 36 +24, 62, 75, 49, 36, 27, 43, 16, 11 +25, 2, 6, 24, 20, 34, 47, 76, 63 +26, 34, 47, 76, 63, 35, 48, 77, 64 +27, 35, 48, 77, 64, 36, 49, 78, 65 +28, 36, 49, 78, 65, 11, 16, 50, 28 +29, 20, 24, 7, 3, 63, 76, 51, 37 +30, 63, 76, 51, 37, 64, 77, 52, 38 +31, 64, 77, 52, 38, 65, 78, 53, 39 +32, 65, 78, 53, 39, 28, 50, 17, 12 +33, 3, 7, 25, 21, 37, 51, 79, 66 +34, 37, 51, 79, 66, 38, 52, 80, 67 +35, 38, 52, 80, 67, 39, 53, 81, 68 +36, 39, 53, 81, 68, 12, 17, 54, 29 +37, 21, 25, 8, 4, 66, 79, 55, 40 +38, 66, 79, 55, 40, 67, 80, 56, 41 +39, 67, 80, 56, 41, 68, 81, 57, 42 +40, 68, 81, 57, 42, 29, 54, 18, 13 +41, 4, 8, 26, 22, 40, 55, 82, 69 +42, 40, 55, 82, 69, 41, 56, 83, 70 +43, 41, 56, 83, 70, 42, 57, 84, 71 +44, 42, 57, 84, 71, 13, 18, 58, 30 +45, 22, 26, 9, 5, 69, 82, 44, 31 +46, 69, 82, 44, 31, 70, 83, 45, 32 +47, 70, 83, 45, 32, 71, 84, 46, 33 +48, 71, 84, 46, 33, 30, 58, 14, 10 +*NSET, NSET=BOTTOM +1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 20, 21, 22, 23, 24, 25 +26, 59 +*NSET, NSET=TOP +10, 11, 12, 13, 14, 15, 16, 17, 18, 27, 28, 29, 30, 43, 50, 54 +58, 72 +*MATERIAL, NAME=ALUMINUM +*DENSITY +2.7000000000E+03 +*ELASTIC +7.0000000000E+10, 3.0000000000E-01 +*SOLID SECTION, ELSET=EALL, MATERIAL=ALUMINUM +*BOUNDARY +BOTTOM, 1, 3, 0.0 +*CLOAD +10, 3, 5.5555555556E+01 +11, 3, 5.5555555556E+01 +12, 3, 5.5555555556E+01 +13, 3, 5.5555555556E+01 +14, 3, 5.5555555556E+01 +15, 3, 5.5555555556E+01 +16, 3, 5.5555555556E+01 +17, 3, 5.5555555556E+01 +18, 3, 5.5555555556E+01 +27, 3, 5.5555555556E+01 +28, 3, 5.5555555556E+01 +29, 3, 5.5555555556E+01 +30, 3, 5.5555555556E+01 +43, 3, 5.5555555556E+01 +50, 3, 5.5555555556E+01 +54, 3, 5.5555555556E+01 +58, 3, 5.5555555556E+01 +72, 3, 5.5555555556E+01 +*STEP +*DYNAMIC +1.0000000000E-01 +*END STEP diff --git a/examples/uniaxialTension3D/tension1000tet.inp b/examples/uniaxialTension3D/tension1000tet.inp new file mode 100644 index 0000000..7895139 --- /dev/null +++ b/examples/uniaxialTension3D/tension1000tet.inp @@ -0,0 +1,892 @@ +*HEADING +FemLite uniaxial tension 3D C3D4 force +*NODE +1, 5.0000000000E-02, -1.2246063538E-17, 2.0000000000E-01 +2, 5.0000000000E-02, -1.2246063538E-17, 0.0000000000E+00 +3, 4.4272801283E-02, 2.3236158602E-02, 2.0000000000E-01 +4, 2.8403237337E-02, 4.1149193295E-02, 2.0000000000E-01 +5, 6.0268340128E-03, 4.9635443705E-02, 2.0000000000E-01 +6, -1.7730244352E-02, 4.6750812134E-02, 2.0000000000E-01 +7, -3.7425537409E-02, 3.3156132912E-02, 2.0000000000E-01 +8, -4.8547090871E-02, 1.1965783214E-02, 2.0000000000E-01 +9, -4.8547090871E-02, -1.1965783214E-02, 2.0000000000E-01 +10, -3.7425537409E-02, -3.3156132912E-02, 2.0000000000E-01 +11, -1.7730244352E-02, -4.6750812134E-02, 2.0000000000E-01 +12, 6.0268340128E-03, -4.9635443705E-02, 2.0000000000E-01 +13, 2.8403237337E-02, -4.1149193295E-02, 2.0000000000E-01 +14, 4.4272801283E-02, -2.3236158602E-02, 2.0000000000E-01 +15, 5.0000000000E-02, -1.2246063538E-17, 2.5000000000E-02 +16, 5.0000000000E-02, -1.2246063538E-17, 5.0000000000E-02 +17, 5.0000000000E-02, -1.2246063538E-17, 7.5000000000E-02 +18, 5.0000000000E-02, -1.2246063538E-17, 1.0000000000E-01 +19, 5.0000000000E-02, -1.2246063538E-17, 1.2500000000E-01 +20, 5.0000000000E-02, -1.2246063538E-17, 1.5000000000E-01 +21, 5.0000000000E-02, -1.2246063538E-17, 1.7500000000E-01 +22, 4.4272801283E-02, 2.3236158602E-02, 0.0000000000E+00 +23, 2.8403237337E-02, 4.1149193295E-02, 0.0000000000E+00 +24, 6.0268340128E-03, 4.9635443705E-02, 0.0000000000E+00 +25, -1.7730244352E-02, 4.6750812134E-02, 0.0000000000E+00 +26, -3.7425537409E-02, 3.3156132912E-02, 0.0000000000E+00 +27, -4.8547090871E-02, 1.1965783214E-02, 0.0000000000E+00 +28, -4.8547090871E-02, -1.1965783214E-02, 0.0000000000E+00 +29, -3.7425537409E-02, -3.3156132912E-02, 0.0000000000E+00 +30, -1.7730244352E-02, -4.6750812134E-02, 0.0000000000E+00 +31, 6.0268340128E-03, -4.9635443705E-02, 0.0000000000E+00 +32, 2.8403237337E-02, -4.1149193295E-02, 0.0000000000E+00 +33, 4.4272801283E-02, -2.3236158602E-02, 0.0000000000E+00 +34, -2.8389714770E-02, -4.1158523969E-02, 2.0603536038E-02 +35, -2.7760571157E-02, 4.1585462473E-02, 1.7787435822E-01 +36, -4.4580791871E-02, 2.2639633305E-02, 2.0175720624E-02 +37, -4.3953032403E-02, -2.3835497531E-02, 1.7651909130E-01 +38, 4.5312500000E-02, 2.1137108216E-02, 8.7500000000E-02 +39, 4.5292474335E-02, -2.1179985095E-02, 1.1275123680E-01 +40, 4.5281246666E-02, -2.1203978410E-02, 6.2399419893E-02 +41, 4.5312500000E-02, 2.1137108216E-02, 1.3750000000E-01 +42, 1.7730244352E-02, -4.6750812134E-02, 1.7932564490E-01 +43, 1.7157001014E-02, 4.6964213144E-02, 1.7224058806E-02 +44, 1.7544413016E-02, 4.6820866843E-02, 1.7492556959E-01 +45, 1.7326840274E-02, -4.6901818793E-02, 1.8488914854E-02 +46, 4.5312500000E-02, -2.1137108217E-02, 1.6250000000E-01 +47, 4.5312500000E-02, 2.1137108216E-02, 3.7500000000E-02 +48, 4.5318261855E-02, -2.1124751891E-02, 1.3763666785E-01 +49, 3.2297177849E-02, -3.8169258612E-02, 1.2511543647E-01 +50, 3.2240640371E-02, -3.8217026421E-02, 9.9965582624E-02 +51, 1.3327798030E-02, -4.8190972180E-02, 1.1278644126E-01 +52, 1.3406227656E-02, -4.8169212782E-02, 8.7765649880E-02 +53, -7.7741989084E-03, -4.9391920709E-02, 1.0071104278E-01 +54, -7.6804187492E-03, -4.9406590328E-02, 1.2505353663E-01 +55, -2.7323229484E-02, -4.1874110505E-02, 1.1299229123E-01 +56, -2.7450185985E-02, -4.1790995314E-02, 8.8825400841E-02 +57, -4.2100514232E-02, -2.6973073636E-02, 1.0099353424E-01 +58, -4.2246127920E-02, -2.6744432613E-02, 7.9842731398E-02 +59, -4.9448428242E-02, -7.4062773655E-03, 8.9052176597E-02 +60, -4.9431414862E-02, -7.5189909409E-03, 1.1311560773E-01 +61, -4.8200355113E-02, 1.3293824393E-02, 1.0118202373E-01 +62, -4.8224868880E-02, 1.3204621217E-02, 1.2521069271E-01 +63, -3.8617168343E-02, 3.1760263053E-02, 1.1324431077E-01 +64, -3.8537531651E-02, 3.1856846269E-02, 8.9130553907E-02 +65, -2.2140541490E-02, 4.4830753089E-02, 1.0134342593E-01 +66, -2.2065713781E-02, 4.4867630596E-02, 7.7087153567E-02 +67, -2.2234507498E-02, 4.4784223520E-02, 1.2557804005E-01 +68, -1.8254934899E-03, 4.9966664623E-02, 1.1350528389E-01 +69, -4.9470124697E-02, -7.2599423214E-03, 6.5011962777E-02 +70, -2.7241340410E-02, -4.1927429836E-02, 1.3718958019E-01 +71, -2.7624946018E-02, -4.1675680648E-02, 6.4673938762E-02 +72, -3.8296619174E-02, 3.2146056676E-02, 6.6192793288E-02 +73, -2.2015623357E-02, 4.4892230154E-02, 5.2978462616E-02 +74, -1.7307609719E-03, 4.9970035686E-02, 6.5030786771E-02 +75, -4.9415624831E-02, -7.6220746882E-03, 1.3711844216E-01 +76, -1.7280864848E-03, 4.9970128248E-02, 1.3393249380E-01 +77, -4.8265282789E-02, 1.3056127960E-02, 1.4918302997E-01 +78, -7.6953531843E-03, -4.9404266409E-02, 1.4916697769E-01 +79, 1.8851074877E-02, 4.6310225393E-02, 1.2543767416E-01 +80, 1.8754430253E-02, 4.6349448172E-02, 1.0447894145E-01 +81, -2.2332547801E-02, 4.4735414480E-02, 1.4982131280E-01 +82, -2.7310446012E-02, -4.1882449053E-02, 1.5972143640E-01 +83, 1.8850845488E-02, 4.6310318768E-02, 1.5012475493E-01 +84, 3.6477810739E-02, 3.4196042515E-02, 1.1359120262E-01 +85, -1.6733195544E-03, 4.9971992172E-02, 4.0827746771E-02 +86, 1.8736863264E-02, 4.6356552450E-02, 5.8727441172E-02 +87, -2.1338553014E-02, 4.5217984865E-02, 3.6094217209E-02 +88, -7.6009484564E-03, -4.9418878807E-02, 1.7340878756E-01 +89, 4.5287703476E-02, -2.1190184375E-02, 8.7506139505E-02 +90, 3.2159201268E-02, -3.8285581801E-02, 1.4443070183E-01 +91, 4.5328997840E-02, 2.1101705023E-02, 6.2566052381E-02 +92, 3.2285829080E-02, 3.8178858556E-02, 7.5000179121E-02 +93, -4.9397642421E-02, -7.7377595766E-03, 1.6112147645E-01 +94, -4.8388367027E-02, 1.2592296711E-02, 1.7184734585E-01 +95, 4.5332579180E-02, -2.1094010166E-02, 3.7580407145E-02 +96, 3.2050975967E-02, -3.8376228834E-02, 5.5516247365E-02 +97, 3.2157338001E-02, -3.8287146834E-02, 7.7594361959E-02 +98, 1.3280334751E-02, -4.8204073572E-02, 6.6710738657E-02 +99, 4.5332579180E-02, 2.1094010166E-02, 1.6241959285E-01 +100, -4.2103716268E-02, -2.6968075134E-02, 1.2495080172E-01 +101, -7.9014622158E-03, -4.9371721611E-02, 7.9262421468E-02 +102, -3.8758440556E-02, 3.1587707826E-02, 1.3694334129E-01 +103, 1.3220017844E-02, -4.8220650433E-02, 1.3526725984E-01 +104, -4.8132156848E-02, 1.3538666005E-02, 8.0434707810E-02 +105, -1.8264115312E-03, 4.9966631074E-02, 8.9324233085E-02 +106, -4.2127985639E-02, -2.6930147158E-02, 1.4899703600E-01 +107, -3.8176299609E-02, 3.2288854860E-02, 4.1462011990E-02 +108, -4.8787966434E-02, 1.0942318368E-02, 4.0611271329E-02 +109, -4.9999965506E-02, -5.8731678424E-05, 2.0125185027E-02 +110, -4.8354012129E-02, -1.2723580903E-02, 4.1879088224E-02 +111, -3.8999760943E-02, 3.1289273663E-02, 1.6086724161E-01 +112, -6.2436212825E-03, 4.9608640309E-02, 1.6931869626E-01 +113, -6.2112615617E-03, -4.9612702303E-02, 2.0089297456E-02 +114, -1.8279625609E-02, -4.6538750387E-02, 4.0588840299E-02 +115, -4.4274618641E-02, -2.3232695585E-02, 2.0600939671E-02 +116, 6.8734004515E-03, -4.9525310360E-02, 4.1374475792E-02 +117, -3.6846056251E-02, -3.3798936947E-02, 4.0901254687E-02 +118, 3.7425537409E-02, 3.3156132912E-02, 1.8041910809E-01 +119, 3.7419879686E-02, -3.3162518064E-02, 1.6384468742E-02 +120, 3.7345188530E-02, 3.3246607250E-02, 1.8752690745E-02 +121, 3.7441058074E-02, -3.3138605437E-02, 1.8333558814E-01 +122, -3.5213506384E-03, 4.9875846757E-02, 1.9289585146E-02 +123, 1.1806169255E-02, -4.8586154072E-02, 1.5862270570E-01 +124, -2.8403237337E-02, -4.1149193295E-02, 1.8262235008E-01 +125, 2.8734771129E-02, 4.0918369080E-02, 3.7116764404E-02 +126, 3.5889674519E-02, 3.4812803146E-02, 1.4999108621E-01 +127, 4.6689761631E-02, 1.7890392921E-02, 1.1196238036E-01 +128, 1.7007325258E-02, 4.7018622774E-02, 8.2195117854E-02 +129, -5.5645959794E-03, -4.9689387917E-02, 5.6810099400E-02 +130, -4.3384466754E-02, -2.4855342372E-02, 6.0119196744E-02 +131, -4.9795255754E-02, -4.5202327816E-03, 1.8183212485E-01 +132, 3.4469536600E-02, 3.6219484350E-02, 9.4222384732E-02 +133, 3.4983369793E-02, 3.5723435416E-02, 5.5591584759E-02 +134, -4.7365722901E-02, 1.6015251921E-02, 6.0713695289E-02 +135, -4.1511314772E-02, 2.7871324796E-02, 1.8232279392E-01 +136, 4.7027657411E-02, 1.6982327239E-02, 1.7626503805E-02 +137, 4.7027657411E-02, -1.6982327239E-02, 1.8237349620E-01 +138, 4.7026423655E-02, 1.6985743383E-02, 1.8237006468E-01 +139, 4.7026423655E-02, -1.6985743383E-02, 1.7629935317E-02 +140, 2.9680712271E-02, 4.0237486491E-02, 1.6498981765E-01 +141, 3.3934040089E-02, 3.6721668307E-02, 1.3298671980E-01 +142, -3.3493941431E-02, 3.7123522023E-02, 1.7562297569E-02 +143, -6.0427637812E-03, 4.9633506887E-02, 1.8703268653E-01 +144, 2.8887999028E-02, -4.0810335850E-02, 1.6708167894E-01 +145, 2.8879448336E-02, -4.0816387197E-02, 3.2842735842E-02 +146, 2.0896316440E-03, 4.9956315312E-02, 1.5340696599E-01 +147, -3.1274711417E-03, -2.9146629938E-02, 2.0000000000E-01 +148, -3.3535409490E-03, 2.7618894536E-02, 2.0000000000E-01 +149, 2.7013297005E-02, -6.6581797194E-03, 2.0000000000E-01 +150, -2.7103215353E-02, 9.3677420306E-04, 2.0000000000E-01 +151, 2.0824876207E-02, 1.8449230424E-02, 2.0000000000E-01 +152, 1.2797474394E-02, -3.3744166707E-02, 2.0000000000E-01 +153, 1.0427986921E-02, -1.5913464098E-02, 2.0000000000E-01 +154, -8.6322070724E-03, -7.6474681417E-03, 2.0000000000E-01 +155, 5.6559510934E-03, 4.4642446325E-03, 2.0000000000E-01 +156, -2.1784016079E-02, -2.1806952658E-02, 2.0000000000E-01 +157, -1.1308875794E-02, 1.0518889161E-02, 2.0000000000E-01 +158, -2.4244750788E-02, 2.1824547693E-02, 2.0000000000E-01 +159, 2.7013297005E-02, -2.3931692847E-02, 2.0000000000E-01 +160, 3.5527743624E-02, 8.7568023267E-03, 2.0000000000E-01 +161, 1.2975351652E-02, 3.4213190490E-02, 2.0000000000E-01 +162, -2.3369875385E-03, -2.7018518050E-02, 0.0000000000E+00 +163, -3.3535409490E-03, 2.7618894536E-02, 0.0000000000E+00 +164, 2.7013297005E-02, -6.6581797194E-03, 0.0000000000E+00 +165, -2.9311093179E-02, 4.0856965750E-04, 0.0000000000E+00 +166, 2.0824876207E-02, 1.8449230424E-02, 0.0000000000E+00 +167, -2.0501110718E-02, 2.9700986465E-02, 0.0000000000E+00 +168, -1.4540482103E-02, 1.2270111289E-02, 0.0000000000E+00 +169, -8.6322070724E-03, -7.6474681417E-03, 0.0000000000E+00 +170, 5.1134448313E-03, 5.0766076141E-03, 0.0000000000E+00 +171, -2.4273728402E-02, -1.8996648396E-02, 0.0000000000E+00 +172, 9.0790602704E-03, -1.2494333337E-02, 0.0000000000E+00 +173, 1.8743040395E-02, -2.6698637785E-02, 0.0000000000E+00 +174, 3.5527743624E-02, 8.7568023267E-03, 0.0000000000E+00 +175, -3.1955568660E-02, 1.6771576230E-02, 0.0000000000E+00 +176, 1.2975351652E-02, 3.4213190490E-02, 0.0000000000E+00 +177, -1.3547620074E-04, 1.7749647571E-05, 1.1914625256E-01 +178, -8.5064451229E-04, -3.0457196365E-04, 5.1028326636E-02 +179, -9.0397861519E-03, 1.5728499214E-03, 1.5959461764E-01 +180, -7.8751818874E-03, 1.1820753400E-02, 8.5108182054E-02 +181, 1.9892914484E-02, 8.0629950522E-03, 1.4999121122E-01 +182, 9.6623385613E-03, -1.5499208832E-02, 9.1592369497E-02 +183, -2.1093300436E-02, 5.3026839319E-03, 2.8940906742E-02 +184, 4.9297603692E-03, -2.0981586905E-02, 2.9156276328E-02 +185, 1.4732169256E-02, -1.4135913376E-02, 1.7001908882E-01 +186, 6.8107957733E-03, 1.8575403068E-02, 2.7768329393E-02 +187, 3.8397106397E-03, -1.9898771776E-02, 1.4202124731E-01 +188, 1.9953186627E-02, 6.7425049689E-03, 7.2730040817E-02 +189, -1.4753292657E-02, -1.5417375786E-02, 7.3460642605E-02 +190, -1.1949807178E-02, 1.9918267444E-02, 1.3701451221E-01 +191, -2.2806041720E-02, -5.6810466883E-03, 1.0237968813E-01 +192, -2.1194298761E-02, -8.2480185099E-03, 1.3606232491E-01 +193, 8.4989804890E-03, 1.9441255162E-02, 1.7393204539E-01 +194, 2.1032247005E-02, 9.2263651771E-03, 1.0159928483E-01 +195, 2.4306805738E-02, -1.7599040429E-03, 3.7579329831E-02 +196, -1.1344174742E-02, -2.1219777899E-02, 1.7465592661E-01 +197, -6.0033435431E-03, -2.5475319670E-02, 1.1289006546E-01 +198, -7.0495549391E-03, 2.3968348101E-02, 1.0907810975E-01 +199, 1.0608267907E-02, -2.1020167064E-02, 6.4788971562E-02 +200, 2.4214293047E-02, -7.2316097815E-03, 1.2820034559E-01 +201, -7.1867373361E-03, 2.3892700082E-02, 6.1034066725E-02 +202, -1.6149431496E-02, 1.8033760113E-02, 1.7680755421E-01 +203, 1.3860487419E-02, 2.0586669236E-02, 1.2766752538E-01 +204, -2.3845827882E-02, -1.1773642972E-02, 4.9665153464E-02 +205, 2.6830276192E-02, 4.7583509465E-03, 1.7814311096E-01 +206, 1.5837127777E-02, 1.9711460370E-02, 5.1387603170E-02 +207, -1.9431825800E-02, -1.9096468812E-02, 2.6637383748E-02 +*ELEMENT, TYPE=C3D4, ELSET=EALL +1, 180, 189, 134, 201 +2, 134, 201, 189, 204 +3, 131, 93, 179, 196 +4, 131, 196, 179, 202 +5, 142, 183, 167, 186 +6, 62, 190, 191, 198 +7, 163, 167, 168, 183 +8, 62, 191, 190, 192 +9, 104, 134, 180, 189 +10, 62, 191, 63, 198 +11, 62, 63, 190, 198 +12, 167, 163, 122, 186 +13, 150, 196, 131, 202 +14, 182, 197, 50, 200 +15, 49, 50, 197, 200 +16, 129, 199, 184, 204 +17, 183, 201, 134, 204 +18, 179, 185, 154, 196 +19, 180, 194, 128, 198 +20, 154, 179, 155, 185 +21, 166, 174, 136, 195 +22, 170, 184, 172, 195 +23, 131, 93, 94, 179 +24, 175, 168, 167, 183 +25, 180, 188, 128, 194 +26, 51, 49, 50, 197 +27, 77, 111, 179, 190 +28, 129, 184, 114, 204 +29, 106, 179, 93, 196 +30, 170, 183, 169, 184 +31, 146, 190, 181, 193 +32, 146, 190, 193, 202 +33, 134, 72, 180, 201 +34, 131, 179, 94, 202 +35, 163, 167, 183, 186 +36, 107, 134, 183, 201 +37, 93, 77, 179, 192 +38, 80, 128, 194, 198 +39, 53, 189, 56, 197 +40, 170, 172, 164, 195 +41, 166, 164, 174, 195 +42, 104, 59, 189, 191 +43, 104, 189, 180, 191 +44, 128, 188, 180, 201 +45, 106, 93, 179, 192 +46, 77, 179, 111, 202 +47, 64, 61, 191, 198 +48, 106, 192, 179, 196 +49, 146, 181, 83, 193 +50, 53, 182, 189, 197 +51, 146, 193, 112, 202 +52, 77, 190, 179, 192 +53, 104, 134, 72, 180 +54, 90, 187, 185, 200 +55, 155, 179, 154, 202 +56, 147, 153, 152, 185 +57, 53, 101, 56, 189 +58, 105, 180, 128, 198 +59, 64, 191, 180, 198 +60, 175, 167, 142, 183 +61, 39, 182, 50, 200 +62, 190, 191, 177, 192 +63, 177, 191, 190, 198 +64, 129, 189, 199, 204 +65, 64, 63, 61, 198 +66, 178, 189, 201, 204 +67, 53, 182, 101, 189 +68, 46, 185, 181, 200 +69, 183, 184, 170, 186 +70, 185, 187, 181, 200 +71, 179, 155, 185, 193 +72, 131, 37, 93, 196 +73, 168, 163, 183, 186 +74, 157, 155, 154, 202 +75, 147, 185, 152, 196 +76, 121, 152, 159, 185 +77, 153, 159, 152, 185 +78, 77, 94, 93, 179 +79, 62, 61, 63, 191 +80, 172, 170, 169, 184 +81, 179, 193, 190, 202 +82, 152, 185, 42, 196 +83, 188, 201, 128, 206 +84, 69, 134, 189, 204 +85, 179, 190, 111, 202 +86, 39, 194, 182, 200 +87, 104, 69, 134, 189 +88, 81, 190, 146, 202 +89, 147, 152, 42, 196 +90, 89, 182, 39, 194 +91, 63, 191, 61, 198 +92, 49, 197, 187, 200 +93, 178, 201, 183, 204 +94, 172, 184, 164, 195 +95, 92, 188, 128, 206 +96, 179, 192, 187, 196 +97, 136, 174, 15, 195 +98, 170, 186, 184, 195 +99, 89, 182, 188, 199 +100, 187, 192, 82, 196 +101, 81, 146, 112, 202 +102, 77, 94, 179, 202 +103, 89, 188, 182, 194 +104, 189, 191, 56, 197 +105, 89, 39, 18, 194 +106, 184, 199, 178, 204 +107, 164, 184, 119, 195 +108, 188, 195, 40, 199 +109, 174, 164, 15, 195 +110, 179, 196, 154, 202 +111, 39, 50, 49, 200 +112, 181, 190, 179, 193 +113, 103, 187, 49, 197 +114, 80, 105, 128, 198 +115, 166, 136, 186, 195 +116, 155, 193, 179, 202 +117, 89, 188, 40, 199 +118, 128, 180, 105, 201 +119, 77, 62, 190, 192 +120, 164, 119, 139, 195 +121, 103, 49, 51, 197 +122, 179, 181, 177, 190 +123, 77, 111, 94, 202 +124, 169, 184, 183, 207 +125, 132, 128, 188, 194 +126, 177, 181, 179, 187 +127, 150, 154, 196, 202 +128, 170, 164, 186, 195 +129, 114, 204, 184, 207 +130, 60, 191, 62, 192 +131, 16, 40, 188, 195 +132, 129, 71, 189, 204 +133, 166, 186, 164, 195 +134, 70, 82, 187, 192 +135, 92, 132, 128, 188 +136, 154, 155, 153, 185 +137, 64, 104, 72, 180 +138, 120, 186, 136, 195 +139, 108, 183, 134, 204 +140, 102, 77, 62, 190 +141, 178, 189, 180, 201 +142, 185, 187, 123, 196 +143, 169, 170, 168, 183 +144, 170, 164, 166, 186 +145, 154, 185, 153, 196 +146, 69, 104, 59, 189 +147, 120, 136, 47, 195 +148, 86, 128, 201, 206 +149, 177, 197, 182, 200 +150, 120, 47, 186, 195 +151, 164, 172, 173, 184 +152, 123, 187, 78, 196 +153, 164, 173, 119, 184 +154, 107, 134, 108, 183 +155, 106, 82, 192, 196 +156, 166, 136, 120, 186 +157, 177, 187, 179, 192 +158, 179, 190, 177, 192 +159, 64, 72, 66, 180 +160, 70, 192, 187, 197 +161, 178, 184, 183, 186 +162, 96, 195, 184, 199 +163, 86, 92, 128, 206 +164, 77, 102, 111, 190 +165, 62, 63, 102, 190 +166, 157, 154, 150, 202 +167, 80, 128, 132, 194 +168, 89, 50, 39, 182 +169, 153, 185, 147, 196 +170, 178, 186, 183, 201 +171, 66, 65, 64, 180 +172, 180, 178, 188, 189 +173, 72, 134, 107, 201 +174, 89, 17, 40, 188 +175, 129, 114, 71, 204 +176, 89, 97, 182, 199 +177, 101, 189, 182, 199 +178, 70, 187, 54, 197 +179, 81, 111, 190, 202 +180, 105, 65, 66, 180 +181, 168, 183, 170, 186 +182, 66, 180, 72, 201 +183, 182, 191, 189, 197 +184, 37, 106, 93, 196 +185, 180, 188, 182, 189 +186, 116, 184, 129, 199 +187, 66, 105, 180, 201 +188, 100, 191, 192, 197 +189, 182, 189, 188, 199 +190, 188, 189, 178, 199 +191, 96, 145, 184, 195 +192, 57, 56, 191, 197 +193, 16, 195, 188, 206 +194, 70, 100, 192, 197 +195, 78, 187, 82, 196 +196, 46, 181, 185, 205 +197, 64, 180, 65, 198 +198, 87, 183, 186, 201 +199, 93, 75, 77, 192 +200, 65, 180, 105, 198 +201, 145, 119, 184, 195 +202, 91, 16, 188, 206 +203, 70, 82, 78, 187 +204, 121, 42, 152, 185 +205, 101, 182, 52, 199 +206, 175, 142, 36, 183 +207, 70, 55, 100, 197 +208, 57, 55, 56, 197 +209, 53, 52, 101, 182 +210, 42, 185, 123, 196 +211, 74, 128, 105, 201 +212, 87, 183, 142, 186 +213, 120, 176, 166, 186 +214, 146, 190, 76, 203 +215, 89, 40, 97, 199 +216, 126, 140, 83, 181 +217, 20, 181, 46, 205 +218, 58, 57, 56, 191 +219, 177, 190, 181, 203 +220, 58, 56, 189, 191 +221, 182, 194, 177, 200 +222, 175, 109, 165, 183 +223, 159, 149, 137, 185 +224, 39, 18, 194, 200 +225, 80, 198, 194, 203 +226, 144, 123, 185, 187 +227, 159, 137, 121, 185 +228, 38, 188, 17, 194 +229, 180, 182, 177, 191 +230, 16, 40, 17, 188 +231, 83, 126, 181, 203 +232, 101, 129, 189, 199 +233, 83, 181, 140, 193 +234, 115, 165, 109, 207 +235, 38, 17, 18, 194 +236, 185, 193, 155, 205 +237, 177, 182, 180, 194 +238, 62, 60, 61, 191 +239, 165, 183, 109, 207 +240, 100, 191, 60, 192 +241, 144, 185, 90, 187 +242, 184, 186, 178, 195 +243, 77, 75, 62, 192 +244, 131, 94, 150, 202 +245, 129, 116, 114, 184 +246, 175, 36, 109, 183 +247, 78, 54, 70, 187 +248, 96, 40, 195, 199 +249, 163, 176, 122, 186 +250, 178, 195, 188, 199 +251, 52, 182, 53, 197 +252, 146, 76, 83, 203 +253, 75, 60, 62, 192 +254, 87, 107, 183, 201 +255, 58, 189, 59, 191 +256, 186, 195, 47, 206 +257, 19, 194, 18, 200 +258, 64, 65, 63, 198 +259, 140, 181, 99, 193 +260, 145, 95, 119, 195 +261, 181, 187, 177, 200 +262, 67, 190, 63, 198 +263, 15, 164, 139, 195 +264, 99, 193, 181, 205 +265, 153, 185, 155, 205 +266, 70, 106, 82, 192 +267, 52, 53, 51, 197 +268, 140, 126, 99, 181 +269, 184, 195, 178, 199 +270, 179, 187, 185, 196 +271, 47, 195, 16, 206 +272, 91, 47, 16, 206 +273, 127, 194, 200, 203 +274, 86, 128, 74, 201 +275, 140, 193, 99, 205 +276, 140, 99, 118, 205 +277, 181, 185, 179, 187 +278, 180, 189, 182, 191 +279, 59, 104, 61, 191 +280, 183, 184, 178, 207 +281, 161, 118, 151, 193 +282, 66, 74, 105, 201 +283, 120, 43, 176, 186 +284, 178, 199, 189, 204 +285, 144, 90, 123, 187 +286, 39, 19, 18, 200 +287, 103, 54, 187, 197 +288, 21, 20, 46, 205 +289, 169, 183, 165, 207 +290, 139, 119, 95, 195 +291, 153, 149, 159, 185 +292, 187, 197, 177, 200 +293, 140, 118, 193, 205 +294, 96, 95, 145, 195 +295, 161, 148, 143, 193 +296, 177, 194, 180, 198 +297, 165, 168, 175, 183 +298, 147, 42, 88, 196 +299, 180, 188, 178, 201 +300, 110, 109, 183, 207 +301, 71, 101, 129, 189 +302, 88, 123, 78, 196 +303, 110, 115, 109, 207 +304, 113, 162, 34, 207 +305, 99, 181, 20, 205 +306, 172, 169, 162, 184 +307, 67, 102, 63, 190 +308, 165, 169, 168, 183 +309, 38, 132, 188, 194 +310, 127, 200, 41, 203 +311, 88, 42, 123, 196 +312, 179, 185, 181, 193 +313, 44, 118, 161, 193 +314, 80, 79, 68, 203 +315, 80, 68, 198, 203 +316, 190, 198, 76, 203 +317, 16, 17, 91, 188 +318, 161, 143, 44, 193 +319, 113, 184, 162, 207 +320, 96, 184, 116, 199 +321, 182, 188, 180, 194 +322, 137, 185, 149, 205 +323, 135, 150, 94, 202 +324, 95, 96, 40, 195 +325, 92, 38, 132, 188 +326, 69, 59, 58, 189 +327, 68, 76, 198, 203 +328, 101, 52, 98, 199 +329, 43, 122, 176, 186 +330, 177, 191, 182, 197 +331, 127, 19, 41, 200 +332, 80, 194, 84, 203 +333, 83, 141, 126, 203 +334, 85, 201, 186, 206 +335, 90, 49, 187, 200 +336, 73, 72, 107, 201 +337, 21, 99, 20, 205 +338, 180, 191, 177, 198 +339, 76, 190, 67, 198 +340, 52, 182, 97, 199 +341, 96, 145, 116, 184 +342, 154, 153, 147, 196 +343, 106, 75, 93, 192 +344, 75, 100, 60, 192 +345, 181, 200, 177, 203 +346, 171, 165, 115, 207 +347, 188, 195, 178, 206 +348, 103, 51, 54, 197 +349, 184, 204, 178, 207 +350, 144, 46, 90, 185 +351, 127, 194, 19, 200 +352, 162, 184, 169, 207 +353, 152, 12, 147, 42 +354, 57, 60, 100, 191 +355, 114, 184, 113, 207 +356, 142, 107, 36, 183 +357, 156, 150, 154, 196 +358, 120, 47, 125, 186 +359, 178, 186, 201, 206 +360, 89, 97, 50, 182 +361, 41, 200, 181, 203 +362, 19, 127, 18, 194 +363, 45, 162, 113, 184 +364, 149, 185, 153, 205 +365, 20, 181, 41, 200 +366, 45, 119, 173, 184 +367, 158, 150, 135, 202 +368, 110, 183, 204, 207 +369, 112, 193, 143, 202 +370, 78, 103, 54, 187 +371, 149, 153, 155, 205 +372, 125, 186, 47, 206 +373, 92, 133, 188, 206 +374, 101, 98, 129, 199 +375, 81, 111, 102, 190 +376, 92, 133, 91, 188 +377, 183, 178, 204, 207 +378, 177, 192, 191, 197 +379, 174, 2, 15, 164 +380, 168, 170, 163, 186 +381, 68, 76, 67, 198 +382, 181, 193, 185, 205 +383, 70, 54, 55, 197 +384, 143, 193, 148, 202 +385, 133, 91, 188, 206 +386, 58, 59, 57, 191 +387, 1, 149, 160, 205 +388, 20, 41, 19, 200 +389, 68, 79, 76, 203 +390, 82, 106, 37, 196 +391, 90, 49, 103, 187 +392, 55, 53, 56, 197 +393, 1, 160, 21, 205 +394, 46, 185, 137, 205 +395, 145, 119, 45, 184 +396, 85, 87, 186, 201 +397, 71, 114, 117, 204 +398, 187, 192, 177, 197 +399, 34, 162, 171, 207 +400, 87, 73, 107, 201 +401, 38, 92, 91, 188 +402, 105, 80, 68, 198 +403, 83, 76, 79, 203 +404, 42, 144, 123, 185 +405, 52, 50, 97, 182 +406, 115, 28, 109, 165 +407, 173, 162, 45, 184 +408, 35, 81, 112, 202 +409, 146, 83, 44, 193 +410, 176, 163, 166, 186 +411, 169, 165, 171, 207 +412, 16, 95, 40, 195 +413, 87, 107, 142, 183 +414, 109, 27, 175, 165 +415, 121, 152, 13, 159 +416, 117, 204, 114, 207 +417, 35, 111, 81, 202 +418, 56, 101, 71, 189 +419, 44, 83, 140, 193 +420, 147, 88, 124, 196 +421, 131, 150, 9, 156 +422, 178, 201, 188, 206 +423, 151, 193, 118, 205 +424, 30, 34, 113, 162 +425, 109, 27, 36, 175 +426, 150, 8, 135, 94 +427, 69, 189, 130, 204 +428, 47, 136, 15, 195 +429, 44, 112, 146, 193 +430, 194, 198, 177, 203 +431, 130, 189, 71, 204 +432, 173, 172, 162, 184 +433, 177, 200, 194, 203 +434, 3, 138, 160, 118 +435, 42, 121, 144, 185 +436, 38, 91, 17, 188 +437, 58, 130, 69, 189 +438, 114, 113, 34, 207 +439, 52, 97, 98, 199 +440, 106, 70, 100, 192 +441, 67, 63, 65, 198 +442, 123, 90, 103, 187 +443, 94, 150, 8, 131 +444, 46, 137, 21, 205 +445, 151, 3, 160, 118 +446, 78, 123, 103, 187 +447, 85, 86, 201, 206 +448, 46, 121, 137, 185 +449, 88, 78, 82, 196 +450, 61, 60, 59, 191 +451, 110, 183, 108, 204 +452, 146, 81, 76, 190 +453, 98, 116, 129, 199 +454, 127, 84, 194, 203 +455, 90, 48, 49, 200 +456, 48, 20, 19, 200 +457, 114, 116, 113, 184 +458, 80, 132, 84, 194 +459, 112, 44, 143, 193 +460, 85, 186, 125, 206 +461, 1, 21, 137, 205 +462, 28, 115, 171, 165 +463, 161, 151, 148, 193 +464, 176, 23, 120, 166 +465, 58, 56, 71, 189 +466, 133, 47, 91, 206 +467, 1, 137, 149, 205 +468, 126, 41, 99, 181 +469, 73, 66, 72, 201 +470, 147, 124, 156, 196 +471, 2, 15, 164, 139 +472, 110, 109, 108, 183 +473, 37, 131, 9, 156 +474, 162, 30, 34, 171 +475, 45, 113, 162, 31 +476, 83, 79, 141, 203 +477, 158, 8, 135, 150 +478, 58, 71, 130, 189 +479, 186, 178, 195, 206 +480, 84, 41, 141, 203 +481, 35, 143, 148, 202 +482, 121, 46, 144, 185 +483, 69, 108, 134, 204 +484, 80, 84, 79, 203 +485, 35, 148, 158, 202 +486, 177, 198, 190, 203 +487, 127, 41, 84, 203 +488, 57, 59, 60, 191 +489, 74, 85, 86, 201 +490, 88, 124, 11, 147 +491, 170, 166, 163, 186 +492, 65, 105, 68, 198 +493, 39, 49, 48, 200 +494, 92, 86, 133, 206 +495, 12, 88, 147, 42 +496, 138, 21, 160, 205 +497, 99, 41, 20, 181 +498, 4, 161, 44, 118 +499, 117, 130, 71, 204 +500, 24, 122, 163, 176 +501, 135, 94, 111, 202 +502, 98, 96, 116, 199 +503, 69, 110, 108, 204 +504, 85, 87, 122, 186 +505, 42, 152, 13, 121 +506, 148, 6, 35, 158 +507, 110, 117, 115, 207 +508, 36, 107, 108, 183 +509, 124, 37, 156, 196 +510, 161, 4, 151, 118 +511, 162, 169, 171, 207 +512, 122, 43, 85, 186 +513, 47, 15, 16, 195 +514, 110, 204, 117, 207 +515, 143, 6, 35, 148 +516, 35, 112, 143, 202 +517, 106, 100, 75, 192 +518, 155, 193, 151, 205 +519, 68, 67, 65, 198 +520, 138, 118, 99, 205 +521, 81, 67, 76, 190 +522, 45, 113, 116, 184 +523, 124, 82, 37, 196 +524, 96, 97, 40, 199 +525, 140, 118, 44, 193 +526, 171, 115, 34, 207 +527, 155, 148, 151, 193 +528, 15, 139, 95, 195 +529, 43, 23, 120, 176 +530, 81, 102, 67, 190 +531, 174, 15, 2, 136 +532, 21, 1, 138, 160 +533, 38, 18, 127, 194 +534, 73, 74, 66, 201 +535, 162, 173, 45, 31 +536, 109, 36, 108, 183 +537, 43, 120, 125, 186 +538, 85, 125, 86, 206 +539, 54, 51, 53, 197 +540, 157, 150, 158, 202 +541, 164, 33, 139, 119 +542, 125, 85, 43, 186 +543, 29, 34, 171, 115 +544, 39, 48, 19, 200 +545, 161, 143, 5, 44 +546, 116, 145, 45, 184 +547, 38, 127, 132, 194 +548, 149, 151, 160, 205 +549, 85, 73, 87, 201 +550, 175, 167, 26, 142 +551, 15, 95, 16, 195 +552, 55, 54, 53, 197 +553, 14, 137, 159, 149 +554, 33, 164, 173, 119 +555, 147, 124, 11, 156 +556, 74, 73, 85, 201 +557, 122, 163, 167, 25 +558, 156, 154, 147, 196 +559, 149, 155, 151, 205 +560, 34, 117, 114, 207 +561, 125, 47, 133, 206 +562, 24, 43, 122, 176 +563, 35, 135, 111, 202 +564, 11, 12, 88, 147 +565, 99, 21, 138, 205 +566, 127, 84, 132, 194 +567, 27, 109, 28, 165 +568, 29, 34, 30, 171 +569, 22, 120, 23, 166 +570, 34, 115, 117, 207 +571, 148, 157, 158, 202 +572, 84, 141, 79, 203 +573, 161, 5, 4, 44 +574, 82, 124, 88, 196 +575, 124, 37, 10, 156 +576, 135, 35, 158, 202 +577, 27, 36, 175, 26 +578, 37, 9, 10, 156 +579, 137, 14, 1, 149 +580, 130, 117, 110, 204 +581, 26, 36, 175, 142 +582, 137, 121, 14, 159 +583, 96, 98, 97, 199 +584, 110, 69, 130, 204 +585, 113, 30, 162, 31 +586, 151, 4, 3, 118 +587, 115, 171, 29, 28 +588, 45, 173, 119, 32 +589, 33, 2, 164, 139 +590, 148, 143, 5, 161 +591, 6, 7, 35, 158 +592, 9, 8, 150, 131 +593, 138, 1, 3, 160 +594, 2, 22, 174, 136 +595, 173, 45, 31, 32 +596, 35, 7, 135, 158 +597, 86, 125, 133, 206 +598, 152, 13, 12, 42 +599, 135, 7, 8, 158 +600, 13, 14, 121, 159 +601, 119, 173, 33, 32 +602, 25, 122, 163, 24 +603, 124, 10, 11, 156 +604, 23, 43, 24, 176 +605, 143, 5, 6, 148 +606, 26, 167, 25, 142 +607, 200, 46, 90, 48 +608, 200, 90, 46, 185 +609, 50, 197, 52, 51 +610, 52, 197, 50, 182 +611, 200, 46, 20, 181 +612, 200, 20, 46, 48 +613, 191, 64, 104, 61 +614, 191, 104, 64, 180 +615, 194, 17, 89, 188 +616, 194, 89, 17, 18 +617, 203, 146, 181, 83 +618, 203, 181, 146, 190 +619, 197, 57, 100, 191 +620, 197, 100, 57, 55 +621, 202, 155, 148, 157 +622, 202, 148, 155, 193 +623, 203, 126, 41, 141 +624, 203, 41, 126, 181 +625, 131, 156, 196, 150 +626, 196, 156, 131, 37 +627, 166, 136, 22, 120 +628, 22, 136, 166, 174 +629, 160, 118, 205, 151 +630, 205, 118, 160, 138 +631, 25, 87, 167, 122 +632, 25, 167, 87, 142 +633, 186, 167, 87, 122 +634, 186, 87, 167, 142 +*NSET, NSET=BOTTOM +2, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 162, 163, 164 +165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176 +*NSET, NSET=TOP +1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 147, 148, 149 +150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161 +*MATERIAL, NAME=ALUMINUM +*DENSITY +2.7000000000E+03 +*ELASTIC +7.0000000000E+10, 3.0000000000E-01 +*SOLID SECTION, ELSET=EALL, MATERIAL=ALUMINUM +*BOUNDARY +BOTTOM, 1, 3, 0.0 +*CLOAD +1, 3, 3.5714285714E+01 +3, 3, 3.5714285714E+01 +4, 3, 3.5714285714E+01 +5, 3, 3.5714285714E+01 +6, 3, 3.5714285714E+01 +7, 3, 3.5714285714E+01 +8, 3, 3.5714285714E+01 +9, 3, 3.5714285714E+01 +10, 3, 3.5714285714E+01 +11, 3, 3.5714285714E+01 +12, 3, 3.5714285714E+01 +13, 3, 3.5714285714E+01 +14, 3, 3.5714285714E+01 +147, 3, 3.5714285714E+01 +148, 3, 3.5714285714E+01 +149, 3, 3.5714285714E+01 +150, 3, 3.5714285714E+01 +151, 3, 3.5714285714E+01 +152, 3, 3.5714285714E+01 +153, 3, 3.5714285714E+01 +154, 3, 3.5714285714E+01 +155, 3, 3.5714285714E+01 +156, 3, 3.5714285714E+01 +157, 3, 3.5714285714E+01 +158, 3, 3.5714285714E+01 +159, 3, 3.5714285714E+01 +160, 3, 3.5714285714E+01 +161, 3, 3.5714285714E+01 +*STEP +*DYNAMIC +1.0000000000E-06, 1.0000000000E-01 +*END STEP diff --git a/src/app/fem_program.f90 b/src/app/fem_program.f90 index fb097fc..2ce9d75 100644 --- a/src/app/fem_program.f90 +++ b/src/app/fem_program.f90 @@ -1,5 +1,7 @@ program femlite use fem_precision + use fem_control, only: max_increment, max_newton_iter, newton_tol_force, & + output_interval use fem_api implicit none @@ -22,10 +24,19 @@ program femlite integer :: num_dload integer :: step integer :: iter + integer :: iarg + integer :: output_interval_arg + integer :: ios real(rk) :: time real(rk) :: res_norm character(len=256) :: filename character(len=256) :: arg + character(len=256) :: output_dir_arg + logical :: do_run + logical :: do_static_linear + logical :: do_static_nonlinear + logical :: do_implicit_newmark + logical :: do_implicit_newmark_nonlinear intrinsic iargc intrinsic getarg @@ -45,6 +56,76 @@ program femlite call fem_read_inp(trim(filename), ierr) call exit_if_error(ierr) + do_run = .false. + do_static_linear = .false. + do_static_nonlinear = .false. + do_implicit_newmark = .false. + do_implicit_newmark_nonlinear = .false. + output_dir_arg = ' ' + output_interval_arg = -1 + + iarg = 2 + do while (iarg .le. argc) + call getarg(iarg, arg) + if (trim(arg) .eq. '--run') then + do_run = .true. + else if (trim(arg) .eq. '--implicit-linear') then + do_static_linear = .true. + else if (trim(arg) .eq. '--static-linear') then + do_static_linear = .true. + else if (trim(arg) .eq. '--static-nonlinear') then + do_static_nonlinear = .true. + else if (trim(arg) .eq. '--implicit-newmark') then + do_implicit_newmark = .true. + else if (trim(arg) .eq. '--implicit-newmark-nonlinear') then + do_implicit_newmark_nonlinear = .true. + else if (trim(arg) .eq. '--output-dir') then + if (iarg + 1 .gt. argc) then + write(*,'(A)') 'missing value after --output-dir' + call fem_finalize(ierr) + call exit(2) + end if + iarg = iarg + 1 + call getarg(iarg, output_dir_arg) + else if (trim(arg) .eq. '--output-interval') then + if (iarg + 1 .gt. argc) then + write(*,'(A)') 'missing value after --output-interval' + call fem_finalize(ierr) + call exit(2) + end if + iarg = iarg + 1 + call getarg(iarg, arg) + read(arg,*,iostat=ios) output_interval_arg + if (ios .ne. 0) then + write(*,'(A,A)') 'invalid --output-interval value: ', trim(arg) + call fem_finalize(ierr) + call exit(2) + end if + else + write(*,'(A,A)') 'unknown argument: ', trim(arg) + call fem_finalize(ierr) + call exit(2) + end if + iarg = iarg + 1 + end do + + if (count_true(do_run, do_static_linear, do_static_nonlinear, & + do_implicit_newmark, do_implicit_newmark_nonlinear) .gt. 1) then + write(*,'(A)') 'analysis mode options cannot be used together' + call fem_finalize(ierr) + call exit(2) + end if + + if (len_trim(output_dir_arg) .gt. 0) then + call fem_set_output_directory(trim(output_dir_arg), ierr) + call exit_if_error(ierr) + end if + + if (output_interval_arg .ge. 0) then + call fem_set_output_interval(output_interval_arg, ierr) + call exit_if_error(ierr) + end if + call fem_build_model(ierr) call exit_if_error(ierr) @@ -67,9 +148,7 @@ program femlite write(*,'(A,I8)') ' cload: ', num_cload write(*,'(A,I8)') ' dload: ', num_dload - if (argc .ge. 2) then - call getarg(2, arg) - if (trim(arg) .eq. '--run') then + if (do_run) then call fem_run_explicit(ierr) call exit_if_error(ierr) call fem_get_current_time(time, step, ierr) @@ -77,17 +156,57 @@ program femlite write(*,'(A)') 'Run completed' write(*,'(A,I8)') ' steps: ', step write(*,'(A,ES12.5)') ' time: ', time - else if (trim(arg) .eq. '--implicit-linear') then - call fem_solve_implicit_linear(500, 1.0e-10_rk, iter, res_norm, ierr) + else if (do_static_linear) then + call fem_solve_static_linear(500, 1.0e-10_rk, iter, res_norm, ierr) call exit_if_error(ierr) call fem_get_current_time(time, step, ierr) call exit_if_error(ierr) - write(*,'(A)') 'Implicit linear solve completed' + if (output_interval .gt. 0) then + call fem_write_output(step, time, ierr) + call exit_if_error(ierr) + end if + write(*,'(A)') 'Static linear solve completed' write(*,'(A,I8)') ' steps: ', step write(*,'(A,ES12.5)') ' time: ', time write(*,'(A,I8)') ' cg iter: ', iter write(*,'(A,ES12.5)') ' residual: ', res_norm - end if + else if (do_static_nonlinear) then + call fem_solve_static_nonlinear(max_increment, max_newton_iter, & + newton_tol_force, iter, res_norm, ierr) + call exit_if_error(ierr) + call fem_get_current_time(time, step, ierr) + call exit_if_error(ierr) + if (output_interval .gt. 0) then + call fem_write_output(step, time, ierr) + call exit_if_error(ierr) + end if + write(*,'(A)') 'Static nonlinear solve completed' + write(*,'(A,I8)') ' increments:', step + write(*,'(A,ES12.5)') ' time: ', time + write(*,'(A,I8)') ' iterations:', iter + write(*,'(A,ES12.5)') ' residual: ', res_norm + else if (do_implicit_newmark) then + call fem_run_implicit_newmark(max_newton_iter, newton_tol_force, & + iter, res_norm, ierr) + call exit_if_error(ierr) + call fem_get_current_time(time, step, ierr) + call exit_if_error(ierr) + write(*,'(A)') 'Implicit Newmark run completed' + write(*,'(A,I8)') ' steps: ', step + write(*,'(A,ES12.5)') ' time: ', time + write(*,'(A,I8)') ' iterations:', iter + write(*,'(A,ES12.5)') ' residual: ', res_norm + else if (do_implicit_newmark_nonlinear) then + call fem_run_newmark_nonlinear(max_newton_iter, newton_tol_force, & + iter, res_norm, ierr) + call exit_if_error(ierr) + call fem_get_current_time(time, step, ierr) + call exit_if_error(ierr) + write(*,'(A)') 'Nonlinear Newmark run completed' + write(*,'(A,I8)') ' steps: ', step + write(*,'(A,ES12.5)') ' time: ', time + write(*,'(A,I8)') ' iterations:', iter + write(*,'(A,ES12.5)') ' residual: ', res_norm end if end if @@ -110,4 +229,19 @@ contains call fem_finalize(ierr_local) call exit(1) end subroutine exit_if_error + + integer function count_true(a, b, c, d, e) + logical, intent(in) :: a + logical, intent(in) :: b + logical, intent(in) :: c + logical, intent(in) :: d + logical, intent(in) :: e + + count_true = 0 + if (a) count_true = count_true + 1 + if (b) count_true = count_true + 1 + if (c) count_true = count_true + 1 + if (d) count_true = count_true + 1 + if (e) count_true = count_true + 1 + end function count_true end program femlite diff --git a/src/base/fem_api.f90 b/src/base/fem_api.f90 index 294cfe2..97c16f0 100644 --- a/src/base/fem_api.f90 +++ b/src/base/fem_api.f90 @@ -451,6 +451,77 @@ contains ierr = FEM_SUCCESS end subroutine fem_get_node_internal_force + subroutine fem_get_node_reaction(node_id, reaction, ierr) + integer, intent(in) :: node_id + real(rk), intent(out) :: reaction(NDOF_NODE) + integer, intent(out) :: ierr + integer :: node + integer :: idir + integer :: dof + + if (.not. api_initialized) then + call error_set(FEM_ERR_INTERNAL, 'fem_get_node_reaction called before fem_initialize', ierr) + return + end if + if (.not. allocated(freaction)) then + call error_set(FEM_ERR_INTERNAL, 'reaction vector is not allocated', ierr) + return + end if + + node = database_find_node(node_id) + if (node .eq. 0) then + call error_set(FEM_ERR_INPUT, 'reaction query references unknown node', ierr) + return + end if + + reaction = ZERO + do idir = 1, NDOF_NODE + dof = dof_id(idir,node) + if (dof .gt. 0) reaction(idir) = freaction(dof) + end do + + ierr = FEM_SUCCESS + end subroutine fem_get_node_reaction + + subroutine fem_get_nodal_reactions(nnode_in, node_id, reaction, ierr) + integer, intent(in) :: nnode_in + integer, intent(in) :: node_id(nnode_in) + real(rk), intent(out) :: reaction(NDOF_NODE,nnode_in) + integer, intent(out) :: ierr + integer :: item + integer :: node + integer :: idir + integer :: dof + + if (.not. api_initialized) then + call error_set(FEM_ERR_INTERNAL, 'fem_get_nodal_reactions called before fem_initialize', ierr) + return + end if + if (.not. allocated(freaction)) then + call error_set(FEM_ERR_INTERNAL, 'reaction vector is not allocated', ierr) + return + end if + if (nnode_in .lt. 0) then + call error_set(FEM_ERR_INPUT, 'number of reaction query nodes is negative', ierr) + return + end if + + reaction = ZERO + do item = 1, nnode_in + node = database_find_node(node_id(item)) + if (node .eq. 0) then + call error_set(FEM_ERR_INPUT, 'reaction query references unknown node', ierr) + return + end if + do idir = 1, NDOF_NODE + dof = dof_id(idir,node) + if (dof .gt. 0) reaction(idir,item) = freaction(dof) + end do + end do + + ierr = FEM_SUCCESS + end subroutine fem_get_nodal_reactions + subroutine fem_get_element_average_state(nelem_in, elem_id, stress_out, & strain_out, plastic_strain, eqps, & damage, ierr) @@ -568,6 +639,25 @@ contains call output_csv_set_interval(interval, ierr) end subroutine fem_set_output_interval + subroutine fem_set_rayleigh_damping(alpha_mass, beta_stiffness, ierr) + real(rk), intent(in) :: alpha_mass + real(rk), intent(in) :: beta_stiffness + integer, intent(out) :: ierr + + if (.not. api_initialized) then + call error_set(FEM_ERR_INTERNAL, 'fem_set_rayleigh_damping called before fem_initialize', ierr) + return + end if + if (alpha_mass .lt. ZERO .or. beta_stiffness .lt. ZERO) then + call error_set(FEM_ERR_INPUT, 'Rayleigh damping factors must be non-negative', ierr) + return + end if + + rayleigh_alpha_mass = alpha_mass + rayleigh_beta_stiffness = beta_stiffness + ierr = FEM_SUCCESS + end subroutine fem_set_rayleigh_damping + subroutine fem_write_output(step, time, ierr) integer, intent(in) :: step real(rk), intent(in) :: time @@ -913,6 +1003,324 @@ contains call log_info('implicit linear solve completed') end subroutine fem_solve_implicit_linear + subroutine fem_solve_static_linear(max_iter, tol, iter, res_norm, ierr) + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr + real(rk) :: solve_time + + if (.not. api_initialized) then + call error_set(FEM_ERR_INTERNAL, 'fem_solve_static_linear called before fem_initialize', ierr) + return + end if + + analysis_type = ANALYSIS_STATIC_LINEAR + solve_time = current_time + if (time_end .gt. ZERO) solve_time = time_end + + call implicit_solve_linear_static(solve_time, max_iter, tol, iter, res_norm, ierr) + if (ierr .ne. FEM_SUCCESS) return + + call element_compute_internal_force(ierr, ZERO) + if (ierr .ne. FEM_SUCCESS) return + + current_step = current_step + 1 + current_time = solve_time + call log_info('static linear solve completed') + end subroutine fem_solve_static_linear + + subroutine fem_solve_static_nonlinear(max_increment_in, max_iter, tol, & + iter, res_norm, ierr) + integer, intent(in) :: max_increment_in + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr + real(rk) :: solve_time + + if (.not. api_initialized) then + call error_set(FEM_ERR_INTERNAL, 'fem_solve_static_nonlinear called before fem_initialize', ierr) + return + end if + + analysis_type = ANALYSIS_STATIC_NONLINEAR + solve_time = current_time + if (time_end .gt. ZERO) solve_time = time_end + + call implicit_solve_nonlinear_static(solve_time, max_increment_in, & + max_iter, tol, iter, res_norm, ierr) + if (ierr .ne. FEM_SUCCESS) return + + call log_info('static nonlinear solve completed') + end subroutine fem_solve_static_nonlinear + + subroutine fem_advance_implicit_newmark(dt, max_iter, tol, iter, res_norm, ierr) + real(rk), intent(in) :: dt + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr + + if (.not. api_initialized) then + call error_set(FEM_ERR_INTERNAL, 'fem_advance_implicit_newmark called before fem_initialize', ierr) + return + end if + if (dt .le. ZERO) then + call error_set(FEM_ERR_SOLVER, 'implicit Newmark time step must be positive', ierr) + return + end if + if (.not. allocated(mass_diag)) then + call error_set(FEM_ERR_INTERNAL, 'mass vector is not allocated', ierr) + return + end if + if (maxval(abs(mass_diag)) .le. tiny(ONE)) then + call element_compute_lumped_mass(ierr) + if (ierr .ne. FEM_SUCCESS) return + end if + + analysis_type = ANALYSIS_IMPLICIT_DYNAMIC + call implicit_advance_newmark_linear(dt, newmark_beta, newmark_gamma, & + max_iter, tol, iter, res_norm, ierr) + if (ierr .ne. FEM_SUCCESS) return + + current_step = current_step + 1 + current_time = current_time + dt + call log_info('implicit Newmark step completed') + end subroutine fem_advance_implicit_newmark + + subroutine fem_advance_newmark_nonlinear(dt, max_iter, tol, iter, & + res_norm, ierr) + real(rk), intent(in) :: dt + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr + + if (.not. api_initialized) then + call error_set(FEM_ERR_INTERNAL, & + 'fem_advance_newmark_nonlinear called before fem_initialize', ierr) + return + end if + if (dt .le. ZERO) then + call error_set(FEM_ERR_SOLVER, 'nonlinear Newmark time step must be positive', ierr) + return + end if + if (.not. allocated(mass_diag)) then + call error_set(FEM_ERR_INTERNAL, 'mass vector is not allocated', ierr) + return + end if + if (maxval(abs(mass_diag)) .le. tiny(ONE)) then + call element_compute_lumped_mass(ierr) + if (ierr .ne. FEM_SUCCESS) return + end if + + analysis_type = ANALYSIS_IMPLICIT_DYNAMIC + call implicit_newmark_nonlinear_step(dt, newmark_beta, newmark_gamma, & + max_iter, tol, iter, res_norm, ierr) + if (ierr .ne. FEM_SUCCESS) return + + current_step = current_step + 1 + current_time = current_time + dt + call log_info('nonlinear Newmark step completed') + end subroutine fem_advance_newmark_nonlinear + + subroutine fem_run_implicit_newmark(max_iter, tol, iter_total, res_norm, ierr) + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter_total + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr + real(rk) :: dt + real(rk) :: dt_step + real(rk) :: remaining + real(rk) :: time_tol + integer :: iter + integer :: run_steps + integer :: step_limit + + iter_total = 0 + res_norm = ZERO + + if (.not. api_initialized) then + call error_set(FEM_ERR_INTERNAL, 'fem_run_implicit_newmark called before fem_initialize', ierr) + return + end if + if (time_end .le. current_time) then + call error_set(FEM_ERR_SOLVER, 'implicit Newmark run requires a positive end time', ierr) + return + end if + + call fem_compute_lumped_mass(ierr) + if (ierr .ne. FEM_SUCCESS) return + + if (use_user_dt) then + dt = dt_user + else + call fem_estimate_stable_dt(dt, ierr) + if (ierr .ne. FEM_SUCCESS) return + end if + if (dt .le. ZERO) then + call error_set(FEM_ERR_SOLVER, 'implicit Newmark run requires a positive time step', ierr) + return + end if + + call boundary_apply_dirichlet(current_time, ierr) + if (ierr .ne. FEM_SUCCESS) return + + if (output_interval .gt. 0) then + call fem_write_output(current_step, current_time, ierr) + if (ierr .ne. FEM_SUCCESS) return + end if + + if (nstep_max .gt. 0) then + step_limit = nstep_max + else + step_limit = huge(1) + end if + run_steps = 0 + time_tol = max(1.0e-12_rk * max(ONE, abs(time_end)), 1.0e-30_rk) + + do + remaining = time_end - current_time + if (remaining .le. time_tol) exit + if (run_steps .ge. step_limit) exit + + dt_step = min(dt, remaining) + call fem_advance_implicit_newmark(dt_step, max_iter, tol, iter, res_norm, ierr) + if (ierr .ne. FEM_SUCCESS) return + iter_total = iter_total + iter + run_steps = run_steps + 1 + + if (output_interval .gt. 0) then + if (mod(current_step, output_interval) .eq. 0 .or. & + time_end - current_time .le. time_tol) then + call fem_write_output(current_step, current_time, ierr) + if (ierr .ne. FEM_SUCCESS) return + end if + end if + end do + + if (time_end - current_time .gt. time_tol) then + call error_set(FEM_ERR_SOLVER, 'implicit Newmark run stopped before end time', ierr) + return + end if + + ierr = FEM_SUCCESS + end subroutine fem_run_implicit_newmark + + subroutine fem_run_newmark_nonlinear(max_iter, tol, iter_total, res_norm, ierr) + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter_total + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr + real(rk) :: dt + real(rk) :: dt_step + real(rk) :: dt_min_eff + real(rk) :: remaining + real(rk) :: time_tol + integer :: iter + integer :: run_steps + integer :: step_limit + integer :: cut_count + + iter_total = 0 + res_norm = ZERO + + if (.not. api_initialized) then + call error_set(FEM_ERR_INTERNAL, & + 'fem_run_newmark_nonlinear called before fem_initialize', ierr) + return + end if + if (time_end .le. current_time) then + call error_set(FEM_ERR_SOLVER, & + 'nonlinear Newmark run requires a positive end time', ierr) + return + end if + + call fem_compute_lumped_mass(ierr) + if (ierr .ne. FEM_SUCCESS) return + + if (use_user_dt) then + dt = dt_user + else + call fem_estimate_stable_dt(dt, ierr) + if (ierr .ne. FEM_SUCCESS) return + end if + if (dt .le. ZERO) then + call error_set(FEM_ERR_SOLVER, & + 'nonlinear Newmark run requires a positive time step', ierr) + return + end if + + call boundary_apply_dirichlet(current_time, ierr) + if (ierr .ne. FEM_SUCCESS) return + + if (output_interval .gt. 0) then + call fem_write_output(current_step, current_time, ierr) + if (ierr .ne. FEM_SUCCESS) return + end if + + if (nstep_max .gt. 0) then + step_limit = nstep_max + else + step_limit = huge(1) + end if + run_steps = 0 + time_tol = max(1.0e-12_rk * max(ONE, abs(time_end)), 1.0e-30_rk) + if (static_min_increment .gt. ZERO) then + dt_min_eff = static_min_increment + else + dt_min_eff = dt * 1.0e-8_rk + end if + dt_min_eff = max(dt_min_eff, time_tol) + + do + remaining = time_end - current_time + if (remaining .le. time_tol) exit + if (run_steps .ge. step_limit) exit + + dt_step = min(dt, remaining) + cut_count = 0 + do + call fem_advance_newmark_nonlinear(dt_step, max_iter, tol, iter, & + res_norm, ierr) + if (ierr .eq. FEM_SUCCESS) exit + if (allow_step_cutback .and. cut_count .lt. max_cutback .and. & + dt_step * cutback_factor .ge. dt_min_eff) then + dt_step = dt_step * cutback_factor + cut_count = cut_count + 1 + ierr = FEM_SUCCESS + else + return + end if + end do + iter_total = iter_total + iter + run_steps = run_steps + 1 + + if (output_interval .gt. 0) then + if (mod(current_step, output_interval) .eq. 0 .or. & + time_end - current_time .le. time_tol) then + call fem_write_output(current_step, current_time, ierr) + if (ierr .ne. FEM_SUCCESS) return + end if + end if + end do + + if (time_end - current_time .gt. time_tol) then + call error_set(FEM_ERR_SOLVER, & + 'nonlinear Newmark run stopped before end time', ierr) + return + end if + + ierr = FEM_SUCCESS + end subroutine fem_run_newmark_nonlinear + subroutine fem_get_current_time(time, step, ierr) real(rk), intent(out) :: time integer, intent(out) :: step diff --git a/src/base/fem_control.f90 b/src/base/fem_control.f90 index 47a270b..3e17149 100644 --- a/src/base/fem_control.f90 +++ b/src/base/fem_control.f90 @@ -2,18 +2,43 @@ module fem_control use fem_precision implicit none + integer, parameter :: ANALYSIS_EXPLICIT_DYNAMIC = 1 + integer, parameter :: ANALYSIS_STATIC_LINEAR = 2 + integer, parameter :: ANALYSIS_STATIC_NONLINEAR = 3 + integer, parameter :: ANALYSIS_IMPLICIT_DYNAMIC = 4 + real(rk) :: time_start = ZERO real(rk) :: time_end = ZERO real(rk) :: current_time = ZERO real(rk) :: dt_user = ZERO real(rk) :: dt_stable = ZERO real(rk) :: stable_dt_safety = 0.8_rk + real(rk) :: static_initial_increment = ONE + real(rk) :: static_min_increment = ZERO + real(rk) :: static_max_increment = ONE + real(rk) :: load_factor = ONE + real(rk) :: newton_tol_force = 1.0e-8_rk + real(rk) :: newton_tol_disp = 1.0e-8_rk + real(rk) :: newmark_beta = 0.25_rk + real(rk) :: newmark_gamma = 0.5_rk + real(rk) :: rayleigh_alpha_mass = ZERO + real(rk) :: rayleigh_beta_stiffness = ZERO + real(rk) :: line_search_min_alpha = 0.125_rk + real(rk) :: line_search_reduction = 0.5_rk + real(rk) :: line_search_accept_ratio = 0.95_rk + real(rk) :: cutback_factor = 0.5_rk integer :: current_step = 0 integer :: nstep_max = 0 + integer :: analysis_type = ANALYSIS_EXPLICIT_DYNAMIC + integer :: max_increment = 0 + integer :: max_newton_iter = 25 + integer :: max_cutback = 8 integer :: output_interval = 1 logical :: use_sph_coupling = .false. logical :: use_user_dt = .false. logical :: large_deformation = .true. + logical :: use_line_search = .true. + logical :: allow_step_cutback = .false. contains @@ -24,12 +49,32 @@ contains dt_user = ZERO dt_stable = ZERO stable_dt_safety = 0.8_rk + static_initial_increment = ONE + static_min_increment = ZERO + static_max_increment = ONE + load_factor = ONE + newton_tol_force = 1.0e-8_rk + newton_tol_disp = 1.0e-8_rk + newmark_beta = 0.25_rk + newmark_gamma = 0.5_rk + rayleigh_alpha_mass = ZERO + rayleigh_beta_stiffness = ZERO + line_search_min_alpha = 0.125_rk + line_search_reduction = 0.5_rk + line_search_accept_ratio = 0.95_rk + cutback_factor = 0.5_rk current_step = 0 nstep_max = 0 + analysis_type = ANALYSIS_EXPLICIT_DYNAMIC + max_increment = 0 + max_newton_iter = 25 + max_cutback = 8 output_interval = 1 use_sph_coupling = .false. use_user_dt = .false. large_deformation = .true. + use_line_search = .true. + allow_step_cutback = .false. end subroutine control_set_defaults end module fem_control diff --git a/src/base/fem_precision.f90 b/src/base/fem_precision.f90 index 966ac1c..a813380 100644 --- a/src/base/fem_precision.f90 +++ b/src/base/fem_precision.f90 @@ -15,7 +15,7 @@ module fem_precision integer, parameter :: NSTATEV_MAX = 32 integer, parameter :: FEMLITE_VERSION_MAJOR = 0 - integer, parameter :: FEMLITE_VERSION_MINOR = 2 + integer, parameter :: FEMLITE_VERSION_MINOR = 3 integer, parameter :: FEMLITE_VERSION_PATCH = 0 real(rk), parameter :: ZERO = 0.0_rk diff --git a/src/boundary/fem_contact.f90 b/src/boundary/fem_contact.f90 index 7468b82..d2be207 100644 --- a/src/boundary/fem_contact.f90 +++ b/src/boundary/fem_contact.f90 @@ -2,11 +2,14 @@ module fem_contact use fem_precision use fem_error use fem_database + use fem_sparse_csr + use fem_coupling implicit none private public :: contact_apply_plane_forces + public :: contact_apply_plane_tangent contains @@ -24,10 +27,28 @@ contains call apply_contact_plane(plane, ierr) if (ierr .ne. FEM_SUCCESS) return end do + call apply_contact_pair_forces(ierr) + if (ierr .ne. FEM_SUCCESS) return ierr = FEM_SUCCESS end subroutine contact_apply_plane_forces + subroutine contact_apply_plane_tangent(kmat, velocity_scale, ierr) + type(csr_matrix), intent(inout) :: kmat + real(rk), intent(in) :: velocity_scale + integer, intent(out) :: ierr + integer :: plane + + do plane = 1, ncontact_plane + call apply_contact_plane_tangent(plane, kmat, velocity_scale, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + call apply_contact_pair_tangent(kmat, velocity_scale, ierr) + if (ierr .ne. FEM_SUCCESS) return + + ierr = FEM_SUCCESS + end subroutine contact_apply_plane_tangent + subroutine apply_contact_plane(plane, ierr) integer, intent(in) :: plane integer, intent(out) :: ierr @@ -79,6 +100,59 @@ contains ierr = FEM_SUCCESS end subroutine apply_contact_plane + subroutine apply_contact_plane_tangent(plane, kmat, velocity_scale, ierr) + integer, intent(in) :: plane + type(csr_matrix), intent(inout) :: kmat + real(rk), intent(in) :: velocity_scale + integer, intent(out) :: ierr + integer :: node + integer :: set_id + integer :: pos + integer :: external_id + integer :: ios + character(len=NAME_LEN) :: target + + target = adjustl(contact_target(plane)) + if (len_trim(target) .eq. 0 .or. trim(target) .eq. 'ALL' .or. & + trim(target) .eq. 'all') then + do node = 1, nnode + call apply_contact_node_tangent(plane, node, kmat, velocity_scale, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + ierr = FEM_SUCCESS + return + end if + + read(target,*,iostat=ios) external_id + if (ios .eq. 0) then + node = database_find_node(external_id) + if (node .eq. 0) then + call error_set(FEM_ERR_INPUT, 'contact tangent references unknown node', ierr) + return + end if + call apply_contact_node_tangent(plane, node, kmat, velocity_scale, ierr) + return + end if + + set_id = database_find_nset(target) + if (set_id .eq. 0) then + call error_set(FEM_ERR_INPUT, 'contact tangent references unknown node set', ierr) + return + end if + + do pos = nset_start(set_id), nset_start(set_id) + nset_count(set_id) - 1 + node = database_find_node(nset_items(pos)) + if (node .eq. 0) then + call error_set(FEM_ERR_INPUT, 'contact tangent node set contains unknown node', ierr) + return + end if + call apply_contact_node_tangent(plane, node, kmat, velocity_scale, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + + ierr = FEM_SUCCESS + end subroutine apply_contact_plane_tangent + subroutine apply_contact_plane_node(plane, node, ierr) integer, intent(in) :: plane integer, intent(in) :: node @@ -132,4 +206,584 @@ contains ierr = FEM_SUCCESS end subroutine apply_contact_plane_node + subroutine apply_contact_node_tangent(plane, node, kmat, velocity_scale, ierr) + integer, intent(in) :: plane + integer, intent(in) :: node + type(csr_matrix), intent(inout) :: kmat + real(rk), intent(in) :: velocity_scale + integer, intent(out) :: ierr + real(rk) :: normal(NDIM) + real(rk) :: position(NDIM) + real(rk) :: velocity(NDIM) + real(rk) :: norm_n + real(rk) :: offset + real(rk) :: gap + real(rk) :: vn + real(rk) :: coeff + integer :: idir + integer :: jdir + integer :: row + integer :: col + + if (node .lt. 1 .or. node .gt. nnode) then + call error_set(FEM_ERR_INPUT, 'contact tangent node is out of range', ierr) + return + end if + + normal = contact_normal(:,plane) + norm_n = sqrt(sum(normal * normal)) + if (norm_n .le. tiny(ONE)) then + call error_set(FEM_ERR_INPUT, 'contact tangent plane normal must be non-zero', ierr) + return + end if + normal = normal / norm_n + offset = contact_offset(plane) / norm_n + + position = coord0(:,node) + velocity = ZERO + do idir = 1, NDIM + row = dof_id(idir,node) + if (row .gt. 0) then + position(idir) = position(idir) + u(row) + if (allocated(v)) velocity(idir) = v(row) + end if + end do + + gap = dot_product(normal, position) - offset + if (gap .ge. ZERO) then + ierr = FEM_SUCCESS + return + end if + + vn = dot_product(normal, velocity) + coeff = contact_penalty(plane) + if (vn .lt. ZERO) coeff = coeff + velocity_scale * contact_damping(plane) + if (abs(coeff) .le. tiny(ONE)) then + ierr = FEM_SUCCESS + return + end if + + do idir = 1, NDIM + row = dof_id(idir,node) + if (row .le. 0) cycle + do jdir = 1, NDIM + col = dof_id(jdir,node) + if (col .gt. 0) then + call csr_add_value(kmat, row, col, coeff * normal(idir) * normal(jdir), ierr) + if (ierr .ne. FEM_SUCCESS) return + end if + end do + end do + + ierr = FEM_SUCCESS + end subroutine apply_contact_node_tangent + + subroutine apply_contact_pair_forces(ierr) + integer, intent(out) :: ierr + integer :: pair + + do pair = 1, ncontact_pair + call apply_contact_pair_force_one(pair, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + + ierr = FEM_SUCCESS + end subroutine apply_contact_pair_forces + + subroutine apply_contact_pair_tangent(kmat, velocity_scale, ierr) + type(csr_matrix), intent(inout) :: kmat + real(rk), intent(in) :: velocity_scale + integer, intent(out) :: ierr + integer :: pair + + do pair = 1, ncontact_pair + call apply_contact_pair_tan_one(pair, kmat, velocity_scale, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + + ierr = FEM_SUCCESS + end subroutine apply_contact_pair_tangent + + subroutine apply_contact_pair_force_one(pair, ierr) + integer, intent(in) :: pair + integer, intent(out) :: ierr + integer :: nf + integer :: max_nodes + integer :: stat + integer :: sf + integer :: mf + integer :: best + integer, allocatable :: facet_id(:) + integer, allocatable :: elem_id(:) + integer, allocatable :: face_id(:) + integer, allocatable :: fnnode(:) + integer, allocatable :: fconn(:,:) + real(rk), allocatable :: x(:,:,:) + real(rk), allocatable :: vnod(:,:,:) + real(rk), allocatable :: normal(:,:) + real(rk), allocatable :: area(:) + real(rk) :: gap + real(rk) :: vn + real(rk) :: best_gap + real(rk) :: best_vn + real(rk) :: force_mag + real(rk) :: nrm(NDIM) + + call cpl_build_facets(ierr) + if (ierr .ne. FEM_SUCCESS) return + call cpl_get_facet_count(nf, max_nodes, ierr) + if (ierr .ne. FEM_SUCCESS) return + if (nf .le. 0) then + ierr = FEM_SUCCESS + return + end if + + allocate(facet_id(nf), elem_id(nf), face_id(nf), fnnode(nf), & + fconn(max_nodes,nf), x(NDIM,max_nodes,nf), & + vnod(NDIM,max_nodes,nf), normal(NDIM,nf), area(nf), stat=stat) + if (stat .ne. 0) then + call error_set(FEM_ERR_INTERNAL, 'failed to allocate contact pair facets', ierr) + return + end if + + call cpl_get_facets(nf, max_nodes, facet_id, elem_id, face_id, fnnode, & + fconn, x, vnod, normal, area, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + do sf = 1, nf + if (.not. facet_target_matches(elem_id(sf), contact_pair_slave(pair))) cycle + best = 0 + best_gap = ZERO + best_vn = ZERO + nrm = ZERO + do mf = 1, nf + if (sf .eq. mf) cycle + if (.not. facet_target_matches(elem_id(mf), contact_pair_master(pair))) cycle + if (facet_nodes_share(max_nodes, fnnode(sf), fconn(:,sf), & + fnnode(mf), fconn(:,mf))) cycle + call pair_contact_gap(pair, sf, mf, nf, max_nodes, fnnode, & + x, vnod, normal, gap, vn, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + if (gap .lt. ZERO) then + if (best .eq. 0 .or. gap .lt. best_gap) then + best = mf + best_gap = gap + best_vn = vn + nrm = normal(:,mf) + end if + end if + end do + + if (best .gt. 0) then + force_mag = contact_pair_penalty(pair) * (-best_gap) * area(sf) + if (best_vn .lt. ZERO) then + force_mag = force_mag + contact_pair_damping(pair) * & + (-best_vn) * area(sf) + end if + call add_contact_pair_force(max_nodes, fnnode(sf), fconn(:,sf), & + fnnode(best), fconn(:,best), & + force_mag, nrm, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + end if + end do + + ierr = FEM_SUCCESS + +900 continue + if (allocated(facet_id)) deallocate(facet_id) + if (allocated(elem_id)) deallocate(elem_id) + if (allocated(face_id)) deallocate(face_id) + if (allocated(fnnode)) deallocate(fnnode) + if (allocated(fconn)) deallocate(fconn) + if (allocated(x)) deallocate(x) + if (allocated(vnod)) deallocate(vnod) + if (allocated(normal)) deallocate(normal) + if (allocated(area)) deallocate(area) + end subroutine apply_contact_pair_force_one + + subroutine apply_contact_pair_tan_one(pair, kmat, velocity_scale, ierr) + integer, intent(in) :: pair + type(csr_matrix), intent(inout) :: kmat + real(rk), intent(in) :: velocity_scale + integer, intent(out) :: ierr + integer :: nf + integer :: max_nodes + integer :: stat + integer :: sf + integer :: mf + integer :: best + integer, allocatable :: facet_id(:) + integer, allocatable :: elem_id(:) + integer, allocatable :: face_id(:) + integer, allocatable :: fnnode(:) + integer, allocatable :: fconn(:,:) + real(rk), allocatable :: x(:,:,:) + real(rk), allocatable :: vnod(:,:,:) + real(rk), allocatable :: normal(:,:) + real(rk), allocatable :: area(:) + real(rk) :: gap + real(rk) :: vn + real(rk) :: best_gap + real(rk) :: best_vn + real(rk) :: coeff + real(rk) :: nrm(NDIM) + + call cpl_build_facets(ierr) + if (ierr .ne. FEM_SUCCESS) return + call cpl_get_facet_count(nf, max_nodes, ierr) + if (ierr .ne. FEM_SUCCESS) return + if (nf .le. 0) then + ierr = FEM_SUCCESS + return + end if + + allocate(facet_id(nf), elem_id(nf), face_id(nf), fnnode(nf), & + fconn(max_nodes,nf), x(NDIM,max_nodes,nf), & + vnod(NDIM,max_nodes,nf), normal(NDIM,nf), area(nf), stat=stat) + if (stat .ne. 0) then + call error_set(FEM_ERR_INTERNAL, 'failed to allocate contact tangent facets', ierr) + return + end if + + call cpl_get_facets(nf, max_nodes, facet_id, elem_id, face_id, fnnode, & + fconn, x, vnod, normal, area, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + do sf = 1, nf + if (.not. facet_target_matches(elem_id(sf), contact_pair_slave(pair))) cycle + best = 0 + best_gap = ZERO + best_vn = ZERO + nrm = ZERO + do mf = 1, nf + if (sf .eq. mf) cycle + if (.not. facet_target_matches(elem_id(mf), contact_pair_master(pair))) cycle + if (facet_nodes_share(max_nodes, fnnode(sf), fconn(:,sf), & + fnnode(mf), fconn(:,mf))) cycle + call pair_contact_gap(pair, sf, mf, nf, max_nodes, fnnode, & + x, vnod, normal, gap, vn, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + if (gap .lt. ZERO) then + if (best .eq. 0 .or. gap .lt. best_gap) then + best = mf + best_gap = gap + best_vn = vn + nrm = normal(:,mf) + end if + end if + end do + + if (best .gt. 0) then + coeff = contact_pair_penalty(pair) * area(sf) + if (best_vn .lt. ZERO) then + coeff = coeff + velocity_scale * contact_pair_damping(pair) * area(sf) + end if + call add_contact_pair_tan(kmat, max_nodes, fnnode(sf), fconn(:,sf), & + fnnode(best), fconn(:,best), coeff, nrm, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + end if + end do + + ierr = FEM_SUCCESS + +900 continue + if (allocated(facet_id)) deallocate(facet_id) + if (allocated(elem_id)) deallocate(elem_id) + if (allocated(face_id)) deallocate(face_id) + if (allocated(fnnode)) deallocate(fnnode) + if (allocated(fconn)) deallocate(fconn) + if (allocated(x)) deallocate(x) + if (allocated(vnod)) deallocate(vnod) + if (allocated(normal)) deallocate(normal) + if (allocated(area)) deallocate(area) + end subroutine apply_contact_pair_tan_one + + logical function facet_target_matches(elem_ext, target) + integer, intent(in) :: elem_ext + character(len=*), intent(in) :: target + character(len=NAME_LEN) :: local_target + integer :: external_id + integer :: ios + integer :: set_id + integer :: pos + + local_target = adjustl(target) + if (len_trim(local_target) .eq. 0 .or. trim(local_target) .eq. 'ALL' .or. & + trim(local_target) .eq. 'all') then + facet_target_matches = .true. + return + end if + + read(local_target,*,iostat=ios) external_id + if (ios .eq. 0) then + facet_target_matches = elem_ext .eq. external_id + return + end if + + set_id = database_find_elset(local_target) + facet_target_matches = .false. + if (set_id .eq. 0) return + do pos = elset_start(set_id), elset_start(set_id) + elset_count(set_id) - 1 + if (elset_items(pos) .eq. elem_ext) then + facet_target_matches = .true. + return + end if + end do + end function facet_target_matches + + logical function facet_nodes_share(max_nodes, nslave, slave_conn, & + nmaster, master_conn) + integer, intent(in) :: max_nodes + integer, intent(in) :: nslave + integer, intent(in) :: nmaster + integer, intent(in) :: slave_conn(max_nodes) + integer, intent(in) :: master_conn(max_nodes) + integer :: i + integer :: j + + facet_nodes_share = .false. + do i = 1, nslave + do j = 1, nmaster + if (slave_conn(i) .eq. master_conn(j)) then + facet_nodes_share = .true. + return + end if + end do + end do + end function facet_nodes_share + + subroutine pair_contact_gap(pair, sf, mf, nf, max_nodes, fnnode, x, vnod, & + normal, gap, vn, ierr) + integer, intent(in) :: pair + integer, intent(in) :: sf + integer, intent(in) :: mf + integer, intent(in) :: nf + integer, intent(in) :: max_nodes + integer, intent(in) :: fnnode(nf) + real(rk), intent(in) :: x(NDIM,max_nodes,nf) + real(rk), intent(in) :: vnod(NDIM,max_nodes,nf) + real(rk), intent(in) :: normal(NDIM,nf) + real(rk), intent(out) :: gap + real(rk), intent(out) :: vn + integer, intent(out) :: ierr + real(rk) :: sc(NDIM) + real(rk) :: mc(NDIM) + real(rk) :: sv(NDIM) + real(rk) :: mv(NDIM) + real(rk) :: projection(NDIM) + real(rk) :: nrm(NDIM) + real(rk) :: nlen + real(rk) :: radius + real(rk) :: search + real(rk) :: dist + + call facet_center_velocity(sf, nf, max_nodes, fnnode, x, vnod, sc, sv) + call facet_center_velocity(mf, nf, max_nodes, fnnode, x, vnod, mc, mv) + + nrm = normal(:,mf) + nlen = sqrt(sum(nrm * nrm)) + if (nlen .le. tiny(ONE)) then + call error_set(FEM_ERR_COUPLING, 'contact pair master facet normal is zero', ierr) + return + end if + nrm = nrm / nlen + + gap = dot_product(nrm, sc - mc) + vn = dot_product(nrm, sv - mv) + if (gap .ge. ZERO) then + ierr = FEM_SUCCESS + return + end if + + search = contact_pair_search(pair) + radius = facet_radius_value(mf, nf, max_nodes, fnnode, x, mc) + if (search .gt. ZERO .and. -gap .gt. search) then + gap = ZERO + ierr = FEM_SUCCESS + return + end if + + projection = sc - gap * nrm + dist = sqrt(sum((projection - mc) * (projection - mc))) + if (dist .gt. radius + max(search, tiny(ONE))) gap = ZERO + + ierr = FEM_SUCCESS + end subroutine pair_contact_gap + + subroutine facet_center_velocity(idx, nf, max_nodes, fnnode, x, vnod, & + center, vel_center) + integer, intent(in) :: idx + integer, intent(in) :: nf + integer, intent(in) :: max_nodes + integer, intent(in) :: fnnode(nf) + real(rk), intent(in) :: x(NDIM,max_nodes,nf) + real(rk), intent(in) :: vnod(NDIM,max_nodes,nf) + real(rk), intent(out) :: center(NDIM) + real(rk), intent(out) :: vel_center(NDIM) + integer :: local_node + + center = ZERO + vel_center = ZERO + do local_node = 1, fnnode(idx) + center = center + x(:,local_node,idx) + vel_center = vel_center + vnod(:,local_node,idx) + end do + center = center / real(fnnode(idx), rk) + vel_center = vel_center / real(fnnode(idx), rk) + end subroutine facet_center_velocity + + real(rk) function facet_radius_value(idx, nf, max_nodes, fnnode, x, center) + integer, intent(in) :: idx + integer, intent(in) :: nf + integer, intent(in) :: max_nodes + integer, intent(in) :: fnnode(nf) + real(rk), intent(in) :: x(NDIM,max_nodes,nf) + real(rk), intent(in) :: center(NDIM) + real(rk) :: delta(NDIM) + real(rk) :: dist + integer :: local_node + + facet_radius_value = ZERO + do local_node = 1, fnnode(idx) + delta = x(:,local_node,idx) - center + dist = sqrt(sum(delta * delta)) + if (dist .gt. facet_radius_value) facet_radius_value = dist + end do + end function facet_radius_value + + subroutine add_contact_pair_force(max_nodes, nslave, slave_conn, nmaster, & + master_conn, force_mag, normal, ierr) + integer, intent(in) :: max_nodes + integer, intent(in) :: nslave + integer, intent(in) :: nmaster + integer, intent(in) :: slave_conn(max_nodes) + integer, intent(in) :: master_conn(max_nodes) + real(rk), intent(in) :: force_mag + real(rk), intent(in) :: normal(NDIM) + integer, intent(out) :: ierr + integer :: local_node + integer :: node + integer :: idir + integer :: dof + real(rk) :: weight + + weight = force_mag / real(nslave, rk) + do local_node = 1, nslave + node = database_find_node(slave_conn(local_node)) + if (node .eq. 0) then + call error_set(FEM_ERR_INPUT, 'contact pair slave facet has unknown node', ierr) + return + end if + do idir = 1, NDIM + dof = dof_id(idir,node) + if (dof .gt. 0) fcontact(dof) = fcontact(dof) + weight * normal(idir) + end do + end do + + weight = force_mag / real(nmaster, rk) + do local_node = 1, nmaster + node = database_find_node(master_conn(local_node)) + if (node .eq. 0) then + call error_set(FEM_ERR_INPUT, 'contact pair master facet has unknown node', ierr) + return + end if + do idir = 1, NDIM + dof = dof_id(idir,node) + if (dof .gt. 0) fcontact(dof) = fcontact(dof) - weight * normal(idir) + end do + end do + + ierr = FEM_SUCCESS + end subroutine add_contact_pair_force + + subroutine add_contact_pair_tan(kmat, max_nodes, nslave, slave_conn, & + nmaster, master_conn, coeff, normal, ierr) + type(csr_matrix), intent(inout) :: kmat + integer, intent(in) :: max_nodes + integer, intent(in) :: nslave + integer, intent(in) :: nmaster + integer, intent(in) :: slave_conn(max_nodes) + integer, intent(in) :: master_conn(max_nodes) + real(rk), intent(in) :: coeff + real(rk), intent(in) :: normal(NDIM) + integer, intent(out) :: ierr + integer :: i + integer :: j + real(rk) :: ws + real(rk) :: wm + + if (abs(coeff) .le. tiny(ONE)) then + ierr = FEM_SUCCESS + return + end if + + ws = ONE / real(nslave, rk) + wm = ONE / real(nmaster, rk) + do i = 1, nslave + do j = 1, nslave + call add_contact_pair_block(kmat, slave_conn(i), slave_conn(j), & + coeff * ws * ws, normal, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + do j = 1, nmaster + call add_contact_pair_block(kmat, slave_conn(i), master_conn(j), & + -coeff * ws * wm, normal, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + end do + + do i = 1, nmaster + do j = 1, nslave + call add_contact_pair_block(kmat, master_conn(i), slave_conn(j), & + -coeff * wm * ws, normal, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + do j = 1, nmaster + call add_contact_pair_block(kmat, master_conn(i), master_conn(j), & + coeff * wm * wm, normal, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + end do + + ierr = FEM_SUCCESS + end subroutine add_contact_pair_tan + + subroutine add_contact_pair_block(kmat, node_a_ext, node_b_ext, scale, & + normal, ierr) + type(csr_matrix), intent(inout) :: kmat + integer, intent(in) :: node_a_ext + integer, intent(in) :: node_b_ext + real(rk), intent(in) :: scale + real(rk), intent(in) :: normal(NDIM) + integer, intent(out) :: ierr + integer :: node_a + integer :: node_b + integer :: idir + integer :: jdir + integer :: row + integer :: col + + node_a = database_find_node(node_a_ext) + node_b = database_find_node(node_b_ext) + if (node_a .eq. 0 .or. node_b .eq. 0) then + call error_set(FEM_ERR_INPUT, 'contact pair tangent references unknown node', ierr) + return + end if + + do idir = 1, NDIM + row = dof_id(idir,node_a) + if (row .le. 0) cycle + do jdir = 1, NDIM + col = dof_id(jdir,node_b) + if (col .gt. 0) then + call csr_add_value(kmat, row, col, & + scale * normal(idir) * normal(jdir), ierr) + if (ierr .ne. FEM_SUCCESS) return + end if + end do + end do + + ierr = FEM_SUCCESS + end subroutine add_contact_pair_block + end module fem_contact diff --git a/src/element/fem_element_internal.f90 b/src/element/fem_element_internal.f90 index b980f41..13267f7 100644 --- a/src/element/fem_element_internal.f90 +++ b/src/element/fem_element_internal.f90 @@ -44,16 +44,16 @@ contains call solid_quadratic_internal_force(elem, dt_local, ierr) if (ierr .ne. FEM_SUCCESS) return case ('S3') - call shell3_internal_force(elem, ierr) + call shell3_internal_force(elem, dt_local, ierr) if (ierr .ne. FEM_SUCCESS) return case ('S4') - call shell4_internal_force(elem, ierr) + call shell4_internal_force(elem, dt_local, ierr) if (ierr .ne. FEM_SUCCESS) return case ('S6') - call shell6_internal_force(elem, ierr) + call shell6_internal_force(elem, dt_local, ierr) if (ierr .ne. FEM_SUCCESS) return case ('S8') - call shell8_internal_force(elem, ierr) + call shell8_internal_force(elem, dt_local, ierr) if (ierr .ne. FEM_SUCCESS) return case default cycle @@ -400,8 +400,9 @@ contains ierr = FEM_SUCCESS end subroutine solid_quadratic_internal_force - subroutine shell3_internal_force(elem, ierr) + subroutine shell3_internal_force(elem, dt, ierr) integer, intent(in) :: elem + real(rk), intent(in) :: dt integer, intent(out) :: ierr real(rk) :: basis(NDIM,NDIM) real(rk) :: xloc(2,3) @@ -478,9 +479,13 @@ contains call shell3_strains(nshape, dndx, dndy, qloc, strain_mem, & strain_ben, strain_shr) - call shell4_resultants(coeff_mem, coeff_ben, coeff_shr, poisson, & - strain_mem, strain_ben, strain_shr, & - force_mem, force_ben, force_shr) + gp = elem_gp_start(elem) + call shell_material_resultants(elem, mat, thickness, coeff_mem, & + coeff_ben, coeff_shr, poisson, & + strain_mem, strain_ben, strain_shr, & + gp, dt, force_mem, force_ben, force_shr, ierr) + if (ierr .ne. FEM_SUCCESS) return + if (elem_status(elem) .ne. 0) return floc = ZERO do local_node = 1, 3 @@ -503,32 +508,13 @@ contains nshape(local_node) * force_shr(1)) end do - gp = elem_gp_start(elem) - if (gp .gt. 0) then - strain(:,gp) = ZERO - stress(:,gp) = ZERO - statev(:,gp) = ZERO - strain(1,gp) = strain_mem(1) - strain(2,gp) = strain_mem(2) - strain(4,gp) = strain_mem(3) - strain(5,gp) = strain_shr(1) - strain(6,gp) = strain_shr(2) - stress(1,gp) = force_mem(1) / thickness - stress(2,gp) = force_mem(2) / thickness - stress(4,gp) = force_mem(3) / thickness - stress(5,gp) = force_shr(1) / thickness - stress(6,gp) = force_shr(2) / thickness - statev(10,gp) = strain_ben(1) - statev(11,gp) = strain_ben(2) - statev(12,gp) = strain_ben(3) - end if - call shell3_add_global(elem, basis, floc) ierr = FEM_SUCCESS end subroutine shell3_internal_force - subroutine shell6_internal_force(elem, ierr) + subroutine shell6_internal_force(elem, dt, ierr) integer, intent(in) :: elem + real(rk), intent(in) :: dt integer, intent(out) :: ierr integer, parameter :: MAX_QP = 16 real(rk) :: basis(NDIM,NDIM) @@ -619,9 +605,12 @@ contains call shell_general_strains(6, nshape, dndx, dndy, qloc, strain_mem, & strain_ben, strain_shr) - call shell4_resultants(coeff_mem, coeff_ben, coeff_shr, poisson, & - strain_mem, strain_ben, strain_shr, & - force_mem, force_ben, force_shr) + call shell_material_resultants(elem, mat, thickness, coeff_mem, & + coeff_ben, coeff_shr, poisson, & + strain_mem, strain_ben, strain_shr, & + gp, dt, force_mem, force_ben, force_shr, ierr) + if (ierr .ne. FEM_SUCCESS) return + if (elem_status(elem) .ne. 0) return do local_node = 1, 6 floc(1,local_node) = floc(1,local_node) + weight * & @@ -643,24 +632,6 @@ contains nshape(local_node) * force_shr(1)) end do - if (gp .gt. 0) then - strain(:,gp) = ZERO - stress(:,gp) = ZERO - statev(:,gp) = ZERO - strain(1,gp) = strain_mem(1) - strain(2,gp) = strain_mem(2) - strain(4,gp) = strain_mem(3) - strain(5,gp) = strain_shr(1) - strain(6,gp) = strain_shr(2) - stress(1,gp) = force_mem(1) / thickness - stress(2,gp) = force_mem(2) / thickness - stress(4,gp) = force_mem(3) / thickness - stress(5,gp) = force_shr(1) / thickness - stress(6,gp) = force_shr(2) / thickness - statev(10,gp) = strain_ben(1) - statev(11,gp) = strain_ben(2) - statev(12,gp) = strain_ben(3) - end if gp = gp + 1 end do @@ -668,8 +639,9 @@ contains ierr = FEM_SUCCESS end subroutine shell6_internal_force - subroutine shell8_internal_force(elem, ierr) + subroutine shell8_internal_force(elem, dt, ierr) integer, intent(in) :: elem + real(rk), intent(in) :: dt integer, intent(out) :: ierr integer, parameter :: MAX_QP = 16 real(rk) :: basis(NDIM,NDIM) @@ -760,9 +732,12 @@ contains call shell_general_strains(8, nshape, dndx, dndy, qloc, strain_mem, & strain_ben, strain_shr) - call shell4_resultants(coeff_mem, coeff_ben, coeff_shr, poisson, & - strain_mem, strain_ben, strain_shr, & - force_mem, force_ben, force_shr) + call shell_material_resultants(elem, mat, thickness, coeff_mem, & + coeff_ben, coeff_shr, poisson, & + strain_mem, strain_ben, strain_shr, & + gp, dt, force_mem, force_ben, force_shr, ierr) + if (ierr .ne. FEM_SUCCESS) return + if (elem_status(elem) .ne. 0) return do local_node = 1, 8 floc(1,local_node) = floc(1,local_node) + weight * & @@ -784,24 +759,6 @@ contains nshape(local_node) * force_shr(1)) end do - if (gp .gt. 0) then - strain(:,gp) = ZERO - stress(:,gp) = ZERO - statev(:,gp) = ZERO - strain(1,gp) = strain_mem(1) - strain(2,gp) = strain_mem(2) - strain(4,gp) = strain_mem(3) - strain(5,gp) = strain_shr(1) - strain(6,gp) = strain_shr(2) - stress(1,gp) = force_mem(1) / thickness - stress(2,gp) = force_mem(2) / thickness - stress(4,gp) = force_mem(3) / thickness - stress(5,gp) = force_shr(1) / thickness - stress(6,gp) = force_shr(2) / thickness - statev(10,gp) = strain_ben(1) - statev(11,gp) = strain_ben(2) - statev(12,gp) = strain_ben(3) - end if gp = gp + 1 end do @@ -809,8 +766,9 @@ contains ierr = FEM_SUCCESS end subroutine shell8_internal_force - subroutine shell4_internal_force(elem, ierr) + subroutine shell4_internal_force(elem, dt, ierr) integer, intent(in) :: elem + real(rk), intent(in) :: dt integer, intent(out) :: ierr real(rk) :: basis(NDIM,NDIM) real(rk) :: xloc(2,4) @@ -903,9 +861,12 @@ contains call shell4_strains(nshape, dndx, dndy, qloc, strain_mem, & strain_ben, strain_shr) - call shell4_resultants(coeff_mem, coeff_ben, coeff_shr, poisson, & - strain_mem, strain_ben, strain_shr, & - force_mem, force_ben, force_shr) + call shell_material_resultants(elem, mat, thickness, coeff_mem, & + coeff_ben, coeff_shr, poisson, & + strain_mem, strain_ben, strain_shr, & + gp, dt, force_mem, force_ben, force_shr, ierr) + if (ierr .ne. FEM_SUCCESS) return + if (elem_status(elem) .ne. 0) return do local_node = 1, 4 floc(1,local_node) = floc(1,local_node) + weight * & @@ -927,24 +888,6 @@ contains nshape(local_node) * force_shr(1)) end do - if (gp .gt. 0) then - strain(:,gp) = ZERO - stress(:,gp) = ZERO - statev(:,gp) = ZERO - strain(1,gp) = strain_mem(1) - strain(2,gp) = strain_mem(2) - strain(4,gp) = strain_mem(3) - strain(5,gp) = strain_shr(1) - strain(6,gp) = strain_shr(2) - stress(1,gp) = force_mem(1) / thickness - stress(2,gp) = force_mem(2) / thickness - stress(4,gp) = force_mem(3) / thickness - stress(5,gp) = force_shr(1) / thickness - stress(6,gp) = force_shr(2) / thickness - statev(10,gp) = strain_ben(1) - statev(11,gp) = strain_ben(2) - statev(12,gp) = strain_ben(3) - end if gp = gp + 1 end do @@ -1603,6 +1546,116 @@ contains force_shr(2) = coeff_shr * strain_shr(2) end subroutine shell4_resultants + subroutine shell_material_resultants(elem, mat, thickness, coeff_mem, & + coeff_ben, coeff_shr, poisson, & + strain_mem, strain_ben, strain_shr, & + gp, dt, force_mem, force_ben, & + force_shr, ierr) + integer, intent(in) :: elem + integer, intent(in) :: mat + real(rk), intent(in) :: thickness + real(rk), intent(in) :: coeff_mem + real(rk), intent(in) :: coeff_ben + real(rk), intent(in) :: coeff_shr + real(rk), intent(in) :: poisson + real(rk), intent(in) :: strain_mem(3) + real(rk), intent(in) :: strain_ben(3) + real(rk), intent(in) :: strain_shr(2) + integer, intent(in) :: gp + real(rk), intent(in) :: dt + real(rk), intent(out) :: force_mem(3) + real(rk), intent(out) :: force_ben(3) + real(rk), intent(out) :: force_shr(2) + integer, intent(out) :: ierr + real(rk) :: eps(NSTRESS) + real(rk) :: deps(NSTRESS) + real(rk) :: sig(NSTRESS) + real(rk) :: state_new(NSTATEV_MAX) + logical :: use_j2 + + call shell4_resultants(coeff_mem, coeff_ben, coeff_shr, poisson, & + strain_mem, strain_ben, strain_shr, & + force_mem, force_ben, force_shr) + + if (gp .le. 0) then + ierr = FEM_SUCCESS + return + end if + + use_j2 = trim(mat_plastic_model(mat)) .eq. 'J2' .or. & + trim(mat_plastic_model(mat)) .eq. 'J2_JC' + + if (.not. use_j2) then + call shell_store_elastic_state(gp, thickness, strain_mem, strain_ben, & + strain_shr, force_mem, force_shr) + ierr = FEM_SUCCESS + return + end if + + eps = ZERO + eps(1) = strain_mem(1) + eps(2) = strain_mem(2) + eps(4) = strain_mem(3) + eps(5) = strain_shr(1) + eps(6) = strain_shr(2) + deps = eps - strain(:,gp) + + call material_update_small_strain_dt(mat, dt, deps, statev(:,gp), & + stress(:,gp), sig, state_new, ierr) + if (ierr .ne. FEM_SUCCESS) return + + strain(:,gp) = eps + stress(:,gp) = sig + statev(:,gp) = state_new + statev(13,gp) = strain_ben(1) + statev(14,gp) = strain_ben(2) + statev(15,gp) = strain_ben(3) + + force_mem(1) = thickness * sig(1) + force_mem(2) = thickness * sig(2) + 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 (state_new(4) .ge. HALF) then + elem_status(elem) = 1 + stress(:,gp) = ZERO + force_mem = ZERO + force_ben = ZERO + force_shr = ZERO + end if + + ierr = FEM_SUCCESS + end subroutine shell_material_resultants + + subroutine shell_store_elastic_state(gp, thickness, strain_mem, strain_ben, & + strain_shr, force_mem, force_shr) + integer, intent(in) :: gp + real(rk), intent(in) :: thickness + real(rk), intent(in) :: strain_mem(3) + real(rk), intent(in) :: strain_ben(3) + real(rk), intent(in) :: strain_shr(2) + real(rk), intent(in) :: force_mem(3) + real(rk), intent(in) :: force_shr(2) + + strain(:,gp) = ZERO + stress(:,gp) = ZERO + statev(:,gp) = ZERO + strain(1,gp) = strain_mem(1) + strain(2,gp) = strain_mem(2) + strain(4,gp) = strain_mem(3) + strain(5,gp) = strain_shr(1) + strain(6,gp) = strain_shr(2) + stress(1,gp) = force_mem(1) / thickness + stress(2,gp) = force_mem(2) / thickness + stress(4,gp) = force_mem(3) / thickness + stress(5,gp) = force_shr(1) / thickness + stress(6,gp) = force_shr(2) / thickness + statev(10,gp) = strain_ben(1) + statev(11,gp) = strain_ben(2) + statev(12,gp) = strain_ben(3) + end subroutine shell_store_elastic_state + subroutine shell4_add_global(elem, basis, floc) integer, intent(in) :: elem real(rk), intent(in) :: basis(NDIM,NDIM) diff --git a/src/element/fem_element_state.f90 b/src/element/fem_element_state.f90 index 93abaa5..7887220 100644 --- a/src/element/fem_element_state.f90 +++ b/src/element/fem_element_state.f90 @@ -7,9 +7,19 @@ module fem_element_state private + real(rk), allocatable :: stress_trial_backup(:,:) + real(rk), allocatable :: strain_trial_backup(:,:) + real(rk), allocatable :: statev_trial_backup(:,:) + integer, allocatable :: status_trial_backup(:) + logical :: trial_backup_active = .false. + public :: element_state_ensure public :: element_state_reset_values public :: element_state_is_available + public :: element_state_begin_trial + public :: element_state_restore_trial + public :: element_state_commit_trial + public :: element_state_abort_trial contains @@ -90,4 +100,101 @@ contains ierr = FEM_SUCCESS end subroutine element_state_reset_values + subroutine element_state_begin_trial(ierr) + integer, intent(out) :: ierr + integer :: stat + + call element_state_commit_trial(ierr) + if (ierr .ne. FEM_SUCCESS) return + + call element_state_ensure(ierr) + if (ierr .ne. FEM_SUCCESS) return + + if (.not. allocated(elem_status)) then + call error_set(FEM_ERR_INTERNAL, 'element status array is not allocated', ierr) + return + end if + + if (allocated(stress)) then + allocate(stress_trial_backup(size(stress,1),size(stress,2)), & + strain_trial_backup(size(strain,1),size(strain,2)), & + statev_trial_backup(size(statev,1),size(statev,2)), stat=stat) + if (stat .ne. 0) then + call error_set(FEM_ERR_INTERNAL, 'failed to allocate trial state backup', ierr) + return + end if + stress_trial_backup = stress + strain_trial_backup = strain + statev_trial_backup = statev + end if + + allocate(status_trial_backup(size(elem_status)), stat=stat) + if (stat .ne. 0) then + call element_state_commit_trial(ierr) + if (ierr .ne. FEM_SUCCESS) return + call error_set(FEM_ERR_INTERNAL, 'failed to allocate trial status backup', ierr) + return + end if + status_trial_backup = elem_status + trial_backup_active = .true. + ierr = FEM_SUCCESS + end subroutine element_state_begin_trial + + subroutine element_state_restore_trial(ierr) + integer, intent(out) :: ierr + + if (.not. trial_backup_active) then + ierr = FEM_SUCCESS + return + end if + + if (allocated(status_trial_backup)) then + if (.not. allocated(elem_status)) then + call error_set(FEM_ERR_INTERNAL, 'cannot restore trial status without elem_status', ierr) + return + end if + if (size(elem_status) .ne. size(status_trial_backup)) then + call error_set(FEM_ERR_INTERNAL, 'trial status backup size mismatch', ierr) + return + end if + elem_status = status_trial_backup + end if + + if (allocated(stress_trial_backup)) then + if (.not. allocated(stress) .or. .not. allocated(strain) .or. & + .not. allocated(statev)) then + call error_set(FEM_ERR_INTERNAL, 'cannot restore incomplete trial state arrays', ierr) + return + end if + if (size(stress,2) .ne. size(stress_trial_backup,2)) then + call error_set(FEM_ERR_INTERNAL, 'trial state backup size mismatch', ierr) + return + end if + stress = stress_trial_backup + strain = strain_trial_backup + statev = statev_trial_backup + end if + + ierr = FEM_SUCCESS + end subroutine element_state_restore_trial + + subroutine element_state_commit_trial(ierr) + integer, intent(out) :: ierr + + if (allocated(stress_trial_backup)) deallocate(stress_trial_backup) + if (allocated(strain_trial_backup)) deallocate(strain_trial_backup) + if (allocated(statev_trial_backup)) deallocate(statev_trial_backup) + if (allocated(status_trial_backup)) deallocate(status_trial_backup) + trial_backup_active = .false. + ierr = FEM_SUCCESS + end subroutine element_state_commit_trial + + subroutine element_state_abort_trial(ierr) + integer, intent(out) :: ierr + + call element_state_restore_trial(ierr) + if (ierr .ne. FEM_SUCCESS) return + call element_state_commit_trial(ierr) + end subroutine element_state_abort_trial + end module fem_element_state diff --git a/src/element/fem_element_stiffness.f90 b/src/element/fem_element_stiffness.f90 index 93b18f0..49ae280 100644 --- a/src/element/fem_element_stiffness.f90 +++ b/src/element/fem_element_stiffness.f90 @@ -5,6 +5,7 @@ module fem_element_stiffness use fem_element_topology use fem_quadrature use fem_shape_functions + use fem_material_j2 implicit none private @@ -29,15 +30,20 @@ contains call error_set(FEM_ERR_MESH, 'linear stiffness element index is out of range', ierr) return end if - if (.not. element_is_solid(elem_type(elem))) then - call error_set(FEM_ERR_MESH, 'linear stiffness is implemented for solid elements only', ierr) - return - end if - etype = adjustl(elem_type(elem)) select case (trim(etype)) case ('C3D4', 'C3D8', 'C3D10', 'C3D20') call solid_linear_stiffness(elem, elem_dofs, n_elem_dof, ke, ierr) + case ('S3') + call shell3_linear_stiffness(elem, elem_dofs, n_elem_dof, ke, ierr) + case ('S4') + call shell4_linear_stiffness(elem, elem_dofs, n_elem_dof, ke, ierr) + case ('S6') + call shell_general_linear_stiffness(elem, 6, 'S6', elem_dofs, & + n_elem_dof, ke, ierr) + case ('S8') + call shell_general_linear_stiffness(elem, 8, 'S8', elem_dofs, & + n_elem_dof, ke, ierr) case default call error_set(FEM_ERR_MESH, 'linear stiffness element type is not implemented', ierr) end select @@ -63,6 +69,9 @@ contains integer :: q integer :: npoint integer :: nlocal + integer :: gp + real(rk) :: stress_cur(NSTRESS) + real(rk) :: state_cur(NSTATEV_MAX) nlocal = elem_nnode(elem) n_elem_dof = 3 * nlocal @@ -77,13 +86,25 @@ contains call fill_solid_dofs(elem, elem_dofs, n_elem_dof, ierr) if (ierr .ne. FEM_SUCCESS) return - call elastic_matrix_3d(elem_mat(elem), dmat, ierr) - if (ierr .ne. FEM_SUCCESS) return call quadrature_get_rule(elem_type(elem), 27, npoint, gp_nat, gp_weight, ierr) if (ierr .ne. FEM_SUCCESS) return do q = 1, npoint + stress_cur = ZERO + state_cur = ZERO + if (allocated(elem_gp_start) .and. allocated(stress) .and. & + allocated(statev)) then + gp = elem_gp_start(elem) + q - 1 + if (gp .ge. 1 .and. gp .le. size(stress,2)) then + stress_cur = stress(:,gp) + state_cur = statev(:,gp) + end if + end if + call material_tangent_small_strain(elem_mat(elem), stress_cur, & + state_cur, dmat, ierr) + if (ierr .ne. FEM_SUCCESS) return + natural = gp_nat(:,q) call shape_evaluate(elem_type(elem), natural, nshape, dndr, ierr) if (ierr .ne. FEM_SUCCESS) return @@ -100,6 +121,383 @@ contains ierr = FEM_SUCCESS end subroutine solid_linear_stiffness + subroutine shell3_linear_stiffness(elem, elem_dofs, n_elem_dof, ke, ierr) + integer, intent(in) :: elem + integer, intent(out) :: elem_dofs(:) + integer, intent(out) :: n_elem_dof + real(rk), intent(out) :: ke(:,:) + integer, intent(out) :: ierr + integer, parameter :: NLOCAL = 3 + integer, parameter :: NQDOF = 5 * NLOCAL + integer, parameter :: NGDOF = 6 * NLOCAL + real(rk) :: basis(NDIM,NDIM) + real(rk) :: xloc(2,NLOCAL) + real(rk) :: nshape(NLOCAL) + real(rk) :: dndx(NLOCAL) + real(rk) :: dndy(NLOCAL) + real(rk) :: bmem(3,NQDOF) + real(rk) :: bben(3,NQDOF) + real(rk) :: bshr(2,NQDOF) + real(rk) :: dmem(3,3) + real(rk) :: dben(3,3) + real(rk) :: dshr(2,2) + real(rk) :: klocal(NQDOF,NQDOF) + real(rk) :: transform(NQDOF,NGDOF) + real(rk) :: tmp(NQDOF,NGDOF) + real(rk) :: young + real(rk) :: poisson + real(rk) :: thickness + real(rk) :: shear_mod + real(rk) :: coeff_mem + real(rk) :: coeff_ben + real(rk) :: coeff_shr + real(rk) :: detj + real(rk) :: weight + integer :: mat + integer :: sec + integer :: gp + + n_elem_dof = NGDOF + if (elem_nnode(elem) .ne. NLOCAL) then + call error_set(FEM_ERR_MESH, 'S3 linear stiffness requires 3 nodes', ierr) + return + end if + if (size(elem_dofs) .lt. n_elem_dof) then + call error_set(FEM_ERR_INTERNAL, 'S3 stiffness dof buffer is too small', ierr) + return + end if + if (size(ke,1) .lt. n_elem_dof .or. size(ke,2) .lt. n_elem_dof) then + call error_set(FEM_ERR_INTERNAL, 'S3 stiffness matrix buffer is too small', ierr) + return + end if + + call fill_shell_dofs(elem, elem_dofs, n_elem_dof, ierr) + if (ierr .ne. FEM_SUCCESS) return + + mat = elem_mat(elem) + sec = elem_sec(elem) + if (mat .lt. 1 .or. mat .gt. n_material) then + call error_set(FEM_ERR_MATERIAL, 'S3 stiffness has invalid material index', ierr) + return + end if + if (sec .lt. 1 .or. sec .gt. n_section) then + call error_set(FEM_ERR_INPUT, 'S3 stiffness has invalid section index', ierr) + return + end if + + young = mat_e(mat) + poisson = mat_nu(mat) + thickness = section_thickness(sec) + if (young .le. ZERO) then + call error_set(FEM_ERR_MATERIAL, 'S3 stiffness requires positive elastic modulus', ierr) + return + end if + if (poisson .le. -ONE .or. poisson .ge. HALF) then + call error_set(FEM_ERR_MATERIAL, 'S3 stiffness Poisson ratio must be in (-1,0.5)', ierr) + return + end if + if (thickness .le. ZERO) then + call error_set(FEM_ERR_INPUT, 'S3 stiffness requires positive thickness', ierr) + return + end if + + call shell3_basis_linear(elem, basis, xloc, ierr) + if (ierr .ne. FEM_SUCCESS) return + call shell3_shape_xy_linear(xloc, nshape, dndx, dndy, detj, ierr) + if (ierr .ne. FEM_SUCCESS) return + + shear_mod = young / (2.0_rk * (ONE + poisson)) + coeff_mem = young * thickness / (ONE - poisson * poisson) + coeff_ben = young * thickness**3 / & + (12.0_rk * (ONE - poisson * poisson)) + coeff_shr = (5.0_rk / 6.0_rk) * shear_mod * thickness + call shell_constitutive(coeff_mem, coeff_ben, coeff_shr, poisson, & + dmem, dben, dshr) + gp = 0 + if (allocated(elem_gp_start)) then + if (elem .le. size(elem_gp_start)) gp = elem_gp_start(elem) + end if + call shell_apply_mem_tangent(mat, thickness, gp, dmem, ierr) + if (ierr .ne. FEM_SUCCESS) return + + call shell_b_matrices(NLOCAL, nshape, dndx, dndy, bmem, bben, bshr) + weight = HALF * detj + klocal = weight * matmul(transpose(bmem), matmul(dmem, bmem)) + & + weight * matmul(transpose(bben), matmul(dben, bben)) + & + weight * matmul(transpose(bshr), matmul(dshr, bshr)) + + call shell_transform_matrix(NLOCAL, basis, transform) + tmp = matmul(klocal, transform) + ke(1:n_elem_dof,1:n_elem_dof) = matmul(transpose(transform), tmp) + call add_shell_drilling_stiffness(NLOCAL, basis, coeff_mem * weight * 1.0e-8_rk, & + ke) + + ierr = FEM_SUCCESS + end subroutine shell3_linear_stiffness + + subroutine shell4_linear_stiffness(elem, elem_dofs, n_elem_dof, ke, ierr) + integer, intent(in) :: elem + integer, intent(out) :: elem_dofs(:) + integer, intent(out) :: n_elem_dof + real(rk), intent(out) :: ke(:,:) + integer, intent(out) :: ierr + integer, parameter :: NLOCAL = 4 + integer, parameter :: NQDOF = 5 * NLOCAL + integer, parameter :: NGDOF = 6 * NLOCAL + real(rk) :: basis(NDIM,NDIM) + real(rk) :: xloc(2,NLOCAL) + real(rk) :: gp_nat(NDIM,4) + real(rk) :: gp_weight(4) + real(rk) :: nshape(NLOCAL) + real(rk) :: dndx(NLOCAL) + real(rk) :: dndy(NLOCAL) + real(rk) :: bmem(3,NQDOF) + real(rk) :: bben(3,NQDOF) + real(rk) :: bshr(2,NQDOF) + real(rk) :: dmem(3,3) + real(rk) :: dmem_gp(3,3) + real(rk) :: dben(3,3) + real(rk) :: dshr(2,2) + real(rk) :: klocal(NQDOF,NQDOF) + real(rk) :: transform(NQDOF,NGDOF) + real(rk) :: tmp(NQDOF,NGDOF) + real(rk) :: young + real(rk) :: poisson + real(rk) :: thickness + real(rk) :: shear_mod + real(rk) :: coeff_mem + real(rk) :: coeff_ben + real(rk) :: coeff_shr + real(rk) :: detj + real(rk) :: weight + real(rk) :: area + integer :: q + integer :: npoint + integer :: gp + integer :: mat + integer :: sec + + n_elem_dof = NGDOF + if (elem_nnode(elem) .ne. NLOCAL) then + call error_set(FEM_ERR_MESH, 'S4 linear stiffness requires 4 nodes', ierr) + return + end if + if (size(elem_dofs) .lt. n_elem_dof) then + call error_set(FEM_ERR_INTERNAL, 'S4 stiffness dof buffer is too small', ierr) + return + end if + if (size(ke,1) .lt. n_elem_dof .or. size(ke,2) .lt. n_elem_dof) then + call error_set(FEM_ERR_INTERNAL, 'S4 stiffness matrix buffer is too small', ierr) + return + end if + + call fill_shell_dofs(elem, elem_dofs, n_elem_dof, ierr) + if (ierr .ne. FEM_SUCCESS) return + + mat = elem_mat(elem) + sec = elem_sec(elem) + if (mat .lt. 1 .or. mat .gt. n_material) then + call error_set(FEM_ERR_MATERIAL, 'S4 stiffness has invalid material index', ierr) + return + end if + if (sec .lt. 1 .or. sec .gt. n_section) then + call error_set(FEM_ERR_INPUT, 'S4 stiffness has invalid section index', ierr) + return + end if + + young = mat_e(mat) + poisson = mat_nu(mat) + thickness = section_thickness(sec) + if (young .le. ZERO) then + call error_set(FEM_ERR_MATERIAL, 'S4 stiffness requires positive elastic modulus', ierr) + return + end if + if (poisson .le. -ONE .or. poisson .ge. HALF) then + call error_set(FEM_ERR_MATERIAL, 'S4 stiffness Poisson ratio must be in (-1,0.5)', ierr) + return + end if + if (thickness .le. ZERO) then + call error_set(FEM_ERR_INPUT, 'S4 stiffness requires positive thickness', ierr) + return + end if + + call shell4_basis_linear(elem, basis, xloc, ierr) + if (ierr .ne. FEM_SUCCESS) return + + shear_mod = young / (2.0_rk * (ONE + poisson)) + coeff_mem = young * thickness / (ONE - poisson * poisson) + coeff_ben = young * thickness**3 / & + (12.0_rk * (ONE - poisson * poisson)) + coeff_shr = (5.0_rk / 6.0_rk) * shear_mod * thickness + call shell_constitutive(coeff_mem, coeff_ben, coeff_shr, poisson, & + dmem, dben, dshr) + + call quadrature_get_rule('S4', 4, npoint, gp_nat, gp_weight, ierr) + if (ierr .ne. FEM_SUCCESS) return + + klocal = ZERO + area = ZERO + do q = 1, npoint + call shell4_shape_xy_linear(xloc, gp_nat(1,q), gp_nat(2,q), & + nshape, dndx, dndy, detj, ierr) + if (ierr .ne. FEM_SUCCESS) return + weight = gp_weight(q) * detj + area = area + weight + call shell_b_matrices(NLOCAL, nshape, dndx, dndy, bmem, bben, bshr) + dmem_gp = dmem + gp = 0 + if (allocated(elem_gp_start)) then + if (elem .le. size(elem_gp_start)) gp = elem_gp_start(elem) + q - 1 + end if + call shell_apply_mem_tangent(mat, thickness, gp, dmem_gp, ierr) + if (ierr .ne. FEM_SUCCESS) return + + klocal = klocal + weight * matmul(transpose(bmem), matmul(dmem_gp, bmem)) + & + weight * matmul(transpose(bben), matmul(dben, bben)) + & + weight * matmul(transpose(bshr), matmul(dshr, bshr)) + end do + + call shell_transform_matrix(NLOCAL, basis, transform) + tmp = matmul(klocal, transform) + ke(1:n_elem_dof,1:n_elem_dof) = matmul(transpose(transform), tmp) + call add_shell_drilling_stiffness(NLOCAL, basis, coeff_mem * area * 1.0e-8_rk, & + ke) + + ierr = FEM_SUCCESS + end subroutine shell4_linear_stiffness + + subroutine shell_general_linear_stiffness(elem, nlocal, etype, elem_dofs, & + n_elem_dof, ke, ierr) + integer, intent(in) :: elem + integer, intent(in) :: nlocal + character(len=*), intent(in) :: etype + integer, intent(out) :: elem_dofs(:) + integer, intent(out) :: n_elem_dof + real(rk), intent(out) :: ke(:,:) + integer, intent(out) :: ierr + real(rk) :: basis(NDIM,NDIM) + real(rk) :: xloc(2,MAX_NEN) + real(rk) :: gp_nat(NDIM,27) + real(rk) :: gp_weight(27) + real(rk) :: nshape(nlocal) + real(rk) :: dndx(nlocal) + real(rk) :: dndy(nlocal) + real(rk) :: bmem(3,5*nlocal) + real(rk) :: bben(3,5*nlocal) + real(rk) :: bshr(2,5*nlocal) + real(rk) :: dmem(3,3) + real(rk) :: dmem_gp(3,3) + real(rk) :: dben(3,3) + real(rk) :: dshr(2,2) + real(rk) :: klocal(5*nlocal,5*nlocal) + real(rk) :: transform(5*nlocal,6*nlocal) + real(rk) :: tmp(5*nlocal,6*nlocal) + real(rk) :: young + real(rk) :: poisson + real(rk) :: thickness + real(rk) :: shear_mod + real(rk) :: coeff_mem + real(rk) :: coeff_ben + real(rk) :: coeff_shr + real(rk) :: detj + real(rk) :: weight + real(rk) :: area + integer :: q + integer :: npoint + integer :: gp + integer :: mat + integer :: sec + + n_elem_dof = 6 * nlocal + if (elem_nnode(elem) .ne. nlocal) then + call error_set(FEM_ERR_MESH, 'shell linear stiffness node count mismatch', ierr) + return + end if + if (size(elem_dofs) .lt. n_elem_dof) then + call error_set(FEM_ERR_INTERNAL, 'shell stiffness dof buffer is too small', ierr) + return + end if + if (size(ke,1) .lt. n_elem_dof .or. size(ke,2) .lt. n_elem_dof) then + call error_set(FEM_ERR_INTERNAL, 'shell stiffness matrix buffer is too small', ierr) + return + end if + + call fill_shell_dofs(elem, elem_dofs, n_elem_dof, ierr) + if (ierr .ne. FEM_SUCCESS) return + + mat = elem_mat(elem) + sec = elem_sec(elem) + if (mat .lt. 1 .or. mat .gt. n_material) then + call error_set(FEM_ERR_MATERIAL, 'shell stiffness has invalid material index', ierr) + return + end if + if (sec .lt. 1 .or. sec .gt. n_section) then + call error_set(FEM_ERR_INPUT, 'shell stiffness has invalid section index', ierr) + return + end if + + young = mat_e(mat) + poisson = mat_nu(mat) + thickness = section_thickness(sec) + if (young .le. ZERO) then + call error_set(FEM_ERR_MATERIAL, 'shell stiffness requires positive elastic modulus', ierr) + return + end if + if (poisson .le. -ONE .or. poisson .ge. HALF) then + call error_set(FEM_ERR_MATERIAL, 'shell stiffness Poisson ratio must be in (-1,0.5)', ierr) + return + end if + if (thickness .le. ZERO) then + call error_set(FEM_ERR_INPUT, 'shell stiffness requires positive thickness', ierr) + return + end if + + call shell_general_basis_linear(elem, nlocal, trim(etype) .eq. 'S8', & + basis, xloc, ierr) + if (ierr .ne. FEM_SUCCESS) return + + shear_mod = young / (2.0_rk * (ONE + poisson)) + coeff_mem = young * thickness / (ONE - poisson * poisson) + coeff_ben = young * thickness**3 / & + (12.0_rk * (ONE - poisson * poisson)) + coeff_shr = (5.0_rk / 6.0_rk) * shear_mod * thickness + call shell_constitutive(coeff_mem, coeff_ben, coeff_shr, poisson, & + dmem, dben, dshr) + + call quadrature_get_rule(etype, 27, npoint, gp_nat, gp_weight, ierr) + if (ierr .ne. FEM_SUCCESS) return + + klocal = ZERO + area = ZERO + do q = 1, npoint + call shell_general_shape_xy_linear(etype, nlocal, xloc, gp_nat(:,q), & + nshape, dndx, dndy, detj, ierr) + if (ierr .ne. FEM_SUCCESS) return + weight = gp_weight(q) * detj + area = area + weight + call shell_b_matrices(nlocal, nshape, dndx, dndy, bmem, bben, bshr) + dmem_gp = dmem + gp = 0 + if (allocated(elem_gp_start)) then + if (elem .le. size(elem_gp_start)) gp = elem_gp_start(elem) + q - 1 + end if + call shell_apply_mem_tangent(mat, thickness, gp, dmem_gp, ierr) + if (ierr .ne. FEM_SUCCESS) return + + klocal = klocal + weight * matmul(transpose(bmem), matmul(dmem_gp, bmem)) + & + weight * matmul(transpose(bben), matmul(dben, bben)) + & + weight * matmul(transpose(bshr), matmul(dshr, bshr)) + end do + + call shell_transform_matrix(nlocal, basis, transform) + tmp = matmul(klocal, transform) + ke(1:n_elem_dof,1:n_elem_dof) = matmul(transpose(transform), tmp) + call add_shell_drilling_stiffness(nlocal, basis, coeff_mem * area * 1.0e-8_rk, & + ke) + + ierr = FEM_SUCCESS + end subroutine shell_general_linear_stiffness + subroutine fill_solid_dofs(elem, elem_dofs, n_elem_dof, ierr) integer, intent(in) :: elem integer, intent(out) :: elem_dofs(:) @@ -141,50 +539,530 @@ contains ierr = FEM_SUCCESS end subroutine fill_solid_dofs - subroutine elastic_matrix_3d(mat, dmat, ierr) - integer, intent(in) :: mat - real(rk), intent(out) :: dmat(NSTRESS,NSTRESS) + subroutine fill_shell_dofs(elem, elem_dofs, n_elem_dof, ierr) + integer, intent(in) :: elem + integer, intent(out) :: elem_dofs(:) + integer, intent(in) :: n_elem_dof integer, intent(out) :: ierr - real(rk) :: young - real(rk) :: poisson - real(rk) :: lambda - real(rk) :: mu + integer :: local_node + integer :: node + integer :: idir + integer :: pos + integer :: dof - dmat = ZERO - if (mat .lt. 1 .or. mat .gt. n_material) then - call error_set(FEM_ERR_MATERIAL, 'invalid material index for linear stiffness', ierr) + if (.not. allocated(dof_id)) then + call error_set(FEM_ERR_INTERNAL, 'shell stiffness requires assigned dof_id table', ierr) return end if - young = mat_e(mat) - poisson = mat_nu(mat) - if (young .le. ZERO) then - call error_set(FEM_ERR_MATERIAL, 'linear stiffness requires positive elastic modulus', ierr) - return - end if - if (poisson .le. -ONE .or. poisson .ge. HALF) then - call error_set(FEM_ERR_MATERIAL, 'linear stiffness Poisson ratio must be in (-1,0.5)', ierr) - return - end if - - lambda = young * poisson / ((ONE + poisson) * (ONE - 2.0_rk * poisson)) - mu = young / (2.0_rk * (ONE + poisson)) - - dmat(1,1) = lambda + 2.0_rk * mu - dmat(2,2) = dmat(1,1) - dmat(3,3) = dmat(1,1) - dmat(1,2) = lambda - dmat(1,3) = lambda - dmat(2,1) = lambda - dmat(2,3) = lambda - dmat(3,1) = lambda - dmat(3,2) = lambda - dmat(4,4) = mu - dmat(5,5) = mu - dmat(6,6) = mu + pos = 0 + do local_node = 1, elem_nnode(elem) + node = elem_conn(local_node, elem) + if (node .lt. 1 .or. node .gt. nnode) then + call error_set(FEM_ERR_MESH, 'shell stiffness element references invalid node', ierr) + return + end if + do idir = 1, NDOF_NODE + dof = dof_id(idir,node) + if (dof .le. 0) then + call error_set(FEM_ERR_MESH, 'shell stiffness element has inactive dof', ierr) + return + end if + pos = pos + 1 + if (pos .gt. n_elem_dof) then + call error_set(FEM_ERR_INTERNAL, 'shell stiffness dof list overflow', ierr) + return + end if + elem_dofs(pos) = dof + end do + end do ierr = FEM_SUCCESS - end subroutine elastic_matrix_3d + end subroutine fill_shell_dofs + + subroutine shell3_basis_linear(elem, basis, xloc, ierr) + integer, intent(in) :: elem + real(rk), intent(out) :: basis(NDIM,NDIM) + real(rk), intent(out) :: xloc(2,3) + integer, intent(out) :: ierr + real(rk) :: origin(NDIM) + real(rk) :: x1(NDIM) + real(rk) :: x2(NDIM) + real(rk) :: x3(NDIM) + real(rk) :: v12(NDIM) + real(rk) :: v13(NDIM) + real(rk) :: normal(NDIM) + real(rk) :: tmp(NDIM) + real(rk) :: len1 + real(rk) :: lenn + integer :: local_node + integer :: node + + x1 = coord0(:, elem_conn(1,elem)) + x2 = coord0(:, elem_conn(2,elem)) + x3 = coord0(:, elem_conn(3,elem)) + origin = x1 + v12 = x2 - x1 + v13 = x3 - x1 + + len1 = sqrt(sum(v12 * v12)) + if (len1 .le. ZERO) then + call error_set(FEM_ERR_MESH, 'S3 stiffness has coincident first edge nodes', ierr) + return + end if + basis(:,1) = v12 / len1 + + call cross3_linear(v12, v13, normal) + lenn = sqrt(sum(normal * normal)) + if (lenn .le. ZERO) then + call error_set(FEM_ERR_MESH, 'S3 stiffness local basis is singular', ierr) + return + end if + basis(:,3) = normal / lenn + call cross3_linear(basis(:,3), basis(:,1), basis(:,2)) + + do local_node = 1, 3 + node = elem_conn(local_node, elem) + tmp = coord0(:,node) - origin + xloc(1,local_node) = dot_product(tmp, basis(:,1)) + xloc(2,local_node) = dot_product(tmp, basis(:,2)) + end do + + ierr = FEM_SUCCESS + end subroutine shell3_basis_linear + + subroutine shell3_shape_xy_linear(xloc, nshape, dndx, dndy, detj, ierr) + real(rk), intent(in) :: xloc(2,3) + real(rk), intent(out) :: nshape(3) + real(rk), intent(out) :: dndx(3) + real(rk), intent(out) :: dndy(3) + real(rk), intent(out) :: detj + integer, intent(out) :: ierr + real(rk) :: dndr(3) + real(rk) :: dnds(3) + real(rk) :: jac(2,2) + real(rk) :: invj(2,2) + integer :: local_node + + nshape = (/ ONE / 3.0_rk, ONE / 3.0_rk, ONE / 3.0_rk /) + dndr = (/ -ONE, ONE, ZERO /) + dnds = (/ -ONE, ZERO, ONE /) + + jac = ZERO + do local_node = 1, 3 + jac(1,1) = jac(1,1) + xloc(1,local_node) * dndr(local_node) + jac(1,2) = jac(1,2) + xloc(1,local_node) * dnds(local_node) + jac(2,1) = jac(2,1) + xloc(2,local_node) * dndr(local_node) + jac(2,2) = jac(2,2) + xloc(2,local_node) * dnds(local_node) + end do + + detj = jac(1,1) * jac(2,2) - jac(1,2) * jac(2,1) + if (detj .le. ZERO) then + call error_set(FEM_ERR_MESH, 'S3 stiffness has non-positive Jacobian', ierr) + return + end if + + invj(1,1) = jac(2,2) / detj + invj(1,2) = -jac(1,2) / detj + invj(2,1) = -jac(2,1) / detj + invj(2,2) = jac(1,1) / detj + + do local_node = 1, 3 + dndx(local_node) = dndr(local_node) * invj(1,1) + & + dnds(local_node) * invj(2,1) + dndy(local_node) = dndr(local_node) * invj(1,2) + & + dnds(local_node) * invj(2,2) + end do + + ierr = FEM_SUCCESS + end subroutine shell3_shape_xy_linear + + subroutine shell4_basis_linear(elem, basis, xloc, ierr) + integer, intent(in) :: elem + real(rk), intent(out) :: basis(NDIM,NDIM) + real(rk), intent(out) :: xloc(2,4) + integer, intent(out) :: ierr + real(rk) :: origin(NDIM) + real(rk) :: x1(NDIM) + real(rk) :: x2(NDIM) + real(rk) :: x3(NDIM) + real(rk) :: x4(NDIM) + real(rk) :: v12(NDIM) + real(rk) :: v14(NDIM) + real(rk) :: normal(NDIM) + real(rk) :: tmp(NDIM) + real(rk) :: len1 + real(rk) :: lenn + integer :: local_node + integer :: node + + x1 = coord0(:, elem_conn(1,elem)) + x2 = coord0(:, elem_conn(2,elem)) + x3 = coord0(:, elem_conn(3,elem)) + x4 = coord0(:, elem_conn(4,elem)) + origin = x1 + v12 = x2 - x1 + v14 = x4 - x1 + + len1 = sqrt(sum(v12 * v12)) + if (len1 .le. ZERO) then + call error_set(FEM_ERR_MESH, 'S4 stiffness has coincident first edge nodes', ierr) + return + end if + basis(:,1) = v12 / len1 + + call cross3_linear(v12, v14, normal) + lenn = sqrt(sum(normal * normal)) + if (lenn .le. ZERO) then + tmp = x3 - x1 + call cross3_linear(v12, tmp, normal) + lenn = sqrt(sum(normal * normal)) + end if + if (lenn .le. ZERO) then + call error_set(FEM_ERR_MESH, 'S4 stiffness local basis is singular', ierr) + return + end if + basis(:,3) = normal / lenn + call cross3_linear(basis(:,3), basis(:,1), basis(:,2)) + + do local_node = 1, 4 + node = elem_conn(local_node, elem) + tmp = coord0(:,node) - origin + xloc(1,local_node) = dot_product(tmp, basis(:,1)) + xloc(2,local_node) = dot_product(tmp, basis(:,2)) + end do + + ierr = FEM_SUCCESS + end subroutine shell4_basis_linear + + subroutine shell4_shape_xy_linear(xloc, r, s, nshape, dndx, dndy, detj, ierr) + real(rk), intent(in) :: xloc(2,4) + real(rk), intent(in) :: r + real(rk), intent(in) :: s + real(rk), intent(out) :: nshape(4) + real(rk), intent(out) :: dndx(4) + real(rk), intent(out) :: dndy(4) + real(rk), intent(out) :: detj + integer, intent(out) :: ierr + real(rk) :: dndr(4) + real(rk) :: dnds(4) + real(rk) :: jac(2,2) + real(rk) :: invj(2,2) + integer :: local_node + + nshape(1) = 0.25_rk * (ONE - r) * (ONE - s) + nshape(2) = 0.25_rk * (ONE + r) * (ONE - s) + nshape(3) = 0.25_rk * (ONE + r) * (ONE + s) + nshape(4) = 0.25_rk * (ONE - r) * (ONE + s) + + dndr(1) = -0.25_rk * (ONE - s) + dndr(2) = 0.25_rk * (ONE - s) + dndr(3) = 0.25_rk * (ONE + s) + dndr(4) = -0.25_rk * (ONE + s) + + dnds(1) = -0.25_rk * (ONE - r) + dnds(2) = -0.25_rk * (ONE + r) + dnds(3) = 0.25_rk * (ONE + r) + dnds(4) = 0.25_rk * (ONE - r) + + jac = ZERO + do local_node = 1, 4 + jac(1,1) = jac(1,1) + xloc(1,local_node) * dndr(local_node) + jac(1,2) = jac(1,2) + xloc(1,local_node) * dnds(local_node) + jac(2,1) = jac(2,1) + xloc(2,local_node) * dndr(local_node) + jac(2,2) = jac(2,2) + xloc(2,local_node) * dnds(local_node) + end do + + detj = jac(1,1) * jac(2,2) - jac(1,2) * jac(2,1) + if (detj .le. ZERO) then + call error_set(FEM_ERR_MESH, 'S4 stiffness has non-positive Jacobian', ierr) + return + end if + + invj(1,1) = jac(2,2) / detj + invj(1,2) = -jac(1,2) / detj + invj(2,1) = -jac(2,1) / detj + invj(2,2) = jac(1,1) / detj + + do local_node = 1, 4 + dndx(local_node) = dndr(local_node) * invj(1,1) + & + dnds(local_node) * invj(2,1) + dndy(local_node) = dndr(local_node) * invj(1,2) + & + dnds(local_node) * invj(2,2) + end do + + ierr = FEM_SUCCESS + end subroutine shell4_shape_xy_linear + + subroutine shell_general_basis_linear(elem, nlocal, use_quad, basis, xloc, ierr) + integer, intent(in) :: elem + integer, intent(in) :: nlocal + logical, intent(in) :: use_quad + real(rk), intent(out) :: basis(NDIM,NDIM) + real(rk), intent(out) :: xloc(2,MAX_NEN) + integer, intent(out) :: ierr + real(rk) :: origin(NDIM) + real(rk) :: x1(NDIM) + real(rk) :: x2(NDIM) + real(rk) :: x3(NDIM) + real(rk) :: x4(NDIM) + real(rk) :: v12(NDIM) + real(rk) :: vnormal(NDIM) + real(rk) :: normal(NDIM) + real(rk) :: tmp(NDIM) + real(rk) :: len1 + real(rk) :: lenn + integer :: local_node + integer :: node + + x1 = coord0(:, elem_conn(1,elem)) + x2 = coord0(:, elem_conn(2,elem)) + x3 = coord0(:, elem_conn(3,elem)) + origin = x1 + v12 = x2 - x1 + if (use_quad) then + x4 = coord0(:, elem_conn(4,elem)) + vnormal = x4 - x1 + else + vnormal = x3 - x1 + end if + + len1 = sqrt(sum(v12 * v12)) + if (len1 .le. ZERO) then + call error_set(FEM_ERR_MESH, 'shell stiffness has coincident first edge nodes', ierr) + return + end if + basis(:,1) = v12 / len1 + + call cross3_linear(v12, vnormal, normal) + lenn = sqrt(sum(normal * normal)) + if (lenn .le. ZERO .and. use_quad) then + tmp = x3 - x1 + call cross3_linear(v12, tmp, normal) + lenn = sqrt(sum(normal * normal)) + end if + if (lenn .le. ZERO) then + call error_set(FEM_ERR_MESH, 'shell stiffness local basis is singular', ierr) + return + end if + basis(:,3) = normal / lenn + call cross3_linear(basis(:,3), basis(:,1), basis(:,2)) + + xloc = ZERO + do local_node = 1, nlocal + node = elem_conn(local_node, elem) + tmp = coord0(:,node) - origin + xloc(1,local_node) = dot_product(tmp, basis(:,1)) + xloc(2,local_node) = dot_product(tmp, basis(:,2)) + end do + + ierr = FEM_SUCCESS + end subroutine shell_general_basis_linear + + subroutine shell_general_shape_xy_linear(etype, nlocal, xloc, natural, & + nshape, dndx, dndy, detj, ierr) + character(len=*), intent(in) :: etype + integer, intent(in) :: nlocal + real(rk), intent(in) :: xloc(2,MAX_NEN) + real(rk), intent(in) :: natural(NDIM) + real(rk), intent(out) :: nshape(nlocal) + real(rk), intent(out) :: dndx(nlocal) + real(rk), intent(out) :: dndy(nlocal) + real(rk), intent(out) :: detj + integer, intent(out) :: ierr + real(rk) :: nbuf(MAX_NEN) + real(rk) :: dndr(NDIM,MAX_NEN) + real(rk) :: jac(2,2) + real(rk) :: invj(2,2) + integer :: local_node + + call shape_evaluate(etype, natural, nbuf, dndr, ierr) + if (ierr .ne. FEM_SUCCESS) return + + jac = ZERO + do local_node = 1, nlocal + jac(1,1) = jac(1,1) + xloc(1,local_node) * dndr(1,local_node) + jac(1,2) = jac(1,2) + xloc(1,local_node) * dndr(2,local_node) + jac(2,1) = jac(2,1) + xloc(2,local_node) * dndr(1,local_node) + jac(2,2) = jac(2,2) + xloc(2,local_node) * dndr(2,local_node) + end do + + detj = jac(1,1) * jac(2,2) - jac(1,2) * jac(2,1) + if (detj .le. ZERO) then + call error_set(FEM_ERR_MESH, 'shell stiffness has non-positive Jacobian', ierr) + return + end if + + invj(1,1) = jac(2,2) / detj + invj(1,2) = -jac(1,2) / detj + invj(2,1) = -jac(2,1) / detj + invj(2,2) = jac(1,1) / detj + + do local_node = 1, nlocal + nshape(local_node) = nbuf(local_node) + dndx(local_node) = dndr(1,local_node) * invj(1,1) + & + dndr(2,local_node) * invj(2,1) + dndy(local_node) = dndr(1,local_node) * invj(1,2) + & + dndr(2,local_node) * invj(2,2) + end do + + ierr = FEM_SUCCESS + end subroutine shell_general_shape_xy_linear + + subroutine shell_constitutive(coeff_mem, coeff_ben, coeff_shr, poisson, & + dmem, dben, dshr) + real(rk), intent(in) :: coeff_mem + real(rk), intent(in) :: coeff_ben + real(rk), intent(in) :: coeff_shr + real(rk), intent(in) :: poisson + real(rk), intent(out) :: dmem(3,3) + real(rk), intent(out) :: dben(3,3) + real(rk), intent(out) :: dshr(2,2) + + dmem = ZERO + dben = ZERO + dshr = ZERO + + dmem(1,1) = coeff_mem + dmem(1,2) = coeff_mem * poisson + dmem(2,1) = coeff_mem * poisson + dmem(2,2) = coeff_mem + dmem(3,3) = coeff_mem * HALF * (ONE - poisson) + + dben(1,1) = coeff_ben + dben(1,2) = coeff_ben * poisson + dben(2,1) = coeff_ben * poisson + dben(2,2) = coeff_ben + dben(3,3) = coeff_ben * HALF * (ONE - poisson) + + dshr(1,1) = coeff_shr + dshr(2,2) = coeff_shr + end subroutine shell_constitutive + + subroutine shell_apply_mem_tangent(mat, thickness, gp, dmem, ierr) + integer, intent(in) :: mat + real(rk), intent(in) :: thickness + integer, intent(in) :: gp + real(rk), intent(inout) :: dmem(3,3) + integer, intent(out) :: ierr + real(rk) :: d3d(NSTRESS,NSTRESS) + + if (gp .le. 0) then + ierr = FEM_SUCCESS + return + end if + if (.not. allocated(stress) .or. .not. allocated(statev)) then + ierr = FEM_SUCCESS + return + end if + if (gp .gt. size(stress,2) .or. gp .gt. size(statev,2)) then + call error_set(FEM_ERR_INTERNAL, 'shell tangent integration point is out of range', ierr) + return + end if + if (trim(mat_plastic_model(mat)) .ne. 'J2' .and. & + trim(mat_plastic_model(mat)) .ne. 'J2_JC') then + ierr = FEM_SUCCESS + return + end if + if (statev(4,gp) .lt. HALF .and. statev(22,gp) .le. tiny(ONE)) then + ierr = FEM_SUCCESS + return + end if + + call material_tangent_small_strain(mat, stress(:,gp), statev(:,gp), d3d, ierr) + if (ierr .ne. FEM_SUCCESS) return + + dmem(1,1) = thickness * d3d(1,1) + dmem(1,2) = thickness * d3d(1,2) + dmem(1,3) = thickness * d3d(1,4) + dmem(2,1) = thickness * d3d(2,1) + dmem(2,2) = thickness * d3d(2,2) + dmem(2,3) = thickness * d3d(2,4) + dmem(3,1) = thickness * d3d(4,1) + dmem(3,2) = thickness * d3d(4,2) + dmem(3,3) = thickness * d3d(4,4) + + ierr = FEM_SUCCESS + end subroutine shell_apply_mem_tangent + + subroutine shell_b_matrices(nlocal, nshape, dndx, dndy, bmem, bben, bshr) + integer, intent(in) :: nlocal + real(rk), intent(in) :: nshape(nlocal) + real(rk), intent(in) :: dndx(nlocal) + real(rk), intent(in) :: dndy(nlocal) + real(rk), intent(out) :: bmem(3,5*nlocal) + real(rk), intent(out) :: bben(3,5*nlocal) + real(rk), intent(out) :: bshr(2,5*nlocal) + integer :: local_node + integer :: base + + bmem = ZERO + bben = ZERO + bshr = ZERO + do local_node = 1, nlocal + base = 5 * (local_node - 1) + + bmem(1,base+1) = dndx(local_node) + bmem(2,base+2) = dndy(local_node) + bmem(3,base+1) = dndy(local_node) + bmem(3,base+2) = dndx(local_node) + + bben(1,base+5) = dndx(local_node) + bben(2,base+4) = -dndy(local_node) + bben(3,base+4) = -dndx(local_node) + bben(3,base+5) = dndy(local_node) + + bshr(1,base+3) = dndx(local_node) + bshr(1,base+5) = nshape(local_node) + bshr(2,base+3) = dndy(local_node) + bshr(2,base+4) = -nshape(local_node) + end do + end subroutine shell_b_matrices + + subroutine shell_transform_matrix(nlocal, basis, transform) + integer, intent(in) :: nlocal + real(rk), intent(in) :: basis(NDIM,NDIM) + real(rk), intent(out) :: transform(5*nlocal,6*nlocal) + integer :: local_node + integer :: i + integer :: qbase + integer :: gbase + + transform = ZERO + do local_node = 1, nlocal + qbase = 5 * (local_node - 1) + gbase = 6 * (local_node - 1) + do i = 1, NDIM + transform(qbase+1,gbase+i) = basis(i,1) + transform(qbase+2,gbase+i) = basis(i,2) + transform(qbase+3,gbase+i) = basis(i,3) + transform(qbase+4,gbase+3+i) = basis(i,1) + transform(qbase+5,gbase+3+i) = basis(i,2) + end do + end do + end subroutine shell_transform_matrix + + subroutine add_shell_drilling_stiffness(nlocal, basis, kdrill, ke) + integer, intent(in) :: nlocal + real(rk), intent(in) :: basis(NDIM,NDIM) + real(rk), intent(in) :: kdrill + real(rk), intent(inout) :: ke(:,:) + integer :: local_node + integer :: i + integer :: j + integer :: base + + if (kdrill .le. ZERO) return + do local_node = 1, nlocal + base = 6 * (local_node - 1) + do i = 1, NDIM + do j = 1, NDIM + ke(base+3+i,base+3+j) = ke(base+3+i,base+3+j) + & + kdrill * basis(i,3) * basis(j,3) + end do + end do + end do + end subroutine add_shell_drilling_stiffness subroutine shape_gradients_current(elem, nlocal, dndr, dndx, detj, ierr) integer, intent(in) :: elem @@ -281,4 +1159,14 @@ contains ierr = FEM_SUCCESS end subroutine inverse3 + subroutine cross3_linear(a, b, c) + real(rk), intent(in) :: a(NDIM) + real(rk), intent(in) :: b(NDIM) + real(rk), intent(out) :: c(NDIM) + + c(1) = a(2) * b(3) - a(3) * b(2) + c(2) = a(3) * b(1) - a(1) * b(3) + c(3) = a(1) * b(2) - a(2) * b(1) + end subroutine cross3_linear + end module fem_element_stiffness diff --git a/src/input/fem_inp_reader.f90 b/src/input/fem_inp_reader.f90 index 1375e94..28eb0eb 100644 --- a/src/input/fem_inp_reader.f90 +++ b/src/input/fem_inp_reader.f90 @@ -26,6 +26,7 @@ module fem_inp_reader integer, parameter :: MODE_RATE_DEPENDENT = 16 integer, parameter :: MODE_SPECIFIC_HEAT = 17 integer, parameter :: MODE_INELASTIC_HEAT_FRACTION = 18 + integer, parameter :: MODE_STATIC = 19 contains @@ -243,6 +244,8 @@ contains mode = MODE_DLOAD else if (starts_with(upper, '*DYNAMIC')) then mode = MODE_DYNAMIC + else if (starts_with(upper, '*STATIC')) then + mode = MODE_STATIC else if (starts_with(upper, '*AMPLITUDE')) then mode = MODE_AMPLITUDE amplitude_count = amplitude_count + 1 @@ -445,6 +448,13 @@ contains close(unit_id) return end if + else if (mode .eq. MODE_STATIC) then + call parse_static_line(clean, ierr) + mode = MODE_NONE + if (ierr .ne. FEM_SUCCESS) then + close(unit_id) + return + end if else if (mode .eq. MODE_AMPLITUDE) then call parse_amplitude_line(clean, current_amp, amp_pos, ierr) if (ierr .ne. FEM_SUCCESS) then @@ -621,7 +631,11 @@ contains else if (starts_with(line, '*DLOAD')) then mode = MODE_DLOAD else if (starts_with(line, '*DYNAMIC')) then + analysis_type = ANALYSIS_EXPLICIT_DYNAMIC mode = MODE_DYNAMIC + else if (starts_with(line, '*STATIC')) then + call set_static_defaults() + mode = MODE_STATIC else if (starts_with(line, '*AMPLITUDE')) then mode = MODE_AMPLITUDE call get_keyword_value(line, 'NAME', name_value) @@ -1184,6 +1198,98 @@ contains ierr = FEM_SUCCESS end subroutine parse_dynamic_line + subroutine set_static_defaults() + analysis_type = ANALYSIS_STATIC_LINEAR + static_initial_increment = ONE + static_min_increment = ZERO + static_max_increment = ONE + load_factor = ONE + dt_user = ONE + time_end = ONE + use_user_dt = .true. + nstep_max = 1 + max_increment = 1 + end subroutine set_static_defaults + + subroutine parse_static_line(line, ierr) + character(len=*), intent(in) :: line + integer, intent(out) :: ierr + character(len=LINE_LEN) :: token + real(rk) :: value + real(rk) :: ratio + integer :: ios + + call set_static_defaults() + + call csv_token(line, 1, token) + if (len_trim(token) .eq. 0) then + ierr = FEM_SUCCESS + return + end if + read(token,*,iostat=ios) value + if (ios .ne. 0) then + call error_set(FEM_ERR_INPUT, 'failed to parse *STATIC initial increment', ierr) + return + end if + if (value .le. ZERO) then + call error_set(FEM_ERR_INPUT, '*STATIC initial increment must be positive', ierr) + return + end if + static_initial_increment = value + dt_user = value + + call csv_token(line, 2, token) + if (len_trim(token) .gt. 0) then + read(token,*,iostat=ios) value + if (ios .ne. 0) then + call error_set(FEM_ERR_INPUT, 'failed to parse *STATIC total time', ierr) + return + end if + if (value .le. ZERO) then + call error_set(FEM_ERR_INPUT, '*STATIC total time must be positive', ierr) + return + end if + time_end = value + end if + + call csv_token(line, 3, token) + if (len_trim(token) .gt. 0) then + read(token,*,iostat=ios) value + if (ios .ne. 0) then + call error_set(FEM_ERR_INPUT, 'failed to parse *STATIC minimum increment', ierr) + return + end if + if (value .lt. ZERO) then + call error_set(FEM_ERR_INPUT, '*STATIC minimum increment must be non-negative', ierr) + return + end if + static_min_increment = value + end if + + call csv_token(line, 4, token) + if (len_trim(token) .gt. 0) then + read(token,*,iostat=ios) value + if (ios .ne. 0) then + call error_set(FEM_ERR_INPUT, 'failed to parse *STATIC maximum increment', ierr) + return + end if + if (value .le. ZERO) then + call error_set(FEM_ERR_INPUT, '*STATIC maximum increment must be positive', ierr) + return + end if + static_max_increment = value + end if + + ratio = time_end / static_initial_increment + nstep_max = int(ratio) + if (real(nstep_max, rk) * static_initial_increment .lt. & + time_end * (ONE - 1.0e-10_rk)) nstep_max = nstep_max + 1 + if (nstep_max .lt. 1) nstep_max = 1 + max_increment = nstep_max + + ierr = FEM_SUCCESS + end subroutine parse_static_line + subroutine parse_shell_section_line(line, section_index, ierr) character(len=*), intent(in) :: line integer, intent(in) :: section_index diff --git a/src/material/fem_material_j2.f90 b/src/material/fem_material_j2.f90 index 298180d..625fb09 100644 --- a/src/material/fem_material_j2.f90 +++ b/src/material/fem_material_j2.f90 @@ -113,6 +113,81 @@ contains ierr = FEM_SUCCESS end subroutine material_update_elastic + subroutine material_tangent_small_strain(mat, stress_cur, state_cur, dmat, ierr) + integer, intent(in) :: mat + real(rk), intent(in) :: stress_cur(NSTRESS) + real(rk), intent(in) :: state_cur(NSTATEV_MAX) + real(rk), intent(out) :: dmat(NSTRESS,NSTRESS) + integer, intent(out) :: ierr + real(rk) :: dev(NSTRESS) + real(rk) :: flow(NSTRESS) + real(rk) :: cflow(NSTRESS) + real(rk) :: seq + real(rk) :: yield_stress + real(rk) :: hardening + real(rk) :: denom + integer :: i + integer :: j + + call elastic_tangent_matrix(mat, dmat, ierr) + if (ierr .ne. FEM_SUCCESS) return + + if (mat .lt. 1 .or. mat .gt. n_material) then + call error_set(FEM_ERR_MATERIAL, 'invalid material index for tangent', ierr) + return + end if + + if (state_cur(4) .ge. HALF) then + dmat = ZERO + ierr = FEM_SUCCESS + return + end if + + if (trim(mat_plastic_model(mat)) .ne. 'J2' .and. & + trim(mat_plastic_model(mat)) .ne. 'J2_JC') then + ierr = FEM_SUCCESS + return + end if + + if (state_cur(22) .le. tiny(ONE)) then + ierr = FEM_SUCCESS + return + end if + + call deviatoric_stress(stress_cur, dev) + seq = mises_stress(dev) + if (seq .le. tiny(ONE)) then + ierr = FEM_SUCCESS + return + end if + + call yield_curve_for_step(mat, state_cur(1), state_cur(22), ZERO, & + state_cur, yield_stress, hardening, ierr) + if (ierr .ne. FEM_SUCCESS) return + + flow(1) = 1.5_rk * dev(1) / seq + flow(2) = 1.5_rk * dev(2) / seq + flow(3) = 1.5_rk * dev(3) / seq + flow(4) = 3.0_rk * dev(4) / seq + flow(5) = 3.0_rk * dev(5) / seq + flow(6) = 3.0_rk * dev(6) / seq + + cflow = matmul(dmat, flow) + denom = hardening + dot_product(flow, cflow) + if (denom .le. tiny(ONE)) then + ierr = FEM_SUCCESS + return + end if + + do i = 1, NSTRESS + do j = 1, NSTRESS + dmat(i,j) = dmat(i,j) - cflow(i) * cflow(j) / denom + end do + end do + + ierr = FEM_SUCCESS + end subroutine material_tangent_small_strain + subroutine material_update_j2(mat, dt, deps, state_old, stress_old, & stress_new, state_new, ierr) integer, intent(in) :: mat @@ -250,6 +325,50 @@ contains ierr = FEM_SUCCESS end subroutine elastic_stress_increment + subroutine elastic_tangent_matrix(mat, dmat, ierr) + integer, intent(in) :: mat + real(rk), intent(out) :: dmat(NSTRESS,NSTRESS) + integer, intent(out) :: ierr + real(rk) :: lambda + real(rk) :: mu + real(rk) :: young + real(rk) :: poisson + + if (mat .lt. 1 .or. mat .gt. n_material) then + call error_set(FEM_ERR_MATERIAL, 'invalid material index for elastic tangent', ierr) + return + end if + + young = mat_e(mat) + poisson = mat_nu(mat) + if (young .le. ZERO) then + call error_set(FEM_ERR_MATERIAL, 'elastic tangent requires positive modulus', ierr) + return + end if + if (poisson .le. -ONE .or. poisson .ge. HALF) then + call error_set(FEM_ERR_MATERIAL, 'elastic tangent Poisson ratio must be in (-1,0.5)', ierr) + return + end if + + lambda = young * poisson / ((ONE + poisson) * (ONE - 2.0_rk * poisson)) + mu = young / (2.0_rk * (ONE + poisson)) + + dmat = ZERO + dmat(1,1) = lambda + 2.0_rk * mu + dmat(2,2) = lambda + 2.0_rk * mu + dmat(3,3) = lambda + 2.0_rk * mu + dmat(1,2) = lambda + dmat(1,3) = lambda + dmat(2,1) = lambda + dmat(2,3) = lambda + dmat(3,1) = lambda + dmat(3,2) = lambda + dmat(4,4) = mu + dmat(5,5) = mu + dmat(6,6) = mu + ierr = FEM_SUCCESS + end subroutine elastic_tangent_matrix + subroutine material_apply_failure(mat, stress_new, state_new, ierr) integer, intent(in) :: mat real(rk), intent(in) :: stress_new(NSTRESS) diff --git a/src/mesh/fem_database.f90 b/src/mesh/fem_database.f90 index df71924..13ef926 100644 --- a/src/mesh/fem_database.f90 +++ b/src/mesh/fem_database.f90 @@ -22,6 +22,7 @@ module fem_database integer :: nmpc = 0 integer :: nmpc_term = 0 integer :: ncontact_plane = 0 + integer :: ncontact_pair = 0 real(rk), allocatable :: coord0(:,:) real(rk), allocatable :: coord(:,:) @@ -44,6 +45,7 @@ module fem_database real(rk), allocatable :: fext(:) real(rk), allocatable :: fsph(:) real(rk), allocatable :: fcontact(:) + real(rk), allocatable :: freaction(:) integer, allocatable :: elem_gp_start(:) integer, allocatable :: elem_ngp(:) @@ -139,6 +141,11 @@ module fem_database real(rk), allocatable :: contact_offset(:) real(rk), allocatable :: contact_penalty(:) real(rk), allocatable :: contact_damping(:) + character(len=NAME_LEN), allocatable :: contact_pair_slave(:) + character(len=NAME_LEN), allocatable :: contact_pair_master(:) + real(rk), allocatable :: contact_pair_penalty(:) + real(rk), allocatable :: contact_pair_damping(:) + real(rk), allocatable :: contact_pair_search(:) contains @@ -590,6 +597,43 @@ contains ierr = FEM_SUCCESS end subroutine database_allocate_contact + subroutine database_allocate_contact_pair(num_pairs, ierr) + integer, intent(in) :: num_pairs + integer, intent(out) :: ierr + integer :: stat + + if (num_pairs .lt. 0) then + call error_set(FEM_ERR_INPUT, 'number of contact pairs must be non-negative', ierr) + return + end if + + if (allocated(contact_pair_slave)) deallocate(contact_pair_slave) + if (allocated(contact_pair_master)) deallocate(contact_pair_master) + if (allocated(contact_pair_penalty)) deallocate(contact_pair_penalty) + if (allocated(contact_pair_damping)) deallocate(contact_pair_damping) + if (allocated(contact_pair_search)) deallocate(contact_pair_search) + + ncontact_pair = num_pairs + + if (num_pairs .gt. 0) then + allocate(contact_pair_slave(num_pairs), contact_pair_master(num_pairs), & + contact_pair_penalty(num_pairs), contact_pair_damping(num_pairs), & + contact_pair_search(num_pairs), stat=stat) + if (stat .ne. 0) then + ncontact_pair = 0 + call error_set(FEM_ERR_INTERNAL, 'failed to allocate contact pair arrays', ierr) + return + end if + contact_pair_slave = 'ALL' + contact_pair_master = 'ALL' + contact_pair_penalty = ZERO + contact_pair_damping = ZERO + contact_pair_search = ZERO + end if + + ierr = FEM_SUCCESS + end subroutine database_allocate_contact_pair + subroutine database_allocate_basic(num_nodes, num_elems, num_dof, ierr) integer, intent(in) :: num_nodes integer, intent(in) :: num_elems @@ -640,6 +684,7 @@ contains if (allocated(fext)) deallocate(fext) if (allocated(fsph)) deallocate(fsph) if (allocated(fcontact)) deallocate(fcontact) + if (allocated(freaction)) deallocate(freaction) if (.not. allocated(dof_id)) then allocate(dof_id(NDOF_NODE,nnode), stat=stat) @@ -651,7 +696,8 @@ contains end if allocate(u(ndof), v(ndof), a(ndof), vhalf(ndof), mass_diag(ndof), & - fint(ndof), fext(ndof), fsph(ndof), fcontact(ndof), stat=stat) + fint(ndof), fext(ndof), fsph(ndof), fcontact(ndof), & + freaction(ndof), stat=stat) if (stat .ne. 0) then call error_set(FEM_ERR_INTERNAL, 'failed to allocate global vectors', ierr) return @@ -666,6 +712,7 @@ contains fext = ZERO fsph = ZERO fcontact = ZERO + freaction = ZERO ierr = FEM_SUCCESS end subroutine database_allocate_vectors @@ -692,6 +739,7 @@ contains if (allocated(fext)) fext = ZERO if (allocated(fsph)) fsph = ZERO if (allocated(fcontact)) fcontact = ZERO + if (allocated(freaction)) freaction = ZERO if (allocated(nset_name)) nset_name = ' ' if (allocated(nset_start)) nset_start = 0 if (allocated(nset_count)) nset_count = 0 @@ -770,6 +818,11 @@ contains if (allocated(contact_offset)) contact_offset = ZERO if (allocated(contact_penalty)) contact_penalty = ZERO if (allocated(contact_damping)) contact_damping = ZERO + if (allocated(contact_pair_slave)) contact_pair_slave = 'ALL' + if (allocated(contact_pair_master)) contact_pair_master = 'ALL' + if (allocated(contact_pair_penalty)) contact_pair_penalty = ZERO + if (allocated(contact_pair_damping)) contact_pair_damping = ZERO + if (allocated(contact_pair_search)) contact_pair_search = ZERO ierr = FEM_SUCCESS end subroutine database_initialize @@ -1361,9 +1414,47 @@ contains end if end do + do item = 1, ncontact_pair + if (.not. contact_surface_target_exists(contact_pair_slave(item))) then + call error_set(FEM_ERR_INPUT, 'contact pair slave is not ALL, an element, or an element set', ierr) + return + end if + if (.not. contact_surface_target_exists(contact_pair_master(item))) then + call error_set(FEM_ERR_INPUT, 'contact pair master is not ALL, an element, or an element set', ierr) + return + end if + if (contact_pair_penalty(item) .le. ZERO) then + call error_set(FEM_ERR_INPUT, 'contact pair penalty must be positive', ierr) + return + end if + if (contact_pair_damping(item) .lt. ZERO) then + call error_set(FEM_ERR_INPUT, 'contact pair damping must be non-negative', ierr) + return + end if + if (contact_pair_search(item) .lt. ZERO) then + call error_set(FEM_ERR_INPUT, 'contact pair search distance must be non-negative', ierr) + return + end if + end do + ierr = FEM_SUCCESS end subroutine validate_contact_data + logical function contact_surface_target_exists(target) + character(len=*), intent(in) :: target + character(len=NAME_LEN) :: local_target + + local_target = adjustl(target) + contact_surface_target_exists = .false. + if (len_trim(local_target) .eq. 0) then + contact_surface_target_exists = .true. + else if (trim(local_target) .eq. 'ALL' .or. trim(local_target) .eq. 'all') then + contact_surface_target_exists = .true. + else + contact_surface_target_exists = elem_or_elset_exists(local_target) + end if + end function contact_surface_target_exists + logical function contact_target_exists(target) character(len=*), intent(in) :: target character(len=NAME_LEN) :: local_target @@ -1428,6 +1519,7 @@ contains if (allocated(fext)) deallocate(fext) if (allocated(fsph)) deallocate(fsph) if (allocated(fcontact)) deallocate(fcontact) + if (allocated(freaction)) deallocate(freaction) if (allocated(elem_gp_start)) deallocate(elem_gp_start) if (allocated(elem_ngp)) deallocate(elem_ngp) if (allocated(stress)) deallocate(stress) @@ -1511,6 +1603,11 @@ contains if (allocated(contact_offset)) deallocate(contact_offset) if (allocated(contact_penalty)) deallocate(contact_penalty) if (allocated(contact_damping)) deallocate(contact_damping) + if (allocated(contact_pair_slave)) deallocate(contact_pair_slave) + if (allocated(contact_pair_master)) deallocate(contact_pair_master) + if (allocated(contact_pair_penalty)) deallocate(contact_pair_penalty) + if (allocated(contact_pair_damping)) deallocate(contact_pair_damping) + if (allocated(contact_pair_search)) deallocate(contact_pair_search) nnode = 0 nelem = 0 @@ -1530,6 +1627,7 @@ contains nmpc = 0 nmpc_term = 0 ncontact_plane = 0 + ncontact_pair = 0 ierr = FEM_SUCCESS end subroutine database_finalize diff --git a/src/output/fem_output_csv.f90 b/src/output/fem_output_csv.f90 index 88fd448..995997b 100644 --- a/src/output/fem_output_csv.f90 +++ b/src/output/fem_output_csv.f90 @@ -92,6 +92,9 @@ contains call output_csv_write_nodes(step, ierr) if (ierr .ne. FEM_SUCCESS) return + call output_csv_write_reactions(step, ierr) + if (ierr .ne. FEM_SUCCESS) return + call output_csv_write_elements(step, ierr) if (ierr .ne. FEM_SUCCESS) return @@ -191,6 +194,57 @@ contains ierr = FEM_SUCCESS end subroutine output_csv_write_nodes + subroutine output_csv_write_reactions(step, ierr) + integer, intent(in) :: step + integer, intent(out) :: ierr + character(len=512) :: filename + integer :: unit_id + integer :: ios + integer :: node + integer :: idir + integer :: dof + real(rk) :: reaction(NDOF_NODE) + + call output_csv_step_filename('reactions', step, filename) + unit_id = 65 + open(unit=unit_id, file=trim(filename), status='replace', & + action='write', iostat=ios) + if (ios .ne. 0) then + call error_set(FEM_ERR_OUTPUT, 'failed to open reaction CSV output', ierr) + return + end if + + write(unit_id,'(A)',iostat=ios) & + 'node_id,reaction_ux,reaction_uy,reaction_uz,reaction_rx,reaction_ry,reaction_rz' + if (ios .ne. 0) then + close(unit_id) + call error_set(FEM_ERR_OUTPUT, 'failed to write reaction CSV header', ierr) + return + end if + + do node = 1, nnode + reaction = ZERO + if (allocated(freaction)) then + do idir = 1, NDOF_NODE + dof = dof_id(idir,node) + if (dof .gt. 0) reaction(idir) = freaction(dof) + end do + end if + + write(unit_id,'(I12,6(A,ES24.16))',iostat=ios) node_id_ext(node), & + ',', reaction(1), ',', reaction(2), ',', reaction(3), & + ',', reaction(4), ',', reaction(5), ',', reaction(6) + if (ios .ne. 0) then + close(unit_id) + call error_set(FEM_ERR_OUTPUT, 'failed to write reaction CSV row', ierr) + return + end if + end do + + close(unit_id) + ierr = FEM_SUCCESS + end subroutine output_csv_write_reactions + subroutine output_csv_write_elements(step, ierr) integer, intent(in) :: step integer, intent(out) :: ierr diff --git a/src/output/fem_output_vtk.f90 b/src/output/fem_output_vtk.f90 index fd48f58..b016514 100644 --- a/src/output/fem_output_vtk.f90 +++ b/src/output/fem_output_vtk.f90 @@ -165,6 +165,8 @@ contains call write_point_vector(unit_id, 'velocity', v, ios) if (ios .ne. 0) return call write_point_vector(unit_id, 'acceleration', a, ios) + if (ios .ne. 0) return + call write_point_vector(unit_id, 'reaction', freaction, ios) end subroutine write_vtk_point_data subroutine write_point_vector(unit_id, name, values, ios) diff --git a/src/solver/fem_assembly_csr.f90 b/src/solver/fem_assembly_csr.f90 index 60fd34f..92c974e 100644 --- a/src/solver/fem_assembly_csr.f90 +++ b/src/solver/fem_assembly_csr.f90 @@ -127,6 +127,8 @@ contains call count_mpc_pattern_entries(raw_count, ierr) if (ierr .ne. FEM_SUCCESS) go to 900 + call count_contact_pattern_entries(raw_count, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 max_raw = maxval(raw_count) allocate(row_cols(max_raw, ndof), stat=stat) @@ -161,6 +163,8 @@ contains call append_mpc_pattern_columns(row_cols, row_count, max_raw, ierr) if (ierr .ne. FEM_SUCCESS) go to 900 + call append_contact_pattern_columns(row_cols, row_count, max_raw, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 do row = 1, ndof call sort_row_columns(row_cols, row_count(row), row) @@ -367,6 +371,153 @@ contains ierr = FEM_SUCCESS end subroutine append_mpc_pattern_columns + subroutine count_contact_pattern_entries(raw_count, ierr) + integer, intent(inout) :: raw_count(:) + integer, intent(out) :: ierr + integer :: pair + integer :: slave_elem + integer :: master_elem + integer :: i + integer :: nslave + integer :: nmaster + integer :: slave_dofs(MAX_ELEM_DOF) + integer :: master_dofs(MAX_ELEM_DOF) + integer :: add_count + + do pair = 1, ncontact_pair + do slave_elem = 1, nelem + if (.not. contact_target_matches_elem(slave_elem, & + contact_pair_slave(pair))) cycle + call assembly_get_element_dofs(slave_elem, slave_dofs, nslave, ierr) + if (ierr .ne. FEM_SUCCESS) return + + do master_elem = 1, nelem + if (.not. contact_target_matches_elem(master_elem, & + contact_pair_master(pair))) cycle + call assembly_get_element_dofs(master_elem, master_dofs, nmaster, ierr) + if (ierr .ne. FEM_SUCCESS) return + + add_count = nslave + nmaster + do i = 1, nslave + if (slave_dofs(i) .gt. 0) raw_count(slave_dofs(i)) = & + raw_count(slave_dofs(i)) + add_count + end do + do i = 1, nmaster + if (master_dofs(i) .gt. 0) raw_count(master_dofs(i)) = & + raw_count(master_dofs(i)) + add_count + end do + end do + end do + end do + + ierr = FEM_SUCCESS + end subroutine count_contact_pattern_entries + + subroutine append_contact_pattern_columns(row_cols, row_count, max_raw, ierr) + integer, intent(inout) :: row_cols(:,:) + integer, intent(inout) :: row_count(:) + integer, intent(in) :: max_raw + integer, intent(out) :: ierr + integer :: pair + integer :: slave_elem + integer :: master_elem + integer :: nslave + integer :: nmaster + integer :: slave_dofs(MAX_ELEM_DOF) + integer :: master_dofs(MAX_ELEM_DOF) + + do pair = 1, ncontact_pair + do slave_elem = 1, nelem + if (.not. contact_target_matches_elem(slave_elem, & + contact_pair_slave(pair))) cycle + call assembly_get_element_dofs(slave_elem, slave_dofs, nslave, ierr) + if (ierr .ne. FEM_SUCCESS) return + + do master_elem = 1, nelem + if (.not. contact_target_matches_elem(master_elem, & + contact_pair_master(pair))) cycle + call assembly_get_element_dofs(master_elem, master_dofs, nmaster, ierr) + if (ierr .ne. FEM_SUCCESS) return + + call append_dof_block(row_cols, row_count, max_raw, & + slave_dofs, nslave, slave_dofs, nslave, ierr) + if (ierr .ne. FEM_SUCCESS) return + call append_dof_block(row_cols, row_count, max_raw, & + slave_dofs, nslave, master_dofs, nmaster, ierr) + if (ierr .ne. FEM_SUCCESS) return + call append_dof_block(row_cols, row_count, max_raw, & + master_dofs, nmaster, slave_dofs, nslave, ierr) + if (ierr .ne. FEM_SUCCESS) return + call append_dof_block(row_cols, row_count, max_raw, & + master_dofs, nmaster, master_dofs, nmaster, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + end do + end do + + ierr = FEM_SUCCESS + end subroutine append_contact_pattern_columns + + subroutine append_dof_block(row_cols, row_count, max_raw, rows, nrow, & + cols, ncol, ierr) + integer, intent(inout) :: row_cols(:,:) + integer, intent(inout) :: row_count(:) + integer, intent(in) :: max_raw + integer, intent(in) :: rows(:) + integer, intent(in) :: nrow + integer, intent(in) :: cols(:) + integer, intent(in) :: ncol + integer, intent(out) :: ierr + integer :: i + integer :: j + + do i = 1, nrow + if (rows(i) .le. 0) cycle + do j = 1, ncol + if (cols(j) .gt. 0) then + call append_unique_column(row_cols, row_count, max_raw, & + rows(i), cols(j), ierr) + if (ierr .ne. FEM_SUCCESS) return + end if + end do + end do + + ierr = FEM_SUCCESS + end subroutine append_dof_block + + logical function contact_target_matches_elem(elem, target) + integer, intent(in) :: elem + character(len=*), intent(in) :: target + character(len=NAME_LEN) :: local_target + integer :: external_id + integer :: ios + integer :: set_id + integer :: pos + + local_target = adjustl(target) + if (len_trim(local_target) .eq. 0 .or. trim(local_target) .eq. 'ALL' .or. & + trim(local_target) .eq. 'all') then + contact_target_matches_elem = .true. + return + end if + + read(local_target,*,iostat=ios) external_id + if (ios .eq. 0) then + contact_target_matches_elem = elem_id_ext(elem) .eq. external_id + return + end if + + set_id = database_find_elset(local_target) + contact_target_matches_elem = .false. + if (set_id .eq. 0) return + do pos = elset_start(set_id), elset_start(set_id) + elset_count(set_id) - 1 + if (elset_items(pos) .eq. elem_id_ext(elem)) then + contact_target_matches_elem = .true. + return + end if + end do + end function contact_target_matches_elem + subroutine mpc_term_dof(item, dof, ierr) integer, intent(in) :: item integer, intent(out) :: dof diff --git a/src/solver/fem_solver_implicit.f90 b/src/solver/fem_solver_implicit.f90 index a10577b..3f7c6ee 100644 --- a/src/solver/fem_solver_implicit.f90 +++ b/src/solver/fem_solver_implicit.f90 @@ -1,17 +1,24 @@ module fem_solver_implicit use fem_precision use fem_error + use fem_control use fem_database use fem_sparse_csr use fem_assembly_csr use fem_linear_solver_cg use fem_element_stiffness + use fem_element_internal + use fem_element_state use fem_boundary + use fem_contact implicit none private public :: implicit_solve_linear_static + public :: implicit_solve_nonlinear_static + public :: implicit_advance_newmark_linear + public :: implicit_newmark_nonlinear_step contains @@ -24,7 +31,12 @@ contains integer, intent(out) :: ierr type(csr_matrix) :: kmat real(rk), allocatable :: rhs(:) + real(rk), allocatable :: rhs_original(:) + real(rk), allocatable :: ku_original(:) + real(rk), allocatable :: k_val_original(:) integer :: stat + integer :: row + integer :: k iter = 0 res_norm = ZERO @@ -39,12 +51,14 @@ contains return end if - allocate(rhs(ndof), stat=stat) + allocate(rhs(ndof), rhs_original(ndof), ku_original(ndof), stat=stat) if (stat .ne. 0) then call error_set(FEM_ERR_SOLVER, 'failed to allocate implicit RHS', ierr) return end if rhs = ZERO + rhs_original = ZERO + ku_original = ZERO call assembly_build_csr_pattern(kmat, ierr) if (ierr .ne. FEM_SUCCESS) go to 900 @@ -65,6 +79,14 @@ contains call apply_implicit_mpc(kmat, rhs, ierr) if (ierr .ne. FEM_SUCCESS) go to 900 + allocate(k_val_original(kmat%nnz), stat=stat) + if (stat .ne. 0) then + call error_set(FEM_ERR_SOLVER, 'failed to allocate reaction workspace', ierr) + go to 900 + end if + k_val_original = kmat%val + rhs_original = rhs + call apply_implicit_dirichlet(kmat, rhs, time, ierr) if (ierr .ne. FEM_SUCCESS) go to 900 @@ -76,11 +98,922 @@ contains if (allocated(a)) a = ZERO if (allocated(vhalf)) vhalf = ZERO + if (.not. allocated(freaction)) then + call error_set(FEM_ERR_INTERNAL, 'reaction vector is not allocated', ierr) + go to 900 + end if + ku_original = ZERO + do row = 1, kmat%nrow + do k = kmat%row_ptr(row), kmat%row_ptr(row+1) - 1 + ku_original(row) = ku_original(row) + & + k_val_original(k) * u(kmat%col_ind(k)) + end do + end do + freaction = ku_original - rhs_original + 900 continue call csr_free(kmat, stat) if (allocated(rhs)) deallocate(rhs) + if (allocated(rhs_original)) deallocate(rhs_original) + if (allocated(ku_original)) deallocate(ku_original) + if (allocated(k_val_original)) deallocate(k_val_original) end subroutine implicit_solve_linear_static + subroutine implicit_solve_nonlinear_static(final_time, num_increment, & + max_iter, tol, iter_total, & + res_norm, ierr) + real(rk), intent(in) :: final_time + integer, intent(in) :: num_increment + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter_total + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr + integer :: inc + integer :: ninc + integer :: iter_inc + real(rk) :: start_time + real(rk) :: target_time + real(rk) :: sub_target_time + real(rk) :: dt_inc + real(rk) :: dt_try + real(rk) :: dt_min_eff + real(rk) :: time_tol + integer :: cut_count + + iter_total = 0 + res_norm = ZERO + + if (ndof .le. 0) then + call error_set(FEM_ERR_SOLVER, 'nonlinear static solve requires positive ndof', ierr) + return + end if + if (.not. allocated(u)) then + call error_set(FEM_ERR_INTERNAL, 'nonlinear static solve requires allocated solution vector', ierr) + return + end if + if (max_iter .le. 0) then + call error_set(FEM_ERR_SOLVER, 'nonlinear static max_iter must be positive', ierr) + return + end if + if (tol .le. ZERO) then + call error_set(FEM_ERR_SOLVER, 'nonlinear static tolerance must be positive', ierr) + return + end if + if (final_time .le. current_time) then + call error_set(FEM_ERR_SOLVER, 'nonlinear static final time must be greater than current time', ierr) + return + end if + if (num_increment .gt. 0) then + ninc = num_increment + else if (max_increment .gt. 0) then + ninc = max_increment + else if (nstep_max .gt. 0) then + ninc = nstep_max + else + ninc = 1 + end if + if (ninc .le. 0) ninc = 1 + + start_time = current_time + dt_inc = (final_time - start_time) / real(ninc, rk) + time_tol = max(1.0e-12_rk * max(ONE, abs(final_time)), 1.0e-30_rk) + + if (static_min_increment .gt. ZERO) then + dt_min_eff = static_min_increment + else + dt_min_eff = abs(dt_inc) * 1.0e-8_rk + end if + dt_min_eff = max(dt_min_eff, time_tol) + + do inc = 1, ninc + target_time = start_time + real(inc, rk) * dt_inc + if (final_time - target_time .le. time_tol) target_time = final_time + + dt_try = target_time - current_time + cut_count = 0 + do + if (abs(target_time - current_time) .le. time_tol) exit + if (abs(dt_try) .gt. abs(target_time - current_time)) then + dt_try = target_time - current_time + end if + sub_target_time = current_time + dt_try + if (abs(target_time - sub_target_time) .le. time_tol) then + sub_target_time = target_time + dt_try = sub_target_time - current_time + end if + + call nonlinear_static_increment(sub_target_time, dt_try, max_iter, tol, & + iter_inc, res_norm, ierr) + if (ierr .eq. FEM_SUCCESS) then + iter_total = iter_total + iter_inc + current_time = sub_target_time + current_step = current_step + 1 + dt_try = target_time - current_time + cut_count = 0 + else if (allow_step_cutback .and. cut_count .lt. max_cutback .and. & + abs(dt_try * cutback_factor) .ge. dt_min_eff) then + dt_try = dt_try * cutback_factor + cut_count = cut_count + 1 + ierr = FEM_SUCCESS + else + return + end if + end do + end do + + if (allocated(v)) v = ZERO + if (allocated(a)) a = ZERO + if (allocated(vhalf)) vhalf = ZERO + + ierr = FEM_SUCCESS + end subroutine implicit_solve_nonlinear_static + + subroutine implicit_advance_newmark_linear(dt, beta, gamma, max_iter, tol, & + iter, res_norm, ierr) + real(rk), intent(in) :: dt + real(rk), intent(in) :: beta + real(rk), intent(in) :: gamma + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr + type(csr_matrix) :: kmat + real(rk), allocatable :: rhs(:) + real(rk), allocatable :: external(:) + real(rk), allocatable :: u_pred(:) + real(rk), allocatable :: v_pred(:) + real(rk), allocatable :: damp_vec(:) + real(rk), allocatable :: kdamp(:) + real(rk), allocatable :: damping_force(:) + real(rk), allocatable :: k_val_original(:) + real(rk) :: a0 + real(rk) :: a1 + real(rk) :: mass_scale + real(rk) :: stiff_scale + real(rk) :: target_time + integer :: dof + integer :: stat + + iter = 0 + res_norm = ZERO + call csr_init(kmat) + + if (ndof .le. 0) then + call error_set(FEM_ERR_SOLVER, 'implicit Newmark requires positive ndof', ierr) + return + end if + if (dt .le. ZERO) then + call error_set(FEM_ERR_SOLVER, 'implicit Newmark time step must be positive', ierr) + return + end if + if (beta .le. ZERO) then + call error_set(FEM_ERR_SOLVER, 'implicit Newmark beta must be positive', ierr) + return + end if + if (gamma .le. ZERO) then + call error_set(FEM_ERR_SOLVER, 'implicit Newmark gamma must be positive', ierr) + return + end if + if (rayleigh_alpha_mass .lt. ZERO .or. rayleigh_beta_stiffness .lt. ZERO) then + call error_set(FEM_ERR_SOLVER, 'Rayleigh damping factors must be non-negative', ierr) + return + end if + if (.not. allocated(u) .or. .not. allocated(v) .or. .not. allocated(a)) then + call error_set(FEM_ERR_INTERNAL, 'implicit Newmark requires kinematic vectors', ierr) + return + end if + if (.not. allocated(mass_diag)) then + call error_set(FEM_ERR_INTERNAL, 'implicit Newmark requires mass vector', ierr) + return + end if + do dof = 1, ndof + if (mass_diag(dof) .le. ZERO) then + call error_set(FEM_ERR_SOLVER, 'implicit Newmark found non-positive lumped mass', ierr) + return + end if + end do + + allocate(rhs(ndof), external(ndof), u_pred(ndof), v_pred(ndof), & + damp_vec(ndof), kdamp(ndof), damping_force(ndof), stat=stat) + if (stat .ne. 0) then + call error_set(FEM_ERR_SOLVER, 'failed to allocate implicit Newmark workspace', ierr) + return + end if + + a0 = ONE / (beta * dt * dt) + a1 = gamma / (beta * dt) + target_time = current_time + dt + u_pred = u + dt * v + dt * dt * (HALF - beta) * a + v_pred = v + dt * (ONE - gamma) * a + damp_vec = a1 * u_pred - v_pred + + call assembly_build_csr_pattern(kmat, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + call assemble_linear_stiffness(kmat, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + allocate(k_val_original(kmat%nnz), stat=stat) + if (stat .ne. 0) then + call error_set(FEM_ERR_SOLVER, 'failed to allocate Newmark stiffness copy', ierr) + go to 900 + end if + k_val_original = kmat%val + + call assemble_nonlinear_external(target_time, external, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + rhs = external + a0 * mass_diag * u_pred + if (rayleigh_alpha_mass .gt. ZERO) then + rhs = rhs + rayleigh_alpha_mass * mass_diag * damp_vec + end if + if (rayleigh_beta_stiffness .gt. ZERO) then + call csr_saved_matvec(kmat, k_val_original, damp_vec, kdamp, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + rhs = rhs + rayleigh_beta_stiffness * kdamp + end if + + stiff_scale = ONE + a1 * rayleigh_beta_stiffness + mass_scale = a0 + a1 * rayleigh_alpha_mass + if (abs(stiff_scale - ONE) .gt. tiny(ONE)) kmat%val = stiff_scale * kmat%val + call add_lumped_mass_diagonal(kmat, mass_scale, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + call apply_implicit_robin(kmat, rhs, target_time, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + call apply_implicit_mpc(kmat, rhs, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + call apply_implicit_dirichlet(kmat, rhs, target_time, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + u = u_pred + call linear_cg_solve(kmat, rhs, u, max_iter, tol, iter, res_norm, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + a = a0 * (u - u_pred) + v = v_pred + gamma * dt * a + if (allocated(vhalf)) vhalf = v - HALF * dt * a + + call boundary_apply_dirichlet(target_time, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + call element_compute_internal_force(ierr, dt) + if (ierr .ne. FEM_SUCCESS) go to 900 + call assemble_nonlinear_external(target_time, external, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + damping_force = ZERO + if (rayleigh_alpha_mass .gt. ZERO) then + damping_force = damping_force + rayleigh_alpha_mass * mass_diag * v + end if + if (rayleigh_beta_stiffness .gt. ZERO) then + call csr_saved_matvec(kmat, k_val_original, v, kdamp, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + damping_force = damping_force + rayleigh_beta_stiffness * kdamp + end if + if (allocated(freaction)) freaction = fint + mass_diag * a + damping_force - external + + ierr = FEM_SUCCESS + +900 continue + call csr_free(kmat, stat) + if (allocated(rhs)) deallocate(rhs) + if (allocated(external)) deallocate(external) + if (allocated(u_pred)) deallocate(u_pred) + if (allocated(v_pred)) deallocate(v_pred) + if (allocated(damp_vec)) deallocate(damp_vec) + if (allocated(kdamp)) deallocate(kdamp) + if (allocated(damping_force)) deallocate(damping_force) + if (allocated(k_val_original)) deallocate(k_val_original) + end subroutine implicit_advance_newmark_linear + + subroutine implicit_newmark_nonlinear_step(dt, beta, gamma, max_iter, tol, & + iter_used, res_norm, ierr) + real(rk), intent(in) :: dt + real(rk), intent(in) :: beta + real(rk), intent(in) :: gamma + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter_used + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr + type(csr_matrix) :: kmat + real(rk), allocatable :: residual(:) + real(rk), allocatable :: external(:) + real(rk), allocatable :: rhs_corr(:) + real(rk), allocatable :: du(:) + real(rk), allocatable :: u_pred(:) + real(rk), allocatable :: v_pred(:) + real(rk), allocatable :: u_start(:) + real(rk), allocatable :: v_start(:) + real(rk), allocatable :: a_start(:) + real(rk), allocatable :: vhalf_start(:) + real(rk), allocatable :: u_base(:) + real(rk), allocatable :: kdamp(:) + real(rk), allocatable :: damping_force(:) + real(rk), allocatable :: k_val_original(:) + real(rk) :: a0 + real(rk) :: a1 + real(rk) :: mass_scale + real(rk) :: stiff_scale + real(rk) :: target_time + real(rk) :: ref_norm + real(rk) :: cg_res + real(rk) :: trial_res_norm + real(rk) :: trial_ref_norm + integer :: dof + integer :: iter + integer :: cg_iter + integer :: stat + integer :: state_ierr + logical :: converged + + iter_used = 0 + res_norm = ZERO + ref_norm = ONE + converged = .false. + call csr_init(kmat) + + if (ndof .le. 0) then + call error_set(FEM_ERR_SOLVER, 'nonlinear Newmark requires positive ndof', ierr) + return + end if + if (dt .le. ZERO) then + call error_set(FEM_ERR_SOLVER, 'nonlinear Newmark time step must be positive', ierr) + return + end if + if (beta .le. ZERO) then + call error_set(FEM_ERR_SOLVER, 'nonlinear Newmark beta must be positive', ierr) + return + end if + if (gamma .le. ZERO) then + call error_set(FEM_ERR_SOLVER, 'nonlinear Newmark gamma must be positive', ierr) + return + end if + if (max_iter .le. 0) then + call error_set(FEM_ERR_SOLVER, 'nonlinear Newmark max_iter must be positive', ierr) + return + end if + if (tol .le. ZERO) then + call error_set(FEM_ERR_SOLVER, 'nonlinear Newmark tolerance must be positive', ierr) + return + end if + if (rayleigh_alpha_mass .lt. ZERO .or. rayleigh_beta_stiffness .lt. ZERO) then + call error_set(FEM_ERR_SOLVER, 'Rayleigh damping factors must be non-negative', ierr) + return + end if + if (.not. allocated(u) .or. .not. allocated(v) .or. .not. allocated(a)) then + call error_set(FEM_ERR_INTERNAL, 'nonlinear Newmark requires kinematic vectors', ierr) + return + end if + if (.not. allocated(mass_diag)) then + call error_set(FEM_ERR_INTERNAL, 'nonlinear Newmark requires mass vector', ierr) + return + end if + do dof = 1, ndof + if (mass_diag(dof) .le. ZERO) then + call error_set(FEM_ERR_SOLVER, 'nonlinear Newmark found non-positive lumped mass', ierr) + return + end if + end do + + allocate(residual(ndof), external(ndof), rhs_corr(ndof), du(ndof), & + u_pred(ndof), v_pred(ndof), u_start(ndof), v_start(ndof), & + a_start(ndof), vhalf_start(ndof), u_base(ndof), & + kdamp(ndof), damping_force(ndof), stat=stat) + if (stat .ne. 0) then + call error_set(FEM_ERR_SOLVER, 'failed to allocate nonlinear Newmark workspace', ierr) + return + end if + + u_start = u + v_start = v + a_start = a + if (allocated(vhalf)) then + vhalf_start = vhalf + else + vhalf_start = ZERO + end if + + a0 = ONE / (beta * dt * dt) + a1 = gamma / (beta * dt) + target_time = current_time + dt + u_pred = u + dt * v + dt * dt * (HALF - beta) * a + v_pred = v + dt * (ONE - gamma) * a + + u = u_pred + call boundary_apply_dirichlet(target_time, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + call element_state_begin_trial(ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + do iter = 1, max_iter + call element_state_restore_trial(ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + a = a0 * (u - u_pred) + v = v_pred + gamma * dt * a + if (allocated(vhalf)) vhalf = v - HALF * dt * a + + call element_compute_internal_force(ierr, dt) + if (ierr .ne. FEM_SUCCESS) go to 900 + call assemble_nonlinear_external(target_time, external, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + call csr_free(kmat, stat) + call assembly_build_csr_pattern(kmat, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + call assemble_linear_stiffness(kmat, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + if (allocated(k_val_original)) deallocate(k_val_original) + allocate(k_val_original(kmat%nnz), stat=stat) + if (stat .ne. 0) then + call error_set(FEM_ERR_SOLVER, 'failed to allocate nonlinear Newmark stiffness copy', ierr) + go to 900 + end if + k_val_original = kmat%val + + damping_force = ZERO + if (rayleigh_alpha_mass .gt. ZERO) then + damping_force = damping_force + rayleigh_alpha_mass * mass_diag * v + end if + if (rayleigh_beta_stiffness .gt. ZERO) then + call csr_saved_matvec(kmat, k_val_original, v, kdamp, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + damping_force = damping_force + rayleigh_beta_stiffness * kdamp + end if + + residual = external - fint - mass_diag * a - damping_force + call zero_prescribed_residual(residual, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + res_norm = sqrt(sum(residual * residual)) + ref_norm = max(ONE, sqrt(sum(external * external))) + iter_used = iter + if (res_norm .le. tol .or. res_norm / ref_norm .le. tol) then + converged = .true. + if (allocated(freaction)) then + freaction = fint + mass_diag * a + damping_force - external + end if + call csr_free(kmat, stat) + if (allocated(k_val_original)) deallocate(k_val_original) + exit + end if + + stiff_scale = ONE + a1 * rayleigh_beta_stiffness + mass_scale = a0 + a1 * rayleigh_alpha_mass + if (abs(stiff_scale - ONE) .gt. tiny(ONE)) kmat%val = stiff_scale * kmat%val + call add_lumped_mass_diagonal(kmat, mass_scale, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + call apply_nl_external_tangent(kmat, target_time, a1, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + rhs_corr = residual + call apply_implicit_dirichlet_zero(kmat, rhs_corr, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + du = ZERO + call linear_cg_solve(kmat, rhs_corr, du, max_iter * 20, tol, & + cg_iter, cg_res, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + call csr_free(kmat, stat) + if (allocated(k_val_original)) deallocate(k_val_original) + + u_base = u + if (use_line_search) then + call nonlinear_newmark_line_search(target_time, dt, a0, a1, & + u_pred, v_pred, u_base, du, & + res_norm, residual, external, & + damping_force, kdamp, & + trial_res_norm, trial_ref_norm, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + else + u = u + du + call boundary_apply_dirichlet(target_time, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + end if + end do + + if (.not. converged) then + call error_set(FEM_ERR_SOLVER, 'nonlinear Newmark Newton iteration did not converge', ierr) + go to 900 + end if + + call element_state_commit_trial(ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + ierr = FEM_SUCCESS + +900 continue + if (ierr .ne. FEM_SUCCESS) then + if (allocated(u_start)) u = u_start + if (allocated(v_start)) v = v_start + if (allocated(a_start)) a = a_start + if (allocated(vhalf_start) .and. allocated(vhalf)) vhalf = vhalf_start + call element_state_abort_trial(state_ierr) + end if + call csr_free(kmat, stat) + if (allocated(residual)) deallocate(residual) + if (allocated(external)) deallocate(external) + if (allocated(rhs_corr)) deallocate(rhs_corr) + if (allocated(du)) deallocate(du) + if (allocated(u_pred)) deallocate(u_pred) + if (allocated(v_pred)) deallocate(v_pred) + if (allocated(u_start)) deallocate(u_start) + if (allocated(v_start)) deallocate(v_start) + if (allocated(a_start)) deallocate(a_start) + if (allocated(vhalf_start)) deallocate(vhalf_start) + if (allocated(u_base)) deallocate(u_base) + if (allocated(kdamp)) deallocate(kdamp) + if (allocated(damping_force)) deallocate(damping_force) + if (allocated(k_val_original)) deallocate(k_val_original) + end subroutine implicit_newmark_nonlinear_step + + subroutine nonlinear_newmark_line_search(target_time, dt, a0, a1, & + u_pred, v_pred, u_base, du, & + current_res_norm, residual, external, & + damping_force, kdamp, & + trial_res_norm, trial_ref_norm, ierr) + real(rk), intent(in) :: target_time + real(rk), intent(in) :: dt + real(rk), intent(in) :: a0 + real(rk), intent(in) :: a1 + real(rk), intent(in) :: u_pred(:) + real(rk), intent(in) :: v_pred(:) + real(rk), intent(in) :: u_base(:) + real(rk), intent(in) :: du(:) + real(rk), intent(in) :: current_res_norm + real(rk), intent(inout) :: residual(:) + real(rk), intent(inout) :: external(:) + real(rk), intent(inout) :: damping_force(:) + real(rk), intent(inout) :: kdamp(:) + real(rk), intent(out) :: trial_res_norm + real(rk), intent(out) :: trial_ref_norm + integer, intent(out) :: ierr + real(rk) :: alpha + real(rk) :: next_alpha + real(rk) :: min_alpha + real(rk) :: reduction + real(rk) :: accept_ratio + + if (size(u_pred) .ne. ndof .or. size(v_pred) .ne. ndof .or. & + size(u_base) .ne. ndof .or. size(du) .ne. ndof) then + call error_set(FEM_ERR_SOLVER, 'Newmark line search vector size mismatch', ierr) + return + end if + + min_alpha = line_search_min_alpha + if (min_alpha .le. ZERO .or. min_alpha .gt. ONE) min_alpha = 0.125_rk + reduction = line_search_reduction + if (reduction .le. ZERO .or. reduction .ge. ONE) reduction = 0.5_rk + accept_ratio = line_search_accept_ratio + if (accept_ratio .le. ZERO) accept_ratio = ONE + + alpha = ONE + do + u = u_base + alpha * du + call evaluate_newmark_trial_residual(target_time, dt, a0, a1, & + u_pred, v_pred, residual, external, & + damping_force, kdamp, & + trial_res_norm, trial_ref_norm, ierr) + if (ierr .ne. FEM_SUCCESS) return + + if (trial_res_norm .le. accept_ratio * current_res_norm .or. & + alpha .le. min_alpha) exit + + next_alpha = alpha * reduction + if (next_alpha .lt. min_alpha) next_alpha = min_alpha + if (abs(next_alpha - alpha) .le. tiny(ONE)) exit + alpha = next_alpha + end do + + ierr = FEM_SUCCESS + end subroutine nonlinear_newmark_line_search + + subroutine evaluate_newmark_trial_residual(target_time, dt, a0, a1, & + u_pred, v_pred, residual, external, & + damping_force, kdamp, res_norm, & + ref_norm, ierr) + real(rk), intent(in) :: target_time + real(rk), intent(in) :: dt + real(rk), intent(in) :: a0 + real(rk), intent(in) :: a1 + real(rk), intent(in) :: u_pred(:) + real(rk), intent(in) :: v_pred(:) + real(rk), intent(inout) :: residual(:) + real(rk), intent(inout) :: external(:) + real(rk), intent(inout) :: damping_force(:) + real(rk), intent(inout) :: kdamp(:) + real(rk), intent(out) :: res_norm + real(rk), intent(out) :: ref_norm + integer, intent(out) :: ierr + type(csr_matrix) :: ktmp + real(rk), allocatable :: kcopy(:) + integer :: stat + + call csr_init(ktmp) + + call boundary_apply_dirichlet(target_time, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + call element_state_restore_trial(ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + a = a0 * (u - u_pred) + v = v_pred + a1 / a0 * a + if (allocated(vhalf)) vhalf = v - HALF * dt * a + + call element_compute_internal_force(ierr, dt) + if (ierr .ne. FEM_SUCCESS) go to 900 + call assemble_nonlinear_external(target_time, external, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + damping_force = ZERO + if (rayleigh_alpha_mass .gt. ZERO) then + damping_force = damping_force + rayleigh_alpha_mass * mass_diag * v + end if + if (rayleigh_beta_stiffness .gt. ZERO) then + call assembly_build_csr_pattern(ktmp, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + call assemble_linear_stiffness(ktmp, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + allocate(kcopy(ktmp%nnz), stat=stat) + if (stat .ne. 0) then + call error_set(FEM_ERR_SOLVER, 'failed to allocate Newmark line-search stiffness copy', ierr) + go to 900 + end if + kcopy = ktmp%val + call csr_saved_matvec(ktmp, kcopy, v, kdamp, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + damping_force = damping_force + rayleigh_beta_stiffness * kdamp + end if + + residual = external - fint - mass_diag * a - damping_force + call zero_prescribed_residual(residual, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + res_norm = sqrt(sum(residual * residual)) + ref_norm = max(ONE, sqrt(sum(external * external))) + ierr = FEM_SUCCESS + +900 continue + call csr_free(ktmp, stat) + if (allocated(kcopy)) deallocate(kcopy) + end subroutine evaluate_newmark_trial_residual + + subroutine nonlinear_static_increment(target_time, dt_inc, max_iter, tol, & + iter_used, res_norm, ierr) + real(rk), intent(in) :: target_time + real(rk), intent(in) :: dt_inc + integer, intent(in) :: max_iter + real(rk), intent(in) :: tol + integer, intent(out) :: iter_used + real(rk), intent(out) :: res_norm + integer, intent(out) :: ierr + type(csr_matrix) :: kmat + real(rk), allocatable :: residual(:) + real(rk), allocatable :: external(:) + real(rk), allocatable :: rhs_corr(:) + real(rk), allocatable :: du(:) + real(rk), allocatable :: u_start(:) + real(rk), allocatable :: u_base(:) + real(rk) :: ref_norm + real(rk) :: cg_res + real(rk) :: trial_res_norm + real(rk) :: trial_ref_norm + integer :: iter + integer :: cg_iter + integer :: stat + integer :: state_ierr + logical :: converged + + iter_used = 0 + res_norm = ZERO + ref_norm = ONE + converged = .false. + allocate(residual(ndof), external(ndof), rhs_corr(ndof), du(ndof), & + u_start(ndof), u_base(ndof), stat=stat) + if (stat .ne. 0) then + call error_set(FEM_ERR_SOLVER, 'failed to allocate nonlinear static workspace', ierr) + return + end if + + u_start = u + + call boundary_apply_dirichlet(target_time, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + call element_state_begin_trial(ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + do iter = 1, max_iter + call element_state_restore_trial(ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + call element_compute_internal_force(ierr, dt_inc) + if (ierr .ne. FEM_SUCCESS) go to 900 + + call assemble_nonlinear_external(target_time, external, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + residual = external - fint + call zero_prescribed_residual(residual, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + res_norm = sqrt(sum(residual * residual)) + ref_norm = max(ONE, sqrt(sum(external * external))) + iter_used = iter + if (res_norm .le. tol .or. res_norm / ref_norm .le. tol) then + converged = .true. + if (allocated(freaction)) freaction = fint - external + exit + end if + + call csr_init(kmat) + call assembly_build_csr_pattern(kmat, ierr) + if (ierr .ne. FEM_SUCCESS) then + call csr_free(kmat, stat) + go to 900 + end if + call assemble_linear_stiffness(kmat, ierr) + if (ierr .ne. FEM_SUCCESS) then + call csr_free(kmat, stat) + go to 900 + end if + call apply_nl_external_tangent(kmat, target_time, ZERO, ierr) + if (ierr .ne. FEM_SUCCESS) then + call csr_free(kmat, stat) + go to 900 + end if + + rhs_corr = residual + call apply_implicit_dirichlet_zero(kmat, rhs_corr, ierr) + if (ierr .ne. FEM_SUCCESS) then + call csr_free(kmat, stat) + go to 900 + end if + + du = ZERO + call linear_cg_solve(kmat, rhs_corr, du, max_iter * 20, tol, & + cg_iter, cg_res, ierr) + call csr_free(kmat, stat) + if (ierr .ne. FEM_SUCCESS) go to 900 + + u_base = u + if (use_line_search) then + call nonlinear_static_line_search(target_time, dt_inc, u_base, du, & + res_norm, residual, external, & + trial_res_norm, trial_ref_norm, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + else + u = u + du + call boundary_apply_dirichlet(target_time, ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + end if + end do + + if (.not. converged) then + call error_set(FEM_ERR_SOLVER, 'nonlinear static Newton iteration did not converge', ierr) + go to 900 + end if + + call element_state_commit_trial(ierr) + if (ierr .ne. FEM_SUCCESS) go to 900 + + ierr = FEM_SUCCESS + +900 continue + if (ierr .ne. FEM_SUCCESS) then + if (allocated(u_start)) u = u_start + call element_state_abort_trial(state_ierr) + end if + if (allocated(residual)) deallocate(residual) + if (allocated(external)) deallocate(external) + if (allocated(rhs_corr)) deallocate(rhs_corr) + if (allocated(du)) deallocate(du) + if (allocated(u_start)) deallocate(u_start) + if (allocated(u_base)) deallocate(u_base) + end subroutine nonlinear_static_increment + + subroutine nonlinear_static_line_search(target_time, dt_inc, u_base, du, & + current_res_norm, residual, external, & + trial_res_norm, trial_ref_norm, ierr) + real(rk), intent(in) :: target_time + real(rk), intent(in) :: dt_inc + real(rk), intent(in) :: u_base(:) + real(rk), intent(in) :: du(:) + real(rk), intent(in) :: current_res_norm + real(rk), intent(inout) :: residual(:) + real(rk), intent(inout) :: external(:) + real(rk), intent(out) :: trial_res_norm + real(rk), intent(out) :: trial_ref_norm + integer, intent(out) :: ierr + real(rk) :: alpha + real(rk) :: next_alpha + real(rk) :: min_alpha + real(rk) :: reduction + real(rk) :: accept_ratio + + if (size(u_base) .ne. ndof .or. size(du) .ne. ndof) then + call error_set(FEM_ERR_SOLVER, 'static line search vector size mismatch', ierr) + return + end if + + min_alpha = line_search_min_alpha + if (min_alpha .le. ZERO .or. min_alpha .gt. ONE) min_alpha = 0.125_rk + reduction = line_search_reduction + if (reduction .le. ZERO .or. reduction .ge. ONE) reduction = 0.5_rk + accept_ratio = line_search_accept_ratio + if (accept_ratio .le. ZERO) accept_ratio = ONE + + alpha = ONE + do + u = u_base + alpha * du + call boundary_apply_dirichlet(target_time, ierr) + if (ierr .ne. FEM_SUCCESS) return + + call element_state_restore_trial(ierr) + if (ierr .ne. FEM_SUCCESS) return + + call element_compute_internal_force(ierr, dt_inc) + if (ierr .ne. FEM_SUCCESS) return + + call assemble_nonlinear_external(target_time, external, ierr) + if (ierr .ne. FEM_SUCCESS) return + + residual = external - fint + call zero_prescribed_residual(residual, ierr) + if (ierr .ne. FEM_SUCCESS) return + + trial_res_norm = sqrt(sum(residual * residual)) + trial_ref_norm = max(ONE, sqrt(sum(external * external))) + + if (trial_res_norm .le. accept_ratio * current_res_norm .or. & + alpha .le. min_alpha) exit + + next_alpha = alpha * reduction + if (next_alpha .lt. min_alpha) next_alpha = min_alpha + if (abs(next_alpha - alpha) .le. tiny(ONE)) exit + alpha = next_alpha + end do + + ierr = FEM_SUCCESS + end subroutine nonlinear_static_line_search + + subroutine assemble_nonlinear_external(time, external, ierr) + real(rk), intent(in) :: time + real(rk), intent(out) :: external(:) + integer, intent(out) :: ierr + + if (size(external) .ne. ndof) then + call error_set(FEM_ERR_SOLVER, 'nonlinear external vector size is inconsistent with ndof', ierr) + return + end if + + call boundary_apply_prescribed_loads(time, ierr) + if (ierr .ne. FEM_SUCCESS) return + + call boundary_apply_robin_forces(time, ierr) + if (ierr .ne. FEM_SUCCESS) return + + call boundary_apply_mpc_forces(ierr) + if (ierr .ne. FEM_SUCCESS) return + + call contact_apply_plane_forces(ierr) + if (ierr .ne. FEM_SUCCESS) return + + external = ZERO + if (allocated(fext)) external = external + fext + if (allocated(fsph)) external = external + fsph + if (allocated(fcontact)) external = external + fcontact + ierr = FEM_SUCCESS + end subroutine assemble_nonlinear_external + + subroutine zero_prescribed_residual(residual, ierr) + real(rk), intent(inout) :: residual(:) + integer, intent(out) :: ierr + integer :: item + integer :: dof_num + + if (size(residual) .ne. ndof) then + call error_set(FEM_ERR_SOLVER, 'nonlinear residual size is inconsistent with ndof', ierr) + return + end if + + do item = 1, nbc + do dof_num = bc_dof_start(item), bc_dof_end(item) + call zero_residual_target(residual, bc_target(item), dof_num, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + end do + + ierr = FEM_SUCCESS + end subroutine zero_prescribed_residual + subroutine assemble_linear_stiffness(kmat, ierr) type(csr_matrix), intent(inout) :: kmat integer, intent(out) :: ierr @@ -111,6 +1044,88 @@ contains if (allocated(ke)) deallocate(ke) end subroutine assemble_linear_stiffness + subroutine add_lumped_mass_diagonal(kmat, scale, ierr) + type(csr_matrix), intent(inout) :: kmat + real(rk), intent(in) :: scale + integer, intent(out) :: ierr + integer :: dof + + if (.not. allocated(mass_diag)) then + call error_set(FEM_ERR_INTERNAL, 'mass vector is not allocated', ierr) + return + end if + + do dof = 1, ndof + call csr_add_value(kmat, dof, dof, scale * mass_diag(dof), ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + + ierr = FEM_SUCCESS + end subroutine add_lumped_mass_diagonal + + subroutine apply_nl_external_tangent(kmat, time, velocity_scale, ierr) + type(csr_matrix), intent(inout) :: kmat + real(rk), intent(in) :: time + real(rk), intent(in) :: velocity_scale + integer, intent(out) :: ierr + + call apply_nl_robin_tangent(kmat, time, velocity_scale, ierr) + if (ierr .ne. FEM_SUCCESS) return + + call apply_nl_mpc_tangent(kmat, ierr) + if (ierr .ne. FEM_SUCCESS) return + + call contact_apply_plane_tangent(kmat, velocity_scale, ierr) + if (ierr .ne. FEM_SUCCESS) return + + ierr = FEM_SUCCESS + end subroutine apply_nl_external_tangent + + subroutine csr_saved_matvec(kmat, values, x, y, ierr) + type(csr_matrix), intent(in) :: kmat + real(rk), intent(in) :: values(:) + real(rk), intent(in) :: x(:) + real(rk), intent(out) :: y(:) + integer, intent(out) :: ierr + integer :: row + integer :: k + + if (size(values) .ne. kmat%nnz) then + call error_set(FEM_ERR_SOLVER, 'saved CSR value size mismatch', ierr) + return + end if + if (size(x) .ne. kmat%ncol .or. size(y) .ne. kmat%nrow) then + call error_set(FEM_ERR_SOLVER, 'saved CSR matvec vector size mismatch', ierr) + return + end if + + y = ZERO + do row = 1, kmat%nrow + do k = kmat%row_ptr(row), kmat%row_ptr(row+1) - 1 + y(row) = y(row) + values(k) * x(kmat%col_ind(k)) + end do + end do + + ierr = FEM_SUCCESS + end subroutine csr_saved_matvec + + subroutine apply_implicit_dirichlet_zero(kmat, rhs, ierr) + type(csr_matrix), intent(inout) :: kmat + real(rk), intent(inout) :: rhs(:) + integer, intent(out) :: ierr + integer :: item + integer :: dof_num + + do item = 1, nbc + do dof_num = bc_dof_start(item), bc_dof_end(item) + call apply_bc_target(kmat, rhs, bc_target(item), dof_num, ZERO, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + end do + + ierr = FEM_SUCCESS + end subroutine apply_implicit_dirichlet_zero + subroutine apply_implicit_dirichlet(kmat, rhs, time, ierr) type(csr_matrix), intent(inout) :: kmat real(rk), intent(inout) :: rhs(:) @@ -132,6 +1147,64 @@ contains ierr = FEM_SUCCESS end subroutine apply_implicit_dirichlet + subroutine zero_residual_target(residual, target, dof_num, ierr) + real(rk), intent(inout) :: residual(:) + character(len=*), intent(in) :: target + integer, intent(in) :: dof_num + integer, intent(out) :: ierr + integer :: node + integer :: set_id + integer :: pos + integer :: external_id + integer :: ios + + if (dof_num .lt. 1 .or. dof_num .gt. NDOF_NODE) then + call error_set(FEM_ERR_INPUT, 'nonlinear boundary dof is outside 1..6', ierr) + return + end if + + read(target,*,iostat=ios) external_id + if (ios .eq. 0) then + node = database_find_node(external_id) + if (node .eq. 0) then + call error_set(FEM_ERR_INPUT, 'nonlinear boundary references unknown node', ierr) + return + end if + call zero_residual_node(residual, node, dof_num, ierr) + return + end if + + set_id = database_find_nset(target) + if (set_id .eq. 0) then + call error_set(FEM_ERR_INPUT, 'nonlinear boundary references unknown node set', ierr) + return + end if + + do pos = nset_start(set_id), nset_start(set_id) + nset_count(set_id) - 1 + node = database_find_node(nset_items(pos)) + if (node .eq. 0) then + call error_set(FEM_ERR_INPUT, 'nonlinear boundary node set contains unknown node', ierr) + return + end if + call zero_residual_node(residual, node, dof_num, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + + ierr = FEM_SUCCESS + end subroutine zero_residual_target + + subroutine zero_residual_node(residual, node, dof_num, ierr) + real(rk), intent(inout) :: residual(:) + integer, intent(in) :: node + integer, intent(in) :: dof_num + integer, intent(out) :: ierr + integer :: dof + + dof = dof_id(dof_num,node) + if (dof .gt. 0) residual(dof) = ZERO + ierr = FEM_SUCCESS + end subroutine zero_residual_node + subroutine apply_implicit_robin(kmat, rhs, time, ierr) type(csr_matrix), intent(inout) :: kmat real(rk), intent(inout) :: rhs(:) @@ -149,6 +1222,24 @@ contains ierr = FEM_SUCCESS end subroutine apply_implicit_robin + subroutine apply_nl_robin_tangent(kmat, time, velocity_scale, ierr) + type(csr_matrix), intent(inout) :: kmat + real(rk), intent(in) :: time + real(rk), intent(in) :: velocity_scale + integer, intent(out) :: ierr + integer :: item + real(rk) :: scale + + do item = 1, nrobin + scale = database_amplitude_value(robin_amp(item), time) + call apply_nl_robin_target(kmat, robin_target(item), item, scale, & + velocity_scale, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + + ierr = FEM_SUCCESS + end subroutine apply_nl_robin_tangent + subroutine apply_robin_target(kmat, rhs, target, item, scale, ierr) type(csr_matrix), intent(inout) :: kmat real(rk), intent(inout) :: rhs(:) @@ -192,6 +1283,49 @@ contains ierr = FEM_SUCCESS end subroutine apply_robin_target + subroutine apply_nl_robin_target(kmat, target, item, scale, velocity_scale, ierr) + type(csr_matrix), intent(inout) :: kmat + character(len=*), intent(in) :: target + integer, intent(in) :: item + real(rk), intent(in) :: scale + real(rk), intent(in) :: velocity_scale + integer, intent(out) :: ierr + integer :: node + integer :: set_id + integer :: pos + integer :: external_id + integer :: ios + + read(target,*,iostat=ios) external_id + if (ios .eq. 0) then + node = database_find_node(external_id) + if (node .eq. 0) then + call error_set(FEM_ERR_INPUT, 'nonlinear Robin tangent references unknown node', ierr) + return + end if + call apply_nl_robin_node(kmat, node, item, scale, velocity_scale, ierr) + return + end if + + set_id = database_find_nset(target) + if (set_id .eq. 0) then + call error_set(FEM_ERR_INPUT, 'nonlinear Robin tangent references unknown node set', ierr) + return + end if + + do pos = nset_start(set_id), nset_start(set_id) + nset_count(set_id) - 1 + node = database_find_node(nset_items(pos)) + if (node .eq. 0) then + call error_set(FEM_ERR_INPUT, 'nonlinear Robin tangent node set contains unknown node', ierr) + return + end if + call apply_nl_robin_node(kmat, node, item, scale, velocity_scale, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + + ierr = FEM_SUCCESS + end subroutine apply_nl_robin_target + subroutine apply_robin_node(kmat, rhs, node, item, scale, ierr) type(csr_matrix), intent(inout) :: kmat real(rk), intent(inout) :: rhs(:) @@ -222,6 +1356,35 @@ contains ierr = FEM_SUCCESS end subroutine apply_robin_node + subroutine apply_nl_robin_node(kmat, node, item, scale, velocity_scale, ierr) + type(csr_matrix), intent(inout) :: kmat + integer, intent(in) :: node + integer, intent(in) :: item + real(rk), intent(in) :: scale + real(rk), intent(in) :: velocity_scale + integer, intent(out) :: ierr + integer :: dof_num + integer :: dof + real(rk) :: stiffness + + dof_num = robin_dof(item) + if (dof_num .lt. 1 .or. dof_num .gt. NDOF_NODE) then + call error_set(FEM_ERR_INPUT, 'nonlinear Robin tangent dof is outside 1..6', ierr) + return + end if + + dof = dof_id(dof_num,node) + if (dof .gt. 0) then + stiffness = scale * (robin_stiffness(item) + velocity_scale * robin_damping(item)) + if (abs(stiffness) .gt. tiny(ONE)) then + call csr_add_value(kmat, dof, dof, stiffness, ierr) + if (ierr .ne. FEM_SUCCESS) return + end if + end if + + ierr = FEM_SUCCESS + end subroutine apply_nl_robin_node + subroutine apply_implicit_mpc(kmat, rhs, ierr) type(csr_matrix), intent(inout) :: kmat real(rk), intent(inout) :: rhs(:) @@ -236,6 +1399,19 @@ contains ierr = FEM_SUCCESS end subroutine apply_implicit_mpc + subroutine apply_nl_mpc_tangent(kmat, ierr) + type(csr_matrix), intent(inout) :: kmat + integer, intent(out) :: ierr + integer :: eqn + + do eqn = 1, nmpc + call apply_mpc_equation_tangent(kmat, eqn, ierr) + if (ierr .ne. FEM_SUCCESS) return + end do + + ierr = FEM_SUCCESS + end subroutine apply_nl_mpc_tangent + subroutine apply_mpc_equation_implicit(kmat, rhs, eqn, ierr) type(csr_matrix), intent(inout) :: kmat real(rk), intent(inout) :: rhs(:) @@ -282,6 +1458,49 @@ contains ierr = FEM_SUCCESS end subroutine apply_mpc_equation_implicit + subroutine apply_mpc_equation_tangent(kmat, eqn, ierr) + type(csr_matrix), intent(inout) :: kmat + integer, intent(in) :: eqn + integer, intent(out) :: ierr + integer :: row_item + integer :: col_item + integer :: start_pos + integer :: stop_pos + integer :: row + integer :: col + real(rk) :: penalty + + start_pos = mpc_start(eqn) + stop_pos = start_pos + mpc_count(eqn) - 1 + if (start_pos .lt. 1 .or. stop_pos .gt. nmpc_term) then + call error_set(FEM_ERR_INPUT, 'nonlinear MPC tangent term range is invalid', ierr) + return + end if + + penalty = mpc_penalty(eqn) + if (penalty .le. ZERO) then + call error_set(FEM_ERR_INPUT, 'nonlinear MPC tangent penalty must be positive', ierr) + return + end if + + do row_item = start_pos, stop_pos + call mpc_term_global_dof(row_item, row, ierr) + if (ierr .ne. FEM_SUCCESS) return + if (row .le. 0) cycle + do col_item = start_pos, stop_pos + call mpc_term_global_dof(col_item, col, ierr) + if (ierr .ne. FEM_SUCCESS) return + if (col .gt. 0) then + call csr_add_value(kmat, row, col, & + penalty * mpc_coeff(row_item) * mpc_coeff(col_item), ierr) + if (ierr .ne. FEM_SUCCESS) return + end if + end do + end do + + ierr = FEM_SUCCESS + end subroutine apply_mpc_equation_tangent + subroutine mpc_term_global_dof(item, dof, ierr) integer, intent(in) :: item integer, intent(out) :: dof diff --git a/tests/data/c3d10_static_patch.inp b/tests/data/c3d10_static_patch.inp new file mode 100644 index 0000000..10e120e --- /dev/null +++ b/tests/data/c3d10_static_patch.inp @@ -0,0 +1,46 @@ +*HEADING +FemLite C3D10 static linear patch verification +*NODE +1, 0.0, 0.0, 0.0 +2, 1.0, 0.0, 0.0 +3, 0.0, 1.0, 0.0 +4, 0.0, 0.0, 1.0 +5, 0.5, 0.0, 0.0 +6, 0.5, 0.5, 0.0 +7, 0.0, 0.5, 0.0 +8, 0.0, 0.0, 0.5 +9, 0.5, 0.0, 0.5 +10, 0.0, 0.5, 0.5 +*ELEMENT, TYPE=C3D10, ELSET=EALL +1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 +*MATERIAL, NAME=MAT +*DENSITY +1.0 +*ELASTIC +30.0, 0.25 +*SOLID SECTION, ELSET=EALL, MATERIAL=MAT +*BOUNDARY +1, 1, 1, 0.0 +1, 2, 3, 0.0 +2, 1, 1, 0.01 +2, 2, 3, 0.0 +3, 1, 1, 0.0 +3, 2, 3, 0.0 +4, 1, 1, 0.0 +4, 2, 3, 0.0 +5, 1, 1, 0.005 +5, 2, 3, 0.0 +6, 1, 1, 0.005 +6, 2, 3, 0.0 +7, 1, 1, 0.0 +7, 2, 3, 0.0 +8, 1, 1, 0.0 +8, 2, 3, 0.0 +9, 1, 1, 0.005 +9, 2, 3, 0.0 +10, 1, 1, 0.0 +10, 2, 3, 0.0 +*STEP +*STATIC +1.0, 1.0, 0.1, 1.0 +*END STEP diff --git a/tests/data/c3d20_static_patch.inp b/tests/data/c3d20_static_patch.inp new file mode 100644 index 0000000..9da228a --- /dev/null +++ b/tests/data/c3d20_static_patch.inp @@ -0,0 +1,76 @@ +*HEADING +FemLite C3D20 static linear patch verification +*NODE +1, 0.0, 0.0, 0.0 +2, 1.0, 0.0, 0.0 +3, 1.0, 1.0, 0.0 +4, 0.0, 1.0, 0.0 +5, 0.0, 0.0, 1.0 +6, 1.0, 0.0, 1.0 +7, 1.0, 1.0, 1.0 +8, 0.0, 1.0, 1.0 +9, 0.5, 0.0, 0.0 +10, 1.0, 0.5, 0.0 +11, 0.5, 1.0, 0.0 +12, 0.0, 0.5, 0.0 +13, 0.5, 0.0, 1.0 +14, 1.0, 0.5, 1.0 +15, 0.5, 1.0, 1.0 +16, 0.0, 0.5, 1.0 +17, 0.0, 0.0, 0.5 +18, 1.0, 0.0, 0.5 +19, 1.0, 1.0, 0.5 +20, 0.0, 1.0, 0.5 +*ELEMENT, TYPE=C3D20, ELSET=EALL +1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 +*MATERIAL, NAME=MAT +*DENSITY +1.0 +*ELASTIC +30.0, 0.25 +*SOLID SECTION, ELSET=EALL, MATERIAL=MAT +*BOUNDARY +1, 1, 1, 0.0 +1, 2, 3, 0.0 +2, 1, 1, 0.01 +2, 2, 3, 0.0 +3, 1, 1, 0.01 +3, 2, 3, 0.0 +4, 1, 1, 0.0 +4, 2, 3, 0.0 +5, 1, 1, 0.0 +5, 2, 3, 0.0 +6, 1, 1, 0.01 +6, 2, 3, 0.0 +7, 1, 1, 0.01 +7, 2, 3, 0.0 +8, 1, 1, 0.0 +8, 2, 3, 0.0 +9, 1, 1, 0.005 +9, 2, 3, 0.0 +10, 1, 1, 0.01 +10, 2, 3, 0.0 +11, 1, 1, 0.005 +11, 2, 3, 0.0 +12, 1, 1, 0.0 +12, 2, 3, 0.0 +13, 1, 1, 0.005 +13, 2, 3, 0.0 +14, 1, 1, 0.01 +14, 2, 3, 0.0 +15, 1, 1, 0.005 +15, 2, 3, 0.0 +16, 1, 1, 0.0 +16, 2, 3, 0.0 +17, 1, 1, 0.0 +17, 2, 3, 0.0 +18, 1, 1, 0.01 +18, 2, 3, 0.0 +19, 1, 1, 0.01 +19, 2, 3, 0.0 +20, 1, 1, 0.0 +20, 2, 3, 0.0 +*STEP +*STATIC +1.0, 1.0, 0.1, 1.0 +*END STEP diff --git a/tests/data/c3d4_implicit_newmark_pull.inp b/tests/data/c3d4_implicit_newmark_pull.inp new file mode 100644 index 0000000..83948af --- /dev/null +++ b/tests/data/c3d4_implicit_newmark_pull.inp @@ -0,0 +1,26 @@ +*HEADING +FemLite C3D4 implicit Newmark pull verification +*NODE +1, 0.0, 0.0, 0.0 +2, 1.0, 0.0, 0.0 +3, 0.0, 1.0, 0.0 +4, 0.0, 0.0, 1.0 +*ELEMENT, TYPE=C3D4, ELSET=EALL +1, 1, 2, 3, 4 +*MATERIAL, NAME=MAT +*DENSITY +1.0 +*ELASTIC +30.0, 0.25 +*SOLID SECTION, ELSET=EALL, MATERIAL=MAT +*BOUNDARY +1, 1, 3, 0.0 +2, 2, 3, 0.0 +3, 1, 3, 0.0 +4, 1, 3, 0.0 +*CLOAD +2, 1, 5.0 +*STEP +*DYNAMIC +0.1, 0.1 +*END STEP diff --git a/tests/data/c3d4_static_nonlinear_elastic.inp b/tests/data/c3d4_static_nonlinear_elastic.inp new file mode 100644 index 0000000..a20be3b --- /dev/null +++ b/tests/data/c3d4_static_nonlinear_elastic.inp @@ -0,0 +1,28 @@ +*HEADING +FemLite C3D4 nonlinear static elastic pull verification +*NODE +1, 0.0, 0.0, 0.0 +2, 1.0, 0.0, 0.0 +3, 0.0, 1.0, 0.0 +4, 0.0, 0.0, 1.0 +*ELEMENT, TYPE=C3D4, ELSET=EALL +1, 1, 2, 3, 4 +*MATERIAL, NAME=MAT +*DENSITY +1.0 +*ELASTIC +30.0, 0.25 +*SOLID SECTION, ELSET=EALL, MATERIAL=MAT +*AMPLITUDE, NAME=RAMP +0.0, 0.0, 1.0, 1.0 +*BOUNDARY +1, 1, 3, 0.0 +2, 2, 3, 0.0 +3, 1, 3, 0.0 +4, 1, 3, 0.0 +*CLOAD, AMPLITUDE=RAMP +2, 1, 5.0 +*STEP +*STATIC +0.25, 1.0, 0.25, 0.25 +*END STEP diff --git a/tests/data/c3d4_static_nonlinear_j2_disp.inp b/tests/data/c3d4_static_nonlinear_j2_disp.inp new file mode 100644 index 0000000..335884d --- /dev/null +++ b/tests/data/c3d4_static_nonlinear_j2_disp.inp @@ -0,0 +1,31 @@ +*HEADING +FemLite C3D4 nonlinear static J2 displacement verification +*NODE +1, 0.0, 0.0, 0.0 +2, 1.0, 0.0, 0.0 +3, 0.0, 1.0, 0.0 +4, 0.0, 0.0, 1.0 +*ELEMENT, TYPE=C3D4, ELSET=EALL +1, 1, 2, 3, 4 +*MATERIAL, NAME=J2MAT +*DENSITY +1.0 +*ELASTIC +300.0, 0.25 +*PLASTIC +1.0, 0.0 +2.0, 0.1 +*SOLID SECTION, ELSET=EALL, MATERIAL=J2MAT +*AMPLITUDE, NAME=RAMP +0.0, 0.0, 1.0, 1.0 +*BOUNDARY +1, 1, 3, 0.0 +2, 2, 3, 0.0 +3, 1, 3, 0.0 +4, 1, 3, 0.0 +*BOUNDARY, AMPLITUDE=RAMP +2, 1, 1, 0.05 +*STEP +*STATIC +0.25, 1.0, 0.25, 0.25 +*END STEP diff --git a/tests/data/c3d4_static_pull.inp b/tests/data/c3d4_static_pull.inp new file mode 100644 index 0000000..e96aab5 --- /dev/null +++ b/tests/data/c3d4_static_pull.inp @@ -0,0 +1,26 @@ +*HEADING +FemLite C3D4 static linear pull verification +*NODE +1, 0.0, 0.0, 0.0 +2, 1.0, 0.0, 0.0 +3, 0.0, 1.0, 0.0 +4, 0.0, 0.0, 1.0 +*ELEMENT, TYPE=C3D4, ELSET=EALL +1, 1, 2, 3, 4 +*MATERIAL, NAME=MAT +*DENSITY +1.0 +*ELASTIC +30.0, 0.25 +*SOLID SECTION, ELSET=EALL, MATERIAL=MAT +*BOUNDARY +1, 1, 3, 0.0 +2, 2, 3, 0.0 +3, 1, 3, 0.0 +4, 1, 3, 0.0 +*CLOAD +2, 1, 5.0 +*STEP +*STATIC +0.1, 1.0, 0.01, 0.2 +*END STEP diff --git a/tests/data/c3d8_static_patch.inp b/tests/data/c3d8_static_patch.inp new file mode 100644 index 0000000..f3cc576 --- /dev/null +++ b/tests/data/c3d8_static_patch.inp @@ -0,0 +1,40 @@ +*HEADING +FemLite C3D8 static linear patch verification +*NODE +1, 0.0, 0.0, 0.0 +2, 1.0, 0.0, 0.0 +3, 1.0, 1.0, 0.0 +4, 0.0, 1.0, 0.0 +5, 0.0, 0.0, 1.0 +6, 1.0, 0.0, 1.0 +7, 1.0, 1.0, 1.0 +8, 0.0, 1.0, 1.0 +*ELEMENT, TYPE=C3D8, ELSET=EALL +1, 1, 2, 3, 4, 5, 6, 7, 8 +*MATERIAL, NAME=MAT +*DENSITY +1.0 +*ELASTIC +30.0, 0.25 +*SOLID SECTION, ELSET=EALL, MATERIAL=MAT +*BOUNDARY +1, 1, 1, 0.0 +1, 2, 3, 0.0 +2, 1, 1, 0.01 +2, 2, 3, 0.0 +3, 1, 1, 0.01 +3, 2, 3, 0.0 +4, 1, 1, 0.0 +4, 2, 3, 0.0 +5, 1, 1, 0.0 +5, 2, 3, 0.0 +6, 1, 1, 0.01 +6, 2, 3, 0.0 +7, 1, 1, 0.01 +7, 2, 3, 0.0 +8, 1, 1, 0.0 +8, 2, 3, 0.0 +*STEP +*STATIC +1.0, 1.0, 0.1, 1.0 +*END STEP diff --git a/tests/data/s3_static_patch.inp b/tests/data/s3_static_patch.inp new file mode 100644 index 0000000..664062f --- /dev/null +++ b/tests/data/s3_static_patch.inp @@ -0,0 +1,26 @@ +*HEADING +FemLite S3 static membrane patch verification +*NODE +1, 0.0, 0.0, 0.0 +2, 1.0, 0.0, 0.0 +3, 0.0, 1.0, 0.0 +*ELEMENT, TYPE=S3, ELSET=EALL +1, 1, 2, 3 +*MATERIAL, NAME=MAT +*DENSITY +1.0 +*ELASTIC +30.0, 0.25 +*SHELL SECTION, ELSET=EALL, MATERIAL=MAT +0.2 +*BOUNDARY +1, 1, 1, 0.0 +1, 2, 6, 0.0 +2, 1, 1, 0.01 +2, 2, 6, 0.0 +3, 1, 1, 0.0 +3, 2, 6, 0.0 +*STEP +*STATIC +1.0, 1.0, 0.1, 1.0 +*END STEP diff --git a/tests/data/s4_static_patch.inp b/tests/data/s4_static_patch.inp new file mode 100644 index 0000000..55f2901 --- /dev/null +++ b/tests/data/s4_static_patch.inp @@ -0,0 +1,29 @@ +*HEADING +FemLite S4 static membrane patch verification +*NODE +1, 0.0, 0.0, 0.0 +2, 1.0, 0.0, 0.0 +3, 1.0, 1.0, 0.0 +4, 0.0, 1.0, 0.0 +*ELEMENT, TYPE=S4, ELSET=EALL +1, 1, 2, 3, 4 +*MATERIAL, NAME=MAT +*DENSITY +1.0 +*ELASTIC +30.0, 0.25 +*SHELL SECTION, ELSET=EALL, MATERIAL=MAT +0.2 +*BOUNDARY +1, 1, 1, 0.0 +1, 2, 6, 0.0 +2, 1, 1, 0.01 +2, 2, 6, 0.0 +3, 1, 1, 0.01 +3, 2, 6, 0.0 +4, 1, 1, 0.0 +4, 2, 6, 0.0 +*STEP +*STATIC +1.0, 1.0, 0.1, 1.0 +*END STEP diff --git a/tests/data/s6_static_patch.inp b/tests/data/s6_static_patch.inp new file mode 100644 index 0000000..3406ad2 --- /dev/null +++ b/tests/data/s6_static_patch.inp @@ -0,0 +1,35 @@ +*HEADING +FemLite S6 static membrane patch verification +*NODE +1, 0.0, 0.0, 0.0 +2, 1.0, 0.0, 0.0 +3, 0.0, 1.0, 0.0 +4, 0.5, 0.0, 0.0 +5, 0.5, 0.5, 0.0 +6, 0.0, 0.5, 0.0 +*ELEMENT, TYPE=S6, ELSET=EALL +1, 1, 2, 3, 4, 5, 6 +*MATERIAL, NAME=MAT +*DENSITY +1.0 +*ELASTIC +30.0, 0.25 +*SHELL SECTION, ELSET=EALL, MATERIAL=MAT +0.2 +*BOUNDARY +1, 1, 1, 0.0 +1, 2, 6, 0.0 +2, 1, 1, 0.01 +2, 2, 6, 0.0 +3, 1, 1, 0.0 +3, 2, 6, 0.0 +4, 1, 1, 0.005 +4, 2, 6, 0.0 +5, 1, 1, 0.005 +5, 2, 6, 0.0 +6, 1, 1, 0.0 +6, 2, 6, 0.0 +*STEP +*STATIC +1.0, 1.0, 0.1, 1.0 +*END STEP diff --git a/tests/data/s8_static_patch.inp b/tests/data/s8_static_patch.inp new file mode 100644 index 0000000..4fdca62 --- /dev/null +++ b/tests/data/s8_static_patch.inp @@ -0,0 +1,41 @@ +*HEADING +FemLite S8 static membrane patch verification +*NODE +1, 0.0, 0.0, 0.0 +2, 1.0, 0.0, 0.0 +3, 1.0, 1.0, 0.0 +4, 0.0, 1.0, 0.0 +5, 0.5, 0.0, 0.0 +6, 1.0, 0.5, 0.0 +7, 0.5, 1.0, 0.0 +8, 0.0, 0.5, 0.0 +*ELEMENT, TYPE=S8, ELSET=EALL +1, 1, 2, 3, 4, 5, 6, 7, 8 +*MATERIAL, NAME=MAT +*DENSITY +1.0 +*ELASTIC +30.0, 0.25 +*SHELL SECTION, ELSET=EALL, MATERIAL=MAT +0.2 +*BOUNDARY +1, 1, 1, 0.0 +1, 2, 6, 0.0 +2, 1, 1, 0.01 +2, 2, 6, 0.0 +3, 1, 1, 0.01 +3, 2, 6, 0.0 +4, 1, 1, 0.0 +4, 2, 6, 0.0 +5, 1, 1, 0.005 +5, 2, 6, 0.0 +6, 1, 1, 0.01 +6, 2, 6, 0.0 +7, 1, 1, 0.005 +7, 2, 6, 0.0 +8, 1, 1, 0.0 +8, 2, 6, 0.0 +*STEP +*STATIC +1.0, 1.0, 0.1, 1.0 +*END STEP diff --git a/tests/interface/test_c_api.c b/tests/interface/test_c_api.c index d70e331..cab986b 100644 --- a/tests/interface/test_c_api.c +++ b/tests/interface/test_c_api.c @@ -51,7 +51,7 @@ int main(void) ierr = femlite_get_version(&major, &minor, &patch); if (ierr != 0) return check_ierr(ierr, 2); - if (major != 0 || minor != 2 || patch != 0) return 3; + if (major != 0 || minor != 3 || patch != 0) return 3; ierr = femlite_read_inp("examples/c3d4_one_element.inp"); if (ierr != 0) return check_ierr(ierr, 4); diff --git a/tests/module/test_contact.f90 b/tests/module/test_contact.f90 index 5d0f5dd..cf6b795 100644 --- a/tests/module/test_contact.f90 +++ b/tests/module/test_contact.f90 @@ -4,6 +4,8 @@ program test_contact use fem_database use fem_contact use fem_api + use fem_assembly_csr + use fem_sparse_csr implicit none real(rk), parameter :: TOL = 1.0e-10_rk @@ -11,6 +13,8 @@ program test_contact call check_plane_force() call check_target_node_only() call check_explicit_contact_step() + call check_surface_pair_force() + call check_surface_pair_tangent() contains @@ -107,6 +111,63 @@ contains if (ierr .ne. FEM_SUCCESS) call fail(27) end subroutine check_explicit_contact_step + subroutine check_surface_pair_force() + integer :: ierr + integer :: node + integer :: dof + + call setup_contact_shell_pair(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(30) + + call contact_apply_plane_forces(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(31) + + do node = 1, 4 + dof = dof_id(3,node) + call check_close(fcontact(dof), -2.5_rk, 32) + end do + do node = 5, 8 + dof = dof_id(3,node) + call check_close(fcontact(dof), 2.5_rk, 33) + end do + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(34) + end subroutine check_surface_pair_force + + subroutine check_surface_pair_tangent() + type(csr_matrix) :: kmat + integer :: ierr + integer :: stat + integer :: row + integer :: col + real(rk) :: value + + call setup_contact_shell_pair(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(40) + + call csr_init(kmat) + call assembly_build_csr_pattern(kmat, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(41) + call contact_apply_plane_tangent(kmat, ZERO, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(42) + + row = dof_id(3,5) + col = dof_id(3,5) + call csr_get_value(kmat, row, col, value, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(43) + call check_close(value, 62.5_rk, 44) + + col = dof_id(3,1) + call csr_get_value(kmat, row, col, value, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(45) + call check_close(value, -62.5_rk, 46) + + call csr_free(kmat, stat) + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(47) + end subroutine check_surface_pair_tangent + subroutine setup_basic_nodes(num_nodes, ierr) integer, intent(in) :: num_nodes integer, intent(out) :: ierr @@ -131,6 +192,71 @@ contains ierr = FEM_SUCCESS end subroutine setup_basic_nodes + subroutine setup_contact_shell_pair(ierr) + integer, intent(out) :: ierr + + call database_allocate_model(8, 2, 0, 2, 0, 2, 1, 0, 1, & + 0, 0, 0, 0, 0, ierr) + if (ierr .ne. FEM_SUCCESS) return + + node_id_ext(1:8) = (/ 1, 2, 3, 4, 5, 6, 7, 8 /) + coord0(:,1) = (/ ZERO, ZERO, ZERO /) + coord0(:,2) = (/ ONE, ZERO, ZERO /) + coord0(:,3) = (/ ONE, ONE, ZERO /) + coord0(:,4) = (/ ZERO, ONE, ZERO /) + coord0(:,5) = (/ ZERO, ZERO, -0.01_rk /) + coord0(:,6) = (/ ONE, ZERO, -0.01_rk /) + coord0(:,7) = (/ ONE, ONE, -0.01_rk /) + coord0(:,8) = (/ ZERO, ONE, -0.01_rk /) + coord = coord0 + + elem_id_ext(1) = 1 + elem_type(1) = 'S4' + elem_nnode(1) = 4 + elem_conn(:,1) = 0 + elem_conn(1:4,1) = (/ 1, 2, 3, 4 /) + elem_mat(1) = 1 + elem_sec(1) = 1 + + elem_id_ext(2) = 2 + elem_type(2) = 'S4' + elem_nnode(2) = 4 + elem_conn(:,2) = 0 + elem_conn(1:4,2) = (/ 5, 6, 7, 8 /) + elem_mat(2) = 1 + elem_sec(2) = 1 + + elset_name(1) = 'MASTER' + elset_start(1) = 1 + elset_count(1) = 1 + elset_items(1) = 1 + elset_name(2) = 'SLAVE' + elset_start(2) = 2 + elset_count(2) = 1 + elset_items(2) = 2 + + mat_name(1) = 'MAT' + mat_density(1) = ONE + mat_e(1) = 30.0_rk + mat_nu(1) = 0.25_rk + + section_type(1) = 'SHELL' + section_elset_name(1) = 'ALL' + section_material_name(1) = 'MAT' + section_thickness(1) = 0.1_rk + + call database_assign_dofs(ierr) + if (ierr .ne. FEM_SUCCESS) return + call database_allocate_contact_pair(1, ierr) + if (ierr .ne. FEM_SUCCESS) return + contact_pair_slave(1) = 'SLAVE' + contact_pair_master(1) = 'MASTER' + contact_pair_penalty(1) = 1000.0_rk + contact_pair_damping(1) = ZERO + contact_pair_search(1) = 0.1_rk + ierr = FEM_SUCCESS + end subroutine setup_contact_shell_pair + subroutine check_close(actual, expected, code) real(rk), intent(in) :: actual real(rk), intent(in) :: expected diff --git a/tests/module/test_element_stiffness.f90 b/tests/module/test_element_stiffness.f90 index 8d1100d..b35f918 100644 --- a/tests/module/test_element_stiffness.f90 +++ b/tests/module/test_element_stiffness.f90 @@ -12,6 +12,10 @@ program test_element_stiffness call check_c3d8_stiff() call check_c3d10_stiff() call check_c3d20_stiff() + call check_s3_stiff() + call check_s4_stiff() + call check_s6_stiff() + call check_s8_stiff() call check_bad_stiff_type() contains @@ -108,6 +112,98 @@ contains if (ierr .ne. FEM_SUCCESS) call fail(59) end subroutine check_c3d20_stiff + subroutine check_s3_stiff() + integer :: ierr + integer :: elem_dofs(MAX_TEST_DOF) + integer :: n_elem_dof + real(rk) :: ke(MAX_TEST_DOF,MAX_TEST_DOF) + + call setup_s3(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(80) + + call element_linear_stiffness(1, elem_dofs, n_elem_dof, ke, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(81) + if (n_elem_dof .ne. 18) call fail(82) + if (elem_dofs(1) .ne. 1 .or. elem_dofs(18) .ne. 18) call fail(83) + call check_symmetric(ke, n_elem_dof, 84) + call check_shell_rigid_translation(ke, n_elem_dof, 1, 85) + call check_shell_rigid_translation(ke, n_elem_dof, 2, 86) + call check_shell_rigid_translation(ke, n_elem_dof, 3, 87) + call check_positive_energy(ke, n_elem_dof, 88) + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(89) + end subroutine check_s3_stiff + + subroutine check_s4_stiff() + integer :: ierr + integer :: elem_dofs(MAX_TEST_DOF) + integer :: n_elem_dof + real(rk) :: ke(MAX_TEST_DOF,MAX_TEST_DOF) + + call setup_s4(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(60) + + call element_linear_stiffness(1, elem_dofs, n_elem_dof, ke, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(61) + if (n_elem_dof .ne. 24) call fail(62) + if (elem_dofs(1) .ne. 1 .or. elem_dofs(24) .ne. 24) call fail(63) + call check_symmetric(ke, n_elem_dof, 64) + call check_shell_rigid_translation(ke, n_elem_dof, 1, 65) + call check_shell_rigid_translation(ke, n_elem_dof, 2, 66) + call check_shell_rigid_translation(ke, n_elem_dof, 3, 67) + call check_positive_energy(ke, n_elem_dof, 68) + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(69) + end subroutine check_s4_stiff + + subroutine check_s6_stiff() + integer :: ierr + integer :: elem_dofs(MAX_TEST_DOF) + integer :: n_elem_dof + real(rk) :: ke(MAX_TEST_DOF,MAX_TEST_DOF) + + call setup_s6(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(90) + + call element_linear_stiffness(1, elem_dofs, n_elem_dof, ke, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(91) + if (n_elem_dof .ne. 36) call fail(92) + if (elem_dofs(1) .ne. 1 .or. elem_dofs(36) .ne. 36) call fail(93) + call check_symmetric(ke, n_elem_dof, 94) + call check_shell_rigid_translation(ke, n_elem_dof, 1, 95) + call check_shell_rigid_translation(ke, n_elem_dof, 2, 96) + call check_shell_rigid_translation(ke, n_elem_dof, 3, 97) + call check_positive_energy(ke, n_elem_dof, 98) + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(99) + end subroutine check_s6_stiff + + subroutine check_s8_stiff() + integer :: ierr + integer :: elem_dofs(MAX_TEST_DOF) + integer :: n_elem_dof + real(rk) :: ke(MAX_TEST_DOF,MAX_TEST_DOF) + + call setup_s8(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(100) + + call element_linear_stiffness(1, elem_dofs, n_elem_dof, ke, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(101) + if (n_elem_dof .ne. 48) call fail(102) + if (elem_dofs(1) .ne. 1 .or. elem_dofs(48) .ne. 48) call fail(103) + call check_symmetric(ke, n_elem_dof, 104) + call check_shell_rigid_translation(ke, n_elem_dof, 1, 105) + call check_shell_rigid_translation(ke, n_elem_dof, 2, 106) + call check_shell_rigid_translation(ke, n_elem_dof, 3, 107) + call check_positive_energy(ke, n_elem_dof, 108) + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(109) + end subroutine check_s8_stiff + subroutine check_bad_stiff_type() integer :: ierr integer :: elem_dofs(MAX_TEST_DOF) @@ -119,7 +215,7 @@ contains if (ierr .ne. FEM_SUCCESS) call fail(70) call fill_node_ids(4) elem_id_ext(1) = 1 - elem_type(1) = 'S4' + elem_type(1) = 'BAD' elem_nnode(1) = 4 elem_conn(:,1) = 0 elem_conn(1:4,1) = (/ 1, 2, 3, 4 /) @@ -262,6 +358,153 @@ contains call database_assign_dofs(ierr) end subroutine setup_c3d20 + subroutine setup_s3(ierr) + integer, intent(out) :: ierr + + call database_allocate_model(3, 1, 0, 1, 0, 1, 1, 0, 1, & + 0, 0, 0, 0, 0, ierr) + if (ierr .ne. FEM_SUCCESS) return + call fill_node_ids(3) + + coord0(:,1) = (/ ZERO, ZERO, ZERO /) + coord0(:,2) = (/ ONE, ZERO, ZERO /) + coord0(:,3) = (/ ZERO, ONE, ZERO /) + + elem_id_ext(1) = 1 + elem_type(1) = 'S3' + elem_nnode(1) = 3 + elem_conn(:,1) = 0 + elem_conn(1:3,1) = (/ 1, 2, 3 /) + elem_mat(1) = 1 + elem_sec(1) = 1 + + elset_name(1) = 'EALL' + elset_start(1) = 1 + elset_count(1) = 1 + elset_items(1) = 1 + + mat_name(1) = 'MAT' + mat_density(1) = ONE + mat_e(1) = 30.0_rk + mat_nu(1) = 0.25_rk + + section_type(1) = 'SHELL' + section_elset_name(1) = 'EALL' + section_material_name(1) = 'MAT' + section_thickness(1) = 0.2_rk + + call database_assign_dofs(ierr) + end subroutine setup_s3 + + subroutine setup_s4(ierr) + integer, intent(out) :: ierr + + call database_allocate_model(4, 1, 0, 1, 0, 1, 1, 0, 1, & + 0, 0, 0, 0, 0, ierr) + if (ierr .ne. FEM_SUCCESS) return + call fill_node_ids(4) + + coord0(:,1) = (/ ZERO, ZERO, ZERO /) + coord0(:,2) = (/ ONE, ZERO, ZERO /) + coord0(:,3) = (/ ONE, ONE, ZERO /) + coord0(:,4) = (/ ZERO, ONE, ZERO /) + + elem_id_ext(1) = 1 + elem_type(1) = 'S4' + elem_nnode(1) = 4 + elem_conn(:,1) = 0 + elem_conn(1:4,1) = (/ 1, 2, 3, 4 /) + elem_mat(1) = 1 + elem_sec(1) = 1 + + elset_name(1) = 'EALL' + elset_start(1) = 1 + elset_count(1) = 1 + elset_items(1) = 1 + + mat_name(1) = 'MAT' + mat_density(1) = ONE + mat_e(1) = 30.0_rk + mat_nu(1) = 0.25_rk + + section_type(1) = 'SHELL' + section_elset_name(1) = 'EALL' + section_material_name(1) = 'MAT' + section_thickness(1) = 0.2_rk + + call database_assign_dofs(ierr) + end subroutine setup_s4 + + subroutine setup_s6(ierr) + integer, intent(out) :: ierr + + call database_allocate_model(6, 1, 0, 1, 0, 1, 1, 0, 1, & + 0, 0, 0, 0, 0, ierr) + if (ierr .ne. FEM_SUCCESS) return + call fill_node_ids(6) + + coord0(:,1) = (/ ZERO, ZERO, ZERO /) + coord0(:,2) = (/ ONE, ZERO, ZERO /) + coord0(:,3) = (/ ZERO, ONE, ZERO /) + coord0(:,4) = HALF * (coord0(:,1) + coord0(:,2)) + coord0(:,5) = HALF * (coord0(:,2) + coord0(:,3)) + coord0(:,6) = HALF * (coord0(:,3) + coord0(:,1)) + + elem_id_ext(1) = 1 + elem_type(1) = 'S6' + elem_nnode(1) = 6 + elem_conn(:,1) = 0 + elem_conn(1:6,1) = (/ 1, 2, 3, 4, 5, 6 /) + call fill_shell_common() + call database_assign_dofs(ierr) + end subroutine setup_s6 + + subroutine setup_s8(ierr) + integer, intent(out) :: ierr + + call database_allocate_model(8, 1, 0, 1, 0, 1, 1, 0, 1, & + 0, 0, 0, 0, 0, ierr) + if (ierr .ne. FEM_SUCCESS) return + call fill_node_ids(8) + + coord0(:,1) = (/ ZERO, ZERO, ZERO /) + coord0(:,2) = (/ ONE, ZERO, ZERO /) + coord0(:,3) = (/ ONE, ONE, ZERO /) + coord0(:,4) = (/ ZERO, ONE, ZERO /) + coord0(:,5) = HALF * (coord0(:,1) + coord0(:,2)) + coord0(:,6) = HALF * (coord0(:,2) + coord0(:,3)) + coord0(:,7) = HALF * (coord0(:,3) + coord0(:,4)) + coord0(:,8) = HALF * (coord0(:,4) + coord0(:,1)) + + elem_id_ext(1) = 1 + elem_type(1) = 'S8' + elem_nnode(1) = 8 + elem_conn(:,1) = 0 + elem_conn(1:8,1) = (/ 1, 2, 3, 4, 5, 6, 7, 8 /) + call fill_shell_common() + call database_assign_dofs(ierr) + end subroutine setup_s8 + + subroutine fill_shell_common() + elem_mat(1) = 1 + elem_sec(1) = 1 + + elset_name(1) = 'EALL' + elset_start(1) = 1 + elset_count(1) = 1 + elset_items(1) = 1 + + mat_name(1) = 'MAT' + mat_density(1) = ONE + mat_e(1) = 30.0_rk + mat_nu(1) = 0.25_rk + + section_type(1) = 'SHELL' + section_elset_name(1) = 'EALL' + section_material_name(1) = 'MAT' + section_thickness(1) = 0.2_rk + end subroutine fill_shell_common + subroutine fill_node_ids(count) integer, intent(in) :: count integer :: i @@ -316,6 +559,26 @@ contains if (maxval(abs(y(1:n))) .gt. TOL) call fail(code) end subroutine check_rigid_translation + subroutine check_shell_rigid_translation(ke, n, idir, code) + real(rk), intent(in) :: ke(MAX_TEST_DOF,MAX_TEST_DOF) + integer, intent(in) :: n + integer, intent(in) :: idir + integer, intent(in) :: code + 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) + idir + x(pos) = ONE + end do + y(1:n) = matmul(ke(1:n,1:n), x(1:n)) + if (maxval(abs(y(1:n))) .gt. TOL) call fail(code) + end subroutine check_shell_rigid_translation + subroutine check_positive_energy(ke, n, code) real(rk), intent(in) :: ke(MAX_TEST_DOF,MAX_TEST_DOF) integer, intent(in) :: n diff --git a/tests/module/test_implicit_inp.f90 b/tests/module/test_implicit_inp.f90 index ab5a5f5..46c986b 100644 --- a/tests/module/test_implicit_inp.f90 +++ b/tests/module/test_implicit_inp.f90 @@ -1,9 +1,27 @@ program test_implicit_inp use fem_precision + use fem_control use fem_api implicit none real(rk), parameter :: TOL = 1.0e-10_rk + + call check_implicit_linear_compat() + call check_static_linear_inp() + call check_static_patch_file('tests/data/c3d8_static_patch.inp', 2, 0.01_rk, 60) + call check_static_patch_file('tests/data/c3d10_static_patch.inp', 2, 0.01_rk, 80) + call check_static_patch_file('tests/data/c3d20_static_patch.inp', 2, 0.01_rk, 100) + call check_shell_static_patch('tests/data/s4_static_patch.inp', 2, 130) + call check_shell_static_patch('tests/data/s3_static_patch.inp', 2, 160) + call check_shell_static_patch('tests/data/s6_static_patch.inp', 2, 190) + call check_shell_static_patch('tests/data/s8_static_patch.inp', 2, 220) + call check_static_nonlinear_elastic() + call check_static_nonlinear_j2_disp() + call check_implicit_newmark_inp() + +contains + + subroutine check_implicit_linear_compat() integer :: ierr integer :: iter integer :: step @@ -43,7 +61,392 @@ program test_implicit_inp call fem_finalize(ierr) if (ierr .ne. 0) call fail(16) -contains + end subroutine check_implicit_linear_compat + + subroutine check_static_linear_inp() + integer :: ierr + integer :: iter + integer :: step + integer :: max_steps + logical :: user_dt + real(rk) :: res_norm + real(rk) :: time + real(rk) :: dt + real(rk) :: end_time + real(rk) :: displacement(NDIM) + real(rk) :: velocity(NDIM) + real(rk) :: acceleration(NDIM) + integer :: query_nodes(4) + real(rk) :: reactions(NDOF_NODE,4) + integer :: query_elems(1) + real(rk) :: stress_out(NSTRESS,1) + real(rk) :: strain_out(NSTRESS,1) + real(rk) :: plastic_strain(NSTRESS,1) + real(rk) :: eqps(1) + real(rk) :: damage(1) + + call fem_initialize(ierr) + if (ierr .ne. 0) call fail(20) + + call fem_read_inp('tests/data/c3d4_static_pull.inp', ierr) + if (ierr .ne. 0) call fail(21) + + if (analysis_type .ne. ANALYSIS_STATIC_LINEAR) call fail(22) + call fem_get_time_control(dt, end_time, max_steps, user_dt, ierr) + if (ierr .ne. 0) call fail(23) + call check_close(dt, 0.1_rk, 24) + call check_close(end_time, ONE, 25) + if (.not. user_dt) call fail(26) + if (max_steps .ne. 10) call fail(27) + if (max_increment .ne. 10) call fail(28) + + call fem_build_model(ierr) + if (ierr .ne. 0) call fail(29) + + call fem_solve_static_linear(50, 1.0e-12_rk, iter, res_norm, ierr) + if (ierr .ne. 0) call fail(30) + if (iter .le. 0 .or. iter .gt. 5) call fail(31) + if (res_norm .gt. TOL) call fail(32) + + call fem_get_node_kinematics(2, displacement, velocity, acceleration, ierr) + if (ierr .ne. 0) call fail(33) + call check_close(displacement(1), 5.0_rk / 6.0_rk, 34) + call check_close(displacement(2), ZERO, 35) + call check_close(displacement(3), ZERO, 36) + call check_close(maxval(abs(velocity)), ZERO, 37) + call check_close(maxval(abs(acceleration)), ZERO, 38) + + call fem_get_current_time(time, step, ierr) + if (ierr .ne. 0) call fail(39) + call check_close(time, ONE, 40) + if (step .ne. 1) call fail(41) + + query_nodes(1) = 1 + query_nodes(2) = 2 + query_nodes(3) = 3 + query_nodes(4) = 4 + call fem_get_nodal_reactions(4, query_nodes, reactions, ierr) + if (ierr .ne. 0) call fail(42) + call check_close(sum(reactions(1,:)), -5.0_rk, 43) + call check_close(sum(reactions(2,:)), ZERO, 44) + call check_close(sum(reactions(3,:)), ZERO, 45) + + query_elems(1) = 1 + call fem_get_element_average_state(1, query_elems, stress_out, strain_out, & + plastic_strain, eqps, damage, ierr) + if (ierr .ne. 0) call fail(46) + call check_close(strain_out(1,1), 5.0_rk / 6.0_rk, 47) + call check_close(strain_out(2,1), ZERO, 48) + call check_close(strain_out(3,1), ZERO, 49) + call check_close(stress_out(1,1), 30.0_rk, 50) + call check_close(stress_out(2,1), 10.0_rk, 51) + call check_close(stress_out(3,1), 10.0_rk, 52) + call check_close(maxval(abs(stress_out(4:6,1))), ZERO, 53) + + call fem_finalize(ierr) + if (ierr .ne. 0) call fail(54) + end subroutine check_static_linear_inp + + subroutine check_static_nonlinear_elastic() + integer :: ierr + integer :: iter + integer :: step + integer :: query_nodes(4) + integer :: query_elems(1) + real(rk) :: res_norm + real(rk) :: time + real(rk) :: displacement(NDIM) + real(rk) :: velocity(NDIM) + real(rk) :: acceleration(NDIM) + real(rk) :: reactions(NDOF_NODE,4) + real(rk) :: stress_out(NSTRESS,1) + real(rk) :: strain_out(NSTRESS,1) + real(rk) :: plastic_strain(NSTRESS,1) + real(rk) :: eqps(1) + real(rk) :: damage(1) + + call fem_initialize(ierr) + if (ierr .ne. 0) call fail(250) + + call fem_read_inp('tests/data/c3d4_static_nonlinear_elastic.inp', ierr) + if (ierr .ne. 0) call fail(251) + if (max_increment .ne. 4) call fail(252) + + call fem_build_model(ierr) + if (ierr .ne. 0) call fail(253) + + call fem_solve_static_nonlinear(4, 50, 1.0e-12_rk, iter, res_norm, ierr) + if (ierr .ne. 0) call fail(254) + if (iter .le. 0 .or. iter .gt. 12) call fail(255) + if (res_norm .gt. TOL) call fail(256) + + call fem_get_node_kinematics(2, displacement, velocity, acceleration, ierr) + if (ierr .ne. 0) call fail(257) + call check_close(displacement(1), 5.0_rk / 6.0_rk, 258) + call check_close(displacement(2), ZERO, 259) + call check_close(displacement(3), ZERO, 260) + call check_close(maxval(abs(velocity)), ZERO, 261) + call check_close(maxval(abs(acceleration)), ZERO, 262) + + call fem_get_current_time(time, step, ierr) + if (ierr .ne. 0) call fail(263) + call check_close(time, ONE, 264) + if (step .ne. 4) call fail(265) + + query_nodes(1) = 1 + query_nodes(2) = 2 + query_nodes(3) = 3 + query_nodes(4) = 4 + call fem_get_nodal_reactions(4, query_nodes, reactions, ierr) + if (ierr .ne. 0) call fail(266) + call check_close(sum(reactions(1,:)), -5.0_rk, 267) + call check_close(sum(reactions(2,:)), ZERO, 268) + call check_close(sum(reactions(3,:)), ZERO, 269) + + query_elems(1) = 1 + call fem_get_element_average_state(1, query_elems, stress_out, strain_out, & + plastic_strain, eqps, damage, ierr) + if (ierr .ne. 0) call fail(270) + call check_close(strain_out(1,1), 5.0_rk / 6.0_rk, 271) + call check_close(stress_out(1,1), 30.0_rk, 272) + call check_close(stress_out(2,1), 10.0_rk, 273) + call check_close(stress_out(3,1), 10.0_rk, 274) + call check_close(maxval(abs(stress_out(4:6,1))), ZERO, 275) + + call fem_finalize(ierr) + if (ierr .ne. 0) call fail(276) + end subroutine check_static_nonlinear_elastic + + subroutine check_static_nonlinear_j2_disp() + integer :: ierr + integer :: iter + integer :: step + integer :: query_elems(1) + real(rk) :: res_norm + real(rk) :: time + real(rk) :: displacement(NDIM) + real(rk) :: velocity(NDIM) + real(rk) :: acceleration(NDIM) + real(rk) :: stress_out(NSTRESS,1) + real(rk) :: strain_out(NSTRESS,1) + real(rk) :: plastic_strain(NSTRESS,1) + real(rk) :: eqps(1) + real(rk) :: damage(1) + + call fem_initialize(ierr) + if (ierr .ne. 0) call fail(300) + + call fem_read_inp('tests/data/c3d4_static_nonlinear_j2_disp.inp', ierr) + if (ierr .ne. 0) call fail(301) + if (max_increment .ne. 4) call fail(302) + + call fem_build_model(ierr) + if (ierr .ne. 0) call fail(303) + + call fem_solve_static_nonlinear(4, 50, 1.0e-12_rk, iter, res_norm, ierr) + if (ierr .ne. 0) call fail(304) + if (iter .le. 0 .or. iter .gt. 4) call fail(305) + if (res_norm .gt. TOL) call fail(306) + + call fem_get_node_kinematics(2, displacement, velocity, acceleration, ierr) + if (ierr .ne. 0) call fail(307) + call check_close(displacement(1), 0.05_rk, 308) + call check_close(displacement(2), ZERO, 309) + call check_close(displacement(3), ZERO, 310) + + call fem_get_current_time(time, step, ierr) + if (ierr .ne. 0) call fail(311) + call check_close(time, ONE, 312) + if (step .ne. 4) call fail(313) + + query_elems(1) = 1 + call fem_get_element_average_state(1, query_elems, stress_out, strain_out, & + plastic_strain, eqps, damage, ierr) + if (ierr .ne. 0) call fail(314) + call check_close(strain_out(1,1), 0.05_rk, 315) + if (eqps(1) .le. 1.0e-8_rk) call fail(316) + if (stress_out(1,1) .ge. 18.0_rk) call fail(317) + + call fem_finalize(ierr) + if (ierr .ne. 0) call fail(318) + end subroutine check_static_nonlinear_j2_disp + + subroutine check_implicit_newmark_inp() + integer :: ierr + integer :: iter + integer :: step + integer :: max_steps + logical :: user_dt + real(rk) :: res_norm + real(rk) :: time + real(rk) :: dt + real(rk) :: end_time + real(rk) :: displacement(NDIM) + real(rk) :: velocity(NDIM) + real(rk) :: acceleration(NDIM) + + call fem_initialize(ierr) + if (ierr .ne. 0) call fail(330) + + call fem_read_inp('tests/data/c3d4_implicit_newmark_pull.inp', ierr) + if (ierr .ne. 0) call fail(331) + call fem_get_time_control(dt, end_time, max_steps, user_dt, ierr) + if (ierr .ne. 0) call fail(332) + call check_close(dt, 0.1_rk, 333) + call check_close(end_time, 0.1_rk, 334) + if (.not. user_dt) call fail(335) + if (max_steps .ne. 1) call fail(336) + + call fem_set_output_interval(0, ierr) + if (ierr .ne. 0) call fail(337) + + call fem_build_model(ierr) + if (ierr .ne. 0) call fail(338) + + call fem_run_implicit_newmark(50, 1.0e-12_rk, iter, res_norm, ierr) + if (ierr .ne. 0) call fail(339) + if (iter .le. 0 .or. iter .gt. 5) call fail(340) + if (res_norm .gt. TOL) call fail(341) + + call fem_get_node_kinematics(2, displacement, velocity, acceleration, ierr) + if (ierr .ne. 0) call fail(342) + call check_close(displacement(1), 15.0_rk / 68.0_rk, 343) + call check_close(velocity(1), 75.0_rk / 17.0_rk, 344) + call check_close(acceleration(1), 1500.0_rk / 17.0_rk, 345) + call check_close(displacement(2), ZERO, 346) + call check_close(displacement(3), ZERO, 347) + + call fem_get_current_time(time, step, ierr) + if (ierr .ne. 0) call fail(348) + call check_close(time, 0.1_rk, 349) + if (step .ne. 1) call fail(350) + + call fem_finalize(ierr) + if (ierr .ne. 0) call fail(351) + end subroutine check_implicit_newmark_inp + + subroutine check_static_patch_file(path, probe_node, expected_ux, code_base) + character(len=*), intent(in) :: path + integer, intent(in) :: probe_node + real(rk), intent(in) :: expected_ux + integer, intent(in) :: code_base + integer :: ierr + integer :: iter + integer :: step + integer :: query_elems(1) + real(rk) :: res_norm + real(rk) :: time + real(rk) :: displacement(NDIM) + real(rk) :: velocity(NDIM) + real(rk) :: acceleration(NDIM) + real(rk) :: stress_out(NSTRESS,1) + real(rk) :: strain_out(NSTRESS,1) + real(rk) :: plastic_strain(NSTRESS,1) + real(rk) :: eqps(1) + real(rk) :: damage(1) + + call fem_initialize(ierr) + if (ierr .ne. 0) call fail(code_base + 1) + + call fem_read_inp(path, ierr) + if (ierr .ne. 0) call fail(code_base + 2) + if (analysis_type .ne. ANALYSIS_STATIC_LINEAR) call fail(code_base + 3) + + call fem_build_model(ierr) + if (ierr .ne. 0) call fail(code_base + 4) + + call fem_solve_static_linear(50, 1.0e-12_rk, iter, res_norm, ierr) + if (ierr .ne. 0) call fail(code_base + 5) + if (iter .le. 0 .or. iter .gt. 5) call fail(code_base + 6) + if (res_norm .gt. TOL) call fail(code_base + 7) + + call fem_get_node_kinematics(probe_node, displacement, velocity, acceleration, ierr) + if (ierr .ne. 0) call fail(code_base + 8) + call check_close(displacement(1), expected_ux, code_base + 9) + call check_close(displacement(2), ZERO, code_base + 10) + call check_close(displacement(3), ZERO, code_base + 11) + + query_elems(1) = 1 + call fem_get_element_average_state(1, query_elems, stress_out, strain_out, & + plastic_strain, eqps, damage, ierr) + if (ierr .ne. 0) call fail(code_base + 12) + call check_close(strain_out(1,1), 0.01_rk, code_base + 13) + call check_close(strain_out(2,1), ZERO, code_base + 14) + call check_close(strain_out(3,1), ZERO, code_base + 15) + call check_close(stress_out(1,1), 0.36_rk, code_base + 16) + call check_close(stress_out(2,1), 0.12_rk, code_base + 17) + call check_close(stress_out(3,1), 0.12_rk, code_base + 18) + call check_close(maxval(abs(stress_out(4:6,1))), ZERO, code_base + 19) + + call fem_get_current_time(time, step, ierr) + if (ierr .ne. 0) call fail(code_base + 20) + call check_close(time, ONE, code_base + 21) + if (step .ne. 1) call fail(code_base + 22) + + call fem_finalize(ierr) + if (ierr .ne. 0) call fail(code_base + 23) + end subroutine check_static_patch_file + + subroutine check_shell_static_patch(path, probe_node, code_base) + character(len=*), intent(in) :: path + integer, intent(in) :: probe_node + integer, intent(in) :: code_base + integer :: ierr + integer :: iter + integer :: step + integer :: query_elems(1) + real(rk) :: res_norm + real(rk) :: time + real(rk) :: displacement(NDIM) + real(rk) :: velocity(NDIM) + real(rk) :: acceleration(NDIM) + real(rk) :: stress_out(NSTRESS,1) + real(rk) :: strain_out(NSTRESS,1) + real(rk) :: plastic_strain(NSTRESS,1) + real(rk) :: eqps(1) + real(rk) :: damage(1) + + call fem_initialize(ierr) + if (ierr .ne. 0) call fail(code_base) + + call fem_read_inp(path, ierr) + if (ierr .ne. 0) call fail(code_base + 1) + if (analysis_type .ne. ANALYSIS_STATIC_LINEAR) call fail(code_base + 2) + + call fem_build_model(ierr) + if (ierr .ne. 0) call fail(code_base + 3) + + call fem_solve_static_linear(50, 1.0e-12_rk, iter, res_norm, ierr) + if (ierr .ne. 0) call fail(code_base + 4) + if (iter .le. 0 .or. iter .gt. 5) call fail(code_base + 5) + if (res_norm .gt. TOL) call fail(code_base + 6) + + call fem_get_node_kinematics(probe_node, displacement, velocity, acceleration, ierr) + if (ierr .ne. 0) call fail(code_base + 7) + call check_close(displacement(1), 0.01_rk, code_base + 8) + call check_close(displacement(2), ZERO, code_base + 9) + call check_close(displacement(3), ZERO, code_base + 10) + + query_elems(1) = 1 + call fem_get_element_average_state(1, query_elems, stress_out, strain_out, & + plastic_strain, eqps, damage, ierr) + if (ierr .ne. 0) call fail(code_base + 11) + call check_close(strain_out(1,1), 0.01_rk, code_base + 12) + call check_close(strain_out(2,1), ZERO, code_base + 13) + call check_close(strain_out(3,1), ZERO, code_base + 14) + call check_close(stress_out(1,1), 0.32_rk, code_base + 15) + call check_close(stress_out(2,1), 0.08_rk, code_base + 16) + call check_close(stress_out(3,1), ZERO, code_base + 17) + call check_close(maxval(abs(stress_out(4:6,1))), ZERO, code_base + 18) + + call fem_get_current_time(time, step, ierr) + if (ierr .ne. 0) call fail(code_base + 19) + call check_close(time, ONE, code_base + 20) + if (step .ne. 1) call fail(code_base + 21) + + call fem_finalize(ierr) + if (ierr .ne. 0) call fail(code_base + 22) + end subroutine check_shell_static_patch subroutine check_close(actual, expected, code) real(rk), intent(in) :: actual diff --git a/tests/module/test_shell_internal.f90 b/tests/module/test_shell_internal.f90 index fe22695..65bb89d 100644 --- a/tests/module/test_shell_internal.f90 +++ b/tests/module/test_shell_internal.f90 @@ -3,6 +3,7 @@ program test_shell_internal use fem_error use fem_database use fem_element_internal + use fem_element_stiffness use fem_quadrature use fem_shape_functions implicit none @@ -17,6 +18,7 @@ program test_shell_internal call check_s3_membrane_patch() call check_s4_membrane_patch() + call check_s4_j2_membrane_plastic() call check_s6_membrane_patch() call check_s8_membrane_patch() call check_shear_patch('S3', 1, 200) @@ -68,6 +70,33 @@ contains if (ierr .ne. FEM_SUCCESS) call fail(190) end subroutine check_s4_membrane_patch + subroutine check_s4_j2_membrane_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) + + call setup_s4_j2(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(451) + call apply_x_extension(EXX) + + call element_compute_internal_force(ierr, 0.1_rk) + if (ierr .ne. FEM_SUCCESS) call fail(452) + if (elem_status(1) .ne. 0) call fail(453) + if (statev(1,1) .le. ZERO) call fail(454) + if (statev(22,1) .le. ZERO) call fail(455) + if (abs(stress(1,1)) .ge. YOUNG * EXX) call fail(456) + + call element_linear_stiffness(1, elem_dofs, n_elem_dof, ke, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(457) + if (n_elem_dof .ne. 24) call fail(458) + call check_matrix_symmetric(ke, n_elem_dof, 459) + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(460) + end subroutine check_s4_j2_membrane_plastic + subroutine check_s6_membrane_patch() integer :: ierr @@ -252,6 +281,54 @@ contains call database_assign_dofs(ierr) end subroutine setup_s4 + subroutine setup_s4_j2(ierr) + integer, intent(out) :: ierr + + call database_allocate_model(4, 1, 0, 1, 0, 1, 1, 1, 1, & + 0, 0, 0, 0, 0, ierr) + if (ierr .ne. FEM_SUCCESS) return + + node_id_ext(1) = 1 + node_id_ext(2) = 2 + node_id_ext(3) = 3 + node_id_ext(4) = 4 + coord0(:,1) = (/ ZERO, ZERO, ZERO /) + coord0(:,2) = (/ ONE, ZERO, ZERO /) + coord0(:,3) = (/ ONE, ONE, ZERO /) + coord0(:,4) = (/ ZERO, ONE, ZERO /) + coord = coord0 + + elem_id_ext(1) = 1 + elem_type(1) = 'S4' + elem_nnode(1) = 4 + elem_conn(:,1) = 0 + elem_conn(1:4,1) = (/ 1, 2, 3, 4 /) + elem_mat(1) = 1 + elem_sec(1) = 1 + + elset_name(1) = 'EALL' + elset_start(1) = 1 + elset_count(1) = 1 + elset_items(1) = 1 + + mat_name(1) = 'MAT' + mat_density(1) = ONE + mat_e(1) = YOUNG + mat_nu(1) = POISSON + mat_plastic_model(1) = 'J2' + mat_plastic_start(1) = 1 + mat_plastic_count(1) = 1 + mat_plastic_stress(1) = 0.05_rk + mat_plastic_strain(1) = ZERO + + section_type(1) = 'SHELL' + section_elset_name(1) = 'EALL' + section_material_name(1) = 'MAT' + section_thickness(1) = THICKNESS + + call database_assign_dofs(ierr) + end subroutine setup_s4_j2 + subroutine setup_s6(ierr) integer, intent(out) :: ierr @@ -553,6 +630,20 @@ contains end do end subroutine check_vector_close + subroutine check_matrix_symmetric(mat, n, code) + real(rk), intent(in) :: mat(:,:) + integer, intent(in) :: n + integer, intent(in) :: code + integer :: i + integer :: j + + do i = 1, n + do j = 1, n + if (abs(mat(i,j) - mat(j,i)) .gt. 1.0e-8_rk) call fail(code) + end do + end do + end subroutine check_matrix_symmetric + subroutine fail(code) integer, intent(in) :: code diff --git a/tests/module/test_solver_implicit.f90 b/tests/module/test_solver_implicit.f90 index b0dfd1d..b80abd7 100644 --- a/tests/module/test_solver_implicit.f90 +++ b/tests/module/test_solver_implicit.f90 @@ -1,8 +1,10 @@ program test_solver_implicit use fem_precision use fem_error + use fem_control use fem_database use fem_boundary + use fem_element_mass use fem_solver_implicit implicit none @@ -14,6 +16,13 @@ program test_solver_implicit call check_robin_implicit_spring() call check_mpc_explicit_force() call check_mpc_implicit_penalty() + call check_newmark_mass_damping() + call check_newmark_nonlinear_elastic() + call check_newmark_nonlinear_robin() + call check_newmark_nonlinear_mpc() + call check_newmark_nonlinear_contact() + call check_newmark_trial_rollback() + call check_static_cutback_rollback() contains @@ -194,6 +203,247 @@ contains if (ierr .ne. FEM_SUCCESS) call fail(67) end subroutine check_mpc_implicit_penalty + subroutine check_newmark_mass_damping() + integer :: ierr + integer :: iter + integer :: dof + real(rk) :: res_norm + + call setup_pull_model(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(70) + call element_compute_lumped_mass(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(71) + + current_time = ZERO + rayleigh_alpha_mass = 2.0_rk + rayleigh_beta_stiffness = ZERO + + call implicit_advance_newmark_linear(0.1_rk, 0.25_rk, 0.5_rk, & + 50, 1.0e-12_rk, iter, res_norm, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(72) + if (iter .le. 0 .or. iter .gt. 5) call fail(73) + if (res_norm .gt. TOL) call fail(74) + + dof = dof_id(1,2) + call check_close(u(dof), 15.0_rk / 73.0_rk, 75) + call check_close(v(dof), 300.0_rk / 73.0_rk, 76) + call check_close(a(dof), 6000.0_rk / 73.0_rk, 77) + call check_close(u(dof_id(2,2)), ZERO, 78) + call check_close(u(dof_id(3,2)), ZERO, 79) + + rayleigh_alpha_mass = ZERO + rayleigh_beta_stiffness = ZERO + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(80) + end subroutine check_newmark_mass_damping + + subroutine check_newmark_nonlinear_elastic() + integer :: ierr + integer :: iter + integer :: dof + real(rk) :: res_norm + + call setup_pull_model(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(90) + call element_compute_lumped_mass(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(91) + + current_time = ZERO + rayleigh_alpha_mass = ZERO + rayleigh_beta_stiffness = ZERO + + call implicit_newmark_nonlinear_step(0.1_rk, 0.25_rk, 0.5_rk, & + 50, 1.0e-12_rk, iter, res_norm, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(92) + if (iter .le. 0 .or. iter .gt. 5) call fail(93) + if (res_norm .gt. TOL) call fail(94) + + dof = dof_id(1,2) + call check_close(u(dof), 15.0_rk / 68.0_rk, 95) + call check_close(v(dof), 75.0_rk / 17.0_rk, 96) + call check_close(a(dof), 1500.0_rk / 17.0_rk, 97) + call check_close(u(dof_id(2,2)), ZERO, 98) + call check_close(u(dof_id(3,2)), ZERO, 99) + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(100) + end subroutine check_newmark_nonlinear_elastic + + subroutine check_newmark_nonlinear_robin() + integer :: ierr + integer :: iter + integer :: dof + real(rk) :: res_norm + + call setup_pull_model(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(110) + call database_allocate_robin(1, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(111) + call element_compute_lumped_mass(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(112) + + robin_target(1) = '2' + robin_dof(1) = 1 + robin_stiffness(1) = 6.0_rk + robin_damping(1) = ZERO + robin_reference(1) = 0.25_rk + robin_amp(1) = 0 + + current_time = ZERO + call implicit_newmark_nonlinear_step(0.1_rk, 0.25_rk, 0.5_rk, & + 50, 1.0e-12_rk, iter, res_norm, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(113) + if (iter .le. 0 .or. iter .gt. 5) call fail(114) + if (res_norm .gt. TOL) call fail(115) + + dof = dof_id(1,2) + call check_close(u(dof), 39.0_rk / 172.0_rk, 116) + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(117) + end subroutine check_newmark_nonlinear_robin + + subroutine check_newmark_nonlinear_mpc() + integer :: ierr + integer :: iter + integer :: dof + real(rk) :: res_norm + + call setup_single_free_dof_model(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(120) + call database_allocate_mpc(1, 1, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(121) + call element_compute_lumped_mass(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(122) + + mpc_start(1) = 1 + mpc_count(1) = 1 + mpc_rhs(1) = 0.25_rk + mpc_penalty(1) = 6.0_rk + mpc_node(1) = 2 + mpc_dof(1) = 1 + mpc_coeff(1) = ONE + + current_time = ZERO + call implicit_newmark_nonlinear_step(0.1_rk, 0.25_rk, 0.5_rk, & + 50, 1.0e-12_rk, iter, res_norm, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(123) + if (iter .le. 0 .or. iter .gt. 5) call fail(124) + if (res_norm .gt. TOL) call fail(125) + + dof = dof_id(1,2) + call check_close(u(dof), 9.0_rk / 172.0_rk, 126) + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(127) + end subroutine check_newmark_nonlinear_mpc + + subroutine check_newmark_nonlinear_contact() + integer :: ierr + integer :: iter + integer :: dof + real(rk) :: res_norm + + call setup_single_free_dof_model(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(130) + call database_allocate_contact(1, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(131) + call element_compute_lumped_mass(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(132) + + contact_target(1) = '2' + contact_normal(:,1) = (/ ONE, ZERO, ZERO /) + contact_offset(1) = 1.1_rk + contact_penalty(1) = 10.0_rk + contact_damping(1) = ZERO + + current_time = ZERO + call implicit_newmark_nonlinear_step(0.1_rk, 0.25_rk, 0.5_rk, & + 50, 1.0e-12_rk, iter, res_norm, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(133) + if (iter .le. 0 .or. iter .gt. 5) call fail(134) + if (res_norm .gt. TOL) call fail(135) + + dof = dof_id(1,2) + call check_close(u(dof), 3.0_rk / 98.0_rk, 136) + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(137) + end subroutine check_newmark_nonlinear_contact + + subroutine check_newmark_trial_rollback() + integer :: ierr + integer :: iter + integer :: dof + real(rk) :: res_norm + + call setup_single_free_dof_model(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(140) + call element_compute_lumped_mass(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(141) + + dof = dof_id(1,2) + u(dof) = 0.2_rk + current_time = ZERO + call implicit_newmark_nonlinear_step(0.1_rk, 0.25_rk, 0.5_rk, & + 1, 1.0e-30_rk, iter, res_norm, ierr) + if (ierr .eq. FEM_SUCCESS) call fail(142) + if (.not. allocated(stress)) call fail(143) + if (maxval(abs(stress)) .gt. TOL) call fail(144) + if (maxval(abs(strain)) .gt. TOL) call fail(145) + if (maxval(abs(statev)) .gt. TOL) call fail(146) + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(147) + end subroutine check_newmark_trial_rollback + + subroutine check_static_cutback_rollback() + integer :: ierr + integer :: iter + real(rk) :: res_norm + logical :: old_cutback + integer :: old_max_cutback + real(rk) :: old_min_increment + real(rk) :: old_cutback_factor + + call setup_pull_model(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(150) + + old_cutback = allow_step_cutback + old_max_cutback = max_cutback + old_min_increment = static_min_increment + old_cutback_factor = cutback_factor + + allow_step_cutback = .true. + max_cutback = 2 + static_min_increment = 0.2_rk + cutback_factor = 0.5_rk + current_time = ZERO + + call implicit_solve_nonlinear_static(ONE, 1, 1, 1.0e-30_rk, & + iter, res_norm, ierr) + if (ierr .eq. FEM_SUCCESS) call fail(151) + if (abs(current_time) .gt. TOL) call fail(152) + if (maxval(abs(u)) .gt. TOL) call fail(153) + if (allocated(stress)) then + if (maxval(abs(stress)) .gt. TOL) call fail(154) + end if + if (allocated(strain)) then + if (maxval(abs(strain)) .gt. TOL) call fail(155) + end if + if (allocated(statev)) then + if (maxval(abs(statev)) .gt. TOL) call fail(156) + end if + + allow_step_cutback = old_cutback + max_cutback = old_max_cutback + static_min_increment = old_min_increment + cutback_factor = old_cutback_factor + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(157) + end subroutine check_static_cutback_rollback + subroutine setup_pull_model(ierr) integer, intent(out) :: ierr @@ -293,7 +543,7 @@ contains integer, intent(out) :: ierr integer :: i - call database_allocate_model(4, 1, 0, 0, 0, 0, 1, 0, 0, & + call database_allocate_model(4, 1, 0, 0, 0, 0, 1, 0, 1, & 0, 0, num_bc, num_cload, 0, ierr) if (ierr .ne. FEM_SUCCESS) return @@ -314,6 +564,10 @@ contains elem_mat(1) = 1 elem_sec(1) = 1 + section_type(1) = 'SOLID' + section_elset_name(1) = 'EALL' + section_material_name(1) = 'MAT' + mat_name(1) = 'MAT' mat_density(1) = ONE mat_e(1) = 30.0_rk diff --git a/tests/performance/perf_p1.f90 b/tests/performance/perf_p1.f90 index 6f2b575..527c580 100644 --- a/tests/performance/perf_p1.f90 +++ b/tests/performance/perf_p1.f90 @@ -40,7 +40,7 @@ program perf_p1 call fem_get_version(major, minor, patch, ierr) call exit_if_error(ierr) - if (major .ne. 0 .or. minor .ne. 1 .or. patch .ne. 0) then + if (major .ne. 0 .or. minor .ne. 3 .or. patch .ne. 0) then write(*,'(A,I1,A,I1,A,I1)') 'unexpected FemLite version ', major, '.', minor, '.', patch call exit(3) end if diff --git a/tests/unit/test_material_j2.f90 b/tests/unit/test_material_j2.f90 index 2a36813..5283bc0 100644 --- a/tests/unit/test_material_j2.f90 +++ b/tests/unit/test_material_j2.f90 @@ -24,6 +24,7 @@ program test_material_j2 real(rk) :: stress_low_rate real(rk) :: temp_expected real(rk) :: spin_inc(3) + real(rk) :: dmat(NSTRESS,NSTRESS) call setup_elastic(ierr) if (ierr .ne. FEM_SUCCESS) stop 1 @@ -83,6 +84,10 @@ program test_material_j2 if (abs(stress_new(2)) .gt. TOL * sigma_expected) stop 22 if (abs(stress_new(3)) .gt. TOL * sigma_expected) stop 23 if (abs(state_new(1) - eqps_expected) .gt. TOL * eqps_expected) stop 24 + call material_tangent_small_strain(1, stress_new, state_new, dmat, ierr) + if (ierr .ne. FEM_SUCCESS) stop 25 + if (dmat(1,1) .le. ZERO .or. dmat(1,1) .ge. E_TEST) stop 26 + if (abs(dmat(1,2) - dmat(2,1)) .gt. TOL * E_TEST) stop 27 stress_old = stress_new state_old = state_new diff --git a/tests/unit/test_smoke.f90 b/tests/unit/test_smoke.f90 index 1b4d16f..5a778e9 100644 --- a/tests/unit/test_smoke.f90 +++ b/tests/unit/test_smoke.f90 @@ -93,7 +93,7 @@ program test_smoke call fem_get_version(major, minor, patch, ierr) if (ierr .ne. 0) stop 2 if (major .ne. 0) stop 3 - if (minor .ne. 2) stop 4 + if (minor .ne. 3) stop 4 if (patch .ne. 0) stop 5 call fem_read_inp('examples/c3d4_one_element.inp', ierr)