Skip to content

ashwakumar/fea_solver_java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FEA Solver Java

A comprehensive Finite Element Analysis (FEA) solver library implemented in Java, supporting both 2D and 3D linear and nonlinear structural analysis.

Academic Project: This repository is part of a Master's degree project in Computational Engineering at Ruhr University Bochum (Ruhr-UniversitΓ€t Bochum), Germany.

πŸ“‹ Features

  • 2D Linear Elasticity Analysis - Planar stress and strain problems
  • 3D Linear Elasticity Analysis - Solid mechanics with hex elements
  • Nonlinear 3D Analysis - Advanced nonlinear material and geometric behaviors
  • Truss Elements - Specialized 1D structural analysis
  • Quad & Hex Elements - 4-node and 8-node elements for 2D/3D analysis
  • Material Models - Linear elastic and custom material definitions
  • Von Mises Stress - Built-in stress visualization and analysis
  • Excel Integration - Read geometry and boundary conditions from Excel files
  • 3D Visualization - Interactive visualization of structures and results
  • GUI Support - Graphical interface for nonlinear analysis

πŸ“ Project Structure

fea_solver_java/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ core/                          # Base FEA library
β”‚   β”‚   β”œβ”€β”€ Element.java              # Base element class
β”‚   β”‚   β”œβ”€β”€ Node.java                 # Node definition
β”‚   β”‚   β”œβ”€β”€ Constraint.java           # Boundary conditions
β”‚   β”‚   β”œβ”€β”€ Force.java                # Load definitions
β”‚   β”‚   β”œβ”€β”€ Material.java             # Material properties
β”‚   β”‚   β”œβ”€β”€ Structure.java            # Main structure handler
β”‚   β”‚   β”œβ”€β”€ ElementQuad2D4N.java      # 2D quad element
β”‚   β”‚   β”œβ”€β”€ ElementQuad3D8N.java      # 3D hex element (8-node)
β”‚   β”‚   β”œβ”€β”€ LinearElastic2D.java      # 2D elasticity model
β”‚   β”‚   β”œβ”€β”€ LinearElastic3D.java      # 3D elasticity model
β”‚   β”‚   β”œβ”€β”€ VonMises2D.java           # 2D stress analysis
β”‚   β”‚   β”œβ”€β”€ VonMises3D.java           # 3D stress analysis
β”‚   β”‚   β”œβ”€β”€ Visualizer.java           # Result visualization
β”‚   β”‚   └── ReadGeometry.java         # File I/O utilities
β”‚   β”‚
β”‚   β”œβ”€β”€ examples/                      # Practical implementations
β”‚   β”‚   β”œβ”€β”€ Linear2D/                 # 2D linear elasticity examples
β”‚   β”‚   β”œβ”€β”€ Linear3D/                 # 3D linear elasticity examples
β”‚   β”‚   β”œβ”€β”€ LinearTruss/              # 1D truss examples
β”‚   β”‚   └── Nonlinear3D/              # Nonlinear analysis examples
β”‚   β”‚
β”‚   └── tests/                         # Test cases and validation
β”‚       β”œβ”€β”€ Test3D/                   # 3D element tests
β”‚       β”œβ”€β”€ TestCube.java             # Cube structure tests
β”‚       β”œβ”€β”€ TestGeometry.java         # Geometry validation
β”‚       └── TestString.java           # String tests
β”‚
β”œβ”€β”€ .gitignore                         # Git ignore rules
└── README.md                          # This file

πŸš€ Quick Start

Prerequisites

  • Java 8 or higher
  • Apache POI (for Excel file reading)
  • JNUMERICS library (for matrix operations)
  • INF.V3D library (for 3D visualization)

Basic Usage

Example: 2D Linear Analysis

import core.*;

Structure struct = new Structure();

// Create nodes
Node n1 = new Node(0, 0);
Node n2 = new Node(1, 0);
Node n3 = new Node(1, 1);
Node n4 = new Node(0, 1);

// Create element
ElementQuad elem = new ElementQuad(n1, n2, n3, n4);

// Define constraints and forces
Constraint c1 = new Constraint(true, true, true);   // Fixed
Force f1 = new Force(0, -1000, 0);                  // Load

