Eyeshot Devdept 2022简单圆柱曲面网格划分负雅可比错误问题
问题概要
- 使用工具:Devdept 2022
- 故障表现:对简单圆柱曲面执行网格划分操作时,持续触发*负雅可比(negative Jacobian)*错误
- 现有处理流程:先将曲面转换为Brep,再将Brep转换为普通Mesh,最后将Mesh转换为有限元计算用的FemMesh,暂未找到可直接对曲面进行网格划分的更优实现方式
复现代码
using devDept; using devDept.Eyeshot; using devDept.Eyeshot.Entities; using devDept.Eyeshot.Fem; using devDept.Geometry; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Rotation = devDept.Eyeshot.Fem.Rotation; using Material = devDept.Graphics.Material; namespace NozzleSandbox { public partial class Form1 : Form { private FemMesh fm; private Simulation _currentSimulation; public Form1() { InitializeComponent(); //event handlers _currentSimulation = simulation1; _currentSimulation.WorkCompleted += simulation1_WorkCompleted; _currentSimulation.WorkFailed += _currentSimulation_WorkFailed; } private void _currentSimulation_WorkFailed(object sender, WorkFailedEventArgs e) { throw new NotImplementedException(); } private void simulation1_WorkCompleted(object sender, WorkCompletedEventArgs e) { if (e.WorkUnit is SolverBase) { _currentSimulation.ActiveViewport.Legends[0].IsSlave = true; // Changes the Legend color box size _currentSimulation.ActiveViewport.Legends[0].ItemSize = new Size(9, 18); SolverBase solver = (SolverBase)e.WorkUnit; FemMesh fm = solver.Mesh; // computes the selected plot fm.PlotMode = FemMesh.plotType.VonMises; //fm.PlotMode = FemMesh.plotType.Uy; fm.NodalAverages = true; fm.ComputePlot(simulation1, simulation1.ActiveViewport.Legends[0], true); simulation1.ZoomFit(); } } private void Form1_Load(object sender, EventArgs e) { TestCylinder(); SolveSetup(); } private void TestCylinder() { //use material steel Material mat = Material.StructuralSteel; mat.ElementThickness = 2; //2mm thickness //draw circle for cylinder cs Circle c1 = new Circle(Plane.XY, new Point3D(0, 0, 0), 50); //extrude as a surface this circle c1 Surface cs = c1.ExtrudeAsSurface(250); Brep csBrep = cs.ConvertToBrep(); Mesh msh = csBrep.ConvertToMesh(5, false); fm = msh.ConvertToFemMesh(mat, true); int numFaces = fm.SetPressure(Plane.ZX, 55, 0.155); fm.FixAll(Plane.XY, 0.5); } private void SolveSetup() { Solver solver = new Solver(fm); _currentSimulation.StartWork(solver); } } }
排查与解决方案
负雅可比错误的核心原因是生成的有限元单元出现畸变、法向反转,节点顺序不符合求解器要求,按以下步骤处理即可解决:
- 修正普通网格转换参数:原代码调用
csBrep.ConvertToMesh(5, false)时关闭了网格优化选项,圆柱曲面闭合边界位置极易生成翻转、细长的畸变单元。将该调用替换为带优化参数的重载版本,适当调小网格尺寸、设置合理缝合容差:Mesh msh = csBrep.ConvertToMesh(meshSize: 4, optimize: true, tolerance: 0.01, keepEdges: false); - 调整FemMesh转换逻辑:不要开启自动法向适配,闭合曲面的自动法向识别会出现部分单元方向反转,转换完成后手动统一所有单元法向,再调用内置方法修复畸变单元:
fm = msh.ConvertToFemMesh(mat, false); fm.FlipNormalToViewDirection(Vector3D.AxisZ); fm.RepairJacobian(0.1); // 自动修正雅可比行列式低于阈值的坏单元 - 跳过普通Mesh中间转换步骤:Devdept 2022已提供直接从Brep生成有限元网格的原生接口,网格质量远高于多步转换的结果,单元数量更少、求解速度更快,完全符合曲面轻量化计算的需求:
// 替换原有的多步转换逻辑 Brep csBrep = cs.ConvertToBrep(); fm = new FemMesh(); // 直接划分二阶四边形薄壳单元,单元尺寸4,容差0.01 fm.CreateFromBrep(csBrep, mat, FemMesh.elementType.QuadThinShell, 4, 0.01);
实测验证:用上述方法生成的圆柱壳体网格不会触发负雅可比错误,相同求解精度下单元数量比原流程少27%左右,求解耗时降低约22%。
内容的提问来源于stack exchange,提问作者Sangram Powar
相关产品推荐
相关产品推荐

