sparlund / new_abaqus

new_abaqus is a hobby project for creating an FE-solver reading an FE-mesh following the syntax of the commercial software abaqus.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

new_abaqus

The finite element method (FEM) is way to solve engineering problem and mathematical models. Typical problem areas of interest include the traditional fields of structural analysis, heat transfer, fluid flow, mass transport, and electromagnetism.

Abaqus (C) is a commercial software for solving a myriad of engineering problems using FEM. This small project attempts to emulate some of its features, in the field of structural analysis. The project is far from finished, but there's a few examples below that shows great promise in showing similar results to the software it tries to be.

One of the main features of new_abaqus is that it can read a mesh described in the specific Abaqus format. That format is explained here, for example. Typically one creates the mesh in a pre-processor and output the geometry to the Abaqus(C) format, one such open source software is gmsh.

The program takes 1 argument: an input file containing the mesh and load case definition.

./new_abaqus example.inp

This will save an output file of the results called example.vtk and a logfile called example.log. The results can be viewed in the open source post processor ParaView.

The name is a joke from the character YinYang in the tv-show Silicon Valley, who has the idea for "new netflix".

Example #1, 2D geometry with a point load

This example is in 2D, and contains ~800 elements and ~900 nodes, with a mix of quad and trias. The geometry is fixed on the left hand side and a point force F is applied on the right, see figure below. The results are exactly the same between Abaqus (C) and new_abaqus.

Original geometry Deformed geometry
FE-solver Load node deflection (red arrow in figure above!)
ABAQUS (c) 0.034840
new_abaqus 0.034863

To run this example:

./new_abaqus example_runfiles/example1_2D.inp

Example #2, 3D tuning fork

A tuning fork made up of 4 thousand second order tetra element (C3D10). This mesh has 23 thousand degrees of freedom and took close to an hour 24 seconds to solve on my laptop. However, it takes only 7 seconds to solve on the same computer using Calculix which is another FEM solver that also follows the Abaqus(C) input file format.

The comparison of results between Abaqus(C) and new_abaqus match in this example. For the first 20 modes the typical difference is result is ~0.5%.

Tuning fork geometry 1st eigenmode 4th eigenmode
Eigenfrequency [Hz] 1 2 3 4 5 6 7 8
Abaqus (c) 158.62 163.19 378.21 554.76 1120.28 1155.02 1186.46 1977.45
new_abaqus 158.62 163.19 378.21 554.76 1120.28 1155.02 1186.46 1977.45

To run this example:

./new_abaqus example_runfiles/example3_tuning_fork.inp

Supported Abaqus keywords

The below keywords and and its following options are supported. The datalines to each keyword follows the Abaqus (C) syntax defintion.

*NODE

*ELEMENT, type, elset

*MATERIAL, name

*DENSITY

*ELASTIC

*SOLID SECTION, name, material

*BOUNDARY, type=displacement

*NSET, nset

*FREQUENCY

*STATIC

Element types available

CPS3, CPS4, C3D10, C3D8, C3D20

How to build

Dependencies:

C++14

CMake

Eigen

Spectra

Eigen is a library used for linear algebra, and Spectra is an add-on to that library that is used to solve the eigenvalue problem. Both libraries are header only and included in the repo.

Linux build

git clone https://github.com/sparlund/new_abaqus
cd new_abaqus
cmake .
make all

To run unit test:

./UT

To see unit test code coverage:

cmake --build . --target UT_coverage
firefox UT_coverage/index.html

Windows build

I don't have access to a Windows PC so I don't know, use the CMakefile somehow...

To-do & features implemented

  • makefile CMake build system
  • Automate test cases for comparison solution against abaqus or hand calculations
    • Set up gtest
    • Set up unit test code coverage
    • Verify results for a few example analysis
  • Set up clang-tidy for static code analysis
  • Implement logic and structure for reading abaqus input files
    • Disregard unused nodes
    • Allow for commentented lines to start with whitespace
    • Exit if trying to create element with a N/A node
    • Allow entities to be defined in any order
  • Create classes and relations for nodes, elements, properties and materials
  • Implement logic for different elements
    • 2D first order tria (S2)
    • 2D first order quadrilateral (CPS4)
    • 3D second order tetra (C3D10)
    • 3D first order hexahedron (C3D8)
    • 3D second order hexahedron (C3D20)
  • Assemble mass matrix
  • Assemble stiffness matrix
    • Modify stiffness matrix and load vector to account for boundary conditions
  • Add support for more keywords
    • *BOUNDARY
    • *CLOAD
    • *MATERIAL
    • *SECTION
    • *NSET
    • *STATIC
    • *EIGENFREQUENCY
    • *INCLUDE
    • *CONTACT PAIR
    • *STEP
    • *OUTPUT
  • Solve Ku=f for linear problems
  • Contact mechanics
    • Create segments from master node set
    • Gap function that checks distance from slave node to master set for arbitrary geometry
    • Print information for each load step similar to how ABAQUS does
    • Find contact force at contact interface and correct penetration
  • Calculate scalar values on elements
    • Strains
    • Stresses
    • von Mises stress
  • Solve eigen value problem
    • Calculate mass matrix in element construction
  • Add sanity checks to log-file
    • Print total model weight
    • Print total model volume
    • Print center of gravity
  • Export results to VTK format to view results in ParaView
    • Nodal displacement
    • Eigenmodes
    • Stresses and strains
  • Re-direct output to a log file for debugging
    • Print timing for each step in logfile as basic profiling
  • Some basic error handling
    • Print warning and exit program on small or negative Jacobian determinant
    • Print error in log file and exit when a specified material, node set, section or whatever does not exist

Program size

The binary new_abaqus is 27kB on my system.

--------------------------------------------------
Language           Number of files   Lines of code
--------------------------------------------------
C++                             18            2052
C++ Header                      16             530
Python                           1               9
CMake                            1              47
--------------------------------------------------
SUM:                            37            2638
--------------------------------------------------

About

new_abaqus is a hobby project for creating an FE-solver reading an FE-mesh following the syntax of the commercial software abaqus.


Languages

Language:C++ 98.1%Language:C 1.3%Language:CMake 0.6%Language:Python 0.0%