How to generate code in MATLAB for randomly oriented short fibers?
Show older comments
I need to generate an input file in MATLAB and run in ABAQUS.
wrote some input accordingly as follows:
%% Monte Carlo style script for random placement of fibres
%% Block 1: Define RVE Space
RVE_Length = 100; %Length
RVE_Width = 100; %Width
D = 15; %Fibre Diameter
VolFract = 30; %Percentage volume fraction
%Define RVE
figure('Name','RVE with random fibres','NumberTitle','off')
rveBox = axes('Box','on');
xlim([0 RVE_Length]);
ylim([0 RVE_Width]);
xlabel('RVE Length, L (\mum)')
ylabel('RVE Width, W (\mum)')
title('Random positioned fibres RVE')
%% Block 2: Determine total number of fibres, N_total
Ntotal = round( (0.01*VolFract*RVE_Length*RVE_Width)/(pi*D^2) );
disp(['Total Number of Fibre, Ntotal = ',num2str(Ntotal)]);
%% Block 3: Generate random position of first fibre
XYALL(:,:) = zeros; % A hold-all variable for all fibre coordinates
XYALL(1,1) = rand*RVE_Length; %Random x-position for 1st fibre
XYALL(1,2) = rand*RVE_Width; %Random y-position for 1st fibre
Dmin=0.1; R=D/2; Ncurrent = 0.1;
%% Block 4: Check overlap criteria
phi = 20; %Percentage of R parameter
for Ni = 2:Ntotal
while Dmin < 2*R*(1+phi)
%Create a test position [xtest, ytest] to see if it overlaps
xtest = rand*RVE_Length; %Random x-position for next fibre
ytest = rand*RVE_Width; %Random y-position for next fibre
for i = 1:Ncurrent
% Include codes here to test for overlap
% for all current fibre existing in RVE
end
end
% Accept into XYALL the tested coordinate position
% when they pass the overlap test
XYALL(Ni,1) = xtest;
XYALL(Ni,2) = ytest;
end
%% Block 6: Implementation of periodicity of material
b = cell(1);
for m = 1:length(xEdgeFibres) %For xEdge Fibres Only
if XYALL(xEdgeFibre(m),1)<R
b(m) = [XYALL(xEdgeFibres(m),1)+RVE_Length XYALL(xEdgeFibres(m),2) ];
else
b(m) = [XYALL(xEdgeFibres(m),1)-RVE_Width XYALL(xEdgeFibres(m),2) ];
end
end
%Repeat similar coding for yEdgeFibres and cornerFibres
Unfortunately code is not able to run as desired. Kindly help with above code how to generate input files and run into MATLAB and ABAQUS.
Accepted Answer
More Answers (1)
Bruno Luong
on 12 Jan 2023
0 votes
8 Comments
RAJESH
on 12 Jan 2023
Bruno Luong
on 12 Jan 2023
If you expect us to read the paper and fill in your structural but empty code, that won't happen. Please make an effort and ask specific question if you encount implementation issues.
RAJESH
on 12 Jan 2023
RAJESH
on 12 Jan 2023
Walter Roberson
on 12 Jan 2023
while Dmin < 2*R*(1+phi)
Where inside your loop do you modify at least one of Dmin or phi or R ? Unless you modify at least one of those, you will have an infinite loop.
Bruno Luong
on 12 Jan 2023
"Kindly look into the code, i am not getting result out of it for random positioning of fiber."
Sight...
RAJESH
on 12 Jan 2023
RAJESH
on 12 Jan 2023
Categories
Find more on Descriptive Statistics and Visualization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!