diff --git a/tools/evaluation/thesisCoupled.py b/tools/evaluation/thesisCoupled.py index 65e66c48ad930b9e93609aea264e376b28df542f..d7352d61b28f1bbbd0ac69ae7bdcde6e9dc432a9 100644 --- a/tools/evaluation/thesisCoupled.py +++ b/tools/evaluation/thesisCoupled.py @@ -13,6 +13,10 @@ fSIOC=eP+'SIOC0004/' fGS=eP+'GS0004/' threshold=-50.0 +fMech0008='../../../data/Kopplung/TimeStepTest/Mech0008/' +fMech0016='../../../data/Kopplung/TimeStepTest/Mech0016/' +fMechAdaptive='../../../data/Kopplung/TimeStepTest/adaptive/' + def DifferencePerPointTabs(case): lL=[1,2,3,4] tL=[] @@ -182,7 +186,33 @@ def plotSchwinger(): for p in listEvaluationPoints: plot.Unterschwinger(fL,nL,threshold,p,j,savePath) plot.Oberschwinger(fL,nL,threshold,p,j,savePath) + + +def MechTimeStepTestTable(): + lL=[2] + tL=[0,1,2] + sdt=0.0004 + endTime=0.6 + listEvaluationPoints=[2,3,4,5,6,7,8,9] + nL=['${\\vartriangle}t^{\\mathrm{m}}={\\vartriangle}t^{\\mathrm{e}}$ ','${\\vartriangle}t^{\\mathrm{m}}=0.0008$\, s','${\\vartriangle}t^{\\mathrm{m}}=0.0016$\, s'] + fL=[fSISVI,fMech0008,fMech0016] + + #read.writeVolumeDataInFile(fMech0008,lL,tL,1) + #read.writeVolumeDataInFile(fMech0016,lL,tL,1) + #read.writeDataInFile(fMech0008,lL,tL,1) + #read.writeDataInFile(fMech0016,lL,tL,1) + #read.writeCaDataInFile(fMech0008,lL,tL,1,len(listEvaluationPoints),True) + #read.writeCaDataInFile(fMech0016,lL,tL,1,len(listEvaluationPoints),True) + #read.writeGammaDataInFile(fMech0008,lL,tL,1,len(listEvaluationPoints),True) + #read.writeGammaDataInFile(fMech0016,lL,tL,1,len(listEvaluationPoints),True) + l=2 + savePath='../../../thesis-lindner/thesis/tables/erstmal/coupled/' + tabWriter = TableWriter(lL,tL,sdt,endTime,1,[fSIOC],listEvaluationPoints) + for p in listEvaluationPoints: + tabWriter.writeMechTimeStepTestTable(l,p,fL,nL,threshold,savePath) + plot=Plot(lL,tL,sdt,endTime,1,listEvaluationPoints) + #plot.volumesDifferentAlgs(nL,fL,l.j,) def WorkPrecisonDiagram(case): lL=[1,2,3,4] tL=[1,2,3,4] @@ -247,7 +277,11 @@ def AllValueTabs(): tabWriter.writeAPDTable(fL,nL,savePath,threshold,'Coupled') print('wrote apd Tab') #tabWriter.writeIntervalLtwoNormTab(fL,nL,savePath,threshold) - + + +######################################################################################################################## +#plotting +########################################################################################################################### def plotPotential(): lL=[1,2,3,4] tL=[0,1,2,3,4]#,3] @@ -407,7 +441,7 @@ if __name__=="__main__": ######################## #gamma_f ################################ - plotGamma() + #plotGamma() diffcase='Gamma' #DifferencePerPointTabs(diffcase) case='Gamma' @@ -424,6 +458,12 @@ if __name__=="__main__": #plotExtraErrorVolumes() ################################ + #MechTimeStep listEvaluationPoints + ################################## + MechTimeStepTestTable() + + + ###################################### #print(read.getActivaitionTimeFromLog(4,4,1, fSIOC, 8,threshold,False,'')) #print(read.getActivaitionTimeFromLog(4,4,1, fSIOC, 8,threshold,True,'')) diff --git a/tools/evaluation/utility/latexTables.py b/tools/evaluation/utility/latexTables.py index bea2f1394a7ad5c95b80773a9d513b33600b783f..f9e53afc755975ed2b2f925c74eeb80f3e17b212 100644 --- a/tools/evaluation/utility/latexTables.py +++ b/tools/evaluation/utility/latexTables.py @@ -1770,7 +1770,7 @@ class Table: return block def writeBeginApproxAndDurationTabList(self,p,cap,label,fL,withDuration=True): block='' - block=self.writeBeginTable() + block=self.writeBeginTable('h') block+=self.writeTabelCapLab(cap,label) block+='\\begin{tabular}{cc' for index in range(len(fL)): @@ -2244,7 +2244,166 @@ class Table: block +=self.EndTabular() return block - + def MechTimeStepTest(self,l,p,fL,nL,th): + L=4 + block = '' + block+='\\toprule\n' + block+='\\multicolumn{2}{c}{$\\ell='+str(l)+'$}' + for name in nL: + block+='& '+name + block+='\\\\\n' + block+='\cmidrule(r){1-2}\n' + for i in range(len(nL)-1): + block+='\cmidrule(lr){'+str(3+i)+'-'+str(3+i)+'}\n' + block+='\cmidrule(l){'+str(len(fL)+2)+'-'+str(len(fL)+2)+'}\n' + + #Extrapolierte tact: + j_refT=3 + tactRef=comp.getTextFullExtrapolate(L,j_refT,1,p,self.exP,th) + + #Extrapolierte bzgl. Vact: + j_refV=4 + tact_ref=comp.getTextFullExtrapolate(L,j_refV,1,p,self.exP,th,'') + (t_f,VInt_full)=comp.getVIntFullExtrapolate(L,j_refV,1,p,self.exP,self.sdt,th,durEvalActi,tact_ref,'') + norm_full=comp.L2(VInt_full,self.sdt,self.T,j_refV-1,False) + + #Exptapolierte CaInt: + j_refCaInt=4 + thCa=0.0002 + tact_refCa=comp.getTextFullExtrapolate(L,j_refCaInt,1,p,self.exP,thCa,'Ca') + (t_f,CaInt_full)=comp.getVIntFullExtrapolate(L,j_refCaInt,1,p,self.exP,self.sdt,thCa,durEvalActi,tact_refCa,'Ca') + normCa_full=comp.L2(CaInt_full,self.sdt,self.T,j_refCaInt-1,False) + + #Extraopolierte GammaInt: + j_refGInt=3 + thG=-0.0005 + tact_refG=comp.getTextFullExtrapolate(L,j_refGInt,1,p,self.exP,thG,'Gamma') + (t_f,GInt_full)=comp.getVIntFullExtrapolate(L,j_refGInt,1,p,self.exP,self.sdt,thG,durEvalActi,tact_ref,'Gamma') + normG_full=comp.L2(GInt_full,self.sdt,self.T,j_refGInt-1,False) + #Extrapolierte Volumes: + j_refVol=3 + LV_ref=comp.getFullExtrapolate(L,j_refVol,self.m,1,self.sdt,self.T,self.exP,'Volumes') + RV_ref=comp.getFullExtrapolate(L,j_refVol,self.m,2,self.sdt,self.T,self.exP,'Volumes') + + normLV_ref=comp.L2(LV_ref,self.sdt,self.T,j_refVol-1,False) + normRV_ref=comp.L2(RV_ref,self.sdt,self.T,j_refVol-1,False) + + + for j in self.tL: + standardlength=int(round(self.T/(self.sdt*2**(-j))))+1 + block+='$j='+str(j)+'$' + + #duration: + proc=512 + block +='& Rechenzeit ' + for alg in fL: + (procAlg,dur)=read.getProcsAndDur(alg,l,j,self.m) + if dur==0: + block+='& - ' + else: + dur=dur[:-3] + block+='&$'+str(dur)+'$' + #block+='&$'+str(procAlg)+'$' + block+='\\\\[2pt]\n' + + #tact: + block+='& $\\errortact^{'+str(j)+','+str(l)+','+str(p)+'}$' + for alg in fL: + (t,V)=read.getDataFromTXT(alg,read.createFilename(l,j,self.m),p) + if len(t)==standardlength: + t_act=comp.getActivaitionTimeFromV(t,V,th) + value=abs(t_act-tactRef)/tactRef + block += " & $"+ str("%8.4f"%(value))+"$" + else: + block+=" & - " + block+='\\\\[2pt]\n' + + #IntV: + block+='& $\\errorVact^{'+str(j)+','+str(l)+','+str(p)+'}$' + for alg in fL: + (t,V)=read.getDataFromTXT(alg,read.createFilename(l,j,self.m),p) + if len(t)==standardlength: + (tact,id_tact)=comp.getTactPerCase(t,V,th,'',True) + id_dur=self.getTimeID(id_tact,j) + value=comp.L2DiffInterval(V[id_tact:id_dur],VInt_full,self.sdt,j,j_refV-1,p) + value=value/norm_full + block += " & $"+ str("%8.4f"%(value))+"$" + else: + block+=" & - " + block+='\\\\[2pt]\n' + + + #Ca IntV: + block+='&$\\errorCaAct^{'+str(j)+','+str(l)+','+str(p)+'}$' + for alg in fL: + (t,V)=read.getDataFromTXT(alg,read.createFilename(l,j,self.m)+'Ca',p) + if len(t)==standardlength: + (tact,id_tact)=comp.getTactPerCase(t,V,thCa,'Ca',True) + id_dur=self.getTimeID(id_tact,j) + value=comp.L2DiffInterval(V[id_tact:id_dur],CaInt_full,self.sdt,j,j_refCaInt-1,p) + value=value/normCa_full + block += " & $"+ str("%8.4f"%(value))+"$" + else: + block+=" & - " + block+='\\\\[2pt]\n' + + #Gamma IntV: + block+='&$\\errorGAct^{'+str(j)+','+str(l)+','+str(p)+'}$' + for alg in fL: + (t,V)=read.getDataFromTXT(alg,read.createFilename(l,j,self.m)+'Gamma',p) + if len(t)==standardlength-1: + (tact,id_tact)=comp.getTactPerCase(t,V,thG,'Gamma',True) + id_dur=self.getTimeID(id_tact,j) + value=comp.L2DiffInterval(V[id_tact:id_dur],GInt_full,self.sdt,j,j_refGInt-1,p) + value=value/normG_full + block += " & $"+ str("%8.4f"%(value))+"$" + else: + block+=" & - " + block+='\\\\[2pt]\n' + + + #LV: + block+='& $\\errorLV^{'+str(j)+','+str(l)+'}$' + for alg in fL: + + (t,LV)=read.getDataFromTXT(alg,read.createFilename(l,j,self.m)+'Volumes',1) + + sdtnew=(int(1000.0*1000.0*self.T)//((len(LV)-1)))/(1000*1000) + refJ=int(math.log(sdtnew/(self.sdt*2**(-(j_refVol-1))) ,2)) + + value=comp.L2DiffInterval(LV,LV_ref,sdtnew,0,refJ) + value=value/normLV_ref + block += " & $"+ str("%8.4f"%(value))+"$" + block+='\\\\[2pt]\n' + + #RV: + block+='& $\\errorRV^{'+str(j)+','+str(l)+'}$' + for alg in fL: + (t,RV)=read.getDataFromTXT(alg,read.createFilename(l,j,self.m)+'Volumes',2) + + sdtnew=(int(1000.0*1000.0*self.T)//((len(RV)-1)))/(1000*1000) + refJ=int(math.log(sdtnew/(self.sdt*2**(-(j_refVol-1))) ,2)) + + value=comp.L2DiffInterval(RV,RV_ref,self.sdt,0,refJ) + value=value/normRV_ref + block += " & $"+ str("%8.4f"%(value))+"$" + + block+='\\\\[2pt]\n' + + if j!=self.tL[-1]: + block+='\cmidrule(r){1-2}\n' + for i in range(len(nL)-1): + block+='\cmidrule(lr){'+str(3+i)+'-'+str(3+i)+'}\n' + block+='\cmidrule(l){'+str(len(fL)+2)+'-'+str(len(fL)+2)+'}\n' + + + + + + block+='\\bottomrule\n' + block +=self.EndTabular() + return block + def writeExtraErrorTab(self,fL,nL,p,case): block = '' block+='\\toprule\n' @@ -2464,7 +2623,7 @@ class Table: block+='& - ' else: dur=dur[:-3] - lock+='&$'+str(dur)+'$' + block+='&$'+str(dur)+'$' block+='&$'+str(proc)+'$' block+='\\\\\n' if l<self.lL[-1]: @@ -3292,7 +3451,18 @@ class TableWriter: output_file.write(self.tab.writeDifferenceTableTimeVolume(l,fL,nL,2,'RV')) output_file.write(self.tab.EndTabular()) output_file.write(self.tab.writeEndTable()) - + + + def writeMechTimeStepTestTable(self,l,p,fL,nL,threshold,savePath): + + cap='Untersuchung verschiedener Varianten zur Anpassung der Zeitschrittweite ${\\vartriangle}t^{\\mathrm{m}}$ für die Mechanik für das \\emm~berechnet mit dem \\SISVI in '+self.tab.getPointNamebyNumber(p,False) + label ='tab:MechTimeStepTestP'+str(p) + filename=savePath +'MechTimeStepTestP'+str(p) + with open(filename+'.tex', 'w') as output_file: + output_file.write(self.tab.writeBeginApproxAndDurationTabList(p,cap,label,fL,False)) + output_file.write(self.tab.MechTimeStepTest(l,p,fL,nL,threshold)) + output_file.write(self.tab.writeEndTable()) + def writeDifferenceTablePerPoint(self,l,j,fL,nL,savePath,case,threshold=-50.0,experiment=''): cap='' filename=''