%build the geometrical modelclear;fs.randSeed(1);%build random modelB=obj_Box;%build a box objectB.name='BoxTunnel';B.GPUstatus='auto';width=50;length=0;height=50;ballR=0.5;%width, length, height, radiusdistriRate=0.2;%define distribution of ball radius, isClump=0;%--------------initial model------------B.ballR=ballR;B.isClump=isClump;B.distriRate=distriRate;B.sampleW=width;B.sampleL=length;B.sampleH=height;%B.BexpandRate=4;%B.PexpandRate=4;B.type='topPlaten';%B.type='TriaxialCompression';B.setType();B.buildInitialModel();%B.show();d=B.d;%--------------end initial model------------B.gravitySediment();B.compactSample(6);%input is compaction time%------------return and save result--------------mfs.reduceGravity(d,5);d.balance('Standard');d.status.dispEnergy();%display the energy of the modeld.clearData(1);%clear dependent datad.recordCalHour('BoxTunnel1Finish');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();d.show('aR');
%set the material of the modelclearload('TempModel/BoxTunnel1.mat');%------------initialize model-------------------B.setUIoutput();d=B.d;d.calculateData();d.mo.setGPU('off');d.getModel();%get xyz from d.mo%------------end initialize model-------------------%-------------set new material----------------matTxt=load('Mats\StrongRock.txt');Mats{1,1}=material('StrongRock',matTxt,B.ballR);Mats{1,1}.Id=1;d.Mats=Mats;d.groupMat2Model({'sample'},1);%-------------end set new material----------------%-------------------apply stress, and balance model------------------B.SET.stressZZ=-10e6;B.setPlatenFixId();d.resetStatus();B.setPlatenStress('StressZZ',B.SET.stressZZ,B.ballR*5);d.balanceBondedModel0(4);d.mo.dT=d.mo.dT*4;%increase the dT to increase the speed of balanced.balance('Standard');d.mo.dT=d.mo.dT/4;%-------------------end apply stress, and balance model------------------%--------------------make tunnel-----------------------sampleId=d.getGroupId('sample');sX=d.mo.aX(sampleId);sY=d.mo.aY(sampleId);sZ=d.mo.aZ(sampleId);dipD=0;dipA=90;radius=4;height=30;mX=d.mo.aX(1:d.mNum);mY=d.mo.aY(1:d.mNum);mZ=d.mo.aZ(1:d.mNum);columnFilter=mfs.getColumnFilter(sX,sY,sZ,dipD,dipA,radius,height);d.addGroup('Tunnel',find(columnFilter));tunnelId=d.getGroupId('Tunnel');d.delElement(tunnelId);%--------------------end make tunnel-----------------------%--------------------save data-----------------------d.mo.setGPU('off');d.clearData(1);d.recordCalHour('BoxTunnel2Finish');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']);%--------------------end save data-----------------------d.calculateData();d.show('ZDisplacement');
%-------------------user_mxSlope3.m;clear;load('TempModel/BoxTunnel2.mat');B.setUIoutput();%------------initialize model-------------------d=B.d;d.calculateData();d.mo.setGPU('off');d.mo.bFilter(:)=true;d.deleteConnection('boundary');d.mo.zeroBalance();d.getModel();%d.setModel();%reset the initial status of the modeld.resetStatus();d.mo.isHeat=1;%calculate heat in the modeld.setStandarddT();d.mo.isCrack=1;%------------end initialize model-------------------%--------------------apply initial stress-----------------------fs.setPlatenStress(d,0,0,B.SET.stressZZ,B.ballR*5);d.mo.setGPU('auto');d.balance('Standard',1);%standard balance%--------------------end apply initial stress-----------------------totalCircle=5;d.tic(totalCircle);%record the initial time of loopfName=['data/step/'B.namenum2str(B.ballR)'-'num2str(B.distriRate)'loopNum'];save([fName'0.mat']);%return;gpuStatus=d.mo.setGPU('auto');fori=1:totalCirclefs.setPlatenStress(d,0,0,-20e6*i,B.ballR*5);d.mo.zeroBalance();d.balance('Standard',1);%standard balanced.clearData(1);d.mo.setGPU('off');save([fNamenum2str(i)'.mat']);d.calculateData();d.mo.setGPU(gpuStatus);d.toc();%show the note of time;endd.tic(totalCircle);fori=totalCircle+1:totalCircle*2d.balance('Standard',0.5);%standard balanced.clearData(1);d.mo.setGPU('off');save([fNamenum2str(i)'.mat']);d.calculateData();d.mo.setGPU(gpuStatus);d.toc();%show the note of time;endd.recordCalHour('BoxTunnel3Finish');d.mo.setGPU('off');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.show('aR');