跳转至

ScrewConveyor

user_ScrewConveyor1.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
%make a box model, which will be put on a slope
clear;
fs.randSeed(1);%build random model
B=obj_Box;%build a box object
B.name='Screw';
B.GPUstatus='auto';
B.ballR=0.005;
B.isClump=0;
B.distriRate=0.2;
B.sampleW=0.2;
B.sampleL=0.2;
B.sampleH=0.4;
B.type='topPlaten';
B.setType();
B.buildInitialModel();%B.show();
B.setUIoutput();

d=B.d;%d.breakGroup('sample');d.breakGroup('lefPlaten');
d.mo.setGPU('auto');
%--------------end initial model------------
B.gravitySediment();
%mfs.reduceGravity(d,2);%reduce the gravity of element
%------------return and save result--------------
d.status.dispEnergy();%display the energy of the model
d.show('aR');

d.mo.setGPU('off');
d.clearData(1);%clear dependent data
d.recordCalHour('Step1Finish');
save(['TempModel/' B.name '1.mat'],'B','d');
save(['TempModel/' B.name '1R' num2str(B.ballR) '-distri' num2str(B.distriRate)  'aNum' num2str(d.aNum) '.mat']);
d.calculateData();%because data is clear, it will be re-calculated
user_ScrewConveyor2.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
load('TempModel/Screw1.mat');
ballR=B.ballR;
helixInnerR=ballR;
helixOuterR=0.1;
helixHeight=1;
circle=6;
Rrate=0.8;

B.d.mo.setGPU('off');
sampleObj=B.d.group2Obj('sample');%make struct object from a group
filter=mfs.getColumnFilter(sampleObj.X, sampleObj.Y, sampleObj.Z, 0, 0, helixOuterR*0.95, B.sampleH);
sampleObj=mfs.filterObj(sampleObj,filter);
objCenter=mfs.getObjCenter(sampleObj);
sampleObj.X=sampleObj.X-objCenter.x;
sampleObj.Y=sampleObj.Y-objCenter.y;

helixObj=f.run('fun/makeHelix.m',helixInnerR,helixOuterR,helixHeight,circle,ballR,Rrate);

figure;fs.showObj(helixObj);
return
tubeR=helixOuterR+ballR*Rrate;
tubeH=helixHeight;
tubeObj=mfs.makeTube2(tubeR,tubeH+ballR*(1-Rrate)*2,ballR*Rrate);
tubeObj.R=tubeObj.R/Rrate;


return
discObj=mfs.makeDisc(tubeR,ballR,Rrate);
%discObj.Z=discObj.Z-ballR;

rotateAngle=-90;
helixObj=mfs.rotate(helixObj,'XZ',rotateAngle);
tubeObj=mfs.rotate(tubeObj,'XZ',rotateAngle);
discObj=mfs.rotate(discObj,'XZ',rotateAngle);
sampleObj=mfs.rotate(sampleObj,'XZ',rotateAngle);

frame=mfs.getObjFrame(tubeObj);
baseH=frame.width*0.2;
helixObj=mfs.move(helixObj,-frame.left,-frame.front,-frame.bottom+baseH);
tubeObj=mfs.move(tubeObj,-frame.left,-frame.front,-frame.bottom+baseH);
discObj=mfs.move(discObj,-frame.left,-frame.front,-frame.bottom+baseH);
sampleObj=mfs.move(sampleObj,-frame.left,-frame.front,-frame.bottom+baseH);

%make a big box for the simulation
fs.randSeed(1);%random model seed, 1,2,3...
B=obj_Box;%declare a box object
B.name='Screw';
%--------------initial model------------
B.GPUstatus='auto';%program will test the CPU and GPU speed, and choose the quicker one
B.ballR=ballR;
B.isShear=0;
B.isClump=0;%if isClump=1, particles are composed of several balls
B.sampleW=frame.width+baseH;%width, length, height, average radius
B.sampleL=frame.length;%when L is zero, it is a 2-dimensional model
B.sampleH=frame.height+baseH;
B.type='botPlaten';%add a top platen to compact model
B.isSample=0;
%B.type='TriaxialCompression';
B.setType();
B.buildInitialModel();
d=B.d;
d.mo.setGPU('off');

matTxt1=load('Mats\rubber.txt');
matTxt1(1)=matTxt1(1)/100;
Mats{1,1}=material('rubber',matTxt1,B.ballR);
Mats{1,1}.Id=1;
d.Mats=Mats;

d.showB=3;
[helixId,tubeId,discId]=d.addElement(1,{helixObj,tubeObj,discObj},'wall');
d.addGroup('helix',helixId);%add a new group
d.addGroup('tube',tubeId);%add a new group
d.addGroup('disc',discId);%add a new group
sampleId=d.addElement(1,sampleObj);
d.addGroup('sample',sampleId);%add a new group
d.minusGroup('sample','helix',0.6);
d.minusGroup('sample','disc',0.6);
d.delElement(d.GROUP.botPlaten);
d.mo.setGPU('auto');
d.balance('Standard');

d.showFilter('SlideY',0.5,1,'aR');
%------------record data
d.mo.setGPU('off');
d.clearData(1);%clear dependent data in d
d.recordCalHour('BoxSlopeNet2Finish');
save(['TempModel/' B.name '2.mat'],'B','d');
save(['TempModel/' B.name '2R' num2str(B.ballR) '-distri' num2str(B.distriRate)  'aNum' num2str(d.aNum) '.mat']);
d.calculateData();
user_ScrewConveyor3.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
clear;
load('TempModel/Screw2.mat');
B.setUIoutput();
d=B.d;
d.calculateData();
d.mo.setGPU('off');
d.getModel();%d.setModel();%reset the initial status of the model
d.resetStatus();%initialize model status, which records running information

d.mo.isHeat=1;%calculate heat in the model
visRate=0.05;
d.mo.mVis=d.mo.mVis*visRate;%use low viscosity for dynamic simulation
d.setStandarddT();
d.mo.setShear('off');
d.breakGroup();
d.setStandarddT();
d.mo.dT=d.mo.dT*4;

showType='mV';
d.showFilter('Group',{'sample','helix'});
figureNumber=d.show(showType);
d.figureNumber=figureNumber;

totalCircle=60;stepNum=100;
totalAngle=360*6;
dAngle=-totalAngle/(totalCircle*stepNum);
balanceNum=2;%you may use greater stepNum and balanceNum
disp(['Total real time is ' num2str(d.mo.dT*totalCircle*stepNum*balanceNum)]);

fName=['data/step/' B.name num2str(B.ballR) '-' num2str(B.distriRate) 'loopNum'];
save([fName '0.mat']);%return;
gpuStatus=d.mo.setGPU('auto');
d.tic(totalCircle*stepNum);
for i=1:totalCircle
    d.mo.setGPU(gpuStatus);
    for j=1:stepNum
        d.rotateGroup('helix','YZ',dAngle);
        d.balance(balanceNum);
        d.recordStatus();
        d.toc();%show the note of time
    end
    d.showFilter();
    d.showFilter('Group',{'sample','helix'});
    d.show(showType);
    d.clearData(1);%clear data before saving
    save([fName num2str(i) '.mat']);
    d.calculateData();%calculate the data for further calculation
end

d.mo.setGPU('off');
d.clearData(1);
d.recordCalHour('Step3Finish');
save(['TempModel/' B.name '3.mat'],'B','d');
save(['TempModel/' B.name '3R' num2str(B.ballR) '-distri' num2str(B.distriRate)  'aNum' num2str(d.aNum) '.mat']);
d.calculateData();