Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 108c646f39 | |||
| dd13b44890 | |||
| 8710688540 |
+11
-1
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
project(FemLite
|
||||
VERSION 0.3.0
|
||||
VERSION 0.3.2
|
||||
LANGUAGES C Fortran
|
||||
)
|
||||
|
||||
@@ -13,6 +13,7 @@ FortranCInterface_HEADER(
|
||||
MACRO_NAMESPACE "FC_"
|
||||
)
|
||||
find_package(Python3 COMPONENTS Interpreter)
|
||||
option(FEMLITE_ENABLE_OPENMP "Enable OpenMP acceleration for contact BVH search" ON)
|
||||
|
||||
set(CMAKE_Fortran_STANDARD 95)
|
||||
set(CMAKE_Fortran_STANDARD_REQUIRED ON)
|
||||
@@ -78,6 +79,15 @@ target_include_directories(femlite_core PUBLIC
|
||||
|
||||
femlite_apply_fortran_options(femlite_core)
|
||||
|
||||
if(FEMLITE_ENABLE_OPENMP)
|
||||
find_package(OpenMP)
|
||||
if(OpenMP_Fortran_FOUND)
|
||||
target_link_libraries(femlite_core PUBLIC OpenMP::OpenMP_Fortran)
|
||||
else()
|
||||
message(WARNING "OpenMP Fortran was requested but not found; contact BVH search will run serially.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(femlite_c STATIC
|
||||
src/interface/fem_c_api.c
|
||||
)
|
||||
|
||||
@@ -392,7 +392,7 @@ coupling 层职责:
|
||||
- 接触状态、接触力和接触功输出
|
||||
- 隐式增量残差和迭代次数输出
|
||||
|
||||
第三版当前接触模块保留刚性平面接触,并新增基于边界 facet 的面-面 contact pair force/tangent 路径。完整接触状态、接触功和搜索加速仍属于后续输出与算法增强项。
|
||||
第三版当前接触模块保留刚性平面接触,并新增基于边界 facet 的面-面 contact pair force/tangent 路径。0.3.1 已补充投影裁剪面积积分、多 master 面积上限修正、Coulomb 摩擦、均匀空间网格候选搜索、facet 空间 broad-phase 精筛,以及接触状态/接触功 CSV 与 API 输出。0.3.2 已补充投影交叠域 mortar 形函数积分、接触对级粘滑历史变量、stick/slip/累计滑移输出,以及可选 OpenMP 的 master facet BVH 宽相搜索。
|
||||
|
||||
输出控制:
|
||||
|
||||
|
||||
@@ -820,7 +820,7 @@ end subroutine
|
||||
当前非线性 Newmark-Newton 实现约定:
|
||||
|
||||
- 实体单元切线从当前积分点材料状态取得弹性/J2 算法切线。
|
||||
- 壳单元膜内项对 J2/J2_JC 使用当前积分点算法切线,弯曲和横向剪切项暂用弹性近似切线。
|
||||
- 壳单元膜内、弯曲和横向剪切 section tangent 对 J2/J2_JC 使用当前积分点算法切线映射。
|
||||
- 每个非线性增量保存材料状态和单元状态备份,迭代试算前恢复,收敛后提交,失败后回滚。
|
||||
- Robin、MPC、刚性平面 penalty contact 和面-面 contact pair 的切线进入 Newton 有效刚度。
|
||||
- 静力和非线性 Newmark 均支持线搜索;可选步长缩减在失败时恢复增量起点状态后重试。
|
||||
@@ -897,6 +897,7 @@ elements_step_xxxxx.csv 至少包含:
|
||||
- `convergence.csv`:静力和隐式动力增量迭代历史。
|
||||
- `reactions_step_xxxxx.csv`:节点反力。
|
||||
- `contact_step_xxxxx.csv`:接触状态、接触力和接触功。
|
||||
当前字段为 `kind,pair_id,active_count,max_penetration,force_norm,work_estimate,cumulative_work,stick_count,slip_count,accumulated_slip,ftx,fty,ftz`,包含 summary 行和逐 contact pair 行。
|
||||
- 静力求解结束后必须写出与显式结果一致的 VTK 场文件。
|
||||
|
||||
## 19. 主程序模块
|
||||
|
||||
@@ -700,7 +700,7 @@ for each load increment:
|
||||
当前 V3.4/V3.5 阶段实现采用 Newton 形式:
|
||||
|
||||
- 残差使用当前位移下的非线性内力 `F_int(u,state)`。
|
||||
- 实体单元切线使用当前积分点弹性/J2 算法切线;壳单元膜内项对 J2/J2_JC 使用当前积分点算法切线,壳弯曲和横向剪切项暂保留弹性近似。
|
||||
- 实体单元切线使用当前积分点弹性/J2 算法切线;壳单元膜内、弯曲和横向剪切 section tangent 对 J2/J2_JC 使用当前积分点算法切线映射。
|
||||
- Dirichlet、CLOAD、DLOAD、Robin、MPC、SPH/contact 外力向量进入静力残差。
|
||||
- Robin、MPC、刚性平面 penalty contact 和面-面 contact pair 切线进入 Newton 切线矩阵。
|
||||
- 材料状态和单元删除标志采用增量级 trial/restore/commit;非收敛时恢复到增量起点。
|
||||
@@ -756,12 +756,12 @@ 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 状态后重试。
|
||||
当前实现中 `K_eff` 使用当前实体材料算法切线、壳 section 塑性算法切线、集中质量矩阵、Rayleigh 阻尼和外部约束/接触切线形成。收敛判据使用绝对力残差和相对力残差,Dirichlet 约束自由度的位移增量残差置零。非线性 Newmark 支持线搜索;可选步长缩减在单步失败时恢复运动学量和材料 trial 状态后重试。
|
||||
|
||||
当前限制:
|
||||
|
||||
- Rayleigh 阻尼已在线性 Newmark 和非线性 Newmark-Newton 骨架中接入。
|
||||
- 实体 J2 非线性 Newmark 使用当前积分点算法切线,壳膜内 J2/J2_JC 使用当前积分点算法切线,壳弯曲/剪切塑性切线仍为后续增强项。
|
||||
- 实体 J2 非线性 Newmark 使用当前积分点算法切线,壳膜内、弯曲和横向剪切 section tangent 对 J2/J2_JC 使用当前积分点算法切线映射。
|
||||
- 材料状态和单元删除标志已具备 trial/restore/commit 机制。
|
||||
- Robin 和 MPC 的非线性动力切线已接入 `K_eff`。
|
||||
- 刚性平面 contact 和面-面 contact pair 的 penalty/damping 切线已接入 `K_eff`。
|
||||
@@ -788,18 +788,20 @@ K_eff Delta_u = R
|
||||
- 面-面接触框架。
|
||||
- 接触法向与穿透量。
|
||||
- 接触阻尼。
|
||||
- 摩擦接口预留。
|
||||
- Coulomb 摩擦力和切向近似切线。
|
||||
- 静力接触和动力接触统一残差接口。
|
||||
- 接触功输出。
|
||||
|
||||
当前第三版阶段实现:
|
||||
|
||||
- 刚性平面接触仍采用节点到平面的 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 积分、精确面内投影裁剪、空间加速搜索和完整接触功统计。
|
||||
- 面-面 contact pair 使用边界 facet 的当前构形坐标、速度、法向、面积、中心和等效半径。
|
||||
- slave facet 沿 master 法向投影到 master facet 平面,在局部二维坐标中执行多边形裁剪;裁剪面积大于零且法向间隙为负时激活。多个 master facet 同时激活时按裁剪面积贡献,且总面积不超过 slave facet 面积。
|
||||
- 0.3.2 在投影交叠多边形上做三角剖分和 Dunavant 积分,计算 `int Ns dA`、`int Nm dA`、`int Ns Ns dA`、`int Ns Nm dA`、`int Nm Ns dA` 和 `int Nm Nm dA`,用于接触力分配和切线块装配。
|
||||
- 接触法向力为 `penalty * penetration * mortar_area` 加可选法向阻尼项;切向力采用接触对级历史切向力 trial、Coulomb 极限和返回映射式粘滑判定。
|
||||
- 接触切线采用法向 penalty/damping 块加切向摩擦近似块,按 mortar 形函数乘积积分装配 slave-slave、slave-master、master-slave 和 master-master 四类自由度耦合。
|
||||
- 当前实现包含 master facet 均匀空间网格候选搜索、master facet BVH 宽相搜索和 facet 中心/等效半径 broad-phase 精筛;OpenMP 可用时 BVH 搜索按 slave facet 并行遍历。接触状态记录激活贡献数、最大穿透量、接触力范数和 `0.5 * |F_contact| * penetration` 形式的接触功估计。
|
||||
- 0.3.2 输出 contact pair 的 stick/slip 计数、累计滑移和切向摩擦力历史。当前仍未实现工程级 mortar 约束求解、摩擦正则化参数体系和大规模接触收敛控制。
|
||||
|
||||
第一版不实现接触,只保留 fcontact 向量和接口位置。
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ end subroutine
|
||||
- `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 调试接口跟随扩展。
|
||||
- 非线性 Newmark Fortran95 接口当前接入实体 J2 算法切线、壳膜内/弯曲/剪切 J2/J2_JC section tangent、trial/restore/commit、线搜索、可选步长缩减、Robin/MPC 切线、刚性平面 penalty contact 切线和面-面 contact pair 切线;C ABI 和 Python 调试接口跟随扩展。
|
||||
|
||||
## 10. 载荷接口
|
||||
|
||||
@@ -544,10 +544,13 @@ end subroutine
|
||||
第三版提供接触结果查询接口:
|
||||
|
||||
```fortran
|
||||
subroutine fem_get_contact_summary(nactive_contact, contact_work, max_penetration, ierr)
|
||||
integer, intent(out) :: nactive_contact
|
||||
real(rk), intent(out) :: contact_work
|
||||
subroutine fem_get_contact_summary(active_count, work_step, work_total, &
|
||||
max_penetration, force_norm, ierr)
|
||||
integer, intent(out) :: active_count
|
||||
real(rk), intent(out) :: work_step
|
||||
real(rk), intent(out) :: work_total
|
||||
real(rk), intent(out) :: max_penetration
|
||||
real(rk), intent(out) :: force_norm
|
||||
integer, intent(out) :: ierr
|
||||
end subroutine
|
||||
```
|
||||
@@ -568,8 +571,19 @@ end subroutine
|
||||
- `contact_pair_penalty(pair)`:法向 penalty 刚度,必须大于 0。
|
||||
- `contact_pair_damping(pair)`:法向阻尼,必须非负。
|
||||
- `contact_pair_search(pair)`:搜索距离,0 表示只按 facet 等效半径过滤。
|
||||
- `contact_pair_friction(pair)`:Coulomb 摩擦系数,必须非负;0 表示无摩擦。
|
||||
|
||||
当前 contact pair 查询统计仍以 `fem_get_contact_summary` 为目标接口,完整激活数量、最大穿透量和接触功统计将在接触输出阶段补齐。
|
||||
当前 contact pair 支持投影裁剪 mortar 形函数积分、多 master facet 面积上限修正、Coulomb 粘滑历史、均匀空间网格候选搜索、OpenMP BVH 宽相搜索和 facet 空间 broad-phase 精筛。
|
||||
|
||||
接触统计包括:
|
||||
|
||||
- `contact_active_count`:最近一次接触力评估中的激活贡献数。
|
||||
- `contact_work_step`:最近一次接触力评估的接触功估计。
|
||||
- `contact_work_total`:累计接触功估计。
|
||||
- `contact_max_penetration`:最近一次接触力评估的最大穿透量。
|
||||
- `contact_force_norm`:最近一次接触力评估的接触力范数累加。
|
||||
|
||||
逐 contact pair 统计保存在 `contact_pair_active/work/max_penetration/force_norm`、`contact_pair_stick_count/slip_count/slip/tangent_force` 数组中,并写入 `contact_step_xxxxx.csv`。
|
||||
|
||||
## 13. 输出控制接口
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ SPH总力映射测试 relative tolerance 1.0e-10 to 1.0e-8
|
||||
- S4 选择性减缩积分路径。
|
||||
- S4 patch test。
|
||||
- S3/S4/S6/S8 线性静力刚度测试。
|
||||
- S4 J2/J2_JC 膜内塑性状态更新和膜内算法切线对称性测试。
|
||||
- S4 J2/J2_JC 膜内塑性状态更新和膜内/弯曲/剪切 section tangent 对称性测试。
|
||||
- Scordelis-Lo 壳静力位移基准测试。
|
||||
- 板壳弯曲静力基准测试。
|
||||
|
||||
@@ -264,13 +264,15 @@ SPH总力映射测试 relative tolerance 1.0e-10 to 1.0e-8
|
||||
- 面压力等效节点力。
|
||||
- amplitude 常值和表格插值。
|
||||
- 刚性平面 contact penalty/damping 力和切线。
|
||||
- 面-面 contact pair 法向力、阻尼项、CSR 图案和切线块。
|
||||
- 面-面 contact pair 法向力、阻尼项、Coulomb 粘滑历史、多 master 分摊、投影裁剪 mortar 权重、空间网格候选、BVH 宽相搜索、空间 broad-phase、CSR 图案和切线块。
|
||||
|
||||
输出测试:
|
||||
|
||||
- `history.csv` 字段存在。
|
||||
- `nodes_step_xxxxx.csv` 字段存在。
|
||||
- `elements_step_xxxxx.csv` 字段存在。
|
||||
- `contact_step_xxxxx.csv` 字段存在,并包含 summary 与逐 contact pair 行、stick/slip 计数、累计滑移和切向力历史。
|
||||
- `fem_get_contact_summary` 返回激活数、单步/累计接触功、最大穿透量和接触力范数。
|
||||
- 删除单元状态可输出。
|
||||
|
||||
## 11. 输入解析测试
|
||||
|
||||
+27
-18
@@ -189,7 +189,7 @@ FemLite 0.3.0 定位为:
|
||||
5. 失败回退和步长缩减。
|
||||
6. 小应变 J2 弹塑性静力路径。
|
||||
7. 大变形 Updated Lagrangian 静力路径。
|
||||
8. 实体 J2 算法切线,壳膜内 J2 算法切线,壳弯曲/剪切塑性切线后续完善。
|
||||
8. 实体 J2 算法切线,壳膜内/弯曲/剪切 section J2 算法切线。
|
||||
9. 材料状态 trial/commit 机制。
|
||||
|
||||
当前实现状态:
|
||||
@@ -198,12 +198,12 @@ FemLite 0.3.0 定位为:
|
||||
- 已实现命令行 `--static-nonlinear` 入口。
|
||||
- 已实现按 `*STATIC` 时间控制分增量加载。
|
||||
- 当前残差由 CLOAD、DLOAD、Robin、MPC、SPH、contact 外力和内力共同构成。
|
||||
- 实体单元切线按积分点材料状态使用弹性/J2 算法切线;壳单元膜内项对 J2/J2_JC 使用当前积分点算法切线,弯曲和横向剪切项暂保留弹性近似。
|
||||
- 实体单元切线按积分点材料状态使用弹性/J2 算法切线;壳单元膜内、弯曲和横向剪切 section tangent 对 J2/J2_JC 使用当前积分点算法切线映射。
|
||||
- 已实现材料状态和单元删除标志的 trial/restore/commit 机制,非收敛时恢复到增量起点。
|
||||
- 已接入 Robin、MPC、刚性平面 penalty contact 和面-面 contact pair 的非线性切线。
|
||||
- 已覆盖弹性非线性退化、位移控制 J2 塑性状态更新和 trial rollback 测试。
|
||||
- 已实现 Newton 线搜索;可选步长缩减支持在非收敛时回退到增量起点并缩小当前增量。
|
||||
- 壳弯曲/剪切塑性一致切线、节点-面接触、摩擦接触和接触输出统计仍需继续完善。
|
||||
- 节点-面接触、接触输出统计和更高阶接触积分仍需继续完善。
|
||||
|
||||
验收条件:
|
||||
|
||||
@@ -252,7 +252,7 @@ K_eff = K_t + a0 M + a1 C
|
||||
- 已提供 `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 对实体 J2 使用当前积分点算法切线;壳膜内、弯曲和横向剪切 section tangent 对 J2/J2_JC 使用当前积分点算法切线映射,更完整隐式动力基准仍需继续补充。
|
||||
- 已实现非线性 Newmark 线搜索;可选动态步长缩减在单步失败时恢复运动学量和材料 trial 状态后重试。
|
||||
|
||||
验收条件:
|
||||
@@ -273,7 +273,7 @@ K_eff = K_t + a0 M + a1 C
|
||||
1. `*SURFACE` 输入子集。
|
||||
2. `*CONTACT PAIR` 输入子集。
|
||||
3. 接触面数据结构。
|
||||
4. 朴素接触搜索,后续再优化为空间网格或 BVH。
|
||||
4. 接触搜索,采用均匀空间网格和可选 OpenMP BVH 宽相搜索。
|
||||
5. 节点-面接触。
|
||||
6. 面-面接触框架。
|
||||
7. penalty 法默认接触力。
|
||||
@@ -284,11 +284,15 @@ K_eff = K_t + a0 M + a1 C
|
||||
当前实现状态:
|
||||
|
||||
- 保留第二版刚性平面 penalty 接触路径。
|
||||
- 新增 `contact_pair_slave/master/penalty/damping/search` 集中式数据库数组,可通过 elset、element id 或 `ALL` 指定接触对目标。
|
||||
- 面-面接触采用边界 facet 的质心投影、法向间隙和 penalty/damping 法向力映射,当前用于小规模接触对验证。
|
||||
- 新增 `contact_pair_slave/master/penalty/damping/search/friction` 集中式数据库数组,可通过 elset、element id 或 `ALL` 指定接触对目标。
|
||||
- 面-面接触采用边界 facet 的当前构形、法向间隙和 penalty/damping 法向力映射;0.3.1 已从质心权重推进到 master 平面局部二维投影裁剪面积积分,并对重复 master 面做从面面积上限修正。
|
||||
- 0.3.2 已补充投影交叠域上的 mortar 形函数积分,面力和接触切线按 `Ns`、`Nm` 及其乘积积分分配到 slave/master 节点。
|
||||
- 0.3.2 支持基于接触对历史切向力的 Coulomb 粘滑判定,记录 stick/slip 计数、累计滑移和切向摩擦力历史。
|
||||
- 0.3.2 增加 master facet BVH 宽相搜索;启用 OpenMP 时按 slave facet 并行遍历 BVH,装配全局接触力/切线和摩擦历史时使用受保护临界区。
|
||||
- 0.3.1 新增全局和逐 contact pair 的激活数、最大穿透量、接触力范数和接触功估计统计;0.3.2 扩展 `contact_step_xxxxx.csv` 输出 stick/slip、累计滑移和切向力。
|
||||
- CSR 稀疏图案会为 contact pair 预留 slave-slave、slave-master、master-slave 和 master-master 切线块。
|
||||
- 已补充 contact pair 法向力和切线装配测试。
|
||||
- 当前尚未实现摩擦、mortar 接触、空间加速搜索、完整接触状态输出和工程级接触收敛控制。
|
||||
- 已补充 contact pair 法向力、摩擦力、多 master 分摊、投影裁剪面积、mortar 权重、空间网格/BVH 分支、粘滑历史、接触统计和切线装配测试。
|
||||
- 当前仍未实现工程级 mortar 约束求解、摩擦正则化参数体系和大规模接触收敛控制。
|
||||
|
||||
验收条件:
|
||||
|
||||
@@ -322,12 +326,17 @@ K_eff = K_t + a0 M + a1 C
|
||||
- my
|
||||
- mz
|
||||
3. `contact_step_xxxxx.csv`:
|
||||
- contact_id
|
||||
- node_id 或 facet_id
|
||||
- penetration
|
||||
- normal_force
|
||||
- tangential_force
|
||||
- contact_status
|
||||
- kind
|
||||
- pair_id
|
||||
- active_count
|
||||
- max_penetration
|
||||
- force_norm
|
||||
- work_estimate
|
||||
- cumulative_work
|
||||
- stick_count
|
||||
- slip_count
|
||||
- accumulated_slip
|
||||
- ftx, fty, ftz
|
||||
4. 静力 VTK 输出:
|
||||
- displacement
|
||||
- rotation
|
||||
@@ -441,8 +450,8 @@ P2 测试:
|
||||
- 先实现线性静力,再实现非线性静力。
|
||||
- 先实体,再壳;先 S4/S3,再 S6/S8。
|
||||
- Scordelis-Lo 作为壳静力主基准,分网格逐步验证。
|
||||
- 非线性静力先完成实体 J2 算法切线,再推进壳膜内塑性切线,最后补齐壳弯曲/剪切塑性一致切线。
|
||||
- 接触先保留刚性平面和朴素面-面框架,再补节点-面、摩擦和搜索加速。
|
||||
- 非线性静力先完成实体 J2 算法切线,再推进壳膜内塑性切线,0.3.1 补齐壳弯曲/剪切 section tangent 映射。
|
||||
- 接触先保留刚性平面和面-面框架,0.3.1 补充投影裁剪面积、多 master 面积上限、Coulomb 摩擦、均匀空间网格和接触输出,0.3.2 补充 mortar 形函数积分、粘滑历史和 OpenMP BVH 搜索。
|
||||
- 输出字段先冻结格式,再增加内容。
|
||||
- 每个阶段均保持 CTest 可通过。
|
||||
|
||||
@@ -451,7 +460,7 @@ P2 测试:
|
||||
第三版不强制完成:
|
||||
|
||||
- 高性能外部稀疏求解器绑定。
|
||||
- 并行接触搜索。
|
||||
- 大规模并行接触域分解和负载均衡。
|
||||
- 完整摩擦接触模型。
|
||||
- 完整热传导求解。
|
||||
- 完整 Abaqus inp 全关键字兼容。
|
||||
|
||||
@@ -17,6 +17,11 @@ int femlite_estimate_stable_dt(double *dtcrit);
|
||||
int femlite_advance_explicit(double dt);
|
||||
int femlite_get_current_time(double *time, int *step);
|
||||
int femlite_get_model_size(int *num_nodes, int *num_elems, int *num_dof);
|
||||
int femlite_get_contact_summary(int *active_count,
|
||||
double *work_step,
|
||||
double *work_total,
|
||||
double *max_penetration,
|
||||
double *force_norm);
|
||||
|
||||
int femlite_clear_sph_forces(void);
|
||||
int femlite_apply_sph_nodal_forces(int num_force_nodes,
|
||||
|
||||
@@ -288,6 +288,28 @@ contains
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine fem_get_sph_force_summary
|
||||
|
||||
subroutine fem_get_contact_summary(active_count, work_step, work_total, &
|
||||
max_penetration, force_norm, ierr)
|
||||
integer, intent(out) :: active_count
|
||||
real(rk), intent(out) :: work_step
|
||||
real(rk), intent(out) :: work_total
|
||||
real(rk), intent(out) :: max_penetration
|
||||
real(rk), intent(out) :: force_norm
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
if (.not. api_initialized) then
|
||||
call error_set(FEM_ERR_INTERNAL, 'fem_get_contact_summary called before fem_initialize', ierr)
|
||||
return
|
||||
end if
|
||||
|
||||
active_count = contact_active_count
|
||||
work_step = contact_work_step
|
||||
work_total = contact_work_total
|
||||
max_penetration = contact_max_penetration
|
||||
force_norm = contact_force_norm
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine fem_get_contact_summary
|
||||
|
||||
subroutine fem_get_boundary_facet_count(num_facets, max_face_nodes, ierr)
|
||||
integer, intent(out) :: num_facets
|
||||
integer, intent(out) :: max_face_nodes
|
||||
|
||||
@@ -16,7 +16,7 @@ module fem_precision
|
||||
|
||||
integer, parameter :: FEMLITE_VERSION_MAJOR = 0
|
||||
integer, parameter :: FEMLITE_VERSION_MINOR = 3
|
||||
integer, parameter :: FEMLITE_VERSION_PATCH = 0
|
||||
integer, parameter :: FEMLITE_VERSION_PATCH = 2
|
||||
|
||||
real(rk), parameter :: ZERO = 0.0_rk
|
||||
real(rk), parameter :: ONE = 1.0_rk
|
||||
|
||||
+2266
-116
File diff suppressed because it is too large
Load Diff
@@ -217,7 +217,7 @@ contains
|
||||
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)
|
||||
call shell_apply_section_tangent(mat, thickness, gp, dmem, dben, dshr, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
|
||||
call shell_b_matrices(NLOCAL, nshape, dndx, dndy, bmem, bben, bshr)
|
||||
@@ -257,7 +257,9 @@ contains
|
||||
real(rk) :: dmem(3,3)
|
||||
real(rk) :: dmem_gp(3,3)
|
||||
real(rk) :: dben(3,3)
|
||||
real(rk) :: dben_gp(3,3)
|
||||
real(rk) :: dshr(2,2)
|
||||
real(rk) :: dshr_gp(2,2)
|
||||
real(rk) :: klocal(NQDOF,NQDOF)
|
||||
real(rk) :: transform(NQDOF,NGDOF)
|
||||
real(rk) :: tmp(NQDOF,NGDOF)
|
||||
@@ -345,16 +347,19 @@ contains
|
||||
area = area + weight
|
||||
call shell_b_matrices(NLOCAL, nshape, dndx, dndy, bmem, bben, bshr)
|
||||
dmem_gp = dmem
|
||||
dben_gp = dben
|
||||
dshr_gp = dshr
|
||||
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)
|
||||
call shell_apply_section_tangent(mat, thickness, gp, dmem_gp, dben_gp, &
|
||||
dshr_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))
|
||||
weight * matmul(transpose(bben), matmul(dben_gp, bben)) + &
|
||||
weight * matmul(transpose(bshr), matmul(dshr_gp, bshr))
|
||||
end do
|
||||
|
||||
call shell_transform_matrix(NLOCAL, basis, transform)
|
||||
@@ -388,7 +393,9 @@ contains
|
||||
real(rk) :: dmem(3,3)
|
||||
real(rk) :: dmem_gp(3,3)
|
||||
real(rk) :: dben(3,3)
|
||||
real(rk) :: dben_gp(3,3)
|
||||
real(rk) :: dshr(2,2)
|
||||
real(rk) :: dshr_gp(2,2)
|
||||
real(rk) :: klocal(5*nlocal,5*nlocal)
|
||||
real(rk) :: transform(5*nlocal,6*nlocal)
|
||||
real(rk) :: tmp(5*nlocal,6*nlocal)
|
||||
@@ -477,16 +484,19 @@ contains
|
||||
area = area + weight
|
||||
call shell_b_matrices(nlocal, nshape, dndx, dndy, bmem, bben, bshr)
|
||||
dmem_gp = dmem
|
||||
dben_gp = dben
|
||||
dshr_gp = dshr
|
||||
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)
|
||||
call shell_apply_section_tangent(mat, thickness, gp, dmem_gp, dben_gp, &
|
||||
dshr_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))
|
||||
weight * matmul(transpose(bben), matmul(dben_gp, bben)) + &
|
||||
weight * matmul(transpose(bshr), matmul(dshr_gp, bshr))
|
||||
end do
|
||||
|
||||
call shell_transform_matrix(nlocal, basis, transform)
|
||||
@@ -939,13 +949,17 @@ contains
|
||||
dshr(2,2) = coeff_shr
|
||||
end subroutine shell_constitutive
|
||||
|
||||
subroutine shell_apply_mem_tangent(mat, thickness, gp, dmem, ierr)
|
||||
subroutine shell_apply_section_tangent(mat, thickness, gp, dmem, dben, dshr, ierr)
|
||||
integer, intent(in) :: mat
|
||||
real(rk), intent(in) :: thickness
|
||||
integer, intent(in) :: gp
|
||||
real(rk), intent(inout) :: dmem(3,3)
|
||||
real(rk), intent(inout) :: dben(3,3)
|
||||
real(rk), intent(inout) :: dshr(2,2)
|
||||
integer, intent(out) :: ierr
|
||||
real(rk) :: d3d(NSTRESS,NSTRESS)
|
||||
real(rk) :: h3
|
||||
real(rk) :: hshear
|
||||
|
||||
if (gp .le. 0) then
|
||||
ierr = FEM_SUCCESS
|
||||
@@ -982,8 +996,25 @@ contains
|
||||
dmem(3,2) = thickness * d3d(4,2)
|
||||
dmem(3,3) = thickness * d3d(4,4)
|
||||
|
||||
h3 = thickness**3 / 12.0_rk
|
||||
dben(1,1) = h3 * d3d(1,1)
|
||||
dben(1,2) = h3 * d3d(1,2)
|
||||
dben(1,3) = h3 * d3d(1,4)
|
||||
dben(2,1) = h3 * d3d(2,1)
|
||||
dben(2,2) = h3 * d3d(2,2)
|
||||
dben(2,3) = h3 * d3d(2,4)
|
||||
dben(3,1) = h3 * d3d(4,1)
|
||||
dben(3,2) = h3 * d3d(4,2)
|
||||
dben(3,3) = h3 * d3d(4,4)
|
||||
|
||||
hshear = (5.0_rk / 6.0_rk) * thickness
|
||||
dshr(1,1) = hshear * d3d(5,5)
|
||||
dshr(1,2) = hshear * d3d(5,6)
|
||||
dshr(2,1) = hshear * d3d(6,5)
|
||||
dshr(2,2) = hshear * d3d(6,6)
|
||||
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine shell_apply_mem_tangent
|
||||
end subroutine shell_apply_section_tangent
|
||||
|
||||
subroutine shell_b_matrices(nlocal, nshape, dndx, dndy, bmem, bben, bshr)
|
||||
integer, intent(in) :: nlocal
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#define F_ADVANCE_EXPLICIT FC_GLOBAL(femlite_f_advance_explicit, FEMLITE_F_ADVANCE_EXPLICIT)
|
||||
#define F_GET_TIME FC_GLOBAL(femlite_f_get_time, FEMLITE_F_GET_TIME)
|
||||
#define F_GET_SIZE FC_GLOBAL(femlite_f_get_size, FEMLITE_F_GET_SIZE)
|
||||
#define F_GET_CONTACT_SUMMARY FC_GLOBAL(femlite_f_get_contact_summary, FEMLITE_F_GET_CONTACT_SUMMARY)
|
||||
#define F_CLEAR_SPH FC_GLOBAL(femlite_f_clear_sph, FEMLITE_F_CLEAR_SPH)
|
||||
#define F_APPLY_SPH_NODES FC_GLOBAL(femlite_f_apply_sph_nodes, FEMLITE_F_APPLY_SPH_NODES)
|
||||
#define F_GET_FACET_COUNT FC_GLOBAL(femlite_f_get_facet_count, FEMLITE_F_GET_FACET_COUNT)
|
||||
@@ -41,6 +42,12 @@ extern void F_ESTIMATE_DT(double *dtcrit, int *ierr);
|
||||
extern void F_ADVANCE_EXPLICIT(double *dt, int *ierr);
|
||||
extern void F_GET_TIME(double *time, int *step, int *ierr);
|
||||
extern void F_GET_SIZE(int *num_nodes, int *num_elems, int *num_dof, int *ierr);
|
||||
extern void F_GET_CONTACT_SUMMARY(int *active_count,
|
||||
double *work_step,
|
||||
double *work_total,
|
||||
double *max_penetration,
|
||||
double *force_norm,
|
||||
int *ierr);
|
||||
extern void F_CLEAR_SPH(int *ierr);
|
||||
extern void F_APPLY_SPH_NODES(int *num_force_nodes,
|
||||
const int *node_ids,
|
||||
@@ -198,6 +205,22 @@ int femlite_get_model_size(int *num_nodes, int *num_elems, int *num_dof)
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_get_contact_summary(int *active_count,
|
||||
double *work_step,
|
||||
double *work_total,
|
||||
double *max_penetration,
|
||||
double *force_norm)
|
||||
{
|
||||
int ierr = 0;
|
||||
if (active_count == NULL || work_step == NULL || work_total == NULL ||
|
||||
max_penetration == NULL || force_norm == NULL) {
|
||||
return -1;
|
||||
}
|
||||
F_GET_CONTACT_SUMMARY(active_count, work_step, work_total,
|
||||
max_penetration, force_norm, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_clear_sph_forces(void)
|
||||
{
|
||||
int ierr = 0;
|
||||
|
||||
@@ -188,6 +188,22 @@ subroutine femlite_f_get_facet_count(num_facets, max_fnodes, ierr)
|
||||
call fem_get_boundary_facet_count(num_facets, max_fnodes, ierr)
|
||||
end subroutine femlite_f_get_facet_count
|
||||
|
||||
subroutine femlite_f_get_contact_summary(active_count, work_step, work_total, &
|
||||
max_penetration, force_norm, ierr)
|
||||
use fem_api
|
||||
use fem_precision
|
||||
implicit none
|
||||
integer, intent(out) :: active_count
|
||||
real(rk), intent(out) :: work_step
|
||||
real(rk), intent(out) :: work_total
|
||||
real(rk), intent(out) :: max_penetration
|
||||
real(rk), intent(out) :: force_norm
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_get_contact_summary(active_count, work_step, work_total, &
|
||||
max_penetration, force_norm, ierr)
|
||||
end subroutine femlite_f_get_contact_summary
|
||||
|
||||
subroutine femlite_f_get_facets(nfacet, max_fnodes, facet_id, elem_id, &
|
||||
face_id, facet_nnode, facet_conn, x, vnod, &
|
||||
normal, area, ierr)
|
||||
|
||||
@@ -146,6 +146,20 @@ module fem_database
|
||||
real(rk), allocatable :: contact_pair_penalty(:)
|
||||
real(rk), allocatable :: contact_pair_damping(:)
|
||||
real(rk), allocatable :: contact_pair_search(:)
|
||||
real(rk), allocatable :: contact_pair_friction(:)
|
||||
integer :: contact_active_count = 0
|
||||
real(rk) :: contact_work_step = ZERO
|
||||
real(rk) :: contact_work_total = ZERO
|
||||
real(rk) :: contact_max_penetration = ZERO
|
||||
real(rk) :: contact_force_norm = ZERO
|
||||
integer, allocatable :: contact_pair_active(:)
|
||||
real(rk), allocatable :: contact_pair_work(:)
|
||||
real(rk), allocatable :: contact_pair_max_penetration(:)
|
||||
real(rk), allocatable :: contact_pair_force_norm(:)
|
||||
real(rk), allocatable :: contact_pair_tangent_force(:,:)
|
||||
real(rk), allocatable :: contact_pair_slip(:)
|
||||
integer, allocatable :: contact_pair_stick_count(:)
|
||||
integer, allocatable :: contact_pair_slip_count(:)
|
||||
|
||||
contains
|
||||
|
||||
@@ -612,13 +626,35 @@ contains
|
||||
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)
|
||||
if (allocated(contact_pair_friction)) deallocate(contact_pair_friction)
|
||||
if (allocated(contact_pair_active)) deallocate(contact_pair_active)
|
||||
if (allocated(contact_pair_work)) deallocate(contact_pair_work)
|
||||
if (allocated(contact_pair_max_penetration)) deallocate(contact_pair_max_penetration)
|
||||
if (allocated(contact_pair_force_norm)) deallocate(contact_pair_force_norm)
|
||||
if (allocated(contact_pair_tangent_force)) deallocate(contact_pair_tangent_force)
|
||||
if (allocated(contact_pair_slip)) deallocate(contact_pair_slip)
|
||||
if (allocated(contact_pair_stick_count)) deallocate(contact_pair_stick_count)
|
||||
if (allocated(contact_pair_slip_count)) deallocate(contact_pair_slip_count)
|
||||
|
||||
ncontact_pair = num_pairs
|
||||
contact_active_count = 0
|
||||
contact_work_step = ZERO
|
||||
contact_work_total = ZERO
|
||||
contact_max_penetration = ZERO
|
||||
contact_force_norm = ZERO
|
||||
|
||||
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)
|
||||
contact_pair_search(num_pairs), contact_pair_friction(num_pairs), &
|
||||
contact_pair_active(num_pairs), contact_pair_work(num_pairs), &
|
||||
contact_pair_max_penetration(num_pairs), &
|
||||
contact_pair_force_norm(num_pairs), &
|
||||
contact_pair_tangent_force(NDIM,num_pairs), &
|
||||
contact_pair_slip(num_pairs), &
|
||||
contact_pair_stick_count(num_pairs), &
|
||||
contact_pair_slip_count(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)
|
||||
@@ -629,6 +665,15 @@ contains
|
||||
contact_pair_penalty = ZERO
|
||||
contact_pair_damping = ZERO
|
||||
contact_pair_search = ZERO
|
||||
contact_pair_friction = ZERO
|
||||
contact_pair_active = 0
|
||||
contact_pair_work = ZERO
|
||||
contact_pair_max_penetration = ZERO
|
||||
contact_pair_force_norm = ZERO
|
||||
contact_pair_tangent_force = ZERO
|
||||
contact_pair_slip = ZERO
|
||||
contact_pair_stick_count = 0
|
||||
contact_pair_slip_count = 0
|
||||
end if
|
||||
|
||||
ierr = FEM_SUCCESS
|
||||
@@ -823,6 +868,20 @@ contains
|
||||
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
|
||||
if (allocated(contact_pair_friction)) contact_pair_friction = ZERO
|
||||
contact_active_count = 0
|
||||
contact_work_step = ZERO
|
||||
contact_work_total = ZERO
|
||||
contact_max_penetration = ZERO
|
||||
contact_force_norm = ZERO
|
||||
if (allocated(contact_pair_active)) contact_pair_active = 0
|
||||
if (allocated(contact_pair_work)) contact_pair_work = ZERO
|
||||
if (allocated(contact_pair_max_penetration)) contact_pair_max_penetration = ZERO
|
||||
if (allocated(contact_pair_force_norm)) contact_pair_force_norm = ZERO
|
||||
if (allocated(contact_pair_tangent_force)) contact_pair_tangent_force = ZERO
|
||||
if (allocated(contact_pair_slip)) contact_pair_slip = ZERO
|
||||
if (allocated(contact_pair_stick_count)) contact_pair_stick_count = 0
|
||||
if (allocated(contact_pair_slip_count)) contact_pair_slip_count = 0
|
||||
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine database_initialize
|
||||
@@ -1435,6 +1494,12 @@ contains
|
||||
call error_set(FEM_ERR_INPUT, 'contact pair search distance must be non-negative', ierr)
|
||||
return
|
||||
end if
|
||||
if (allocated(contact_pair_friction)) then
|
||||
if (contact_pair_friction(item) .lt. ZERO) then
|
||||
call error_set(FEM_ERR_INPUT, 'contact pair friction must be non-negative', ierr)
|
||||
return
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
|
||||
ierr = FEM_SUCCESS
|
||||
@@ -1608,6 +1673,15 @@ contains
|
||||
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)
|
||||
if (allocated(contact_pair_friction)) deallocate(contact_pair_friction)
|
||||
if (allocated(contact_pair_active)) deallocate(contact_pair_active)
|
||||
if (allocated(contact_pair_work)) deallocate(contact_pair_work)
|
||||
if (allocated(contact_pair_max_penetration)) deallocate(contact_pair_max_penetration)
|
||||
if (allocated(contact_pair_force_norm)) deallocate(contact_pair_force_norm)
|
||||
if (allocated(contact_pair_tangent_force)) deallocate(contact_pair_tangent_force)
|
||||
if (allocated(contact_pair_slip)) deallocate(contact_pair_slip)
|
||||
if (allocated(contact_pair_stick_count)) deallocate(contact_pair_stick_count)
|
||||
if (allocated(contact_pair_slip_count)) deallocate(contact_pair_slip_count)
|
||||
|
||||
nnode = 0
|
||||
nelem = 0
|
||||
@@ -1628,6 +1702,11 @@ contains
|
||||
nmpc_term = 0
|
||||
ncontact_plane = 0
|
||||
ncontact_pair = 0
|
||||
contact_active_count = 0
|
||||
contact_work_step = ZERO
|
||||
contact_work_total = ZERO
|
||||
contact_max_penetration = ZERO
|
||||
contact_force_norm = ZERO
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine database_finalize
|
||||
|
||||
|
||||
@@ -69,7 +69,9 @@ contains
|
||||
|
||||
if (.not. exists .and. .not. history_header_written) then
|
||||
write(unit_id,'(A)',iostat=ios) &
|
||||
'step,time,total_mass,kinetic_energy,max_displacement,max_velocity,max_acceleration'
|
||||
'step,time,total_mass,kinetic_energy,max_displacement,max_velocity,'// &
|
||||
'max_acceleration,contact_active_count,contact_work_step,'// &
|
||||
'contact_work_total,contact_max_penetration,contact_force_norm'
|
||||
if (ios .ne. 0) then
|
||||
close(unit_id)
|
||||
call error_set(FEM_ERR_OUTPUT, 'failed to write history CSV header', ierr)
|
||||
@@ -77,9 +79,12 @@ contains
|
||||
end if
|
||||
end if
|
||||
|
||||
write(unit_id,'(I12,A,5(ES24.16,A),ES24.16)',iostat=ios) step, ',', time, ',', &
|
||||
write(unit_id,'(I12,A,5(ES24.16,A),ES24.16,A,I12,4(A,ES24.16))',iostat=ios) &
|
||||
step, ',', time, ',', &
|
||||
total_mass, ',', kinetic_energy, ',', max_displacement, ',', &
|
||||
max_velocity, ',', max_acceleration
|
||||
max_velocity, ',', max_acceleration, ',', contact_active_count, &
|
||||
',', contact_work_step, ',', contact_work_total, ',', &
|
||||
contact_max_penetration, ',', contact_force_norm
|
||||
if (ios .ne. 0) then
|
||||
close(unit_id)
|
||||
call error_set(FEM_ERR_OUTPUT, 'failed to write history CSV row', ierr)
|
||||
@@ -98,6 +103,9 @@ contains
|
||||
call output_csv_write_elements(step, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
|
||||
call output_csv_write_contact(step, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine output_csv_write
|
||||
|
||||
@@ -298,6 +306,121 @@ contains
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine output_csv_write_elements
|
||||
|
||||
subroutine output_csv_write_contact(step, ierr)
|
||||
integer, intent(in) :: step
|
||||
integer, intent(out) :: ierr
|
||||
character(len=512) :: filename
|
||||
integer :: unit_id
|
||||
integer :: ios
|
||||
integer :: pair
|
||||
integer :: active
|
||||
real(rk) :: max_pen
|
||||
real(rk) :: force_sum
|
||||
real(rk) :: work_sum
|
||||
|
||||
if (ncontact_plane .le. 0 .and. ncontact_pair .le. 0) then
|
||||
ierr = FEM_SUCCESS
|
||||
return
|
||||
end if
|
||||
|
||||
call output_csv_step_filename('contact', step, filename)
|
||||
unit_id = 66
|
||||
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 contact CSV output', ierr)
|
||||
return
|
||||
end if
|
||||
|
||||
write(unit_id,'(A)',iostat=ios) &
|
||||
'kind,pair_id,active_count,max_penetration,force_norm,work_estimate,'// &
|
||||
'cumulative_work,stick_count,slip_count,accumulated_slip,ftx,fty,ftz'
|
||||
if (ios .ne. 0) then
|
||||
close(unit_id)
|
||||
call error_set(FEM_ERR_OUTPUT, 'failed to write contact CSV header', ierr)
|
||||
return
|
||||
end if
|
||||
|
||||
write(unit_id,'(A,A,I12,A,I12,4(A,ES24.16),2(A,I12),4(A,ES24.16))',iostat=ios) &
|
||||
'SUMMARY', ',', 0, ',', contact_active_count, &
|
||||
',', contact_max_penetration, ',', contact_force_norm, &
|
||||
',', contact_work_step, ',', contact_work_total, ',', 0, ',', 0, &
|
||||
',', ZERO, ',', ZERO, ',', ZERO, ',', ZERO
|
||||
if (ios .ne. 0) then
|
||||
close(unit_id)
|
||||
call error_set(FEM_ERR_OUTPUT, 'failed to write contact CSV summary row', ierr)
|
||||
return
|
||||
end if
|
||||
|
||||
do pair = 1, ncontact_pair
|
||||
active = 0
|
||||
max_pen = ZERO
|
||||
force_sum = ZERO
|
||||
work_sum = ZERO
|
||||
if (allocated(contact_pair_active)) active = contact_pair_active(pair)
|
||||
if (allocated(contact_pair_max_penetration)) then
|
||||
max_pen = contact_pair_max_penetration(pair)
|
||||
end if
|
||||
if (allocated(contact_pair_force_norm)) force_sum = contact_pair_force_norm(pair)
|
||||
if (allocated(contact_pair_work)) work_sum = contact_pair_work(pair)
|
||||
|
||||
write(unit_id,'(A,A,I12,A,I12,4(A,ES24.16),2(A,I12),4(A,ES24.16))',iostat=ios) &
|
||||
'PAIR', ',', pair, ',', active, ',', max_pen, ',', force_sum, &
|
||||
',', work_sum, ',', ZERO, &
|
||||
',', contact_pair_stick_value(pair), ',', contact_pair_slip_value(pair), &
|
||||
',', contact_pair_accumulated_slip(pair), &
|
||||
',', contact_pair_tangent_component(pair, 1), &
|
||||
',', contact_pair_tangent_component(pair, 2), &
|
||||
',', contact_pair_tangent_component(pair, 3)
|
||||
if (ios .ne. 0) then
|
||||
close(unit_id)
|
||||
call error_set(FEM_ERR_OUTPUT, 'failed to write contact CSV pair row', ierr)
|
||||
return
|
||||
end if
|
||||
end do
|
||||
|
||||
close(unit_id)
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine output_csv_write_contact
|
||||
|
||||
integer function contact_pair_stick_value(pair)
|
||||
integer, intent(in) :: pair
|
||||
|
||||
contact_pair_stick_value = 0
|
||||
if (.not. allocated(contact_pair_stick_count)) return
|
||||
if (pair .lt. 1 .or. pair .gt. size(contact_pair_stick_count)) return
|
||||
contact_pair_stick_value = contact_pair_stick_count(pair)
|
||||
end function contact_pair_stick_value
|
||||
|
||||
integer function contact_pair_slip_value(pair)
|
||||
integer, intent(in) :: pair
|
||||
|
||||
contact_pair_slip_value = 0
|
||||
if (.not. allocated(contact_pair_slip_count)) return
|
||||
if (pair .lt. 1 .or. pair .gt. size(contact_pair_slip_count)) return
|
||||
contact_pair_slip_value = contact_pair_slip_count(pair)
|
||||
end function contact_pair_slip_value
|
||||
|
||||
real(rk) function contact_pair_accumulated_slip(pair)
|
||||
integer, intent(in) :: pair
|
||||
|
||||
contact_pair_accumulated_slip = ZERO
|
||||
if (.not. allocated(contact_pair_slip)) return
|
||||
if (pair .lt. 1 .or. pair .gt. size(contact_pair_slip)) return
|
||||
contact_pair_accumulated_slip = contact_pair_slip(pair)
|
||||
end function contact_pair_accumulated_slip
|
||||
|
||||
real(rk) function contact_pair_tangent_component(pair, idir)
|
||||
integer, intent(in) :: pair
|
||||
integer, intent(in) :: idir
|
||||
|
||||
contact_pair_tangent_component = ZERO
|
||||
if (.not. allocated(contact_pair_tangent_force)) return
|
||||
if (pair .lt. 1 .or. pair .gt. size(contact_pair_tangent_force,2)) return
|
||||
if (idir .lt. 1 .or. idir .gt. NDIM) return
|
||||
contact_pair_tangent_component = contact_pair_tangent_force(idir,pair)
|
||||
end function contact_pair_tangent_component
|
||||
|
||||
subroutine output_csv_average_element(elem, sig, eps, peps, eqps, damage)
|
||||
integer, intent(in) :: elem
|
||||
real(rk), intent(out) :: sig(NSTRESS)
|
||||
|
||||
@@ -29,6 +29,7 @@ int main(void)
|
||||
int nfacet = 0;
|
||||
int max_face_nodes = 0;
|
||||
int step = 0;
|
||||
int active_contact = -1;
|
||||
int node_ids[1] = {2};
|
||||
int facet_id[8];
|
||||
int elem_id[8];
|
||||
@@ -45,13 +46,17 @@ int main(void)
|
||||
double acc[3] = {0.0, 0.0, 0.0};
|
||||
double dtcrit = 0.0;
|
||||
double time = 0.0;
|
||||
double contact_work_step = -1.0;
|
||||
double contact_work_total = -1.0;
|
||||
double contact_max_penetration = -1.0;
|
||||
double contact_force_norm = -1.0;
|
||||
|
||||
ierr = femlite_initialize();
|
||||
if (ierr != 0) return check_ierr(ierr, 1);
|
||||
|
||||
ierr = femlite_get_version(&major, &minor, &patch);
|
||||
if (ierr != 0) return check_ierr(ierr, 2);
|
||||
if (major != 0 || minor != 3 || patch != 0) return 3;
|
||||
if (major != 0 || minor != 3 || patch != 2) return 3;
|
||||
|
||||
ierr = femlite_read_inp("examples/c3d4_one_element.inp");
|
||||
if (ierr != 0) return check_ierr(ierr, 4);
|
||||
@@ -62,6 +67,15 @@ int main(void)
|
||||
if (ierr != 0) return check_ierr(ierr, 6);
|
||||
if (nnode != 4 || nelem != 1 || ndof != 12) return 7;
|
||||
|
||||
ierr = femlite_get_contact_summary(&active_contact, &contact_work_step,
|
||||
&contact_work_total,
|
||||
&contact_max_penetration,
|
||||
&contact_force_norm);
|
||||
if (ierr != 0) return check_ierr(ierr, 24);
|
||||
if (active_contact != 0 || contact_work_step != 0.0 ||
|
||||
contact_work_total != 0.0 || contact_max_penetration != 0.0 ||
|
||||
contact_force_norm != 0.0) return 25;
|
||||
|
||||
ierr = femlite_compute_lumped_mass();
|
||||
if (ierr != 0) return check_ierr(ierr, 8);
|
||||
ierr = femlite_estimate_stable_dt(&dtcrit);
|
||||
|
||||
@@ -15,6 +15,10 @@ program test_contact
|
||||
call check_explicit_contact_step()
|
||||
call check_surface_pair_force()
|
||||
call check_surface_pair_tangent()
|
||||
call check_surface_pair_friction()
|
||||
call check_surface_pair_multimaster()
|
||||
call check_pair_clipped()
|
||||
call check_pair_grid()
|
||||
|
||||
contains
|
||||
|
||||
@@ -82,6 +86,11 @@ contains
|
||||
subroutine check_explicit_contact_step()
|
||||
integer :: ierr
|
||||
integer :: dof
|
||||
integer :: active_count
|
||||
real(rk) :: work_step
|
||||
real(rk) :: work_total
|
||||
real(rk) :: max_penetration
|
||||
real(rk) :: force_norm
|
||||
|
||||
call fem_initialize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(20)
|
||||
@@ -106,9 +115,16 @@ contains
|
||||
call check_close(a(dof), ONE, 24)
|
||||
call check_close(v(dof), 0.10_rk, 25)
|
||||
call check_close(u(dof), -0.095_rk, 26)
|
||||
call fem_get_contact_summary(active_count, work_step, work_total, &
|
||||
max_penetration, force_norm, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(27)
|
||||
if (active_count .ne. 1) call fail(28)
|
||||
call check_close(max_penetration, 0.10_rk, 29)
|
||||
call check_close(force_norm, ONE, 30)
|
||||
call check_close(work_step, 0.05_rk, 31)
|
||||
|
||||
call fem_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(27)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(32)
|
||||
end subroutine check_explicit_contact_step
|
||||
|
||||
subroutine check_surface_pair_force()
|
||||
@@ -156,18 +172,185 @@ contains
|
||||
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)
|
||||
call check_close(value, 1000.0_rk / 9.0_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 check_close(value, -1000.0_rk / 9.0_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 check_surface_pair_friction()
|
||||
type(csr_matrix) :: kmat
|
||||
integer :: ierr
|
||||
integer :: stat
|
||||
integer :: node
|
||||
integer :: dof
|
||||
integer :: row
|
||||
integer :: col
|
||||
real(rk) :: value
|
||||
|
||||
call setup_contact_shell_pair(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(50)
|
||||
contact_pair_friction(1) = 0.2_rk
|
||||
do node = 5, 8
|
||||
dof = dof_id(1,node)
|
||||
v(dof) = ONE
|
||||
end do
|
||||
|
||||
call contact_apply_plane_forces(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(51)
|
||||
|
||||
do node = 1, 4
|
||||
dof = dof_id(1,node)
|
||||
call check_close(fcontact(dof), 0.5_rk, 52)
|
||||
end do
|
||||
do node = 5, 8
|
||||
dof = dof_id(1,node)
|
||||
call check_close(fcontact(dof), -0.5_rk, 53)
|
||||
end do
|
||||
if (contact_pair_stick_count(1) .ne. 0) call fail(500)
|
||||
if (contact_pair_slip_count(1) .ne. 1) call fail(501)
|
||||
call check_close(contact_pair_slip(1), 0.998_rk, 502)
|
||||
call check_close(contact_pair_tangent_force(1,1), -2.0_rk, 503)
|
||||
|
||||
call csr_init(kmat)
|
||||
call assembly_build_csr_pattern(kmat, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(54)
|
||||
call contact_apply_plane_tangent(kmat, ZERO, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(55)
|
||||
|
||||
row = dof_id(1,5)
|
||||
col = dof_id(1,5)
|
||||
call csr_get_value(kmat, row, col, value, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(56)
|
||||
call check_close(value, 200.0_rk / 9.0_rk, 57)
|
||||
|
||||
call csr_free(kmat, stat)
|
||||
call database_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(58)
|
||||
end subroutine check_surface_pair_friction
|
||||
|
||||
subroutine check_surface_pair_multimaster()
|
||||
integer :: ierr
|
||||
integer :: node
|
||||
integer :: dof
|
||||
|
||||
call setup_contact_shell_multimaster(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(60)
|
||||
|
||||
call contact_apply_plane_forces(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(61)
|
||||
|
||||
do node = 5, 8
|
||||
dof = dof_id(3,node)
|
||||
call check_close(fcontact(dof), 2.5_rk, 62)
|
||||
end do
|
||||
do node = 1, 4
|
||||
dof = dof_id(3,node)
|
||||
call check_close(fcontact(dof), -1.25_rk, 63)
|
||||
end do
|
||||
do node = 9, 12
|
||||
dof = dof_id(3,node)
|
||||
call check_close(fcontact(dof), -1.25_rk, 64)
|
||||
end do
|
||||
|
||||
call database_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(65)
|
||||
end subroutine check_surface_pair_multimaster
|
||||
|
||||
subroutine check_pair_clipped()
|
||||
integer :: ierr
|
||||
integer :: node
|
||||
|
||||
call setup_contact_shell_pair(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(70)
|
||||
|
||||
do node = 5, 8
|
||||
coord0(1,node) = coord0(1,node) + 0.5_rk
|
||||
end do
|
||||
coord = coord0
|
||||
|
||||
call contact_apply_plane_forces(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(71)
|
||||
|
||||
call check_close(fcontact(dof_id(3,5)), 1.875_rk, 72)
|
||||
call check_close(fcontact(dof_id(3,6)), 0.625_rk, 73)
|
||||
call check_close(fcontact(dof_id(3,7)), 0.625_rk, 74)
|
||||
call check_close(fcontact(dof_id(3,8)), 1.875_rk, 75)
|
||||
call check_close(fcontact(dof_id(3,1)), -0.625_rk, 76)
|
||||
call check_close(fcontact(dof_id(3,2)), -1.875_rk, 77)
|
||||
call check_close(fcontact(dof_id(3,3)), -1.875_rk, 78)
|
||||
call check_close(fcontact(dof_id(3,4)), -0.625_rk, 79)
|
||||
|
||||
if (contact_active_count .ne. 1) call fail(80)
|
||||
if (contact_pair_active(1) .ne. 1) call fail(81)
|
||||
call check_close(contact_max_penetration, 0.01_rk, 82)
|
||||
call check_close(contact_pair_max_penetration(1), 0.01_rk, 83)
|
||||
call check_close(contact_force_norm, 5.0_rk, 84)
|
||||
call check_close(contact_pair_force_norm(1), 5.0_rk, 85)
|
||||
call check_close(contact_work_step, 0.025_rk, 86)
|
||||
call check_close(contact_pair_work(1), 0.025_rk, 87)
|
||||
|
||||
call database_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(88)
|
||||
end subroutine check_pair_clipped
|
||||
|
||||
subroutine check_pair_grid()
|
||||
type(csr_matrix) :: kmat
|
||||
integer :: ierr
|
||||
integer :: stat
|
||||
integer :: node
|
||||
integer :: dof
|
||||
integer :: row
|
||||
integer :: col
|
||||
real(rk) :: value
|
||||
|
||||
call setup_contact_grid_pair(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(90)
|
||||
|
||||
call contact_apply_plane_forces(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(91)
|
||||
|
||||
do node = 73, 76
|
||||
dof = dof_id(3,node)
|
||||
call check_close(fcontact(dof), 2.5_rk, 92)
|
||||
end do
|
||||
do node = 1, 4
|
||||
dof = dof_id(3,node)
|
||||
call check_close(fcontact(dof), -2.5_rk, 93)
|
||||
end do
|
||||
do node = 5, 72
|
||||
dof = dof_id(3,node)
|
||||
call check_close(fcontact(dof), ZERO, 94)
|
||||
end do
|
||||
if (contact_active_count .ne. 1) call fail(95)
|
||||
call check_close(contact_force_norm, 10.0_rk, 96)
|
||||
|
||||
call csr_init(kmat)
|
||||
call assembly_build_csr_pattern(kmat, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(510)
|
||||
call contact_apply_plane_tangent(kmat, ZERO, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(511)
|
||||
row = dof_id(3,73)
|
||||
col = dof_id(3,73)
|
||||
call csr_get_value(kmat, row, col, value, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(512)
|
||||
call check_close(value, 1000.0_rk / 9.0_rk, 513)
|
||||
col = dof_id(3,1)
|
||||
call csr_get_value(kmat, row, col, value, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(514)
|
||||
call check_close(value, -1000.0_rk / 9.0_rk, 515)
|
||||
call csr_free(kmat, stat)
|
||||
|
||||
call database_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(97)
|
||||
end subroutine check_pair_grid
|
||||
|
||||
subroutine setup_basic_nodes(num_nodes, ierr)
|
||||
integer, intent(in) :: num_nodes
|
||||
integer, intent(out) :: ierr
|
||||
@@ -254,15 +437,161 @@ contains
|
||||
contact_pair_penalty(1) = 1000.0_rk
|
||||
contact_pair_damping(1) = ZERO
|
||||
contact_pair_search(1) = 0.1_rk
|
||||
contact_pair_friction(1) = ZERO
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine setup_contact_shell_pair
|
||||
|
||||
subroutine setup_contact_shell_multimaster(ierr)
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call database_allocate_model(12, 3, 0, 2, 0, 3, 1, 0, 1, &
|
||||
0, 0, 0, 0, 0, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
|
||||
node_id_ext(1:12) = (/ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 /)
|
||||
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 /)
|
||||
coord0(:,9) = coord0(:,1)
|
||||
coord0(:,10) = coord0(:,2)
|
||||
coord0(:,11) = coord0(:,3)
|
||||
coord0(:,12) = coord0(:,4)
|
||||
coord = coord0
|
||||
|
||||
elem_id_ext(1:3) = (/ 1, 2, 3 /)
|
||||
elem_type(1:3) = 'S4'
|
||||
elem_nnode(1:3) = 4
|
||||
elem_conn(:,1:3) = 0
|
||||
elem_conn(1:4,1) = (/ 1, 2, 3, 4 /)
|
||||
elem_conn(1:4,2) = (/ 5, 6, 7, 8 /)
|
||||
elem_conn(1:4,3) = (/ 9, 10, 11, 12 /)
|
||||
elem_mat(1:3) = 1
|
||||
elem_sec(1:3) = 1
|
||||
|
||||
elset_name(1) = 'MASTER'
|
||||
elset_start(1) = 1
|
||||
elset_count(1) = 2
|
||||
elset_items(1:2) = (/ 1, 3 /)
|
||||
elset_name(2) = 'SLAVE'
|
||||
elset_start(2) = 3
|
||||
elset_count(2) = 1
|
||||
elset_items(3) = 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
|
||||
contact_pair_friction(1) = ZERO
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine setup_contact_shell_multimaster
|
||||
|
||||
subroutine setup_contact_grid_pair(ierr)
|
||||
integer, intent(out) :: ierr
|
||||
integer :: master
|
||||
integer :: node_base
|
||||
integer :: xshift
|
||||
|
||||
call database_allocate_model(76, 19, 0, 2, 0, 19, 1, 0, 1, &
|
||||
0, 0, 0, 0, 0, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
|
||||
do master = 1, 18
|
||||
node_base = 4 * (master - 1)
|
||||
xshift = 10 * (master - 1)
|
||||
node_id_ext(node_base+1:node_base+4) = &
|
||||
(/ node_base + 1, node_base + 2, node_base + 3, node_base + 4 /)
|
||||
coord0(:,node_base+1) = (/ real(xshift, rk), ZERO, ZERO /)
|
||||
coord0(:,node_base+2) = (/ real(xshift, rk) + ONE, ZERO, ZERO /)
|
||||
coord0(:,node_base+3) = (/ real(xshift, rk) + ONE, ONE, ZERO /)
|
||||
coord0(:,node_base+4) = (/ real(xshift, rk), ONE, ZERO /)
|
||||
elem_id_ext(master) = master
|
||||
elem_type(master) = 'S4'
|
||||
elem_nnode(master) = 4
|
||||
elem_conn(:,master) = 0
|
||||
elem_conn(1:4,master) = &
|
||||
(/ node_base + 1, node_base + 2, node_base + 3, node_base + 4 /)
|
||||
elem_mat(master) = 1
|
||||
elem_sec(master) = 1
|
||||
end do
|
||||
|
||||
node_id_ext(73:76) = (/ 73, 74, 75, 76 /)
|
||||
coord0(:,73) = (/ ZERO, ZERO, -0.01_rk /)
|
||||
coord0(:,74) = (/ ONE, ZERO, -0.01_rk /)
|
||||
coord0(:,75) = (/ ONE, ONE, -0.01_rk /)
|
||||
coord0(:,76) = (/ ZERO, ONE, -0.01_rk /)
|
||||
coord = coord0
|
||||
|
||||
elem_id_ext(19) = 19
|
||||
elem_type(19) = 'S4'
|
||||
elem_nnode(19) = 4
|
||||
elem_conn(:,19) = 0
|
||||
elem_conn(1:4,19) = (/ 73, 74, 75, 76 /)
|
||||
elem_mat(19) = 1
|
||||
elem_sec(19) = 1
|
||||
|
||||
elset_name(1) = 'MASTER'
|
||||
elset_start(1) = 1
|
||||
elset_count(1) = 18
|
||||
do master = 1, 18
|
||||
elset_items(master) = master
|
||||
end do
|
||||
elset_name(2) = 'SLAVE'
|
||||
elset_start(2) = 19
|
||||
elset_count(2) = 1
|
||||
elset_items(19) = 19
|
||||
|
||||
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
|
||||
contact_pair_friction(1) = ZERO
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine setup_contact_grid_pair
|
||||
|
||||
subroutine check_close(actual, expected, code)
|
||||
real(rk), intent(in) :: actual
|
||||
real(rk), intent(in) :: expected
|
||||
integer, intent(in) :: code
|
||||
|
||||
if (abs(actual - expected) .gt. TOL * max(ONE, abs(expected))) call fail(code)
|
||||
if (abs(actual - expected) .gt. TOL * max(ONE, abs(expected))) then
|
||||
write(*,*) 'check_close actual expected:', actual, expected
|
||||
call fail(code)
|
||||
end if
|
||||
end subroutine check_close
|
||||
|
||||
subroutine fail(code)
|
||||
|
||||
@@ -76,9 +76,12 @@ contains
|
||||
integer :: elem_dofs(MAX_SHELL_TEST_DOF)
|
||||
integer :: n_elem_dof
|
||||
real(rk) :: ke(MAX_SHELL_TEST_DOF,MAX_SHELL_TEST_DOF)
|
||||
real(rk) :: ke_elastic(MAX_SHELL_TEST_DOF,MAX_SHELL_TEST_DOF)
|
||||
|
||||
call setup_s4_j2(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(451)
|
||||
call element_linear_stiffness(1, elem_dofs, n_elem_dof, ke_elastic, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(450)
|
||||
call apply_x_extension(EXX)
|
||||
|
||||
call element_compute_internal_force(ierr, 0.1_rk)
|
||||
@@ -92,6 +95,9 @@ contains
|
||||
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)
|
||||
if (ke(1,1) .ge. ke_elastic(1,1)) call fail(461)
|
||||
if (ke(5,5) .ge. ke_elastic(5,5)) call fail(462)
|
||||
if (ke(3,3) .le. ZERO) call fail(463)
|
||||
|
||||
call database_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(460)
|
||||
|
||||
@@ -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. 3 .or. patch .ne. 0) then
|
||||
if (major .ne. 0 .or. minor .ne. 3 .or. patch .ne. 2) then
|
||||
write(*,'(A,I1,A,I1,A,I1)') 'unexpected FemLite version ', major, '.', minor, '.', patch
|
||||
call exit(3)
|
||||
end if
|
||||
|
||||
@@ -94,7 +94,7 @@ program test_smoke
|
||||
if (ierr .ne. 0) stop 2
|
||||
if (major .ne. 0) stop 3
|
||||
if (minor .ne. 3) stop 4
|
||||
if (patch .ne. 0) stop 5
|
||||
if (patch .ne. 2) stop 5
|
||||
|
||||
call fem_read_inp('examples/c3d4_one_element.inp', ierr)
|
||||
if (ierr .ne. 0) stop 11
|
||||
|
||||
Reference in New Issue
Block a user