spacether / pycalculix

Python 3 library to automate and build finite element analysis (FEA) models in Calculix. Meshing uses Calculix or GMSH.
http://justinablack.com/pycalculix/
Apache License 2.0
169 stars 56 forks source link

Modelling of splines and orthotropic materials #9

Closed mrosemeier closed 7 years ago

mrosemeier commented 8 years ago

First of all: Thanks for making pycalculix an open source project!

I am looking for a python tool that is able to mesh splined based geometries such as rotor blade cross sections. Further, handling of 3D orthotropic materials would be a requirement. Especially the element/material coordinate system is important to be set so that the material orientation follows a 'major' spline of an area. To give you an idea, I have attached an image of an exemplary mesh of a wind turbine rotor blade cross section where the element/material coordinate system is shown for one element in red.

cs

It seems that pycalculix already offers a well developed framework interfacing to state-of-the-art meshing tools (gmsh and cgx) which could be extended to the above requests. Before starting the implementation of new things into pycalculix, I would really appreciate your opinion about extending pycalculix towards:

Further, I wonder if there is a preference between gmsh and cgx for the extension ideas?

spacether commented 8 years ago

Hi, thanks for your interest in pycalculix. Would you want your blade geometry to be plane stress, plane strain, or true 3d? Pycalculix is already set up to do plane stress and plane strain. What kind of loading would be on the airfoil? Pressure, self weight rotation forces? Would you want to do a stress model or a heat transfer model? Pycalculix only works in the stress/deflection domain right now.

If it were true 3d, calculix would need to be extended into 3d. Which is doable. It already stores multiple areas in a surface. A volume is multiple closed areas. It's just that plotting gets way more painful, and you need to worry about orientation etc.. I have some code where I was working on implementing a plotter object which allows different 2d orientations xy and yz, but I haven't posted it because I didn't finish it.

How one would best implement the features you mention would be to continue the wrapping of gmsh functionality in python. I would make a spline base class based on gmsh's spline or bspline class: http://geuz.org/gmsh/doc/texinfo/gmsh.html#Lines And I would also make a signed spline class. The signed spline class is needed to close a loop of lines or splines or arcs to make an area. Pycalculix already has a base line and arc class which are similarly built.

To plot the spline and closed area in pycaculix, you need to plot it using matplotlib. To draw the spline, you'd user vertices. I already use vertices to close arbitrary areas in python so that would be a fairly straightforward adaptation. The matplotlib page which describes plotting vertices is here: http://matplotlib.org/api/path_api.html See my plotting code where I plot a patch with vertices: https://github.com/spacether/pycalculix/blob/master/pycalculix/geometry.py#L1573

How to make the material follow the major spline of the area. I assume material orientation would be along the spline, normal to it, and normal to the page. This may require a custom material for every element. One could approach this a couple ways. Maybe your area has a material generator function that takes location along spline, and normal distance from the surface and spits a material back out. You can loop through elements and generate one of these materials for every element. Or maybe you map mesh the spline, and make a material that is normal to a passed face. This is harder, and would require a perfect map mesh. The other option I mentioned feels easier. Calculix material definition documentation is here: http://web.mit.edu/calculix_v2.7/CalculiX/ccx_2.7/doc/ccx/node193.html

Preference on which mesher to use: Definitely gmsh, more people use it, and it would allow a non-calculix solver to be plugged in more easily at a later date if the meshing format is separate from the solver. The gmsh meshing also provided more control when I compared its features to cgx. It is also easier to debug gmsh files with the gmsh gui.

mrosemeier commented 8 years ago

@spacether: Thanks for your comments on the new features.

To your questions: In a first stage I would like to use pycalculix only for very detailed 2D cross section mesh generation, which is then used to be passed to BECAS to (1) calculate beam cross sectional properties and also to (2) recover stresses and strains with the internal loads (forces and moments) from an FE beam model. BECAS is also already wrapped into Python via the BECASWrapper.

In a second stage we could indeed think of 3D splined based mesh generation (Shell or HEX20 elements) of whole blades using ccx or Elmer as solver to run benchmarks vs. Ansys or MSC Marc. This model would then be loaded by shear forces.