I am using Devdept 2022.
The problem is I cannot mesh a simple cylinderical surface without getting negative Jacobian errors.
Process:- I am using is to convert surface to Brep, then Brep to mesh and finally mesh to femmesh. I cannot find a better way to directly mesh surfaces.
Code:-
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);
}
}
}
I think its better for such a library to provide powerful methods to work with surfaces as surfaces models are lightweight and require much less resources and time to solve.