diff --git a/src/dgAnalysis.py b/src/dgAnalysis.py index e81085482f8eab7e32a483e5500a758bce40e674..a4d8fc3379c48f1ee7bbdb68db5f2a874a098581 100644 --- a/src/dgAnalysis.py +++ b/src/dgAnalysis.py @@ -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 diff --git a/src/mmdg.cc b/src/mmdg.cc index 11a081bc1ea81e64d5ec3f067930134a0c35befc..3152cf1f3a9c7ebfc945311f97816373a923f6c3 100644 --- a/src/mmdg.cc +++ b/src/mmdg.cc @@ -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 { diff --git a/src/mmdgAnalysis.py b/src/mmdgAnalysis.py index d204afdffa353d7c2d9caeb6cfafba2c360958cb..4aecbc6a4113f44c9c0a66fba986f37334ebcd90 100644 --- a/src/mmdgAnalysis.py +++ b/src/mmdgAnalysis.py @@ -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] diff --git a/src/parameterDG.ini b/src/parameterDG.ini index e3e1b98f436304cfd37913f8d0d2d0a8e7de9c36..275babcaa75b797c5558068c7a394eb716598827 100644 --- a/src/parameterDG.ini +++ b/src/parameterDG.ini @@ -1,2 +1,3 @@ mu0 = 1000 -problem = dg1 +problem = dg2 +fastEOC = true diff --git a/src/parameterMMDG.ini b/src/parameterMMDG.ini index 95986ff5e58fb2862b0e3ea4b58b1b20f8bdf415..257871d69143b4d3315df49397f181c785ad5fab 100644 --- a/src/parameterMMDG.ini +++ b/src/parameterMMDG.ini @@ -1,5 +1,6 @@ mu0 = 1000 -#xi = 0.75 -d = 0.01 problem = mmdg2 -gridfile = mmdg5_C +d = 1e-2 +#xi = 0.75 +gridfile = mmdg2_C +fastEOC = true