Commit 6a29c259 authored by Adam Larat's avatar Adam Larat

Merge with SizeMoments branch. Fully tested on thinkpad. 8 FAILING test on...

Merge with SizeMoments branch. Fully tested on thinkpad. 8 FAILING test on Fusion and Plafrim. SizeMoments tests need to be implemented
parents be391fea 3e3630cd
*.png
*.pyc
*.~
*.swp
*.bak
data/*/*
data/*.dat
data/*.dat[0-9]
data/*.dat*
data/*.data
data/*.png
data/*.mov
data/*.tgz
data/*.log
data/*/*
.spyderproject
Tests/Execute/*
Figures/*
......
This diff is collapsed.
generateParameters:
@echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
@echo " Parrallel execution "
@echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
@mkdir -p Parameters
@./generateParameters.sh > Parameters/generatedParameterFiles.log
%.dummy: %.py
@./runOneTest.sh $(notdir $<)
single: $(addsuffix .dummy, $(basename $(wildcard Parameters/*-parameters.py)))
#!/bin/bash
cd Execute
for O in {1,2,3}
do
for M in {2..8}
do
mkdir -p Order${O}/Convergence_${M}Moments
done
done
for T in {Border,Gamma,Beta}
do
for O in {1,2,3}
do
for M in {2..8}
do
for N in {32,64,128,256,512,1024}
do
echo "***********************************"
echo "** T = "$T", O = "$O", N = "$N" **"
echo "***********************************"
cat out_momentsAdv-moments${T}_Order${O}_${M}Moments_N${N}.log
done > Order${O}/Convergence_${M}Moments/out_momentsAdv-moments${T}_Order${O}.log
done
done
done
mv Order[1-3] ../.
cd ..
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 6 18:23:14 2016
@author: larat
"""
import sys
import numpy as np
from scipy import stats
import pylab as plt
plt.close('all')
if(len(sys.argv)==1):
print "Usage: convergence.py rootName"
rootName = "Convergence.dat"
print "Since you have provided none, I have provided the arguments for you:"
print rootName
elif(len(sys.argv)==2):
rootName = str(sys.argv[1])
else:
print "Usage: convergence.py rootName"
sys.exit(-1)
### Must contain on each line : N m1_L1 ... mk_L1 m1_L2 ... mk_L2 m1_Linf ... mk_Linf
conv = np.loadtxt(rootName)
nMom = (np.shape(conv)[-1]-1)/3
NMin = np.min(conv[:,0])
NMax = np.max(conv[:,0])
lconv = np.log(conv)
x = np.linspace(NMin,NMax,10)
for i in np.arange(nMom):
Slope1, inter1, r1, p1, err1 = stats.linregress(lconv[:,0],lconv[:,1+i])
Slope2, inter2, r2, p2, err2 = stats.linregress(lconv[:,0],lconv[:,1+nMom+i])
SlopeInf, interInf, rInf, pInf, errInf = stats.linregress(lconv[:,0],lconv[:,1+2*nMom+i])
plt.figure()
plt.loglog(conv[:,0],conv[:,1+i],'r+',ms=16,label='L1 Error')
plt.loglog(x,np.exp(Slope1*np.log(x)+inter1),'r-',lw=3,label="Slope = "+("%.2f"%Slope1))
plt.loglog(conv[:,0],conv[:,1+nMom+i],'bx',ms=16,label='L2 Error')
plt.loglog(x,np.exp(Slope2*np.log(x)+inter2),'b-',lw=3,label="Slope = "+("%.2f"%Slope2))
plt.loglog(conv[:,0],conv[:,1+2*nMom+i],'gd',ms=16,label='LInf Error')
plt.loglog(x,np.exp(SlopeInf*np.log(x)+interInf),'g-',lw=3,label="Slope = "+("%.2f"%SlopeInf))
plt.ylabel('Errors')
plt.xlabel('# Cells')
plt.title('Moment '+str(i))
plt.legend()
plt.savefig(rootName[:-4]+'_M'+str(i)+'.png')
#!/bin/bash
for T in {Beta,Gamma,Border}
do
for O in {1,2,3}
do
for M in {2..8}
do
rootname="momentsAdv-moments${T}_Order${O}"
path="Order${O}/Convergence_${M}Moments"
echo "Treating Order${O}/Convergence_${M}Moments/out_${rootname}.log"
cat ${path}/out_${rootname}.log | grep -e ^[NL] | grep -v "Norm" | grep -v "Loss" | sed -e 's/inf/i/'| sed -e ':z;N;s/\]*\nL[1|2|i] Error = \[//;bz' | sed -e 's/Number of Cells: N = //' -e 's/\]$//' > ${path}/Convergence_${rootname}.dat
python convergence.py ${path}/Convergence_${rootname}.dat
done
done
done
#!/bin/bash
for T in {Border,Gamma,Beta}
do
for O in 1 #{1,2,3}
do
for M in {2..8}
do
for N in {32,64,128,256,512,1024}
do
echo "Parameters/momentsAdv-moments${T}_Order${O}_${M}Moments_N${N}-parameters.py"
sed -e "s/NNN/${N}/" -e "s/TTT/${T}/" -e "s/MMM/${M}/" parametersNT${O}.py > Parameters/momentsAdv-moments${T}_Order${O}_${M}Moments_N${N}-parameters.py
done
done
done
done
#!/bin/bash
for O in {1,2,3}
do
cd Order${O}
for T in {Beta,Gamma,Border}
do
sed -e "s/OOO/${O}/" -e "s/TTT/${T}/" ../ConvergenceDifferentMoments.tex > Convergence${T}Order${O}_DifferentMoments.tex
echo "Compiling Order${O}/Convergence${T}Order${O}_DifferentMoments.tex"
echo "Once..."
pdflatex Convergence${T}Order${O}_DifferentMoments.tex #| grep -i warning
echo "Twice..."
pdflatex Convergence${T}Order${O}_DifferentMoments.tex | grep -i warning
done
cd ..
done
# -*- coding: utf-8 -*-
import timeStepping
import schemes
import initFct
#import equations
class parameters:
def __init__(self,N=-1):
self.half = 0 ### For the sake of consistency with the math notations
self.nbDigit = 3 ### nb of digits for numbering the output files name
### Mesh Quantities
NCells = NNN
if(N<0):
self.N = NCells
else:
self.N = N
self.ng = 1 ### nb of ghost cells on each side of the domain
self.NTot = self.N+2*self.ng
self.xMin = 0.0
self.xMax = 1.0
self.dx = (self.xMax-self.xMin)/self.N
### Time Quantities
self.CFL = 0.1
self.tMax = 1.0
self.nbSaveMax = 10
""" *** Boundary Conditions ***
periodic,dirichlet,...
See mesh1D.py..."""
self.BCs = "periodic"
""" *** Numerical Flux ***
FStar (Godunov or Exact), LaxFriedrichs, LaxWendroff,...
see equations.py..."""
self.numFlux = "LxF"
""" *** Initial Condition ***
cos4x, gaussian, hat, periodicCosine, localizedCosine, mixed
see initFct.py..."""
self.initFunction = initFct.momentsAdvection(self,'Border',MMM)
""" *** Equation to be solved ***
Now instantiated by initFunction.
see initFct.py """
self.equation = self.initFunction.getEquation()
""" *** ODE integrator ***
FE, RK2Direct, RK2SSP
See timeStepping.py..."""
self.timeIntegration = timeStepping.RK3SSP()
""" *** Semi-discretization in space ***
upwind, centered, downwind, Godunov, LaxFriedrichs, MUSCL, MusclHancock,
DG2, DG3
See schemes.py..."""
self.scheme = schemes.DG3()#upwind()
### Computation rootName
self.rootName = ("data/"
+self.equation.name()+"-"
+self.initFunction.name()+"-"
+self.timeIntegration.name()+"-"
+self.scheme.name()+(self.numFlux if self.scheme.usesFStar() else "") +"-")
### Computation Variables
self.t = 0.0
self.n = 0
self.nbStep = 0
self.dt = 0.0
self.mass0 = 0.0
# -*- coding: utf-8 -*-
import timeStepping
import schemes
import initFct
#import equations
class parameters:
def __init__(self,N=-1):
self.half = 0 ### For the sake of consistency with the math notations
self.nbDigit = 3 ### nb of digits for numbering the output files name
### Mesh Quantities
NCells = NNN
if(N<0):
self.N = NCells
else:
self.N = N
self.ng = 1 ### nb of ghost cells on each side of the domain
self.NTot = self.N+2*self.ng
self.xMin = 0.0
self.xMax = 1.0
self.dx = (self.xMax-self.xMin)/self.N
### Time Quantities
self.CFL = 0.8
self.tMax = 1.0
self.nbSaveMax = 10
""" *** Boundary Conditions ***
periodic,dirichlet,...
See mesh1D.py..."""
self.BCs = "periodic"
""" *** Numerical Flux ***
FStar (Godunov or Exact), LaxFriedrichs, LaxWendroff,...
see equations.py..."""
self.numFlux = "LxF"
""" *** Initial Condition ***
cos4x, gaussian, hat, periodicCosine, localizedCosine, mixed
see initFct.py..."""
self.initFunction = initFct.momentsAdvection(self,'TTT',MMM)
""" *** Equation to be solved ***
Now instantiated by initFunction.
see initFct.py """
self.equation = self.initFunction.getEquation()
""" *** ODE integrator ***
FE, RK2Direct, RK2SSP
See timeStepping.py..."""
self.timeIntegration = timeStepping.FE()
""" *** Semi-discretization in space ***
upwind, centered, downwind, Godunov, LaxFriedrichs, MUSCL, MusclHancock,
DG2, DG3
See schemes.py..."""
self.scheme = schemes.upwind()
### Computation rootName
self.rootName = ("data/"
+self.equation.name()+"-"
+self.initFunction.name()+"-"
+self.timeIntegration.name()+"-"
+self.scheme.name()+(self.numFlux if self.scheme.usesFStar() else "") +"-")
### Computation Variables
self.t = 0.0
self.n = 0
self.nbStep = 0
self.dt = 0.0
self.mass0 = 0.0
# -*- coding: utf-8 -*-
import timeStepping
import schemes
import initFct
#import equations
class parameters:
def __init__(self,N=-1):
self.half = 0 ### For the sake of consistency with the math notations
self.nbDigit = 3 ### nb of digits for numbering the output files name
### Mesh Quantities
NCells = NNN
if(N<0):
self.N = NCells
else:
self.N = N
self.ng = 1 ### nb of ghost cells on each side of the domain
self.NTot = self.N+2*self.ng
self.xMin = 0.0
self.xMax = 1.0
self.dx = (self.xMax-self.xMin)/self.N
### Time Quantities
self.CFL = 0.3
self.tMax = 1.0
self.nbSaveMax = 10
""" *** Boundary Conditions ***
periodic,dirichlet,...
See mesh1D.py..."""
self.BCs = "periodic"
""" *** Numerical Flux ***
FStar (Godunov or Exact), LaxFriedrichs, LaxWendroff,...
see equations.py..."""
self.numFlux = "LxF"
""" *** Initial Condition ***
cos4x, gaussian, hat, periodicCosine, localizedCosine, mixed
see initFct.py..."""
self.initFunction = initFct.momentsAdvection(self,'TTT',MMM)
""" *** Equation to be solved ***
Now instantiated by initFunction.
see initFct.py """
self.equation = self.initFunction.getEquation()
""" *** ODE integrator ***
FE, RK2Direct, RK2SSP
See timeStepping.py..."""
self.timeIntegration = timeStepping.RK2SSP()
""" *** Semi-discretization in space ***
upwind, centered, downwind, Godunov, LaxFriedrichs, MUSCL, MusclHancock,
DG2, DG3
See schemes.py..."""
self.scheme = schemes.DG2()#upwind()
### Computation rootName
self.rootName = ("data/"
+self.equation.name()+"-"
+self.initFunction.name()+"-"
+self.timeIntegration.name()+"-"
+self.scheme.name()+(self.numFlux if self.scheme.usesFStar() else "") +"-")
### Computation Variables
self.t = 0.0
self.n = 0
self.nbStep = 0
self.dt = 0.0
self.mass0 = 0.0
# -*- coding: utf-8 -*-
import timeStepping
import schemes
import initFct
#import equations
class parameters:
def __init__(self,N=-1):
self.half = 0 ### For the sake of consistency with the math notations
self.nbDigit = 3 ### nb of digits for numbering the output files name
### Mesh Quantities
NCells = NNN
if(N<0):
self.N = NCells
else:
self.N = N
self.ng = 1 ### nb of ghost cells on each side of the domain
self.NTot = self.N+2*self.ng
self.xMin = 0.0
self.xMax = 1.0
self.dx = (self.xMax-self.xMin)/self.N
### Time Quantities
self.CFL = 0.15
self.tMax = 1.0
self.nbSaveMax = 10
""" *** Boundary Conditions ***
periodic,dirichlet,...
See mesh1D.py..."""
self.BCs = "periodic"
""" *** Numerical Flux ***
FStar (Godunov or Exact), LaxFriedrichs, LaxWendroff,...
see equations.py..."""
self.numFlux = "LxF"
""" *** Initial Condition ***
cos4x, gaussian, hat, periodicCosine, localizedCosine, mixed
see initFct.py..."""
self.initFunction = initFct.momentsAdvection(self,'TTT',MMM)
""" *** Equation to be solved ***
Now instantiated by initFunction.
see initFct.py """
self.equation = self.initFunction.getEquation()
""" *** ODE integrator ***
FE, RK2Direct, RK2SSP
See timeStepping.py..."""
self.timeIntegration = timeStepping.RK3SSP()
""" *** Semi-discretization in space ***
upwind, centered, downwind, Godunov, LaxFriedrichs, MUSCL, MusclHancock,
DG2, DG3
See schemes.py..."""
self.scheme = schemes.DG3()#upwind()
### Computation rootName
self.rootName = ("data/"
+self.equation.name()+"-"
+self.initFunction.name()+"-"
+self.timeIntegration.name()+"-"
+self.scheme.name()+(self.numFlux if self.scheme.usesFStar() else "") +"-")
### Computation Variables
self.t = 0.0
self.n = 0
self.nbStep = 0
self.dt = 0.0
self.mass0 = 0.0
#!/bin/bash
if [ $# -ne 1 ]
then
echo "This script needs one argument, the name of the parameters file"
echo "Syntax:"
echo " If one wants to run a simple test case: runOneTest.sh root-parameters.py"
echo "Exiting!"
else
file=$1
fileType=${file##*-}
root=$(echo ${file} | sed -e "s/-${fileType}//")
if [ ${fileType} == "parameters.py" ]
then
echo $root
############################# Classical test for one Test Case ##############################################
cd Execute
if [ -d ${root} ]
then
rm -Rf $root
fi
mkdir -p ${root}/data
cd $root
cp ../../../*.py .
cp ../../Parameters/${file} parameters.py
python main.py > out_${root}.log 2> out_${root}.err
mv *.{log,err} ..
cd ..
rm -Rf $root
cd ..
else
echo "Unknown file type: " ${fileType}
echo "Exiting!"
fi
fi
......@@ -23,4 +23,5 @@ single: $(addsuffix .dummy, $(basename $(wildcard Parameters/*-parameters.py)))
convergence: $(addsuffix .dummy, $(basename $(wildcard Parameters/*-convergence.py)))
all: $(addsuffix .dummy, $(basename $(wildcard Parameters/*.py)))
......@@ -35,7 +35,7 @@ else
echo "******************"
echo "diff data/${root}-001.dat ../../data/${root}-001.dat"
echo "******************"
diff data/${root}-001.dat ../../data/${root}-001.dat
diff data/${root}-001.dat ../data/${root}-001.dat
echo "******************"
echo "cat ${root}.err"
echo "******************"
......
import numpy as np
momMer = np.array([
[ 9.83650314e-07 , 1.96730063e-08 , 3.93460126e-10 , 7.86920251e-12 , 1.57384050e-13],
[ 1.65875554e-05 , 3.31751108e-07 , 6.63502216e-09 , 1.32700443e-10 , 2.65400886e-12],
[ 9.60978467e-05 , 1.92195693e-06 , 3.84391387e-08 , 7.68782774e-10 , 1.53756555e-11],
[ 2.96578797e-01 , 5.93157593e-03 , 1.18631519e-04 , 2.37263037e-06 , 4.74526074e-08],
[ 3.30167028e-01 , 6.60340190e-03 , 1.32070492e-04 , 2.64150798e-06 , 5.28340856e-08],
[ 3.65073365e-01 , 7.30248882e-03 , 1.46090637e-04 , 2.92344717e-06 , 5.85343207e-08]
])
zetMer = np.array([
[ 9.83650314e-07 , 2.00000000e-02 ,-2.71050543e-18 , 1.12500000e-02 ,-6.68055556e-02],
[ 1.65875554e-05 , 2.00000000e-02 , 2.71050543e-18 ,-2.00000000e-02 ,-2.88281250e-02],
[ 9.60978467e-05 , 2.00000000e-02 ,-5.42101086e-18 ,-2.00000000e-02 , 2.00000000e-02],
[ 2.96578797e-01 , 2.00000000e-02 , 2.71050543e-18 , 1.12500000e-02 ,-6.68055556e-02],
[ 3.30167028e-01 , 2.00001858e-02 , 1.85791121e-07 , 3.99996284e-02 ,-4.33593076e-12],
[ 3.65073365e-01 , 2.00027981e-02 , 2.79733659e-06 , 3.99944045e-02 ,-3.12509479e-14]
])
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 4 15:48:46 2018
@author: larat
"""
import numpy as np
import pylab as p
p.close('all')
rootname = '/home/larat/Codes/Spyder/YODA/data/momentsAdv-momentsBorder-RK3SSP-DG3LxF-'
for i in np.arange(11):
filename = rootname+'%03d'%i+'.dat'
U = np.loadtxt(filename)
with open(filename, 'r') as f:
header = f.readline()
Nmom = (np.shape(U)[-1]-1)/2
X = U[:,0]
ULim = U[:,1:Nmom+1]
UExact = U[:,Nmom+1:]
p.figure()
p.plot(X,np.abs(ULim-UExact),label="L1Error")
p.xlabel('x')
p.ylabel('L1Error')
p.title(header)
p.legend()
p.savefig(rootname+"L1Error-"+"%03d"%i+'.png')
p.close()
#U000 = np.loadtxt('/home/larat/Codes/Spyder/YODA/data/momentsAdv-momentsBorder-RK3SSP-DG3LxF-000.dat')
#U001 = np.loadtxt('/home/larat/Codes/Spyder/YODA/data/momentsAdv-momentsBorder-RK3SSP-DG3LxF-001.dat')
##U100 = np.loadtxt('/home/larat/Codes/Spyder/YODA/data/momentsAdv-momentsBorder-RK3SSP-DG3LxF-100.dat')
#
#X = U000[:,0]
#U000Lim = U000[:,1:9]
#U000Exact = U000[:,9:]
#U001Lim = U001[:,1:9]
#U001Exact = U001[:,9:]
##U100Lim = U100[:,1:9]
##U100Exact = U100[:,9:]
#
#p.plot(X,np.abs(U000Lim-U000Exact),label="L1Errors")
#p.legend()
#p.figure()
#p.plot(X,np.abs(U001Lim-U001Exact),label="L1Errors")
#p.legend()
##p.figure()
##p.plot(X,np.abs(U100Lim-U100Exact),label="L1Errors")
##p.legend()
\ No newline at end of file
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 6 18:23:14 2016
@author: larat
"""
import sys
import numpy as np
from scipy import stats
import pylab as plt
plt.close('all')
if(len(sys.argv)==1):
print "Usage: convergence.py rootName"
rootName = "Convergence.dat"
print "Since you have provided none, I have provided the arguments for you:"
print rootName
elif(len(sys.argv)==2):
rootName = str(sys.argv[1])
else:
print "Usage: convergence.py rootName"
sys.exit(-1)
### Must contain on each line : N m1_L1 ... mk_L1 m1_L2 ... mk_L2 m1_Linf ... mk_Linf
conv = np.loadtxt(rootName)
nMom = (np.shape(conv)[-1]-1)/3
NMin = np.min(conv[:,0])
NMax = np.max(conv[:,0])
lconv = np.log(conv)
x = np.linspace(NMin,NMax,10)
for i in np.arange(nMom):
Slope1, inter1, r1, p1, err1 = stats.linregress(lconv[:,0],lconv[:,1+i])
Slope2, inter2, r2, p2, err2 = stats.linregress(lconv[:,0],lconv[:,1+nMom+i])
SlopeInf, interInf, rInf, pInf, errInf = stats.linregress(lconv[:,0],lconv[:,1+2*nMom+i])
plt.figure()
plt.loglog(conv[:,0],conv[:,1+i],'r+',ms=16,label='L1 Error')
plt.loglog(x,np.exp(Slope1*np.log(x)+inter1),'r-',lw=3,label="Slope = "+("%.2f"%Slope1))
plt.loglog(conv[:,0],conv[:,1+nMom+i],'bx',ms=16,label='L2 Error')
plt.loglog(x,np.exp(Slope2*np.log(x)+inter2),'b-',lw=3,label="Slope = "+("%.2f"%Slope2))
plt.loglog(conv[:,0],conv[:,1+2*nMom+i],'gd',ms=16,label='LInf Error')
plt.loglog(x,np.exp(SlopeInf*np.log(x)+interInf),'g-',lw=3,label="Slope = "+("%.2f"%SlopeInf))
plt.ylabel('Errors')
plt.xlabel('# Cells')
plt.title('Moment '+str(i))
plt.legend()
plt.savefig(rootName[:-4]+'_M'+str(i)+'.png')
#!/bin/bash
for T in {Beta,Gamma,Border}
do
for O in {2,3}
do
for M in {2..8}
do
rootname="momentsAdv-moments${T}_Order${O}"
path="Order${O}/Convergence_${M}Moments"
echo "Treating Order${O}/Convergence_${M}Moments/out_${rootname}.log"
cat ${path}/out_${rootname}.log | grep -e ^[NL] | grep -v "Norm" | grep -v "Loss" | sed -e 's/inf/i/'| sed -e ':z;N;s/\]*\nL[1|2|i] Error = \[//;bz' | sed -e 's/Number of Cells: N = //' -e 's/\]$//' > ${path}/Convergence_${rootname}.dat
python convergence.py ${path}/Convergence_${rootname}.dat
done
done
done
#!/bin/bash
rm -Rf Convergence_*Moments
for M in {2..8}
do
mkdir Convergence_${M}Moments
done
for T in {Border,Gamma,Beta}
do
for O in 1 #{1,2,3}
do
for M in {2..8}
do
for N in {32,64,128,256,512,1024} #{40,80,100,200,400}
do
echo "***********************************"
echo "** T = "$T", O = "$O", N = "$N" **"
echo "***********************************"
sed -e "s/NNN/${N}/" -e "s/TTT/${T}/" -e "s/MMM/${M}/" parametersNT${O}.py > ../parameters.py
sleep 1
cd ..;
python main.py
cd data
done | tee Convergence_${M}Moments/out_momentsAdv-moments${T}_Order${O}.log
done
done
done
#!/bin/bash
for O in {2,3}
do
cd Order${O}
for T in {Beta,Gamma,Border}
do
echo "Compiling Order${O}/Convergence${T}Order${O}_DifferentMoments.tex"
echo "Once..."
pdflatex Convergence${T}Order${O}_DifferentMoments.tex #| grep -i warning
echo "Twice..."
pdflatex Convergence${T}Order${O}_DifferentMoments.tex #| grep -i warning
done
cd ..
done
# -*- coding: utf-8 -*-
import timeStepping
import schemes
import initFct
#import equations
class parameters:
def __init__(self,N=-1):
self.half = 0 ### For the sake of consistency with the math notations
self.nbDigit = 3 ### nb of digits for numbering the output files name
### Mesh Quantities
NCells = NNN
if(N<0):
self.N = NCells
else:
self.N = N