%build the geometrical modelclear;fs.randSeed(2);%build random modelB=obj_Box;%build a box objectB.name='BoxEarthquake';B.GPUstatus='auto';B.ballR=1;%default value is 0.5, use 1 to increase speedB.isClump=0;B.distriRate=0.2;B.sampleW=200;B.sampleL=0;B.sampleH=160;%B.BexpandRate=4;%B.PexpandRate=4;B.type='topPlaten';%B.type='TriaxialCompression';B.setType();B.buildInitialModel();%B.show();B.setUIoutput();d=B.d;%d.breakGroup('sample');d.breakGroup('lefPlaten');%--------------end initial model------------B.gravitySediment();B.compactSample(1);%input is compaction time%------------return and save result--------------d.status.dispEnergy();%display the energy of the modeld.clearData(1);%clear dependent datad.recordCalHour('Box1Finish');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');
%initilizationclearload('TempModel/BoxEarthquake1.mat');B.setUIoutput();%set output of messaged=B.d;d.calculateData();d.mo.setGPU('off');d.getModel();%get xyz from d.mo%---------set material of modelmatTxt=load('Mats\Soil3.txt');%material of soilMats{1,1}=material('Soil1',matTxt,B.ballR);Mats{1,1}.Id=1;matTxt2=load('Mats\Rock1.txt');Mats{2,1}=material('Rock1',matTxt2,B.ballR);%material of rockMats{2,1}.Id=2;d.Mats=Mats;%---------end set material of model%---------cut the model and make layersC=Tool_Cut(d);%cut the modellSurf=load('slope/Earthquake.txt');%load the surface dataC.addSurf(lSurf);%add the surfaces to the cutC.setLayer({'sample'},[1,2,3,4]);%set layers according geometrical datagNames={'lefPlaten';'rigPlaten';'botPlaten';'layer1';'layer2';'layer3'};d.makeModelByGroups(gNames);%build new model%---------end cut the model and make layers%---------set material of groupd.setGroupMat('layer1','Rock1');d.setGroupMat('layer2','Soil1');d.setGroupMat('layer3','Rock1');d.groupMat2Model({'layer1','layer2','layer3'},2);%---------end set material of group%---------balance the modeld.balanceBondedModel0();%balance the bonded model without friction%---------define a block on left side of the model to generate wavemX=d.mo.aX(1:d.mNum);leftBlockId=find(mX<0.05*max(mX));%choose element Id of blockd.addGroup('LeftBlock',leftBlockId);%add a new groupd.setClump('LeftBlock');%set the block clumpd.mo.zeroBalance();%---------end define a block on left side of the model to generate wave%---------balance the modeld.mo.bFilter(:)=true;d.mo.dT=d.mo.dT*4;d.balance('Standard',1);d.mo.bFilter(:)=true;d.balance('Standard',0.5);d.mo.dT=d.mo.dT/4;%---------end balance the modeld.show('aMatId');%show material of model%---------save datad.mo.setGPU('off');d.clearData(1);d.recordCalHour('BoxModel2Finish');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();
clear;load('TempModel/BoxEarthquake2.mat');B.setUIoutput();d=B.d;d.calculateData();d.mo.setGPU('off');d.getModel();%reset the initial status of the modeld.resetStatus();%initialize model status, which records running informationd.mo.isHeat=1;%calculate heat in the modeld.mo.isCrack=1;%record in the modelvisRate=0.000001;d.mo.mVis=d.mo.mVis*visRate;gpuStatus=d.mo.setGPU('auto');d.setStandarddT();%------------move left boundary to generate compressive waved.moveBoundary('left',0.01,0,0);totalCircle=40;d.tic(totalCircle);fName=['data/step/'B.namenum2str(B.ballR)'-'num2str(B.distriRate)'loopNum'];save([fName'0.mat']);%return;fori=1:totalCircled.mo.setGPU(gpuStatus);d.balance('Standard',0.01);d.clearData(1);save([fNamenum2str(i)'.mat']);d.calculateData();d.toc();%show the note of timeendd.show('mV');%-----------save datad.mo.setGPU('off');d.clearData(1);d.recordCalHour('BoxModel3Finish');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();