In [1]:
import sys,os
import numpy as np
import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cmx
#this works apparently only for savefig stuff
mpl.rcParams['figure.figsize']=(6.0,4.0) #(6.0,4.0)
mpl.rcParams['font.size']=10 #10
mpl.rcParams['savefig.dpi']=400 #72
mpl.rcParams['figure.subplot.bottom']=.1 #.125
plt.rc('font', family='serif')
plt.rc('text', usetex=True)
#inline Shit
%matplotlib inline
%config InlineBackend.figure_format='svg'
%config InlineBackend.rc = {'figure.facecolor': 'white', 'figure.subplot.bottom': 0.125, 'figure.edgecolor': 'white', 'savefig.dpi': 400, 'figure.figsize': (12.0, 8.0), 'font.size': 10}
#GUi shit
%matplotlib tk
mpl.get_configdir()
Out[1]:
In [2]:
from SimFileReader import *
def plotDataIteration(simDataIteration,dataRange=[0,1e5],steps=100, plotOpts={'color':'r','marker':'.' }):
#plot first residual
iterationDataTime = simDataIteration[0];
#clamp
dataRange[0] = min(np.shape(iterationDataTime)[0]-1, max(0,dataRange[0]) )
dataRange[1] = max(0,min(np.shape(iterationDataTime)[0]-1,dataRange[1]))
if(dataRange[1]<dataRange[0]):
dataRange[1]=dataRange[0]
print('DataRange:', dataRange)
nth = int((dataRange[1]-dataRange[0]) / steps);
if(nth<=1.0):
nth = 1;
iterationCounter = np.arange(dataRange[0],dataRange[1]+1,nth,dtype=int)
#print(iterationCounter)
print("Orig. Iterations: ", np.shape(iterationDataTime))
#iterationDataTime2 = iterationDataTime[dataRange[0]:dataRange[1]:nth]
print("Clamped Iterations: ", np.shape(iterationCounter))
plt.semilogy(iterationCounter,iterationDataTime[iterationCounter],**plotOpts)
In [3]:
plt.close('all')
scriptpath = "./"
# Add the directory containing your module to the Python path (wants absolute paths)
sys.path.append(os.path.abspath(scriptpath))
from SimFileReader import *
bodyRange = [0,3]
timeRange = [0,50]
folderNumber=0
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
plt.figure()
pltOpt = {'color':'r', 'marker':'.', 'markersize': 2,'markeredgewidth': 0, 'markeredgecolor':'none', 'linewidth':0.4}
pltOpt['label']=r'$\alpha=1.8,d_{N}^{-1}=d_{T}^{-1}=1e-7, \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,10000],5000,pltOpt);
folderNumber=1
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='g'
pltOpt['label']=r'$\alpha=1.8,d_{N}^{-1}=d_{T}^{-1}=1e-4, \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,10000],5000,pltOpt);
folderNumber=2
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='b'
pltOpt['label']=r'$\alpha=1.1,d_{N}^{-1}=d_{T}^{-1}=1e-4, \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,10000],5000,pltOpt);
folderNumber=3
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='y'
pltOpt['label']=r'$\alpha=1.1,d_{N}^{-1}=d_{T}^{-1}=1e-6, \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,10000],5000,pltOpt);
folderNumber=4
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='k'
pltOpt['label']=r'$\alpha=1.1,d_{N}^{-1}=d_{T}^{-1}=1e-7, \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,20000],5000,pltOpt);
plt.title(r'Simulation Test Problem 7500 Balls, UCFD Model, $\mu=0.3$' + '\n Term. Crit.: Velocity')
plt.legend()
plt.xlabel('Iteration (without minIter)')
plt.ylabel(r'max. Residual $\| x^{k+1} -x^k\|$')
plt.gca().margins(0.05)
plt.gcf().tight_layout()
plt.gcf().canvas.draw()
plt.savefig('ResidualPlot1Velocity.pdf')
In [4]:
plt.figure()
folderNumber=5
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='r'
pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1},d_{T}^{-1}=10^{-4}, \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,20000],5000,pltOpt);
folderNumber=6
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='g'
pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1},d_{T}^{-1}=10^{-5}, \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,10000],5000,pltOpt);
folderNumber=7
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='b'
pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1},d_{T}^{-1}=10^{-6}, \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,10000],5000,pltOpt);
folderNumber=8
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='y'
pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1}=d_{T}^{-1}=10^{-5} \rightarrow 10^{-6} (warm), \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,10000],5000,pltOpt);
folderNumber=9
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='k'
pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1}=d_{T}^{-1}=10^{-5} \rightarrow 10^{-6} (warm), \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,10000],5000,pltOpt);
plt.title(r'Simulation Test Problem 7500 Balls, UCFD Model, $\mu=0.3$' + '\n Term. Crit.: Lambda')
plt.legend()
plt.xlabel('Iteration (without minIter)')
plt.ylabel(r'Residual $\| x^{k+1} -x^k\|$')
plt.gca().margins(0.05)
plt.gcf().tight_layout()
plt.gcf().canvas.draw()
plt.savefig('ResidualPlot2Lambda.pdf')
In [5]:
plt.figure()
folderNumber=10
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='r'
pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1}=10^{-7},d_{T}^{-1}=10^{-3}, \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,20000],5000,pltOpt);
folderNumber=11
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='g'
pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1}=10^{-8},d_{T}^{-1}=10^{-2}, \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,20000],5000,pltOpt);
folderNumber=12
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='b'
pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1}=10^{-10},d_{T}^{-1}=10^{-2}, \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,20000],5000,pltOpt);
folderNumber=13
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='y'
pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1}=10^{-10},d_{T}^{-1}=10^{-4}, \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,20000],5000,pltOpt);
plt.title(r'Simulation Test Problem 7500 Balls, UCFD Model, $\mu=0.3$' + '\n Term. Crit.: Lambda')
plt.legend()
plt.xlabel('Iteration (without minIter)')
plt.ylabel(r'Residual $\| x^{k+1} -x^k\|$')
plt.gca().margins(0.05)
plt.gcf().tight_layout()
plt.gcf().canvas.draw()
plt.savefig('ResidualPlot2Lambda.pdf')
In [6]:
plt.figure()
folderNumber=14
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='r'
pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1}=10^{-6},d_{T}^{-1}=10^{-6} (\Lambda^{k+1}-\Lambda^{k}), \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,20000],5000,pltOpt);
folderNumber=15
folderPath = "SimData_7500DampedTest/Test%d/" % folderNumber
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='g'
pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1}=10^{-6},d_{T}^{-1}=10^{-6} (+\mathbf{M}^{-1}\mathbf{W} \Lambda^k ), \quad T%d$' % folderNumber
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,20000],5000,pltOpt);
plt.title(r'Simulation Test Problem 7500 Balls, UCFD Model, $\mu=0.3$' + '\n Term. Crit.: Lambda')
plt.legend()
plt.xlabel('Iteration (without minIter)')
plt.ylabel(r'Residual $\| x^{k+1} -x^k\|$')
plt.gca().margins(0.05)
plt.gcf().tight_layout()
plt.gcf().canvas.draw()
plt.savefig('ResidualPlot4Auslöschung.pdf')
In [7]:
plt.figure()
pltOpt = {'color':'r', 'marker':'.', 'markersize': 2,'markeredgewidth': 0, 'markeredgecolor':'none', 'linewidth':0.4}
folderPath = "../SimFiles/SimDataRECORD_0/"
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='b'
pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1}=10^{-10},d_{T}^{-1}=10^{-4},m=1$'
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,100000],5000,pltOpt);
# folderPath = "../SimFiles/SimDataRECORD_24/"
# simDataIterationFile = folderPath + "SimDataIteration.dat";
# pltOpt['color']='r'
# pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1}=10^{-10},d_{T}^{-1}=10^{-4},m=1$'
# simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
# plotDataIteration(simDataIteration,[0,100000],5000,pltOpt);
# folderPath = "../SimFiles/SimDataRECORD_25/"
# simDataIterationFile = folderPath + "SimDataIteration.dat";
# pltOpt['color']='g'
# pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1}=10^{-10},d_{T}^{-1}=10^{-4},m=1$'
# simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
# plotDataIteration(simDataIteration,[0,100000],5000,pltOpt);
folderPath = "../SimFiles/SimDataRECORD_41/"
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='y'
pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1}=10^{-10},d_{T}^{-1}=10^{-4},descending$'
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,100000],5000,pltOpt);
folderPath = "../SimFiles/SimDataRECORD_42/"
simDataIterationFile = folderPath + "SimDataIteration.dat";
pltOpt['color']='y'
pltOpt['label']=r'$\alpha=1.5,d_{N}^{-1}=10^{-10},d_{T}^{-1}=10^{-4},ascending$'
simDataIteration = ReadInSimDataIterationFile(simDataIterationFile)
plotDataIteration(simDataIteration,[0,100000],5000,pltOpt);
plt.title(r'Simulation Test Problem 7500 Balls, UCFD Model, $\mu=0.3$' + '\n Term. Crit.: Lambda')
plt.legend()
plt.xlabel('Iteration (without minIter)')
plt.ylabel(r'Residual $\| x^{k+1} -x^k\|$')
plt.gca().margins(0.05)
plt.gcf().tight_layout()
plt.gcf().canvas.draw()
plt.savefig('ResidualPlot5UCFCD.pdf')
In [7]: