MultiScaleCA is a Java-based application for simulating grain growth using Cellular Automata (CA) principles in both 2D and 3D. It supports various neighborhood strategies, seeding methods, and Monte Carlo simulations, with a JavaFX-based user interface for interactive exploration and visualization.
- 2D and 3D Grain Growth: Grow grains in a grid or volume with customizable boundary conditions.
- Neighborhood Strategies: Von Neumann, Moore, Pentagonal, Hexagonal (random/flat), and custom 3D strategies.
- Seeding Methods: Random, Uniform, and Manual seeding for both 2D and 3D.
- Monte Carlo Simulation: Energy-based grain boundary migration with temperature parameter (kT).
- Interactive UI: JavaFX controls for seeding, growth iterations, Monte Carlo steps, and real-time statistics.
- Export: Export 3D voxel data to XYZ format for OVITO visualization.
- Java 11 or higher
- JavaFX SDK compatible with your Java version
- Maven (for building)
-
Clone the repository:
git clone https://github.com/yourusername/multiscaleca.git cd multiscaleca -
Build with Maven:
mvn clean package
-
Run the application:
mvn javafx:run -DmainClass=com.example.multiscaleca.ui.MainApp
-
Launch the 2D app:
java -cp target/multiscaleca.jar com.example.multiscaleca.ui.MainApp
-
Use the control panel to select:
- Seeding mode (Random, Uniform, Manual)
- Neighborhood (Von Neumann, Moore, Pentagonal, Hexagonal)
- Boundary (Periodic, Absorbing)
- Number of seeds and kT for Monte Carlo
-
Click Start to seed and render initial state.
-
Use Iteracja to grow grains by CA rules.
-
Use MC Iteracja to perform a Monte Carlo step.
-
View real-time statistics in the stats panel.
-
Launch the 3D app:
java -cp target/multiscaleca.jar com.example.multiscaleca.ui.MainApp3D
-
Configure seeding, neighborhood, boundary, and seeds in the control panel.
-
Click Start to initialize the volume.
-
Use Iteracja, MC Iteracja, and Export for growth, Monte Carlo, and XYZ export.
-
Use the Pokaż 3D button to open an interactive 3D viewer.
src/main/java
├── com.example.multiscaleca.algorithm
│ ├── MonteCarloSimulator.java
│ └── MonteCarloSimulator3D.java
├── com.example.multiscaleca.model
│ ├── Cell.java
│ ├── Grid.java
│ ├── Grid3D.java
│ ├── GrainStats.java
│ └── GrainStats3D.java
├── com.example.multiscaleca.neighborhood
│ ├── NeighborhoodStrategy.java
│ ├── VonNeumannStrategy.java
│ ├── MooreStrategy.java
│ ├── PentagonalStrategy.java
│ ├── RandomHexagonalStrategy.java
│ └── (3D counterparts)
├── com.example.multiscaleca.seeding
│ ├── GrainSeeder.java
│ ├── RandomSeeder.java
│ ├── UniformSeeder.java
│ ├── ManualSeeder.java
│ └── (3D counterparts)
└── com.example.multiscaleca.ui
├── MainApp.java
├── MainApp3D.java
├── GridCanvas.java
├── GridCanvas3D.java
├── ControlPanel.java
├── StatsPanel.java
├── StatsPanel3D.java
├── Exporter3D.java
└── event handlers
- Custom Neighborhood: Implement
NeighborhoodStrategyorNeighborhood3DStrategyand register in the UI. - New Seeding: Implement
GrainSeederorGrainSeeder3Dfor new initialization algorithms. - Analysis: Modify
GrainStatsfor additional metrics.

