Material orientations, distributions - PrePoMax fork

Hello,

I’ve been using PrePoMax quite a bit lately for setting up CalculiX simulations - it is great! Since what I am doing involves a lot of parametric/procedural geometry generation, I have been using PrePoMax through its .NET API, which is also pretty straightforward to use and understand :slight_smile:

Since I am working with orthotropic materials (wood) and I got tired of injecting material orientations and distributions into the resultant .inp files, I went ahead an took a crack at adding these to the PrePoMax code as well as a new material property for Engineering Constants. It is pretty basic at the moment, but I have tried to follow the same gist of the code as the rest of the codebase.

The FeMesh now has a dictionary of MaterialOrientation objects which hold an element label and define the X- and Y-axes for the orientation. The FeMesh class now also has a Distributions property to bundle up material orientations that should be named differently, etc. The SolidSection class now has an optional FeOrientation property which defines the orientation (and relevant FeDistribution) for that section.

I’ve extended the CalculixFileWriter class to support these and added CalOrientation, CalDistribution, and CalEngineeringConstants to the model definition.

From my recent testing, it seems to work well enough, albeit only programmatically - nothing is exposed in the UI, of course.

I’ve merged the latest changes from Gitlab today and my fork can be found here:

https://github.com/tsvilans/PrePoMax

I have no idea how to do pull requests between Github/Gitlab.

I hope it is interesting and useful for someone else too! If it looks OK, I’m happy to tweak it and improve it so that it maybe could eventually add orientation support to PrePoMax for real :slight_smile: :partying_face:

4 Likes

Adding orientations looks something like this:

// Add some element orientations...
model.Mesh.ElementOrientations.Add(1, new FeMaterialOrientation(1, new double[] { 0, 0, 1 }, new double[] { 0, 1, 0 }));
model.Mesh.ElementOrientations.Add(2, new FeMaterialOrientation(3, new double[] { 0, 0, 1 }, new double[] { 0, 1, 0 }));
model.Mesh.ElementOrientations.Add(3, new FeMaterialOrientation(2, new double[] { 0, 0, 1 }, new double[] { 0, 1, 0 }));

// Make distribution with default element orientation and all the element orientations we just made
var distribution = new FeDistribution("dist", new FeMaterialOrientation(-1, 1, 0, 0, 0, 1, 0), model.Mesh.ElementOrientations.Select(x => x.Key).ToArray());
model.Mesh.Distributions.Add(distribution.Name, distribution);

// Create orientation that targets the distribution
var orientation = new FeOrientation("orientation", distribution);
model.Mesh.Orientations.Add(orientation.Name, orientation);

// Create section and assign orientation
var section = new SolidSection("Section", material.Name, "MainPart", RegionTypeEnum.PartName, 10.0, false);
section.Orientation = orientation;

I think this is great. I will take a look at the code shortly (vacations). Then I will add it to my source somehow :wink:.

I did not work with orientation and distribution previously so I will find a way to add it to the UI.

1 Like

Sounds good! Just let me know if there is anything I should explain, clarify, or tweak :slight_smile: