Generating COMSOL Steel Fiber Concrete Models with Random Fiber Distribution Using MATLAB's rand Function

Resource Overview

Creating COMSOL steel fiber concrete files with randomly distributed fibers using MATLAB's random function rand

Detailed Documentation

In composite material numerical simulations, the random distribution of steel fibers in concrete directly influences mechanical properties. High-precision fiber distribution modeling can be achieved through MATLAB-COMSOL integration. Below are the core implementation approaches:

Random Coordinate Generation Using MATLAB's `rand` function to generate uniformly distributed random points within a specified volume domain, where each point represents a fiber's starting position. Boundary conditions must be considered to prevent fibers from exceeding material boundaries, typically handled through coordinate offset methods to account for fiber length effects. Implementation involves defining domain dimensions and generating N×3 coordinate arrays with `rand(N,3).*[Lx,Ly,Lz]`.

Fiber Orientation Control Transforming random numbers into 3D direction vectors using spherical coordinate conversion. For 2D models, simply generate angle values using `rand`. The key is maintaining uniform distribution characteristics of direction vectors to avoid local clustering. Code implementation may use `theta = 2*pi*rand()` for 2D angles or `[phi,theta] = deal(2*pi*rand(), pi*rand())` for 3D spherical coordinates.

Parametric Script Integration Saving generated fiber position and orientation data as `.txt` or `.csv` files, then directly importing them through COMSOL's LiveLink for MATLAB interface or script import functionality. In COMSOL, these parameters can be converted into geometric line segments or cylinders as embedded units in solid mechanics modules. The workflow includes using `writematrix()` for data export and COMSOL's `importdata()` function for seamless integration.

Collision Detection Optimization To prevent fiber overlapping, precompute Euclidean distances in MATLAB. If the distance between two fibers is less than the diameter threshold, regenerate positions. This process can be accelerated using loops combined with the `knnsearch` function for efficient nearest-neighbor searches. Implementation typically involves while-loops with distance matrix calculations and threshold comparisons.

This method is suitable for mesoscale modeling, where fiber volume fraction (controlled by adjusting generated point counts) or aspect ratios (defined by segment lengths) can be modified to match experimental data. For large-scale models, recommend generating in blocks and merging to reduce memory consumption. The algorithm scalability can be improved through domain partitioning and parallel processing techniques.