跳转至

models

user_modelAnchor.m
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
clear;
ballR=0.001;
discR=0.01;
holeR=0.006;
poleL=0.1;
Rrate=0.8;
discObj0=f.run('fun/makeDisc.m',discR,ballR*0.8);%define the basic disc
discObj0.R=discObj0.R/0.8;
discObj0=mfs.cutBoxObj(discObj0,discR*2.1,discR*1.5,1);
f=sqrt(discObj0.X.^2+discObj0.Y.^2)>holeR;
discObj0=mfs.filterObj(discObj0, f);
fs.showObj(discObj0);

dDis=ballR*2*Rrate;
num=ceil(poleL/dDis);
dDis=poleL/num;
dAngle=360/num;

allObj.X=[];allObj.Y=[];allObj.Z=[];allObj.R=[];
for i=1:num
    discObjNew=mfs.rotate(discObj0,'XY',dAngle*i);
    discObjNew=mfs.move(discObjNew,0,0,dDis*i);
    allObj=mfs.combineObj(allObj,discObjNew);
end
figure;
fs.showObj(allObj);
user_modelExample.m
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
clear
figure
ballR=0.02;Rrate=0.4;
%create a hob, define the size of a hob
hobR=0.2;hobT=0.1;cutRate=2;
hob=f.run('fun/makeHob.m',hobR,hobT,cutRate,ballR,Rrate);%run function with internal functions
subplot(2,2,1);
fs.showObj(hob);%show the hob

columnR=0.05;columnHeight=0.1;
column=f.run('fun/makeColumn.m',columnR,columnHeight,ballR,Rrate);%run function with internal functions
subplot(2,2,2);
fs.showObj(column);%show the hob

moveDis=(hobT+columnHeight)/2-ballR*(1-Rrate);
column=mfs.move(column,0,0,moveDis);
hobColumn=mfs.combineObj(hob,column);
subplot(2,2,3);
fs.showObj(hobColumn);%show the hob

hobWidth=0.3;hobLength=0.5;hobHeight=1;
hobColumn2=mfs.cutBoxObj(hobColumn,hobWidth,hobLength,hobHeight);
hobColumn2=mfs.rotate(hobColumn2,'YZ',90);
hobColumn2=mfs.rotate(hobColumn2,'XY',30);
subplot(2,2,4);
fs.showObj(hobColumn2);%show the hob
user_modelFiber.m
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
clear;
fs.randSeed(1);%random model seed, 1,2,3...
B=obj_Box;%declare a box object
B.name='BoxFiber';
B.GPUstatus='off';%program will test the CPU and GPU speed, and choose the quicker one
B.ballR=0.01;
B.isShear=0;
B.isClump=0;%if isClump=1, particles are composed of several balls
B.distriRate=0.2;%define distribution of ball radius, 
B.sampleW=0.9;%width, length, height, average radius
B.sampleL=0.4;%when L is zero, it is a 2-dimensional model
B.sampleH=0.6;
B.BexpandRate=2;%boundary is 4-ball wider than 
B.PexpandRate=0;
B.type='botPlaten';%add a top platen to compact model
B.isSample=0;
B.setType();

%make objects
minBallR=B.ballR/2;
innerR=0.05;
layerNum=2;
Rrate=0.8;
ringObj=f.run('fun/makeRing.m',innerR,layerNum,minBallR,Rrate);
tubeObj=mfs.make3Dfrom2D(ringObj, B.sampleW/2,minBallR);
tubeObj=mfs.rotate(tubeObj,'XZ',90);%rotate the group along XZ plane
tube1Obj=mfs.move(tubeObj,B.sampleW/4,B.sampleL/2,B.sampleH/2);
tube2Obj=mfs.move(tubeObj,B.sampleW*3/4,B.sampleL/2,B.sampleH/2);
fiberObj=f.run('fun/make3DLine.m',[minBallR/2,B.sampleW-minBallR/2],[0,0],[0,0],minBallR,0.8);
fiberObj=mfs.move(fiberObj,0,B.sampleL/2,B.sampleH/2);

fiberAngle=[30,150,270]*pi/180;
rate=[0.99,0.99,0.99]*0.99;
fiberR1=ringObj.outerR+minBallR;
fiberY=fiberR1*cos(fiberAngle).*rate;
fiberZ=fiberR1*sin(fiberAngle).*rate;

fiber1Obj=mfs.move(fiberObj,0,fiberY(1),fiberZ(1));
fiber2Obj=mfs.move(fiberObj,0,fiberY(2),fiberZ(2));
fiber3Obj=mfs.move(fiberObj,0,fiberY(3),fiberZ(3));

%add the objects to the box model
B.buildInitialModel();d=B.d;
[tube1Id,tube2Id,fiber1Id,fiber2Id,fiber3Id]=d.addElement(1,{tube1Obj,tube2Obj,fiber1Obj,fiber2Obj,fiber3Obj});
d.addGroup('tube1',tube1Id);%add a new group
d.setClump('tube1');%set the pile clump
d.addGroup('tube2',tube2Id);%add a new group
d.setClump('tube2');%set the pile clump
d.addGroup('fiber1',fiber1Id);%add a new group
d.setClump('fiber1');%set the pile clump
d.addGroup('fiber2',fiber2Id);%add a new group
d.setClump('fiber2');%set the pile clump
d.addGroup('fiber3',fiber3Id);%add a new group
d.setClump('fiber3');%set the pile clump

d.delElement('botPlaten');
d=f.run('fun/setGroupId.m',d);
d.show('groupId');
xlswrite('abc.xls',d.aX);
%