%build the geometrical modelclear;fs.randSeed(2);%build random modelB=obj_Box;%build a box objectB.name='BoxLandSubsidence';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=80;B.type='GeneralSlope';%B.type='TriaxialCompression';B.setType();B.buildInitialModel();%B.show();B.setUIoutput();d=B.d;d.mo.setGPU('auto');%--------------end initial model------------B.gravitySediment();%------------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');
%set the material of the modelclearload('TempModel/BoxLandSubsidence1.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\SoilLandSubsidence.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 model and make layersC=Tool_Cut(d);%cut the modellSurf=load('slope/LandSubsidence.txt');%load the surface dataC.addSurf(lSurf);%add the surfaces to the cutC.setLayer({'sample'},[1,2,3]);%set layers according geometrical datagNames={'lefPlaten';'rigPlaten';'botPlaten';'layer1';'layer2'};d.makeModelByGroups(gNames);%build new model using layer1 and 2%set material of groupd.setGroupMat('layer1','Rock1');d.setGroupMat('layer2','Soil1');d.defineWallElement('layer1');%change rigid rock to wall%d.show();d.groupMat2Model({'layer1','layer2'});%---------end cut model and make layers%---------balance the modeld.balanceBondedModel0();d.mo.bFilter(:)=true;d.balance('Standard');d.mo.bFilter(:)=true;d.balance('Standard');%---------end balance the 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/BoxLandSubsidence2.mat');B.setUIoutput();d=B.d;d.calculateData();d.mo.setGPU('off');%-------------initializing parametersmGZ0=d.mo.mGZ;%record the initial gravity of elementmZ=d.mo.aZ(1:d.mNum);mR=d.mo.aR(1:d.mNum);mVolumn=4/3*pi*mR.*mR.*mR;%volumn of elementswaterDensity=1e3;waterTable1=55;%initial water tablewaterTable2=25;mBuoyancy=-waterDensity*mVolumn*d.mo.g;%buoyancy of element%-------------end initializing parameters%-------------initializing modelwaterFilter=mZ<waterTable1;%filter of element under the water tabled.mo.mGZ=mGZ0+mBuoyancy.*waterFilter;d.balanceBondedModel0();%bond the model and balance it without frictiond.mo.bFilter(:)=true;%bond all elementsd.balance('Standard');d.mo.isCrack=1;%record the information of cracksd.getModel();%d.setModel();%reset the initial status of the modeld.resetStatus();%initialize model status, which records running informationd.mo.isHeat=1;%calculate heat in the modelvisRate=1;d.mo.mVis=d.mo.mVis*visRate;%change the viscosity of the simulationd.setStandarddT();%-------------end initializing model%-------------when water table dropswaterFilter=mZ<waterTable2;%filter of element under the water tablemBuoyancy=-waterDensity*mVolumn*d.mo.g;d.mo.mGZ=mGZ0+mBuoyancy.*waterFilter;d.balance('Standard');d.show('Displacement');d.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();