Skip to content
Snippets Groups Projects
Commit 7b2ff735 authored by Hörl, Maximilian's avatar Hörl, Maximilian
Browse files

add parameter fastEOC

parent 3fb97648
No related branches found
No related tags found
No related merge requests found
......@@ -47,6 +47,24 @@ def readData():
return np.array([error, timeTotal, numberOfElements])
# determines the parameter "fastEOC" from the ini file
def determineFastEOC ():
# boolean that determines whether to exclude computationally expensive grids
fastEOC = False
# read ini file content
with open("parameterDG.ini", "r") as file:
lines = file.read().splitlines()
for i in range(len(lines)):
if (lines[i].startswith("fastEOC") and \
lines[i].rstrip().lower().endswith("true")):
fastEOC = True
break
return fastEOC
# === main ===
# create directory for the plots if necessary
......@@ -60,6 +78,12 @@ numberOfMeans = 1
numElemsPerDir_12 = np.unique(np.logspace(0, 2.7, 15).astype(int))
numElemsPerDir_3 = np.unique(np.logspace(0, 1.5, 8).astype(int))
if determineFastEOC(): # exclude computationally expensive grids
numElemsPerDir_12 = numElemsPerDir_12[:-3]
numElemsPerDir_3 = numElemsPerDir_3[:-2]
else:
print("fastEOC = false. This may take some minutes.\n")
for dim in [1, 2, 3]:
numElemsPerDir = numElemsPerDir_3 if (dim == 3) else numElemsPerDir_12
......
......@@ -66,38 +66,38 @@ int main(int argc, char** argv)
if (pt["problem"] == "mmdg1")
{
problem = new MMDGProblem1<Coordinate>(aperture);
gridType = "mmdg2_5e-2";
gridType = "mmdg2_C";
xi = 0.75;
}
else if (pt["problem"] == "mmdg2")
{
problem = new MMDGProblem2<Coordinate>(aperture);
gridType = "mmdg2_5e-2";
gridType = "mmdg2_C";
xi = 0.75;
}
else if (pt["problem"] == "mmdg3")
{
problem = new MMDGProblem3<Coordinate>(aperture);
gridType = "mmdg3_5e-2";
gridType = "mmdg3_C";
xi = 1.0;
}
else if (pt["problem"] == "mmdg4")
{
problem = new MMDGProblem4<Coordinate>(aperture);
gridType = "mmdg2_5e-2";
gridType = "mmdg2_C";
xi = 0.75;
}
else if (pt["problem"] == "mmdg5")
{
problem = new MMDGProblem5<Coordinate>(aperture);
gridType = "mmdg5_5e-2";
gridType = "mmdg5_C";
xi = 0.75;
}
else if (pt["problem"] == "mmdg6")
{
xi = (pt.hasKey("xi")) ? std::stod(pt["xi"]) : 1.0;
problem = new MMDGProblem6<Coordinate>(aperture, xi);
gridType = "mmdg2_5e-2";
gridType = "mmdg2_C";
}
else
{
......
......@@ -55,11 +55,14 @@ def readData():
hMaxInterface, timeTotal])
# determines the problem type from the ini file
# determines the problem type and the parameter "fastEOC" from the ini file
def getProblemType ():
# storage for problem type (1 to 6)
problemType = None
# boolean that determines whether to exclude computationally expensive grids
fastEOC = False
# read file content and get problem type
with open("parameterMMDG.ini", "r") as file:
lines = file.read().splitlines()
......@@ -67,9 +70,11 @@ def getProblemType ():
for i in range(len(lines)):
if (lines[i].startswith("problem")):
problemType = int(lines[i].rstrip()[-1])
break
elif (lines[i].startswith("fastEOC") and \
lines[i].rstrip().lower().endswith("true")):
fastEOC = True
return problemType
return problemType, fastEOC
# determines experimental order of convergence (EOC),
......@@ -84,7 +89,7 @@ def EOCloop (data):
EOC[i] = log(data[i, 0] / data[i+1, 0]) / \
log(data[i, 1] / data[i+1, 1])
else:
EOC[i] = -1.0*float('inf')
EOC[i] = -1.0 * float('inf')
# end for i
return EOC
......@@ -106,11 +111,17 @@ gridfiles_2d = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"]
gridfiles_3d = ["A", "B", "C", "D", "E", "F", "G"]
# get problem type (integer from 1 to 6) from ini file
problemType = getProblemType()
problemType, fastEOC = getProblemType()
if problemType in [1, 4, 6]: # these problems use the same grids
problemType = 2
if fastEOC: # exclude computationally expensive grids
gridfiles_2d = gridfiles_2d[:-3]
gridfiles_3d = gridfiles_3d[:-2]
else:
print("fastEOC = false. This may take some minutes.\n")
gridfiles_2d = ["mmdg" + str(problemType) + "_" + s for s in gridfiles_2d]
gridfiles_3d = ["mmdg" + str(problemType) + "_" + s for s in gridfiles_3d]
......
mu0 = 1000
problem = dg1
problem = dg2
fastEOC = true
mu0 = 1000
#xi = 0.75
d = 0.01
problem = mmdg2
gridfile = mmdg5_C
d = 1e-2
#xi = 0.75
gridfile = mmdg2_C
fastEOC = true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment