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

9 ビュー (過去 30 日間)
RAJESH
RAJESH 2023 年 1 月 9 日
コメント済み: Walter Roberson 2023 年 1 月 12 日
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 件のコメント
KSSV
KSSV 2023 年 1 月 9 日
Why do you think code is unable to run? What problem you are facing? You need to specify your error exactly.
RAJESH
RAJESH 2023 年 1 月 10 日
I am not able to generate short fibre on plot, Kindly help.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2023 年 1 月 10 日
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 件のコメント
RAJESH
RAJESH 2023 年 1 月 12 日
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 2023 年 1 月 12 日
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.

サインインしてコメントする。

その他の回答 (1 件)

Bruno Luong
Bruno Luong 2023 年 1 月 12 日
See if this FEX can help you
  8 件のコメント
RAJESH
RAJESH 2023 年 1 月 12 日
I didnt get you how to modify it can you help me with some examples
RAJESH
RAJESH 2023 年 1 月 12 日
Can you suggest me some exmple for random fibre positioning?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTest Scripts についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by