How to generate code in MATLAB for randomly oriented short fibers?

9 vues (au cours des 30 derniers jours)
RAJESH
RAJESH le 9 Jan 2023
Commenté : Walter Roberson le 12 Jan 2023
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.
  2 commentaires
KSSV
KSSV le 9 Jan 2023
Why do you think code is unable to run? What problem you are facing? You need to specify your error exactly.
RAJESH
RAJESH le 10 Jan 2023
I am not able to generate short fibre on plot, Kindly help.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 10 Jan 2023
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
Your while tests a relationship between Dmin and R and phi . The while loop body might not be entered at all (depending on the initial values), but if it is entered, then the while loop will continue until the condition stops holding or until there is a break statement encountered. In order for the condition to stop holding, at least one of the variables involved in the relationship being tested, must change inside the loop. If all of the variables involved in the relationship are constants inside the loop body and there is no break then the value of the relationship cannot change, so if the loop body were ever entered then it could not possibly be exited.
  12 commentaires
RAJESH
RAJESH le 12 Jan 2023
Could please help me for above code, i am getting confused, can you try by some modification, if possible else i will update you the same from my end.
Walter Roberson
Walter Roberson le 12 Jan 2023
https://www.mathworks.com/matlabcentral/answers/405186-fill-area-with-random-circles-having-different-diameters#comment_1236758 has code for filling space with ellipsoids. Fibres can be modeled as ellipsoids with a long major axes and short minor axes.

Connectez-vous pour commenter.

Plus de réponses (1)

Bruno Luong
Bruno Luong le 12 Jan 2023
See if this FEX can help you
  8 commentaires
RAJESH
RAJESH le 12 Jan 2023
I didnt get you how to modify it can you help me with some examples
RAJESH
RAJESH le 12 Jan 2023
Can you suggest me some exmple for random fibre positioning?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Test Scripts dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by