This repository contains Python scripts for implementing Direct FE2 (Finite Element Squared - two-scale) analysis for powder compaction processes using Abaqus. The FE2 method enables multi-scale simulation by coupling macroscale and microscale models through representative volume elements (RVEs) placed at each Gauss point.
Two distinct simulation frameworks are provided:
- Mechanical Simulation - For pure mechanical analysis
- Thermo-Mechanical-Electrical Simulation - For coupled thermo-mechanical-electrical analysis
direct_fe2_abaqus/
├── 3D_RVE.png # Reference image for RVE configuration
├── Tan-plastic.pdf # Material properties reference
├── readme.docx # Original documentation
│
├── 3D_DFE2_Powder_Mechanical/ # Mechanical Simulation
│ ├── 1_Micro_RVE_placement_3DFE2.py # RVE placement at Gauss points
│ ├── 2_Surface_Interface.py # Surface interface treatment
│ ├── 3_Input_PBC_Condition_3DFE2.py # Periodic boundary conditions
│ └── README.md # Additional documentation
│
└── 3D_DFE2_Powder_ThermoMechanicalElectrical/ # Coupled Analysis
├── 1_Micro_RVE_placement_3DFE2_TM.py # RVE placement (TM variant)
├── 2_Surface_Interface.py # Surface interface treatment
├── 3_Input_PBC_Condition_3DFE2_TM.py # Periodic boundary conditions (TM variant)
└── git_Abaqus_Files/
├── Powder_Master_ETM.cae # Master Abaqus model (ETM)
└── Powder_Master_ETM.jnl # Abaqus journal file
This module implements a 3D Direct FE2 framework for mechanical powder compaction analysis:
Scripts:
-
1_Micro_RVE_placement_3DFE2.py
- Automatically places microscale RVEs at each Gauss point of the macroscale mesh
- Extracts nodes and element connectivity from the input
.inpfile - Computes natural coordinate positions of 8 Gauss points (C3D8R elements)
- Generates a Python script to instantiate RVEs in the Abaqus assembly
-
2_Surface_Interface.py
- Handles surface interactions between adjacent RVEs
- Manages interface constraints and contact definitions
- Creates necessary surface sets according to the reference image (3D_RVE.png)
-
3_Input_PBC_Condition_3DFE2.py
- Implements Periodic Boundary Conditions (PBC) for the microscale RVE
- Enforces displacement periodicity and anti-periodicity
- Applies homogenization constraints up to 8 Gauss points
- Computes shape functions with controlled accuracy (default: 7 significant figures)
This module extends the mechanical framework to include thermal and electrical effects:
Key Differences:
- Uses Q3D8 elements (thermal-mechanical elements with electrical coupling)
- Handles 6 loops for temperature and voltage calculations
- Compatible with
Powder_Master_ETM.caemaster model - Scripts follow same structure with
_TMsuffix for thermo-mechanical variants
- Abaqus 2016 or later
- Python 2.7 (for Abaqus scripting) or compatible version
- NumPy library
- Access to the example CAE files in
git_Abaqus_Files/
Before running the scripts, update the following parameters in each Python file:
# Step 1: Set Input Directory
Inp_Directory = 'E:\\2_AbaqusWorkingDir\\3D_Powder_Mechanical\\Powder_DFE2'
Inp_File_Name = 'Powder_V0.inp'
# Step 2: Define Model Configuration
RVE_part_name = 'Powder-mesh-1' # Must match GUI part name
macro_part_name = 'MACRO' # Macroscale mesh part name
macro_instance_name = 'MACRO-1' # Instance name in assembly
# Step 3: Set RVE Properties
RVE_center = (0.5, 0.5, 0.5) # RVE center coordinates
lx, ly, lz = 1.0, 1.0, 1.0 # RVE dimensions-
Prepare Macroscale Model
- Create macroscale mesh in Abaqus GUI
- Export to
.inpfile
-
Create Microscale RVE
- Define RVE geometry in Part module
- IMPORTANT: Create mesh part (do NOT copy 2D parts)
- Create sets according to 3D_RVE.png reference image
- Export to
.inpfile
-
Run Step 1: RVE Placement
python 1_Micro_RVE_placement_3DFE2.py
- Generates RVE instances at all Gauss points
- Creates Python model generation script
-
Run Step 2: Surface Interface (if needed)
python 2_Surface_Interface.py
- Applies surface interactions
- Creates contact definitions
-
Run Step 3: Periodic Boundary Conditions
python 3_Input_PBC_Condition_3DFE2.py
- Implements PBC constraints
- Generates final
.inpfile with all constraints
-
Submit Analysis
- Import modified
.inpfile into Abaqus - Run simulation through Abaqus/Standard or Abaqus/Explicit
- Import modified
Reference image showing the 3D RVE mesh structure and set definitions. Follow this configuration when creating microscale mesh sets in Abaqus.
- Follow the reference image 3D_RVE.png for correct set definitions
- Create sets on the microscale RVE before export
- Sets include:
- Face sets (for PBC application)
- Node sets (for constraint mapping)
- Surface sets (for contact/interaction)
- Create mesh part in Abaqus (Below the RVE mesh, mesh>creat mesh part).
