Files
CCLite/suggests.md
T
2026-07-04 21:52:49 +08:00

1695 lines
29 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
这个定位很合适,而且比“把所有接触都做进一个大模块”更清晰。
**CCLite = Coupling & Contact Lite** 可以定位为:
> 专门负责 **SPHLite 与 FEMLite 之间** 的耦合、接触、界面传递、损伤释放和 FSI 边界交互;
> 不负责 SPHLite 内部粒子接触,也不负责 FEMLite 内部单元接触。
这样做的好处是边界清晰、职责单一、软件更容易工业化。
---
# 1. CCLite 的核心定位
建议把 CCLite 定义为一个 **跨求解器界面算法库**,而不是一个独立求解器。
它不直接求解 SPH 动量方程,也不直接组装 FEM 刚度矩阵,而是负责:
```text
SPHLite boundary state
+
FEMLite boundary state
↓
CCLite interface algorithm
↓
SPH side coupling force / boundary condition
+
FEM side coupling force / boundary condition
```
也就是说,CCLite 的核心输入输出是:
```text
输入:
- SPH 粒子状态
- SPH 壳粒子状态
- FEM 实体表面状态
- FEM 壳表面状态
- 材料/厚度/法向/速度/压力等界面信息
输出:
- 施加给 SPH 粒子的界面力、边界速度、ghost state
- 施加给 FEM 节点/壳节点的界面力、面力、力矩
- 接触状态、穿透量、接触能量、耦合诊断信息
```
因此 CCLite 的边界应明确为:
| 模块 | 是否由 CCLite 负责 |
| --------------------- | ------------- |
| SPH 内部粒子-粒子相互作用 | 不负责 |
| SPH 内部壳粒子接触 | 不负责 |
| FEM 内部实体接触 | 不负责 |
| FEM 内部壳接触 | 不负责 |
| SPH 粒子 ↔ FEM 实体面 | 负责 |
| SPH 粒子 ↔ FEM 壳面 | 负责 |
| SPH 壳粒子 ↔ FEM 实体面 | 负责 |
| SPH 壳粒子 ↔ FEM 壳面 | 负责 |
| SPH-FEM tied coupling | 负责 |
| SPH-FEM FSI coupling | 负责 |
| SPH-FEM 损伤释放后的接触转换 | 负责 |
这点非常重要。否则 CCLite 很容易膨胀成一个“通用接触库”,和 FEMLite/SPHLite 职责重叠。
---
# 2. 建议的软件边界
建议 CCLite 只处理下面 4 类对象之间的交互:
```text
SPH solid particles ↔ FEM solid boundary faces
SPH solid particles ↔ FEM shell faces
SPH shell particles ↔ FEM solid boundary faces
SPH shell particles ↔ FEM shell faces
```
进一步扩展时,可以支持:
```text
SPH boundary particles ↔ FEM surface
SPH ghost particles ↔ FEM surface
SPH damaged particles ↔ FEM surface
SPH converted particles ↔ FEM erosion region
```
但仍然保持原则:
> 只处理 **SPH 域与 FEM 域之间** 的相互作用。
---
# 3. CCLite 不应该做什么
建议从架构设计文档中明确写出“不负责项”。
## 3.1 不负责 SPH 内部算法
例如:
```text
SPH particle-particle pressure force
SPH artificial viscosity
SPH tensile instability correction
SPH shell particle internal force
SPH shell self-contact
SPH damage bond breaking inside SPH
SPH neighbor summation
SPH density update
```
这些应该留在 SPHLite 中。
## 3.2 不负责 FEM 内部算法
例如:
```text
FEM element stiffness/internal force
FEM shell membrane/bending/shear internal force
FEM solid-solid contact
FEM shell-shell self-contact
FEM hourglass control
FEM material constitutive update
FEM element erosion
FEM implicit contact iteration
```
这些应该留在 FEMLite 中。
## 3.3 不负责全局时间积分
CCLite 不应该自己推进时间步。它最多提供:
```text
interface force
interface impulse
interface boundary condition
interface stable time step suggestion
```
时间推进仍由 SPHLite/FEMLite 或上层 Driver 管理。
---
# 4. CCLite 的推荐总体架构
建议采用下面的分层:
```text
CCLite
├── Interface Data Layer
│ ├── SPHInterfaceView
│ ├── SPHShellInterfaceView
│ ├── FEMSolidSurfaceView
│ └── FEMShellSurfaceView
│
├── Geometry & Search Layer
│ ├── ContactPrimitive
│ ├── AABB
│ ├── HashGrid
│ ├── BVH
│ └── PairCandidateBuilder
│
├── Detection Layer
│ ├── ParticleFaceDetector
│ ├── ParticleShellDetector
│ ├── ShellParticleFaceDetector
│ ├── PointEdgeDetector
│ └── ThicknessAwareShellDetector
│
├── Coupling Law Layer
│ ├── PenaltyContact
│ ├── DampedPenaltyContact
│ ├── CoulombFrictionContact
│ ├── KinematicTie
│ ├── PenaltyTie
│ ├── GhostParticleBoundary
│ ├── PressureProjectionFSI
│ └── RiemannFSI
│
├── Transfer Layer
│ ├── SPHToFEMForceTransfer
│ ├── FEMToSPHBoundaryTransfer
│ ├── ShellMomentTransfer
│ └── EnergyMomentumMonitor
│
└── Diagnostics Layer
├── ContactReport
├── CouplingReport
├── PenetrationReport
├── EnergyReport
└── DebugVTKOutput
```
简化成一句话:
```text
CCLite = Interface View + Search + Detection + Coupling Law + Force Transfer + Diagnostics
```
---
# 5. CCLite 的核心数据抽象
## 5.1 SPHInterfaceView
CCLite 不应该直接依赖 SPHLite 内部数组结构,而应该通过 view 读取必要数据。
```cpp
struct CCL_SPHParticleView {
int64_t id;
double x[3];
double v[3];
double mass;
double rho;
double volume;
double h;
double radius;
double pressure;
double stress[6];
int material_id;
int body_id;
int active;
};
```
对 CCLite 来说,SPH 实体粒子最重要的是:
```text
位置 x
速度 v
质量 m
体积 V
光滑长度 h
等效接触半径 r
压力 p
应力 sigma
材料/体编号
是否激活
```
---
## 5.2 SPHShellInterfaceView
SPH 壳粒子需要更多几何信息:
```cpp
struct CCL_SPHShellParticleView {
int64_t id;
double x[3];
double v[3];
double director[3];
double angular_velocity[3];
double thickness;
double area;
double mass;
double normal[3];
double radius;
double membrane_stress[3];
double bending_moment[3];
int material_id;
int body_id;
int active;
};
```
壳粒子对 CCLite 的关键属性是:
```text
中面位置
速度
法向/director
厚度
面积
质量
角速度/转角信息
等效接触半径
```
---
## 5.3 FEMSolidSurfaceView
FEMLite 不需要把整个实体单元暴露给 CCLite,只暴露边界面。
```cpp
struct CCL_FEMSurfaceFaceView {
int64_t face_id;
int64_t elem_id;
int node_count; // 3 or 4
int64_t node_ids[4];
double x[4][3];
double v[4][3];
double normal[3];
double area;
int material_id;
int body_id;
int active;
};
```
CCLite 只需要:
```text
边界面节点坐标
边界面节点速度
面法向
面积
所属单元/体
材料编号
是否激活
```
---
## 5.4 FEMShellSurfaceView
FEM 壳面需要额外提供厚度和转角/director。
```cpp
struct CCL_FEMShellFaceView {
int64_t shell_id;
int node_count; // 3, 4, 6, 8 可逐步支持
int64_t node_ids[8];
double x[8][3];
double v[8][3];
double director[8][3];
double omega[8][3];
double thickness;
double normal[3];
double area;
int material_id;
int body_id;
int active;
};
```
对壳接触而言,CCLite 必须知道:
```text
中面
厚度
法向
节点速度
节点转动信息
正反面
边界边
```
---
# 6. CCLite 的输出数据
CCLite 不应该直接修改 SPHLite 和 FEMLite 的内部力数组,而是输出增量。
## 6.1 SPH 侧输出
```cpp
struct CCL_SPHForceOutput {
int64_t particle_id;
double force[3];
double moment[3]; // shell particle 可用
double boundary_velocity[3];
double ghost_pressure;
double ghost_density;
int has_boundary_state;
};
```
## 6.2 FEM 侧输出
```cpp
struct CCL_FEMForceOutput {
int64_t node_id;
double force[3];
double moment[3]; // shell node 可用
};
```
这样 SPHLite/FEMLite 可以自己决定:
```text
加入外力项
加入接触力项
加入 RHS
加入显式动量更新
加入隐式残差
```
---
# 7. CCLite 应支持的主要算法类型
建议分为 5 大类。
---
## 7.1 SPH-FEM penalty contact
这是第一优先级。
支持组合:
```text
SPH solid particle ↔ FEM solid face
SPH solid particle ↔ FEM shell face
SPH shell particle ↔ FEM solid face
SPH shell particle ↔ FEM shell face
```
基本形式:
[
\mathbf{f}_n = k_n \delta_n \mathbf{n}
]
阻尼:
[
\mathbf{f}_d = -c_n v_n \mathbf{n}
]
摩擦:
[
|\mathbf{f}_t| \le \mu |\mathbf{f}_n|
]
其中:
```text
δ_n:穿透量
k_n:法向接触刚度
c_n:接触阻尼
μ:摩擦系数
```
这是 CCLite 最基础、最通用、最容易工业试点的功能。
---
## 7.2 SPH-FEM tied coupling
用于同一连续体的不同离散区域连接。
例如:
```text
FEM 远场结构
+
SPH 局部破坏区
```
约束形式:
[
\mathbf{x}_p = \sum_a N_a \mathbf{x}_a
]
[
\mathbf{v}_p = \sum_a N_a \mathbf{v}_a
]
力反传:
[
\mathbf{f}_a += N_a \mathbf{f}_p
]
适合:
```text
SPH solid ↔ FEM solid tied interface
SPH shell ↔ FEM shell tied interface
SPH shell ↔ FEM solid tied interface
```
建议 CCLite 支持两种 tie:
```text
Penalty tie
Kinematic interpolation tie
```
第一阶段可以先做 penalty tie:
[
\mathbf{f}*{tie} = k*{tie}
\left(
\sum_a N_a \mathbf{x}_a - \mathbf{x}_p
\right)
]
后续再做严格运动学约束。
---
## 7.3 Damage release: tie-to-contact
这是 CCLite 很重要的特色功能。
工程上经常需要:
```text
未损伤时:SPH-FEM tied coupling
损伤达到阈值后:释放 tie
释放后:变成普通接触或自由分离
```
可以设计成:
```text
InterfaceBond
├── active tied
├── weakening
├── released
└── contact-only
```
典型状态转换:
```text
damage < d0:
tied coupling
d0 ≤ damage < d1:
degraded tie stiffness
damage ≥ d1:
release tie
activate contact
```
这对以下场景很重要:
```text
FEM 壳破坏后与 SPH 区域分离
FEM-SPH 过渡区断裂
复合结构粘接失效
爆炸冲击下界面脱开
侵彻破坏
```
---
## 7.4 Ghost particle / boundary particle FSI
用于 SPH 流体与 FEM 结构耦合。
CCLite 可以根据 FEM 边界面生成或管理 boundary particles:
```text
FEM shell/solid surface
↓
CCLite boundary particle sampling
↓
SPHLite neighbor interaction
```
这些 boundary particles 由 CCLite 生成,但参与 SPH 邻域求和时由 SPHLite 使用。
边界粒子的状态来自 FEM:
```text
x_b = shell / solid surface position
v_b = shell / solid surface velocity
n_b = surface normal
```
适合:
```text
SPH 水 ↔ FEM 壳
SPH 水 ↔ FEM 实体
SPH 爆轰产物 ↔ FEM 结构
SPH 空气/气体 ↔ FEM 结构
```
这是做水下爆炸、入水砰击、冲击波-FSI 的关键路线。
---
## 7.5 Riemann FSI interface
后续高级版本建议支持。
用于可压缩 SPH / Godunov SPH / 水下爆炸。
输入:
```text
SPH fluid state:
ρ, v, p, c, EOS
FEM boundary state:
v_b, n
```
求界面压力:
[
p^*
]
然后:
```text
p* 施加到 FEM 结构
v_b / ghost state 反馈给 SPH 流体
```
适合:
```text
stiffened gas water
JWL explosive gas
ideal gas air
compressible SPH
underwater explosion
water hammer
slamming impact
```
这一类可以作为 CCLite 的高端特色。
---
# 8. 接触检测算法建议
CCLite 只处理 SPH-FEM,所以接触检测组合可以明显收窄。
## 8.1 必须支持的 narrow phase
```text
Point ↔ Triangle
Point ↔ Quad
Point ↔ ShellFaceWithThickness
Point ↔ Edge
OrientedShellParticle ↔ ShellFace
OrientedShellParticle ↔ SolidFace
```
其中:
```text
SPH solid particle = point/sphere
SPH shell particle = oriented disk/patch
FEM solid boundary = triangle/quad face
FEM shell = triangle/quad midsurface + thickness
```
---
## 8.2 壳厚度处理
对 FEM 壳接触,必须使用:
[
r_c = r_{sph} + \frac{t_{shell}}{2}
]
对 SPH 壳粒子与 FEM 壳:
[
r_c = \frac{t_{sph-shell}}{2} + \frac{t_{fem-shell}}{2}
]
不能只按中面距离判断。
建议 CCLite 内部使用:
```text
ShellContactSurface
├── midsurface
├── top surface
├── bottom surface
├── edge surface
└── thickness offset
```
第一阶段可以不显式生成 top/bottom surface,但检测时必须考虑厚度。
---
## 8.3 边缘接触
SPH 粒子撞 FEM 壳边缘时,仅用 point-face 会漏掉边界接触。
因此至少支持:
```text
particle ↔ shell edge
shell particle ↔ shell edge
```
边缘距离:
[
d = |\mathbf{x}*p - \mathbf{x}*{closest-edge}|
]
若:
[
d < r_c
]
则发生边缘接触。
---
# 9. 宽相搜索建议
由于 CCLite 只处理 SPH-FEM,宽相搜索可以比较简洁。
## 9.1 SPH 侧
使用 SPH 粒子的 hash grid / cell linked list。
```text
SPHLite 可提供已有邻域网格
或 CCLite 自己构建轻量 hash grid
```
建议第一版 CCLite 自己构建一个独立 hash grid,避免强依赖 SPHLite 内部实现。
---
## 9.2 FEM 侧
FEM 边界面使用 BVH / AABB tree。
```text
FEM solid boundary faces → BVH
FEM shell faces → BVH
FEM shell edges → BVH or edge AABB list
```
推荐:
```text
static FEM surface:
build once
moving FEM surface:
refit BVH each time step
large deformation/contact:
rebuild or periodic rebuild
```
---
## 9.3 混合查询
主流程:
```text
for each active SPH particle:
build particle AABB with contact radius
query FEM surface BVH
get candidate faces/edges
run narrow phase
compute contact/coupling force
```
对于 SPH 壳粒子:
```text
for each active SPH shell particle:
build oriented/thickness AABB
query FEM shell/solid BVH
run shell-aware narrow phase
```
---
# 10. CCLite 的推荐功能矩阵
## 10.1 第一层:接触
| 功能 | 第一版是否需要 |
| --------------------------- | ------- |
| SPH 实体粒子 ↔ FEM 实体面 | 必须 |
| SPH 实体粒子 ↔ FEM 壳面 | 必须 |
| SPH 壳粒子 ↔ FEM 壳面 | 必须 |
| SPH 壳粒子 ↔ FEM 实体面 | 建议 |
| 壳厚度接触 | 必须 |
| 边缘接触 | 必须 |
| Coulomb 摩擦 | 建议 |
| 接触阻尼 | 必须 |
| 自适应 penalty 刚度 | 建议 |
| Lagrange multiplier contact | 后续 |
| Augmented Lagrangian | 后续 |
| Mortar contact | 后续 |
---
## 10.2 第二层:耦合
| 功能 | 第一版是否需要 |
| --------------------------------- | ------- |
| SPH solid ↔ FEM solid penalty tie | 建议 |
| SPH solid ↔ FEM shell penalty tie | 建议 |
| SPH shell ↔ FEM shell penalty tie | 建议 |
| Kinematic tie | 后续 |
| Damage release | 建议作为特色 |
| Tie-to-contact 转换 | 强烈建议 |
| Mortar tie | 后续 |
| Nitsche tie | 后续 |
---
## 10.3 第三层:FSI
| 功能 | 第一版是否需要 |
| ------------------------------ | -------- |
| FEM surface ghost particles | 建议 |
| SPH pressure projection to FEM | 必须用于 FSI |
| FEM velocity boundary to SPH | 必须用于 FSI |
| Riemann FSI | 后续重点 |
| 多介质 EOS interface | 后续 |
| 水下爆炸专用 FSI | 后续重点 |
---
# 11. 建议的版本开发路线
下面给一个比较适合 CCLite 的版本路线。
---
## CCLite 0.1.x:最小可用接口层
目标:打通 SPHLite/FEMLite 数据通道。
### 0.1.0:项目骨架
实现:
```text
CCLite C API / C++ API
SPHInterfaceView
SPHShellInterfaceView
FEMSolidSurfaceView
FEMShellSurfaceView
ForceOutputBuffer
ContactReport
```
验收标准:
```text
可以从 SPHLite 读取粒子状态
可以从 FEMLite 读取边界面状态
可以返回 SPH/FEM 接触力输出
```
---
### 0.1.1:FEM 边界面导入
实现:
```text
FEM solid boundary face import
FEM shell face import
triangle/quad face primitive
face normal/area calculation
AABB generation
```
---
### 0.1.2:SPH 粒子导入
实现:
```text
SPH solid particle import
SPH shell particle import
particle AABB
shell particle AABB
contact radius estimation
```
---
### 0.1.3:调试输出
实现:
```text
candidate pair VTK
contact point VTK
penetration report
interface pair report
force report
```
这一版非常重要,方便后续排查接触问题。
---
## CCLite 0.2.x:基础 SPH-FEM penalty contact
目标:完成最基础、最实用的跨域接触。
### 0.2.0:SPH 实体粒子 ↔ FEM 实体面
实现:
```text
point-triangle contact
point-quad contact
normal penalty force
damping force
force transfer to FEM nodes
equal-opposite force to SPH particle
```
---
### 0.2.1:SPH 实体粒子 ↔ FEM 壳面
实现:
```text
shell midsurface projection
shell thickness-aware gap
double-sided contact
shell node force transfer
```
---
### 0.2.2:边缘接触
实现:
```text
particle-edge closest point
shell edge contact
solid face edge contact
edge fallback when projection is outside face
```
---
### 0.2.3:摩擦接触
实现:
```text
relative tangential velocity
penalty tangential force
Coulomb limit
frictional energy output
```
---
### 0.2.4:自动 penalty 参数
实现:
```text
user-defined stiffness
material-based stiffness
time-step-based stiffness
auto penalty scaling
```
---
## CCLite 0.3.x:壳粒子与 FEM 接触
目标:支持 SPH 壳粒子与 FEM 壳/实体交互。
### 0.3.0:SPH 壳粒子 ↔ FEM 壳面
实现:
```text
oriented shell particle model
director-aware normal
thickness-aware shell-shell gap
normal penalty force
moment transfer to shell particle/FEM shell
```
---
### 0.3.1:SPH 壳粒子 ↔ FEM 实体面
实现:
```text
shell particle to solid face projection
orientation filter
thickness distance
contact force and moment
```
---
### 0.3.2:壳正反面识别
实现:
```text
front-side contact
back-side contact
double-sided shell contact
normal smoothing
side switching protection
```
---
### 0.3.3:壳边缘增强
实现:
```text
SPH shell particle ↔ FEM shell edge
SPH shell particle ↔ FEM solid edge
edge normal construction
edge contact damping
```
---
## CCLite 0.4.x:SPH-FEM tied coupling
目标:支持连续区域连接。
### 0.4.0:SPH solid ↔ FEM solid penalty tie
实现:
```text
SPH particle projection to FEM face/element
shape function interpolation
penalty displacement tie
penalty velocity tie
force back-transfer
```
---
### 0.4.1:SPH solid ↔ FEM shell tie
实现:
```text
particle to shell midsurface tie
thickness offset support
shell node force transfer
```
---
### 0.4.2:SPH shell ↔ FEM shell tie
实现:
```text
shell particle position tie
director tie
velocity tie
angular velocity tie
moment transfer
```
---
### 0.4.3:tie-to-contact release
实现:
```text
interface bond state
damage input from SPHLite/FEMLite
tie stiffness degradation
bond release
automatic contact activation after release
```
这会成为 CCLite 的重要亮点。
---
## CCLite 0.5.x:FSI 基础耦合
目标:支持水-结构、气体-结构、爆炸-结构耦合。
### 0.5.0:FEM surface boundary particles
实现:
```text
FEM 面采样 boundary particles
随 FEM 面运动更新
boundary particle normal/velocity/area
输出给 SPHLite
```
---
### 0.5.1:SPH pressure projection to FEM
实现:
```text
SPH pressure sampling near FEM surface
kernel weighted pressure projection
nodal force assembly
pressure work output
```
---
### 0.5.2:FEM velocity boundary to SPH
实现:
```text
moving wall velocity
no-penetration boundary
slip / no-slip switch
boundary velocity ghost state
```
---
### 0.5.3:双向弱耦合 FSI
实现:
```text
SPH → FEM pressure force
FEM → SPH moving boundary
subcycling support
interface energy report
```
---
## CCLite 0.6.x:冲击/爆炸高级 FSI
目标:面向水下爆炸、冲击波、可压缩 SPH。
### 0.6.0:Riemann FSI interface
实现:
```text
SPH fluid state extraction
FEM boundary state extraction
normal Riemann solver
interface pressure p*
interface velocity u*
```
---
### 0.6.1:EOS support for interface
实现接口支持:
```text
Ideal gas
Stiffened gas
JWL
Tait
Mie-Grüneisen
```
注意:EOS 可以由 SPHLite 提供,CCLite 只需要调用 EOS interface。
---
### 0.6.2:水下爆炸 FSI 场景
实现:
```text
JWL explosive gas ↔ FEM shell
stiffened gas water ↔ FEM shell
multi-material SPH side state
pressure impulse report
```
---
### 0.6.3:FSI 稳定性增强
实现:
```text
added-mass stabilization
interface pressure filtering
normal smoothing
time subcycling support
force relaxation
```
---
# 12. 和 SPHLite / FEMLite 的关系
建议采用“三层驱动关系”。
```text
上层 Driver / CaeLite
├── 调用 SPHLite 更新 SPH 内力
├── 调用 FEMLite 更新 FEM 内力
├── 调用 CCLite 计算 SPH-FEM 界面力
├── 汇总力
└── 时间推进
```
不要让 CCLite 主控整个求解流程。否则会破坏模块边界。
---
## 12.1 显式动力学推荐流程
```text
for each time step:
SPHLite:
compute SPH internal forces
FEMLite:
compute FEM internal forces
CCLite:
collect SPH/FEM interface states
search SPH-FEM candidate pairs
detect contact/coupling
compute interface forces
output SPH/FEM force increments
Driver:
add forces to SPH and FEM
update acceleration
update velocity
update displacement
update damage
update interface state
```
---
## 12.2 隐式/显式混合流程
如果 FEMLite 是隐式,SPHLite 是显式,可以先支持弱耦合:
```text
SPH 显式推进
FEM 隐式推进
CCLite 交换界面力和边界速度
采用 staggered coupling
```
后续再做强耦合迭代:
```text
while interface residual not converged:
SPH predictor
FEM solve
CCLite interface correction
```
但第一阶段不建议做复杂强耦合。
---
# 13. CCLite 的 API 设计建议
建议优先提供 C API,方便 SPHLite/FEMLite/CaeLite 调用。
## 13.1 基本生命周期
```c
CCL_Context* ccl_create_context(void);
void ccl_destroy_context(CCL_Context* ctx);
void ccl_set_time_step(CCL_Context* ctx, double dt);
void ccl_set_contact_parameters(CCL_Context* ctx, const CCL_ContactParams* params);
void ccl_set_coupling_parameters(CCL_Context* ctx, const CCL_CouplingParams* params);
```
---
## 13.2 输入接口
```c
void ccl_set_sph_particles(
CCL_Context* ctx,
const CCL_SPHParticle* particles,
int count
);
void ccl_set_sph_shell_particles(
CCL_Context* ctx,
const CCL_SPHShellParticle* particles,
int count
);
void ccl_set_fem_solid_faces(
CCL_Context* ctx,
const CCL_FEMFace* faces,
int count
);
void ccl_set_fem_shell_faces(
CCL_Context* ctx,
const CCL_FEMShellFace* faces,
int count
);
```
---
## 13.3 计算接口
```c
void ccl_build_search(CCL_Context* ctx);
void ccl_compute_contact(CCL_Context* ctx);
void ccl_compute_tie_coupling(CCL_Context* ctx);
void ccl_compute_fsi_coupling(CCL_Context* ctx);
void ccl_compute_all(CCL_Context* ctx);
```
---
## 13.4 输出接口
```c
int ccl_get_sph_force_count(CCL_Context* ctx);
void ccl_get_sph_forces(CCL_Context* ctx, CCL_SPHForce* out);
int ccl_get_fem_force_count(CCL_Context* ctx);
void ccl_get_fem_forces(CCL_Context* ctx, CCL_FEMForce* out);
void ccl_get_contact_report(CCL_Context* ctx, CCL_ContactReport* report);
void ccl_write_debug_vtk(CCL_Context* ctx, const char* filename);
```
---
# 14. CCLite 的配置文件建议
可以设计一个简单 JSON/YAML 配置。
```yaml
cclite:
mode: explicit
contact:
enabled: true
pair_types:
- sph_solid_to_fem_shell
- sph_solid_to_fem_solid
- sph_shell_to_fem_shell
normal_law: penalty
friction_law: coulomb
damping: true
penalty:
mode: auto_timestep
scale: 0.2
friction:
mu: 0.15
shell:
thickness_aware: true
double_sided: true
edge_contact: true
coupling:
tie:
enabled: true
law: penalty_tie
release_by_damage: true
fsi:
enabled: true
method: pressure_projection
boundary_particles: true
```
---
# 15. 验证算例建议
CCLite 必须有独立验证算例,不能只靠完整 CaeLite 工程例子。
## 15.1 接触验证
```text
1. 单个 SPH 粒子撞刚性 FEM 平面
2. SPH 粒子云压缩 FEM 实体表面
3. SPH 粒子撞 FEM 壳板
4. SPH 壳粒子撞 FEM 壳板
5. 粒子撞壳边缘
6. 带摩擦斜面滑移
```
验收指标:
```text
穿透量
反弹速度
动量守恒
接触能量
摩擦耗散
接触力峰值
```
---
## 15.2 tied coupling 验证
```text
1. FEM 杆 + SPH 杆拉伸
2. FEM 板 + SPH 局部区域弯曲
3. FEM 壳 + SPH 壳过渡拉伸
4. tie 释放后自由分离
5. tie 释放后再次接触
```
验收指标:
```text
界面位移连续性
界面力平衡
应力波透射/反射
能量误差
释放状态正确性
```
---
## 15.3 FSI 验证
```text
1. SPH 水柱冲击 FEM 刚性壁
2. SPH 水柱冲击 FEM 弹性板
3. 水下冲击波作用 FEM 壳
4. 气泡/高压区作用薄板
5. 入水砰击简化模型
```
验收指标:
```text
压力峰值
冲量
板中心位移
能量交换
界面无明显穿透
压力振荡水平
```
---
# 16. CCLite 的工业级关键点
要想后续做成可靠模块,建议从一开始就加入这些诊断能力。
## 16.1 接触诊断
```text
最大穿透量
平均穿透量
接触对数量
接触力最大值
接触力总和
接触能量
摩擦耗散
接触失效/释放数量
```
---
## 16.2 动量和能量检查
每个时间步输出:
```text
SPH side total contact force
FEM side total contact force
force balance residual
contact work
interface energy transfer
```
要求:
```text
SPH 接触力总和 + FEM 接触力总和 ≈ 0
```
如果不满足,说明力反传或形函数分配有问题。
---
## 16.3 可视化调试
建议输出:
```text
contact_pairs.vtp
contact_normals.vtp
penetration_points.vtp
interface_forces.vtp
tie_bonds.vtp
released_bonds.vtp
boundary_particles.vtp
```
这对调接触算法非常关键。
---
# 17. CCLite 的最佳初期定位
不要一开始就追求:
```text
通用 mortar
强耦合隐式接触
任意壳-壳自接触
复杂多体接触
```
这些会拖慢进度。
最好的初期定位是:
> **一个显式动力学友好的 SPH-FEM 跨域接触与耦合库。**
第一阶段核心卖点:
```text
SPH 粒子 ↔ FEM 面接触
SPH 粒子 ↔ FEM 壳接触
SPH 壳粒子 ↔ FEM 壳接触
SPH-FEM penalty tie
tie-to-contact release
SPH-FEM FSI pressure transfer
```
这已经能支撑很多工程场景:
```text
水下爆炸作用壳体
水冲击薄板
粒子/碎片撞击结构
局部 SPH 破坏区与 FEM 结构耦合
FEM 壳结构与 SPH 壳破坏区耦合
```
---
# 18. 推荐的 CCLite 技术路线图
可以概括成下面这条路线:
```text
CCLite 0.1
接口和数据视图
↓
CCLite 0.2
SPH solid particle ↔ FEM solid/shell penalty contact
↓
CCLite 0.3
SPH shell particle ↔ FEM solid/shell thickness-aware contact
↓
CCLite 0.4
SPH-FEM tied coupling + damage release + tie-to-contact
↓
CCLite 0.5
SPH-FEM FSI: pressure projection + ghost particles
↓
CCLite 0.6
Riemann FSI + underwater explosion interface
↓
CCLite 0.7+
mortar/Nitsche/augmented Lagrangian/high-order shell coupling
```
---
# 19. 最建议的模块名称
既然叫 CCLite,可以把内部模块命名为:
```text
ccl_core
ccl_interface
ccl_geometry
ccl_search
ccl_contact
ccl_coupling
ccl_fsi
ccl_transfer
ccl_diagnostics
```
算法对象命名:
```text
CCLContactPair
CCLContactLaw
CCLCouplingPair
CCLCouplingLaw
CCLInterfaceBond
CCLBoundaryParticle
CCLForceTransfer
CCLShellContact
CCLFSIInterface
```
---
# 20. 总结建议
CCLite 的方向非常合适。建议把它定义为:
> **SPHLite 与 FEMLite 之间的跨域耦合与接触算法库。**
它应该负责:
```text
SPH solid ↔ FEM solid/shell contact
SPH shell ↔ FEM solid/shell contact
SPH-FEM tied coupling
damage release / tie-to-contact
SPH-FEM FSI pressure/velocity transfer
ghost/boundary particles
Riemann FSI
interface diagnostics
```
它不应该负责:
```text
SPH 内部粒子作用
SPH 内部壳粒子接触
FEM 内部实体/壳接触
FEM 单元内力
SPH 粒子内力
全局时间积分
材料本构
```
最稳妥的开发策略是:
```text
先做 penalty contact
再做 shell thickness-aware contact
再做 SPH-FEM tied coupling
再做 tie-to-contact damage release
再做 FSI pressure projection
最后做 Riemann FSI / mortar / Nitsche / augmented Lagrangian
```
这样 CCLite 的边界清楚、算法层次清楚,也能自然服务于你已有的 **SPHLite** 和 **FEMLite**。