// Add to structure
struct.addNode(n1);
// ... add more nodes and elements

// Solve
struct.enumerateDOFs();
struct.solve();

// Visualize
Viewer viewer = new Viewer();
Visualizer viz = new Visualizer(struct, viewer);
viz.drawElements();

Example: 3D Linear Analysis

import core.*;

// Create 3D hex element (8 nodes)
Node n1 = new Node(0, 0, 0);
Node n2 = new Node(1, 0, 0);
// ... define 8 nodes for hex element

ElementHex elem = new ElementHex(n1, n2, n3, n4, n5, n6, n7, n8);

// Similar workflow as 2D

πŸ” Module Descriptions

Core Library (src/core/)

The foundation for all FEA operations:

  • Element Classes: Base element definitions and derived types (Quad, Hex)
  • Node & Constraint: Mesh definition and boundary conditions
  • Material & Force: Material properties and load definitions
  • Elasticity Models: LinearElastic2D and LinearElastic3D solvers
  • Stress Analysis: Von Mises stress computation and visualization
  • Structure: Main orchestration class managing assembly and solving

Examples (src/examples/)

Linear2D

2D planar stress/strain analysis with quad elements:

  • Mesh generation from geometry files
  • Linear elasticity solve
  • Von Mises stress visualization

Linear3D

3D solid analysis with hex elements:

  • 3D mesh handling
  • Linear elasticity in 3D
  • 3D stress visualization and export

LinearTruss

Specialized 1D truss element analysis:

  • Truss structure definition
  • Axial force analysis
  • Small structure examples

Nonlinear3D

Advanced nonlinear analysis capabilities:

  • Nonlinear material models
  • Geometric nonlinearity
  • Graphical user interface for parameter input
  • Interactive visualization

Tests (src/tests/)

Validation and test cases:

  • ElementTests: Verify element formulations
  • GeometryTests: Mesh and boundary condition validation
  • CubeTests: Common benchmark problems

πŸ“Š Analysis Types Supported

Feature 2D 3D Nonlinear
Linear Elasticity βœ… βœ… ❌
Element Types Quad Hex Hex
Material Models Linear Linear Nonlinear
Visualization βœ… βœ… βœ…
GUI Interface ❌ ❌ βœ…

πŸ› οΈ External Dependencies

  • JNUMERICS: Matrix and linear algebra operations
  • Apache POI: Excel file reading for geometry input
  • INF.V3D: 3D visualization engine
  • ICEB.JNUMERICS: Numerical computing utilities

πŸ“– Usage Examples

Reading Geometry from Excel

ReadGeometry reader = new ReadGeometry("geometry.xlsx");
reader.parseGeometry(struct);

Computing Von Mises Stress

VonMises3D vm = new VonMises3D(struct);
double stress = vm.computeStress(element);

Visualizing Results

Viewer viewer = new Viewer();
Visualizer viz = new Visualizer(struct, viewer);
viz.drawElements();
viz.drawConstraints();
viz.drawForces();

πŸ”§ Development

Building

Compile using your preferred Java IDE or build tool:

javac -cp .:../lib/* src/core/*.java
javac -cp .:../lib/* src/examples/Linear2D/*.java

Running Tests

java -cp bin tests.Test3D.HexTest
java -cp bin tests.TestCube

Running Examples

java -cp bin examples.Linear2D.TestElement
java -cp bin examples.Linear3D.TestGeometry
java -cp bin examples.Nonlinear3D.GraphicalUI

πŸ“ File Input Format

Excel Geometry Files

Expected columns:

  • NodeID: Unique node identifier
  • X, Y, Z: Coordinates
  • ElementID: Element identifier
  • Node1-8: Node references for element connectivity

🎯 Key Classes

Class Purpose
Structure Main analysis controller
Node Point in space with degrees of freedom
Element Base element (extended by specific types)
ElementQuad / ElementHex 2D/3D element implementations
Material Material property definitions
Constraint Boundary condition (fixed, free, etc.)
Force Applied load
Visualizer Results visualization
ReadGeometry Input file parsing

About

FEA Solver Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages