1264 lines
45 KiB
Markdown
1264 lines
45 KiB
Markdown
# FEM Detailed Design
|
||
|
||
文档状态:详细设计基线草稿
|
||
|
||
适用对象:船舶接触爆炸船体结构 FEM 核心库与小型分析程序
|
||
|
||
## 1. 文档目的
|
||
|
||
本文档给出各 Fortran95 模块的数据结构、数组维度、子程序接口、调用顺序和实现约定,用于直接指导编码。
|
||
|
||
本文档承接需求规格说明书和软件架构设计说明书。
|
||
|
||
## 2. 设计原则
|
||
|
||
代码实现应遵循:
|
||
|
||
- 采用 Fortran95 过程式模块设计。
|
||
- 模块名与文件名保持一致。
|
||
- 使用集中式 fem_database 管理全局数据。
|
||
- 允许模块共享 fem_database 中的全局 allocatable 数组。
|
||
- 分量维度放在数组第一维,实体数量放在第二维。
|
||
- 所有核心子程序通过 ierr 返回状态。
|
||
- 核心库子程序不直接 stop,主程序根据 ierr 决定是否退出。
|
||
- 输入解析、数据库构建、单元计算、材料更新、求解器、耦合和输出保持解耦。
|
||
|
||
## 3. 文件与模块组织
|
||
|
||
第一版建议文件结构:
|
||
|
||
```text
|
||
src/base/fem_precision.f90
|
||
src/base/fem_error.f90
|
||
src/base/fem_log.f90
|
||
src/base/fem_control.f90
|
||
src/mesh/fem_database.f90
|
||
src/mesh/fem_database_lookup.f90
|
||
src/mesh/fem_database_lifecycle.f90
|
||
src/mesh/fem_database_validation.f90
|
||
src/mesh/fem_database_surface.f90
|
||
src/input/fem_inp_reader.f90
|
||
src/input/fem_inp_material_parser.f90
|
||
src/input/fem_inp_contact_parser.f90
|
||
src/input/fem_inp_keywords.f90
|
||
src/material/fem_material_iso.f90
|
||
src/material/fem_material_j2.f90
|
||
src/element/fem_quadrature.f90
|
||
src/element/fem_shape_solid.f90
|
||
src/element/fem_shape_shell.f90
|
||
src/element/fem_element_solid.f90
|
||
src/element/fem_element_shell.f90
|
||
src/element/fem_shell_rotation.f90
|
||
src/element/fem_shell_finite_kinematics.f90
|
||
src/element/fem_shell_finite_tangent.f90
|
||
src/element/fem_shell_section.f90
|
||
src/element/fem_shell_finite_element.f90
|
||
src/element/fem_element_driver.f90
|
||
src/boundary/fem_boundary.f90
|
||
src/coupling/fem_sph_coupling.f90
|
||
src/solver/fem_solver_explicit.f90
|
||
src/solver/fem_sparse_csr.f90
|
||
src/output/fem_output_csv.f90
|
||
src/app/fem_program.f90
|
||
```
|
||
|
||
第二版可增加:
|
||
|
||
```text
|
||
src/boundary/fem_constraint.f90
|
||
src/boundary/fem_contact.f90
|
||
src/boundary/fem_contact_state.f90
|
||
src/boundary/fem_contact_target.f90
|
||
src/boundary/fem_contact_geometry.f90
|
||
src/boundary/fem_contact_search.f90
|
||
src/boundary/fem_contact_candidate_cache.f90
|
||
src/boundary/fem_contact_history.f90
|
||
src/boundary/fem_contact_multiplier.f90
|
||
src/boundary/fem_contact_multiplier_report.f90
|
||
src/boundary/fem_contact_friction.f90
|
||
src/boundary/fem_contact_force.f90
|
||
src/boundary/fem_contact_tangent.f90
|
||
src/boundary/fem_contact_output.f90
|
||
src/boundary/fem_contact_mortar_al.f90
|
||
src/boundary/fem_contact_mortar_batch.f90
|
||
src/boundary/fem_contact_mortar_cons.f90
|
||
src/boundary/fem_contact_mortar_iter.f90
|
||
src/boundary/fem_contact_mortar_report.f90
|
||
src/boundary/fem_contact_mortar_tangent.f90
|
||
src/mesh/fem_database_lookup.f90
|
||
src/mesh/fem_database_lifecycle.f90
|
||
src/mesh/fem_database_validation.f90
|
||
src/mesh/fem_database_surface.f90
|
||
src/input/fem_inp_defs.f90
|
||
src/input/fem_inp_helpers.f90
|
||
src/input/fem_inp_material_parser.f90
|
||
src/input/fem_inp_contact_parser.f90
|
||
src/input/fem_inp_nlc.f90
|
||
src/element/fem_element_internal_helpers.f90
|
||
src/solver/fem_implicit_constraints.f90
|
||
src/solver/fem_solver_implicit.f90
|
||
src/output/fem_output_vtk.f90
|
||
src/output/fem_restart.f90
|
||
src/base/fem_api_stable_dt.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 统一调度实体和壳单元。
|
||
- 输出模块应统一显式、静力和隐式动力结果字段。
|
||
- 0.3.3 将 INP 常量/辅助解析、数据库 surface/contact 查询和 C3D8 局部内力辅助逻辑拆成独立模块,以满足源码规模硬阈值并降低主模块耦合。
|
||
|
||
## 4. 全局精度与常量模块
|
||
|
||
模块:fem_precision.f90
|
||
|
||
职责:
|
||
|
||
- 定义实数精度。
|
||
- 定义常用整数常量。
|
||
- 定义数组固定维度常量。
|
||
|
||
建议常量:
|
||
|
||
```fortran
|
||
integer, parameter :: rk = selected_real_kind(12, 100)
|
||
integer, parameter :: ik = selected_int_kind(9)
|
||
|
||
integer, parameter :: NDIM = 3
|
||
integer, parameter :: NDOF_NODE = 6
|
||
integer, parameter :: NSTRESS = 6
|
||
integer, parameter :: MAX_NEN = 20
|
||
integer, parameter :: MAX_FACE_NODES = 8
|
||
integer, parameter :: NAME_LEN = 80
|
||
integer, parameter :: ELEM_TYPE_LEN = 16
|
||
integer, parameter :: MAT_MODEL_LEN = 32
|
||
integer, parameter :: NSTATEV_MAX = 32
|
||
```
|
||
|
||
应力、应变分量顺序:
|
||
|
||
```text
|
||
1 XX / 11
|
||
2 YY / 22
|
||
3 ZZ / 33
|
||
4 XY / 12
|
||
5 XZ / 13
|
||
6 YZ / 23
|
||
```
|
||
|
||
剪切约定:
|
||
|
||
- 应变数组中第 4、5、6 分量采用工程剪切应变 gamma12、gamma13、gamma23。
|
||
- 应力数组中第 4、5、6 分量采用真实剪切应力 tau12、tau13、tau23。
|
||
- 材料模块内部如需张量剪切应变,应在材料例程内部显式转换。
|
||
|
||
## 5. 错误与日志模块
|
||
|
||
模块:
|
||
|
||
- fem_error.f90
|
||
- fem_log.f90
|
||
|
||
错误码分组:
|
||
|
||
```text
|
||
0 success
|
||
1000 input errors
|
||
2000 mesh and dof errors
|
||
3000 material and state errors
|
||
4000 solver errors
|
||
5000 coupling errors
|
||
6000 output errors
|
||
9000 internal errors
|
||
```
|
||
|
||
核心接口约定:
|
||
|
||
```fortran
|
||
subroutine some_core_routine(..., ierr)
|
||
integer, intent(out) :: ierr
|
||
end subroutine
|
||
```
|
||
|
||
日志模块至少提供:
|
||
|
||
```fortran
|
||
subroutine log_info(message)
|
||
subroutine log_warning(message)
|
||
subroutine log_error(message)
|
||
```
|
||
|
||
## 6. 控制参数模块
|
||
|
||
模块:fem_control.f90
|
||
|
||
职责:
|
||
|
||
- 保存分析控制参数。
|
||
- 保存输出控制参数。
|
||
- 保存材料和求解器选项。
|
||
- 保存 SPH 耦合运行模式。
|
||
|
||
第一版关键变量:
|
||
|
||
```fortran
|
||
real(rk) :: time_start
|
||
real(rk) :: time_end
|
||
real(rk) :: dt_user
|
||
real(rk) :: dt_stable
|
||
integer :: nstep_max
|
||
integer :: output_interval
|
||
logical :: use_sph_coupling
|
||
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.
|
||
- use_user_dt 由输入文件或外部驱动器决定。
|
||
- SPH 耦合模式下 dt 由外部驱动器传入。
|
||
|
||
## 7. 数据库模块
|
||
|
||
模块:fem_database.f90
|
||
|
||
职责:
|
||
|
||
- 统一保存网格、材料、截面、集合、自由度、状态变量和全局向量。
|
||
- 提供 allocate/deallocate/init 子程序。
|
||
- 不承担具体单元、材料和求解算法。
|
||
|
||
### 7.1 网格数组
|
||
|
||
数组维度采用 Fortran 列主序友好形式:
|
||
|
||
```fortran
|
||
integer :: nnode
|
||
integer :: nelem
|
||
integer :: ndof
|
||
integer :: ngauss_total
|
||
|
||
real(rk), allocatable :: coord0(:,:) ! coord0(3,nnode)
|
||
real(rk), allocatable :: coord(:,:) ! coord(3,nnode)
|
||
integer, allocatable :: elem_conn(:,:) ! elem_conn(MAX_NEN,nelem)
|
||
integer, allocatable :: elem_nnode(:) ! elem_nnode(nelem)
|
||
character(len=ELEM_TYPE_LEN), allocatable :: elem_type(:)
|
||
integer, allocatable :: elem_mat(:) ! elem_mat(nelem)
|
||
integer, allocatable :: elem_sec(:) ! elem_sec(nelem)
|
||
integer, allocatable :: elem_status(:) ! elem_status(nelem)
|
||
```
|
||
|
||
单元类型直接使用 Abaqus 字符串:
|
||
|
||
```text
|
||
C3D4
|
||
C3D8
|
||
C3D10
|
||
C3D20
|
||
S3
|
||
S4
|
||
S6
|
||
S8
|
||
```
|
||
|
||
实现约定:
|
||
|
||
- INP 读取时将单元类型转换为大写并去除多余空格。
|
||
- 内部不使用整数单元类型编码作为主标识。
|
||
- 单元调度通过字符串比较或统一的字符串选择例程完成。
|
||
- 后续如需性能优化,可增加内部缓存编码,但 Abaqus 字符串仍作为数据库主字段。
|
||
|
||
单元状态建议:
|
||
|
||
```text
|
||
0 active
|
||
1 deleted
|
||
2 inactive by input
|
||
```
|
||
|
||
### 7.2 自由度数组
|
||
|
||
每节点预留 6 个自由度:
|
||
|
||
```fortran
|
||
integer, allocatable :: dof_id(:,:) ! dof_id(6,nnode)
|
||
```
|
||
|
||
规则:
|
||
|
||
- dof_id(1:3,node) 对应 UX、UY、UZ。
|
||
- dof_id(4:6,node) 对应 RX、RY、RZ。
|
||
- 实体单元只激活 1:3。
|
||
- 壳单元激活 1:6。
|
||
- 未激活自由度编号为 0。
|
||
|
||
### 7.3 全局向量
|
||
|
||
显式动力学第一版使用:
|
||
|
||
```fortran
|
||
real(rk), allocatable :: u(:) ! u(ndof)
|
||
real(rk), allocatable :: v(:) ! v(ndof), output velocity
|
||
real(rk), allocatable :: a(:) ! a(ndof)
|
||
real(rk), allocatable :: vhalf(:) ! vhalf(ndof)
|
||
real(rk), allocatable :: mass_diag(:) ! mass_diag(ndof)
|
||
|
||
real(rk), allocatable :: fint(:) ! fint(ndof)
|
||
real(rk), allocatable :: fext(:) ! fext(ndof)
|
||
real(rk), allocatable :: fsph(:) ! fsph(ndof)
|
||
real(rk), allocatable :: fcontact(:) ! fcontact(ndof), second version
|
||
```
|
||
|
||
速度约定:
|
||
|
||
- 显式求解内部保存半步速度 vhalf。
|
||
- 输出速度 v 可由相邻半步速度重建。
|
||
- v 数组保存用于输出和外部接口的整步速度估计。
|
||
|
||
### 7.4 高斯点与状态变量
|
||
|
||
```fortran
|
||
integer, allocatable :: elem_gp_start(:) ! elem_gp_start(nelem)
|
||
integer, allocatable :: elem_ngp(:) ! elem_ngp(nelem)
|
||
|
||
real(rk), allocatable :: stress(:,:) ! stress(6,ngauss_total)
|
||
real(rk), allocatable :: strain(:,:) ! strain(6,ngauss_total)
|
||
real(rk), allocatable :: statev(:,:) ! statev(NSTATEV_MAX,ngauss_total)
|
||
```
|
||
|
||
固定 statev 布局:
|
||
|
||
```text
|
||
1 eqps, equivalent plastic strain
|
||
2 damage
|
||
3 temperature
|
||
4 fail_flag, 0 active material point, 1 failed material point
|
||
5 plastic strain XX
|
||
6 plastic strain YY
|
||
7 plastic strain ZZ
|
||
8 plastic strain XY, engineering shear component
|
||
9 plastic strain XZ, engineering shear component
|
||
10 plastic strain YZ, engineering shear component
|
||
11 Fp11
|
||
12 Fp12
|
||
13 Fp13
|
||
14 Fp21
|
||
15 Fp22
|
||
16 Fp23
|
||
17 Fp31
|
||
18 Fp32
|
||
19 Fp33
|
||
20 eqps_rate
|
||
21 current_yield_stress
|
||
22 plastic_multiplier
|
||
23 internal_energy_density
|
||
24 reserved for temperature history
|
||
25-32 reserved
|
||
```
|
||
|
||
约定:
|
||
|
||
- 小应变 J2 使用 1、2、3、4、5:10、20、21、22。
|
||
- 大应变 J2 使用 1、2、3、4、11:19、20、21、22。
|
||
- Mohr-Coulomb 复用共享状态槽:5:10 为塑性应变,11 为分支号,12:13 为
|
||
剪切/张拉最终屈服值,20 为塑性增量率,21 为最终最大屈服值,22 为最近
|
||
一次塑性增量,26 为强度折减系数。
|
||
- 未使用槽位置零。
|
||
- 材料失效后设置 statev(4,gp)=1。
|
||
- 单元删除由 elem_status 标记,不通过释放内存实现。
|
||
|
||
## 8. INP 读取模块
|
||
|
||
模块:
|
||
|
||
- fem_inp_reader.f90
|
||
- fem_inp_keywords.f90
|
||
|
||
职责:
|
||
|
||
- 读取 Abaqus inp 文件。
|
||
- 解析第一版支持的 keyword。
|
||
- 构造数据库所需的原始数据。
|
||
- 对不支持 keyword 记录 warning。
|
||
- 对关键数据缺失返回 error。
|
||
|
||
第一版 keyword:
|
||
|
||
```text
|
||
*NODE
|
||
*ELEMENT
|
||
*NSET
|
||
*ELSET
|
||
*MATERIAL
|
||
*DENSITY
|
||
*ELASTIC
|
||
*PLASTIC
|
||
*SOLID SECTION
|
||
*SHELL SECTION
|
||
*BOUNDARY
|
||
*CLOAD
|
||
*DLOAD
|
||
*AMPLITUDE
|
||
*STEP
|
||
*DYNAMIC
|
||
```
|
||
|
||
集合要求:
|
||
|
||
- 支持 *NSET, GENERATE。
|
||
- 支持 *ELSET, GENERATE。
|
||
- 集合名统一转大写保存。
|
||
|
||
建议接口:
|
||
|
||
```fortran
|
||
subroutine inp_read_file(filename, ierr)
|
||
character(len=*), intent(in) :: filename
|
||
integer, intent(out) :: ierr
|
||
end subroutine
|
||
```
|
||
|
||
## 9. 集合数据结构
|
||
|
||
节点集和单元集采用压缩连续存储。
|
||
|
||
```fortran
|
||
integer :: n_nset
|
||
integer :: n_elset
|
||
|
||
character(len=NAME_LEN), allocatable :: nset_name(:)
|
||
integer, allocatable :: nset_start(:)
|
||
integer, allocatable :: nset_count(:)
|
||
integer, allocatable :: nset_items(:)
|
||
|
||
character(len=NAME_LEN), allocatable :: elset_name(:)
|
||
integer, allocatable :: elset_start(:)
|
||
integer, allocatable :: elset_count(:)
|
||
integer, allocatable :: elset_items(:)
|
||
```
|
||
|
||
规则:
|
||
|
||
- set_start 指向 set_items 中的起始位置。
|
||
- set_count 表示集合元素数。
|
||
- 集合项保持输入编号,数据库构建时再映射为内部编号。
|
||
|
||
## 10. 材料模块
|
||
|
||
模块:
|
||
|
||
- fem_material_iso.f90
|
||
- fem_material_j2.f90
|
||
- fem_material_mohr_coulomb.f90
|
||
- fem_material_mohr_coulomb_db.f90
|
||
- fem_material_mc_driver.f90
|
||
- fem_material_mc_envelope.f90
|
||
- fem_strength_reduction.f90
|
||
- fem_strength_reduction_driver.f90
|
||
- fem_strength_reduction_report.f90
|
||
|
||
材料控制建议采用分解模型选项:
|
||
|
||
```fortran
|
||
character(len=MAT_MODEL_LEN), allocatable :: mat_elastic_model(:)
|
||
character(len=MAT_MODEL_LEN), allocatable :: mat_plastic_model(:)
|
||
character(len=MAT_MODEL_LEN), allocatable :: mat_rate_model(:)
|
||
character(len=MAT_MODEL_LEN), allocatable :: mat_temp_model(:)
|
||
character(len=MAT_MODEL_LEN), allocatable :: mat_failure_model(:)
|
||
```
|
||
|
||
第一版材料选项:
|
||
|
||
```text
|
||
elastic model: ISO_LINEAR
|
||
plastic model: NONE / J2_SMALL / J2_FINITE
|
||
hardening: IDEAL / LINEAR / TABULAR
|
||
rate model: NONE / JOHNSON_COOK
|
||
temperature model: NONE / JOHNSON_COOK
|
||
failure model: NONE / EQPS_LIMIT / JOHNSON_COOK
|
||
```
|
||
|
||
第五版当前材料选项:
|
||
|
||
```text
|
||
plastic model: MOHR_COULOMB
|
||
```
|
||
|
||
Mohr-Coulomb 更新由 `fem_material_mohr_coulomb` 承担,参数合法性 helper 位于
|
||
`fem_material_mohr_coulomb_db`。材料点路径诊断由 `fem_material_mc_driver`
|
||
记录,包络 margin 和 safety ratio 由 `fem_material_mc_envelope` 提供。强度
|
||
折减参数、trial 搜索状态和报告输出分别由 `fem_strength_reduction`、
|
||
`fem_strength_reduction_driver` 和 `fem_strength_reduction_report` 管理。
|
||
|
||
材料参数至少包含:
|
||
|
||
```fortran
|
||
real(rk), allocatable :: mat_density(:)
|
||
real(rk), allocatable :: mat_e(:)
|
||
real(rk), allocatable :: mat_nu(:)
|
||
real(rk), allocatable :: mat_yield0(:)
|
||
real(rk), allocatable :: mat_hardening_modulus(:)
|
||
```
|
||
|
||
Mohr-Coulomb 额外材料参数:
|
||
|
||
```fortran
|
||
real(rk), allocatable :: mat_mc_phi(:)
|
||
real(rk), allocatable :: mat_mc_cohesion(:)
|
||
real(rk), allocatable :: mat_mc_dilation(:)
|
||
real(rk), allocatable :: mat_mc_tension(:)
|
||
real(rk), allocatable :: mat_mc_res_phi(:)
|
||
real(rk), allocatable :: mat_mc_res_cohesion(:)
|
||
real(rk), allocatable :: mat_mc_res_dilation(:)
|
||
real(rk), allocatable :: mat_mc_reduction(:)
|
||
```
|
||
|
||
Mohr-Coulomb 使用受拉为正的应力约定;材料点内部将主应力排序后,以压缩正量
|
||
评估剪切屈服,并单独检查最大主应力张拉截断。
|
||
|
||
材料更新接口建议:
|
||
|
||
```fortran
|
||
subroutine material_update_3d(mat_id, dt, strain_inc, defgrad, &
|
||
strain_rate, temperature, state_old, &
|
||
stress_old, stress_new, state_new, &
|
||
failed, ierr)
|
||
integer, intent(in) :: mat_id
|
||
real(rk), intent(in) :: dt
|
||
real(rk), intent(in) :: strain_inc(6)
|
||
real(rk), intent(in) :: defgrad(3,3)
|
||
real(rk), intent(in) :: strain_rate
|
||
real(rk), intent(in) :: temperature
|
||
real(rk), intent(in) :: state_old(NSTATEV_MAX)
|
||
real(rk), intent(in) :: stress_old(6)
|
||
real(rk), intent(out) :: stress_new(6)
|
||
real(rk), intent(out) :: state_new(NSTATEV_MAX)
|
||
logical, intent(out) :: failed
|
||
integer, intent(out) :: ierr
|
||
end subroutine
|
||
```
|
||
|
||
材料模块约束:
|
||
|
||
- 不直接访问全局节点和单元数组。
|
||
- 不执行单元删除,只返回 failed 标志。
|
||
- 不施加边界条件。
|
||
- 不写输出文件。
|
||
- 不在材料点更新中控制结构级强度折减 bracket;结构 trial 指标应通过
|
||
`fem_strength_reduction_driver` 记录和判定。
|
||
- Mohr-Coulomb 当前提供活动集算法一致切线;若修改 shear、tension 或 mixed
|
||
角点返回映射,必须同步更新 `material_mohr_coulomb`、`material_mc_driver`、
|
||
算法文档、材料点有限差分切线审计和结构 benchmark 诊断。
|
||
- `METHOD=MC_SUBSTEPPING_SEMISMOOTH` 的生产路径由材料分发层在
|
||
`MOHR_COULOMB` 更新时调用 `fem_material_mc_driver`。该路径使用 `fem_control`
|
||
中的 MC 子步控制量,并把聚合诊断写入 `statev(27:32)`;benchmark 工具只允许
|
||
读取这些诊断,不得实现替代材料积分。
|
||
|
||
## 11. 形函数与积分模块
|
||
|
||
模块:
|
||
|
||
- fem_shape_solid.f90
|
||
- fem_shape_shell.f90
|
||
- fem_quadrature.f90
|
||
|
||
接口建议:
|
||
|
||
```fortran
|
||
subroutine shape_solid(elem_type, xi, nnode, n, dndxi, ierr)
|
||
character(len=*), intent(in) :: elem_type
|
||
real(rk), intent(in) :: xi(3)
|
||
integer, intent(out) :: nnode
|
||
real(rk), intent(out) :: n(MAX_NEN)
|
||
real(rk), intent(out) :: dndxi(3,MAX_NEN)
|
||
integer, intent(out) :: ierr
|
||
end subroutine
|
||
```
|
||
|
||
```fortran
|
||
subroutine quadrature_rule(elem_type, ngauss, xi, weight, ierr)
|
||
character(len=*), intent(in) :: elem_type
|
||
integer, intent(out) :: ngauss
|
||
real(rk), intent(out) :: xi(3,*)
|
||
real(rk), intent(out) :: weight(*)
|
||
integer, intent(out) :: ierr
|
||
end subroutine
|
||
```
|
||
|
||
第一版支持:
|
||
|
||
- C3D4
|
||
- C3D8
|
||
- S4
|
||
|
||
## 12. 实体单元模块
|
||
|
||
模块:fem_element_solid.f90
|
||
|
||
职责:
|
||
|
||
- 计算 C3D4、C3D8 集中质量。
|
||
- 计算单元内力。
|
||
- 计算线性静力单元刚度。
|
||
- 为非线性静力和隐式动力提供切线刚度或近似切线刚度。
|
||
- 更新高斯点应力和状态变量。
|
||
- 估算稳定时间步。
|
||
- 处理材料点失效并向单元删除逻辑报告。
|
||
|
||
接口建议:
|
||
|
||
```fortran
|
||
subroutine solid_lumped_mass(elem, ierr)
|
||
integer, intent(in) :: elem
|
||
integer, intent(out) :: ierr
|
||
end subroutine
|
||
|
||
subroutine solid_internal_force(elem, dt, ierr)
|
||
integer, intent(in) :: elem
|
||
real(rk), intent(in) :: dt
|
||
integer, intent(out) :: ierr
|
||
end subroutine
|
||
|
||
subroutine solid_stable_dt(elem, dtcrit, ierr)
|
||
integer, intent(in) :: elem
|
||
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
|
||
```
|
||
|
||
单元删除策略:
|
||
|
||
- 删除后的单元在内存中保留且可访问。
|
||
- 删除通过 elem_status(elem)=1 标记。
|
||
- 删除单元不再贡献内力。
|
||
- 删除单元不再接受面压力和 SPH facet 外载。
|
||
- 删除单元的质量不从全局 mass_diag 中移除。
|
||
- 删除单元不触发自由度重编号。
|
||
- 输出中应保留删除状态。
|
||
|
||
## 13. 壳单元模块
|
||
|
||
模块:fem_element_shell.f90
|
||
|
||
第一版支持 S4。
|
||
|
||
职责:
|
||
|
||
- 计算 S4 集中质量。
|
||
- 计算 S4 内力。
|
||
- 支持 S4 面压力。
|
||
- 支持 S4 输出应力、应变和塑性应变。
|
||
|
||
第一版约束:
|
||
|
||
- S4 作为可计算单元纳入第一版。
|
||
- 壳大变形和有限转动能力在第一版中保持受限实现。
|
||
- 二次壳单元和基础壳响应在第二版扩展,hourglass 控制、drilling DOF 稳定和壳静力刚度在第三版继续完善。
|
||
|
||
第二版状态:
|
||
|
||
- S3、S6、S8 纳入基础能力。
|
||
- S4 膜、弯曲、横向剪切和压力路径增强。
|
||
- 壳单元仍优先服务显式动力学。
|
||
|
||
第三版要求:
|
||
|
||
- 提供 S3、S4、S6、S8 线性静力刚度。
|
||
- 支持 Mindlin-Reissner 壳膜、弯曲和横向剪切刚度装配。
|
||
- 提供 drilling DOF 稳定处理。
|
||
- 支持壳单元静力应力、应变和节点反力输出。
|
||
- Scordelis-Lo 屋面壳体作为壳静力基准验收模型。
|
||
|
||
V4.7 壳稳定与塑性验证增强:
|
||
|
||
- `fem_control` 提供 drilling 稳定系数、S3 剪切锁定折减系数和最小折减比例,默认保持第三版数值。
|
||
- `fem_element_stiffness` 在壳刚度装配后记录 sample count、最近单元、最近 drilling 刚度、最近 S3 剪切折减、最小剪切折减和最大 drilling 刚度,供敏感性测试和外部诊断查询。
|
||
- S4/S3/S6/S8 section tangent 对 J2/J2_JC 继续从当前积分点算法切线映射到膜、弯曲和横向剪切块。
|
||
- 壳 J2 内力路径将膜应变、横向剪切应变和 `0.5 * thickness * bending strain` 外纤维弯曲近似组合成代表性三维小应变,用于触发弯曲/剪切塑性状态更新,并将弯曲应变写入 `statev(13:15)`。
|
||
- 当前弯曲塑性是代表性外纤维近似,不是完整厚度方向 plastic section integration;
|
||
V5.11 已把多层 `*SHELL SECTION, COMPOSITE` 的 ABD/H 层合矩阵、层级塑性状态、
|
||
trial/rollback 和 algorithmic tangent 接入 `fem_shell_section`,有限应变 S4 和小应变壳
|
||
共享该 section 入口。旧外纤维近似不得作为多层塑性完成证据。
|
||
|
||
V5.11 壳几何非线性重新设计目标:
|
||
|
||
- V5.11 的完成路线改为 Abaqus-style finite-membrane-strain shell,而不是恢复或补丁化
|
||
旧的 S4 诊断路径。生产验收单元先限定为 `S4`;`S3` 在第二阶段
|
||
接入独立三角壳有限转动/DSG 或 MITC3 剪切路径;`S6` 和 `S8` 在完整二次壳
|
||
formulation 完成前,若请求几何非线性必须显式报 unsupported,不能隐式退回线性壳
|
||
或旧诊断简化。
|
||
- 旧 S4 诊断模块、生产 dispatch、输入别名和只服务该路线的测试入口已经删除。
|
||
`SHELL_GEOMETRIC=FINITE_STRAIN` 当前只允许 S4 进入生产有限应变壳路径;其他壳单元
|
||
必须显式报 unsupported,不能通过 hidden fallback 继续求解。
|
||
- `fem_shell_rotation` 负责壳节点有限转动状态。节点 4:6 DOF 仍是 Newton 修正量;
|
||
模块用 exponential-map quaternion 更新 committed/trial rotation,并记录每个节点上次
|
||
已同步的旋转 DOF。Newton 迭代中新的位移修正按增量旋转复合到当前 trial director,
|
||
而不是反复把总旋转向量作用到 committed director。cutback、line-search rejection
|
||
和 Newmark rollback 必须通过 element-state 生命周期同时恢复 rotation state 和 DOF
|
||
sync state。
|
||
- `fem_shell_finite_kinematics` 负责 S4 参考/当前中面几何、covariant basis、
|
||
director、metric、有限膜应变、Koiter-Sanders 类曲率增量、局部工程分量投影和
|
||
MITC4 横向剪切采样。该模块直接处理初始曲率和非平面四边形参考几何,不能先把
|
||
单元拍平成局部平面再做大位移小应变近似。若后续需要膜/弯曲 assumed strain
|
||
扩展,应在该模块或从该模块拆出的生产模块中实现,不能新增空接口。
|
||
- `fem_shell_section` 继续作为单层、多层、弹塑性 shell section 的唯一生产入口。
|
||
几何非线性壳只向它传入广义应变
|
||
`[e11,e22,2e12,k11,k22,2k12,gamma13,gamma23]`,并取得广义力
|
||
`[N11,N22,N12,M11,M22,M12,Q13,Q23]` 与 algorithmic section tangent。旧
|
||
`shell_stiffness_props`、`shell_constitutive` 和 `shell4_resultants` 不得重新引入。
|
||
- `fem_shell_finite_tangent` 负责 S4 有限膜应变 B 矩阵、B 的算法线性化、
|
||
`B^T D_alg B + S_i dB_i/du` 高斯点切线和局部工程分量映射。
|
||
- `fem_shell_finite_element` 负责 S4 几何非线性生产装配:
|
||
`F_int = integral B_nl^T S dA`,并通过 `fem_element_internal` 与
|
||
`fem_element_stiffness` 接管 `SHELL_GEOMETRIC=FINITE_STRAIN` 的 S4 内力和刚度调度。
|
||
该模块只调度运动学、section resultants/tangent、几何切线和旋转线性化,不直接写材料
|
||
返回映射。
|
||
- drilling rotation 稳定化作为 `fem_shell_finite_element` 内部能量项装配:
|
||
稳定能量、残差和刚度必须来自同一二次势能,刚度因子、诊断字段和薄壳基准影响必须
|
||
可测试;不得把 drilling 稳定项混在 material tangent 中。
|
||
- `fem_dload_tangent` 继续在 solver 层装配 shell `DLOAD P` current-geometry
|
||
follower-pressure tangent,并由 `fem_implicit_constraints` 调用。finite-strain
|
||
S4 路径还必须明确其他 follower-load 类型的支持/拒绝边界。
|
||
- 维护该路径时必须同步运行 finite-strain S4 运动学刚体运动、小转角线性极限、
|
||
MITC/ANS patch、解析切线有限差分审计、J2/J2_JC/composite section trial/rollback、
|
||
pressure follower tangent 和 spherical-cap postbuckling checker。当前
|
||
`examples/spherical_cap_with_central_point_load` 的 Shell-4 deck 已改为 S4-only
|
||
square-disk 冠部重网格;当前 nonlinear route 可到达目标位移,但反力曲线仍单调硬化。
|
||
全 benchmark 只有在复现 PDF load drop/restiffening 后才能列为通过。
|
||
|
||
## 14. 边界与载荷模块
|
||
|
||
模块:fem_boundary.f90
|
||
|
||
第一版数据结构:
|
||
|
||
```fortran
|
||
integer :: nbc
|
||
integer, allocatable :: bc_node(:)
|
||
integer, allocatable :: bc_dof(:)
|
||
real(rk), allocatable :: bc_value(:)
|
||
integer, allocatable :: bc_amp(:)
|
||
|
||
integer :: ncload
|
||
integer, allocatable :: cload_node(:)
|
||
integer, allocatable :: cload_dof(:)
|
||
real(rk), allocatable :: cload_value(:)
|
||
integer, allocatable :: cload_amp(:)
|
||
|
||
integer :: ndload
|
||
integer, allocatable :: dload_elem(:)
|
||
integer, allocatable :: dload_face(:)
|
||
real(rk), allocatable :: dload_value(:)
|
||
integer, allocatable :: dload_amp(:)
|
||
```
|
||
|
||
接口建议:
|
||
|
||
```fortran
|
||
subroutine boundary_apply_dirichlet(time, ierr)
|
||
subroutine boundary_apply_cload(time, ierr)
|
||
subroutine boundary_apply_dload(time, ierr)
|
||
```
|
||
|
||
约定:
|
||
|
||
- Dirichlet 支持位移约束。
|
||
- 节点力写入 fext。
|
||
- 面压力转换为等效节点力后写入 fext。
|
||
- amplitude 编号为 0 时表示常值。
|
||
|
||
V5.3 mortar/AL 接触工程化模块约定:
|
||
|
||
- `fem_contact_multiplier` 负责 mortar/AL 积分点乘子槽、trial/commit/rollback、
|
||
restart 写读和 `contact_multiplier_audit` 审计。乘子槽键为 pair、
|
||
slave element/face、master element/face 和 point id。
|
||
- `contact_multiplier_audit` 返回 slot 数、active/released/open 状态数、
|
||
duplicate key 数、invalid status 数、最大已提交乘子、最大 trial gap 和
|
||
commit/trial 差异;restart 或报告路径发现 duplicate/invalid 时应返回错误。
|
||
- `fem_contact_multiplier_report` 负责乘子 CSV 和 summary 文本输出。0.5.1 起
|
||
summary 同步输出 duplicate、invalid 和 max commit error,便于排查 restart
|
||
状态污染或未 commit 的 trial 状态。
|
||
- `fem_contact_mortar_al` 负责 AL 点更新、gap residual、weighted gap、
|
||
complementarity、penalty adapt 和 summary;它只处理积分点级状态,不直接
|
||
写全局力或全局刚度。
|
||
- `fem_contact_mortar_tangent` 负责局部 mortar tangent 块、stick/slip
|
||
模式、法向/切向 projector、矩阵应用和 `mortar_tan_audit_matrix`。
|
||
audit 检查 row/column balance、刚体平移残差、非对称量和能量 probe;
|
||
stick 模式应保持对称,slip 模式可通过 `nonsym_scale` 暴露摩擦耦合的
|
||
非对称切线。
|
||
- `contact_mortar_tangent` 和 `restart` 模块测试必须覆盖上述审计入口;
|
||
新增接触状态或 tangent 公式时,应同步更新算法文档、验收矩阵和测试计划。
|
||
|
||
V5.6 滚压运动学模块约定:
|
||
|
||
- `fem_rigid_cylinder` 负责圆柱几何、投影、法向、切向基和表面速度。
|
||
- `fem_rigid_roller` 负责辊位姿、进给/下压速度、接触运动学、经典 Coulomb 牵引和正则化滚压牵引。
|
||
- `fem_roller_schedule` 负责 feed/down/spin/pressure 随时间的插值和速率。
|
||
- `fem_roll_metrics` 负责 active sample、pressure、slip、friction power、contact width、残余位移和 springback ratio 等紧凑指标。
|
||
- `tools/benchmarks/roll_forming_kinematics_benchmark.f90` 是示例验收编排工具,调用上述生产模块生成 history/summary;它不承担塑性成形或回弹求解。
|
||
- `tools/benchmarks/roll_forming_springback_benchmark.f90` 是 V5.6 塑性成形/卸载回弹验收编排工具;它读取专用 benchmark 输入,调用生产滚压运动学、正则化牵引、roll metrics 和 J2 小应变材料更新,输出 springback summary、history 和 plastic zone。该工具不进入 `src`,也不作为主求解器通用滚压 step。
|
||
|
||
V5.7 cohesive 模块约定:
|
||
|
||
- `fem_cohesive_law` 负责 traction-separation law、混合模态能量、损伤起始、损伤不可逆更新、完全脱粘、压缩分支和 secant stiffness。
|
||
- `fem_cohesive_state` 负责 contact 积分点级 damage、trial damage、最大法向开口、最大有效分离、cohesive 能量和 status;状态槽按 pair、slave/master element/face 和 point id 索引,并支持 trial/rollback/commit 与 restart 写读。
|
||
- `fem_cohesive_metrics` 负责 bonded/damaging/failed/compress 数量、最大损伤、最大开口、最大有效分离、总面积、失效面积、cohesive 能量和弹性能汇总。
|
||
- `test_cohesive_contact` 是当前 cohesive 单积分点验收入口,覆盖 bonded loading、mixed-mode damage、unloading、reload、complete decohesion、非负耗散、损伤不可逆和 restart 保持。
|
||
- `tools/benchmarks/ball_adhesion_cohesive_benchmark.f90` 是 V5.7 compact 球-膜粘附/脱粘验收编排工具;它读取专用 benchmark 输入,把粘附区离散为同心环,调用生产 cohesive law/state/metrics 输出 force-displacement history、summary 和 decohesion profile。该工具不进入 `src`,也不作为主求解器通用 cohesive contact step。
|
||
- 球-膜粘附/脱粘示例升级时应继续复用上述生产模块;示例 checker、benchmark 编排和结果抽样仍放在 `examples/` 或 `tools/benchmarks`,不放入 `src`。
|
||
|
||
V5.8 颗粒模块约定:
|
||
|
||
- `fem_particle_state` 负责离散球颗粒的 id、位置、速度、半径、质量、力、总质量、动量和动能。
|
||
- `fem_particle_search` 负责颗粒对、搜索半径和墙面几何量。
|
||
- `fem_particle_contact` 负责颗粒-颗粒和颗粒-墙接触力、弹性能和耗散功率。
|
||
- `fem_particle_step` 负责显式推进、pair/wall 调用和 `particle_step_diag` 诊断;`pstep_diag_values` 将诊断转换为质量、动量、动能、步耗散能和最大重叠。
|
||
- `fem_particle_facet_coupling` 负责颗粒-facet 接触、节点载荷分配、接触功和力平衡。
|
||
- `fem_particle_facet_step` 汇总颗粒-facet contact count、最大重叠、弹性能、耗散功率和力范数。
|
||
- `fem_particle_coupling` 负责颗粒-facet 载荷收集/应用,不承担颗粒时间积分算法。
|
||
- `test_particle_acceptance` 是模块级验收入口,覆盖自由落体、墙碰撞、颗粒堆和颗粒-facet 载荷平衡;示例或 benchmark 编排仍应放在 `examples/` 或 `tools/`,不放入 `src`。
|
||
- `dynamic_grain_container_benchmark.f90` 是 `tools/benchmarks` 中的验收编排工具:它读取 benchmark 控制输入、加载无压力载荷的柔性容器结构输入,每步依次清空 `fsph`、调用 `particle_fem_apply_all` 映射颗粒-facet 节点力、执行 `fem_advance_explicit`、再用 `pstep_advance` 推进颗粒。工具输出 `grain_container_history.csv` 和 `grain_container_summary.csv`,由示例目录内 checker 验证粒子数、接触数、映射力、容器位移、质量守恒、重叠和能量。
|
||
|
||
## 15. SPH 耦合模块
|
||
|
||
模块:fem_sph_coupling.f90
|
||
|
||
facet 数据结构:
|
||
|
||
```fortran
|
||
integer :: nfacet
|
||
integer, allocatable :: facet_elem(:)
|
||
integer, allocatable :: facet_face(:)
|
||
integer, allocatable :: facet_nnode(:)
|
||
integer, allocatable :: facet_conn(:,:) ! facet_conn(MAX_FACE_NODES,nfacet)
|
||
real(rk), allocatable :: facet_center(:,:) ! facet_center(3,nfacet)
|
||
real(rk), allocatable :: facet_area(:)
|
||
real(rk), allocatable :: facet_normal(:,:) ! facet_normal(3,nfacet)
|
||
```
|
||
|
||
导出数据应包含:
|
||
|
||
- facet 编号
|
||
- facet 所属单元和面号
|
||
- facet 节点连接
|
||
- facet 中心坐标
|
||
- facet 节点坐标
|
||
- facet 节点速度
|
||
- facet 外法向
|
||
- facet 面积
|
||
|
||
接口建议:
|
||
|
||
```fortran
|
||
subroutine coupling_build_facets(ierr)
|
||
subroutine fem_get_boundary_facets(nfacet_out, conn, x, vnod, normal, area, ierr)
|
||
subroutine fem_apply_sph_nodal_forces(nnode_in, node_id, force, ierr)
|
||
subroutine fem_apply_sph_facet_tractions(nfacet_in, facet_id, pressure, shear, ierr)
|
||
```
|
||
|
||
约定:
|
||
|
||
- coupling 层只做数据交换和力映射。
|
||
- FEM 不依赖 SPH 程序。
|
||
- solver 只接收已经映射完成的 fsph。
|
||
- 删除单元不再作为有效 SPH facet 来源。
|
||
|
||
## 16. 求解器模块
|
||
|
||
模块:fem_solver_explicit.f90
|
||
|
||
核心接口:
|
||
|
||
```fortran
|
||
subroutine fem_initialize(ierr)
|
||
subroutine fem_read_inp(filename, ierr)
|
||
subroutine fem_build_model(ierr)
|
||
subroutine fem_compute_lumped_mass(ierr)
|
||
subroutine fem_estimate_stable_dt(dtcrit, ierr)
|
||
subroutine fem_advance_explicit(dt, ierr)
|
||
subroutine fem_write_output(step, time, ierr)
|
||
subroutine fem_finalize(ierr)
|
||
```
|
||
|
||
显式单步流程:
|
||
|
||
```text
|
||
clear fint, fext, fsph if required
|
||
apply prescribed loads
|
||
receive or keep SPH forces depending on coupling mode
|
||
loop over active elements and compute internal force
|
||
apply Dirichlet constraints
|
||
compute acceleration from lumped mass
|
||
update vhalf
|
||
update displacement u
|
||
reconstruct output velocity v
|
||
update current coordinates coord = coord0 + displacement
|
||
mark failed elements as deleted
|
||
write output if requested
|
||
```
|
||
|
||
第二版模块:
|
||
|
||
- fem_solver_implicit.f90
|
||
- fem_sparse_csr.f90
|
||
|
||
第一版只保留接口占位,不要求装配全局刚度矩阵。
|
||
|
||
第三版静力求解接口建议:
|
||
|
||
```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_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
|
||
|
||
subroutine fem_get_convergence_metrics(relative_residual_norm, &
|
||
contact_gap_norm, combined_norm, ierr)
|
||
real(rk), intent(out) :: relative_residual_norm
|
||
real(rk), intent(out) :: contact_gap_norm
|
||
real(rk), intent(out) :: combined_norm
|
||
integer, intent(out) :: ierr
|
||
end subroutine
|
||
|
||
subroutine fem_get_convergence_diagnostics(cutback_count, last_dt, &
|
||
last_accepted_time, status_code, &
|
||
failure_code, ierr)
|
||
integer, intent(out) :: cutback_count
|
||
real(rk), intent(out) :: last_dt
|
||
real(rk), intent(out) :: last_accepted_time
|
||
integer, intent(out) :: status_code
|
||
integer, intent(out) :: failure_code
|
||
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 算法切线。
|
||
- 壳单元膜内、弯曲和横向剪切 section tangent 对 J2/J2_JC 使用当前积分点算法切线映射。
|
||
- 每个非线性增量保存材料状态和单元状态备份,迭代试算前恢复,收敛后提交,失败后回滚。
|
||
- Robin、MPC、刚性平面 penalty contact、面-面 contact pair 和 follower load
|
||
切线通过 `fem_implicit_constraints` 进入 Newton 有效刚度。
|
||
- 静力和非线性 Newmark 均支持线搜索;可选步长缩减在失败时恢复增量起点状态后重试。
|
||
- V4.5 起,`fem_control` 保存最近一次求解收敛快照、relative residual、contact gap residual、combined norm、cutback 诊断、最后有效时间和失败原因码,供 Fortran API、C ABI 和测试直接查询。
|
||
- V4.6 起,隐式求解器通过线性求解器分发层求解 CSR 方程;默认 CG + Jacobi,可切换 BiCGSTAB/GMRES/DENSE + none/Jacobi/Gauss-Seidel/ILU0,并记录最近一次线性求解方法、预条件器、迭代数、残差、矩阵分类和状态。
|
||
- V4.7 起,壳 drilling/S3 剪切锁定参数可配置并提供稳定性统计;壳 J2 剪切和代表性弯曲塑性路径纳入 trial/rollback 回归。
|
||
- V5.4 起,`*NONLINEAR CONTINUATION` 的方法选择和 NC-2/NC-3/NC-4 控制量保存在
|
||
`fem_control`,由 `fem_inp_nlc` 解析;`fem_inp_helpers` 仅保留通用 keyword
|
||
和 data-line helper。`fem_solver_implicit` 的非线性静力
|
||
主路径负责目标 Newton 自适应步长、trust-region 修正裁剪、residual-merit
|
||
damping、trust radius 更新、直接位移控制 accepted-path 记录和 rollback/cutback
|
||
交互;benchmark 工具只能读取并输出这些生产诊断,不能实现替代求解算法。
|
||
NC-4 当前完成了两条明确分离的生产路径:载荷型问题进入 Riks/arc-length
|
||
增广方程,未知量为位移和全局 `load_factor`,参考载荷方向由
|
||
`dF_ext/dlambda` 得到;非零 prescribed-displacement 问题则在 accepted
|
||
increment 收敛后记录与实际边界条件一致的 `load_factor * amplitude * value`、
|
||
约束残差、反力和收敛状态。若两类控制量都不存在,solver 直接报错,
|
||
不再保留普通 Newton accepted-path 简化 fallback。V5.11 壳几何非线性后续以
|
||
finite-membrane-strain S4 为完成目标;可复用基础设施限于 `fem_shell_section`、
|
||
shell layer/resultant state、`fem_element_internal`、`fem_element_stiffness` 和
|
||
`fem_dload_tangent`。修改 `SHELL_GEOMETRIC`、
|
||
finite-strain shell 选项或算法切线语义时必须同步更新 INP 解析、算法文档、用户手册、
|
||
spherical-cap checker 和 shell internal/implicit input 回归。
|
||
- V5.4 的 NC-5 路线已把 Mohr-Coulomb 局部子步接入生产材料分发;`fem_control`
|
||
保存 `MC_MIN_SUBSTEPS`、`MC_MAX_SUBSTEPS`、`MC_TARGET_STRAIN`、`MC_YIELD_TOL`
|
||
和 `MC_PLASTIC_LIMIT` 控制量,`statev(27:32)` 保存子步聚合诊断。结构级
|
||
substep 汇总已接入;0.75 m 临界失稳 cloud 的效果证明移入后续研究验证,
|
||
不作为 V5 交付项。
|
||
- V5.5 起,`fem_eigensolver` 提供内部 dense 对称 Jacobi 特征值求解和 SPD 广义特征值变换,`fem_buckling_solver` 提供线性屈曲 dense solve、几何刚度符号处理、Euler 柱解析临界载荷和模态参与系数 helper。该路径用于小规模解析/工程 benchmark,不依赖第三方特征值库或外部求解器。`buckling_dense_solve` 的 Jacobi 迭代预算随自由度规模增长,避免小型工程矩阵被固定旋转次数误截断。
|
||
|
||
线性屈曲支撑模块:
|
||
|
||
```text
|
||
src/solver/fem_eigensolver.f90
|
||
src/solver/fem_buckling_solver.f90
|
||
src/element/fem_geometric_stiffness.f90
|
||
```
|
||
|
||
当前约定:
|
||
|
||
- `eig_generalized_spd` 要求几何刚度参考矩阵为对称正定矩阵。
|
||
- 模态通过 `eig_mass_normalize` 按 `phi^T K_G phi = 1` 归一化。
|
||
- `eig_modal_residuals` 输出 `K phi - lambda K_G phi` 的相对残差。
|
||
- 示例/benchmark 编排工具放在 `tools/benchmarks` 和 `examples/<case>`,不要放入 `src`。
|
||
- `tools/benchmarks/corrugated_shell_buckling_benchmark.f90` 是波纹壳紧凑循环屈曲验收编排工具,负责构造周期约化矩阵、调用屈曲/循环/模态输出模块并生成 summary、wave sweep、modal CSV 和 profile;它不承担主求解器通用 `*BUCKLING` step 解析。
|
||
|
||
## 17. 稀疏矩阵模块
|
||
|
||
模块:fem_sparse_csr.f90
|
||
|
||
第二版主用 CSR。
|
||
|
||
第一版状态:
|
||
|
||
- 可提供空接口或最小数据结构。
|
||
- dense 仅用于单元局部矩阵和调试。
|
||
- skyline 非第一优先级。
|
||
|
||
V4.6 线性求解器抽象仍位于 `fem_linear_solver_cg.f90`,保留 `linear_cg_solve` 兼容入口,同时新增:
|
||
|
||
- `linear_solver_solve`:根据 `fem_control` 中的 `linear_solver_method / linear_precond_method` 分发。
|
||
- `linear_bicgstab_solve`:用于非对称或非正定 CSR 小系统的内部备用路径。
|
||
- `linear_gmres_solve`:用于非对称 CSR 小系统的内部 Krylov 路径,构造 Arnoldi Hessenberg 基并求解小型最小二乘修正。
|
||
- `linear_dense_solve`:用于小中型回归矩阵和非线性修正 fallback 的内部 dense
|
||
pivoting 路径,由 CSR 转换为 dense 矩阵并做部分主元高斯消元,不依赖外部库。
|
||
- `linear_solver_configure / linear_solver_get_settings / linear_solver_get_stats / linear_solver_get_diagnostics`:配置和查询当前/最近一次线性求解器状态、CSR 矩阵分类、初始残差、最终残差和最终相对残差。
|
||
- 分发层不包含外部求解器 adapter。非 CG/BiCGSTAB/GMRES/DENSE 的 method
|
||
值在配置阶段返回错误,并保持当前设置不变。
|
||
|
||
## 18. 输出模块
|
||
|
||
模块:fem_output_csv.f90
|
||
|
||
第一版 CSV 文件组织:
|
||
|
||
```text
|
||
history.csv
|
||
nodes_step_xxxxx.csv
|
||
elements_step_xxxxx.csv
|
||
```
|
||
|
||
history.csv 至少包含:
|
||
|
||
- step
|
||
- time
|
||
- kinetic_energy
|
||
- internal_energy
|
||
- external_work
|
||
- max_displacement
|
||
- max_velocity
|
||
- deleted_element_count
|
||
|
||
nodes_step_xxxxx.csv 至少包含:
|
||
|
||
- node_id
|
||
- x
|
||
- y
|
||
- z
|
||
- ux
|
||
- uy
|
||
- uz
|
||
- vx
|
||
- vy
|
||
- vz
|
||
- ax
|
||
- ay
|
||
- az
|
||
|
||
elements_step_xxxxx.csv 至少包含:
|
||
|
||
- elem_id
|
||
- elem_type
|
||
- elem_status
|
||
- stress components
|
||
- strain components
|
||
- plastic strain components
|
||
- eqps
|
||
- damage
|
||
|
||
第二版增加:
|
||
|
||
- VTK 输出
|
||
- restart 输出与读取
|
||
|
||
第三版增加:
|
||
|
||
- `convergence.csv`:静力和隐式动力增量迭代历史。
|
||
- `reactions_step_xxxxx.csv`:节点反力。
|
||
- `contact_XXXXXXXX.csv`:接触状态、接触力和接触功。
|
||
当前字段为 `kind,pair_id,active_count,max_penetration,force_norm,work_estimate,cumulative_work,stick_count,slip_count,accumulated_slip,friction_work,friction_work_total,friction_regularization,ftx,fty,ftz,status,activation_count,release_count,gap_residual,aug_factor,aug_lambda,search_facets,search_masters,search_candidates,search_active,search_bvh_nodes,search_cache_used,search_cache_overflow,search_cpu_time,contact_force_cpu_time,contact_tangent_cpu_time`,包含 summary 行和逐 contact pair 行。
|
||
- 静力求解结束后必须写出与显式结果一致的 VTK 场文件。
|
||
|
||
第四版增加:
|
||
|
||
- restart v2 在原有 DOF、单元状态和高斯点状态之后增加 `CONTACT_HISTORY` 段,
|
||
保存 mortar 积分点摩擦历史槽。
|
||
- 0.5.x restart 继续增加 `CONTACT_MULTIPLIER` 段,保存 mortar/AL 积分点
|
||
乘子键、状态、已提交乘子和 trial gap;读入后恢复 `trial_lambda = lambda`。
|
||
- restart 读入端兼容 v1/v2;当文件没有 `CONTACT_HISTORY` 或
|
||
`CONTACT_MULTIPLIER` 段时,应清空对应当前状态,避免旧模型状态串入重启计算。
|
||
|
||
## 19. 主程序模块
|
||
|
||
模块:fem_program.f90
|
||
|
||
命令行程序 femlite 第一版流程:
|
||
|
||
```text
|
||
parse command line
|
||
fem_initialize
|
||
fem_read_inp
|
||
fem_build_model
|
||
fem_compute_lumped_mass
|
||
time loop:
|
||
fem_estimate_stable_dt if needed
|
||
fem_advance_explicit
|
||
fem_write_output
|
||
fem_finalize
|
||
return exit code
|
||
```
|
||
|
||
命令行建议:
|
||
|
||
```text
|
||
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 --allow-cutback --max-newton 80 --newton-tol 1.0e-4
|
||
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. 内存分配与释放
|
||
|
||
内存策略:
|
||
|
||
- 读取 inp 后确定模型规模。
|
||
- 根据节点数、单元数、集合大小、边界条件数量和高斯点总数 allocate。
|
||
- 所有 allocate 失败必须返回 ierr。
|
||
- fem_finalize 统一 deallocate。
|
||
- 单元删除不释放单元、状态变量或自由度内存。
|
||
|
||
核心接口:
|
||
|
||
```fortran
|
||
subroutine database_allocate(ierr)
|
||
subroutine database_initialize(ierr)
|
||
subroutine database_finalize(ierr)
|
||
```
|
||
|
||
## 21. 0.5.3 Diagnostic Design Addendum
|
||
|
||
0.5.3 is a diagnostic hardening release, not a broad contact-solver rewrite.
|
||
The production boundary is:
|
||
|
||
- Nonlinear failures carry stable reason ids/names through the convergence
|
||
diagnostic path.
|
||
- Nonlinear residual storage separates total, force, contact, constraint, arc
|
||
and material-local-failure categories when those quantities are available.
|
||
- Contact summaries expose stable state counts, gap/penetration statistics,
|
||
slip/friction residuals, multiplier/augmentation diagnostics and active-set
|
||
flip counts.
|
||
- Contact restart version 4 preserves accepted-increment diagnostic state in
|
||
the optional `CONTACT_PAIR_DIAGNOSTICS` block.
|
||
- Mortar/friction tangent work in 0.5.3 is an audit interface. It splits normal,
|
||
stick and slip finite-difference errors and rigid/energy residuals; it does
|
||
not replace the production contact path with a complete industrial
|
||
AL/mortar consistent tangent.
|