Skip to content
Snippets Groups Projects
Commit 8f508bd6 authored by Klaus Böhnlein's avatar Klaus Böhnlein
Browse files

add data-sets for different Bilayer thicknesses to perforated example

parent 656ff811
No related branches found
No related tags found
No related merge requests found
......@@ -107,30 +107,59 @@ def eval_energy(kappa,alpha,Q,B) :
# pythonPath = '/home/klaus/Desktop/Dune_release/dune-microstructure/experiment/wood-bilayer'
#--- Choose wether to perforate upper (passive) or lower (active) layer
perforatedLayer = 'upper'
# perforatedLayer = 'lower'
path = os.getcwd() + '/experiment/perforated-bilayer/results_' + perforatedLayer + '/'
pythonPath = os.getcwd() + '/experiment/perforated-bilayer'
pythonModule = "perforated_wood_" + perforatedLayer
executable = os.getcwd() + '/build-cmake/src/Cell-Problem'
# ---------------------------------
# Setup Experiment
# ---------------------------------
gamma = 1.0
# ----- Define Parameters for Material Function --------------------
# [r, h, omega_flat, omega_target, theta, experimental_kappa]
# r = (thickness upper layer)/(thickness)
# h = thickness [meter]
# omega_flat = moisture content in the flat state before drying [%]
# omega_target = moisture content in the target state [%]
# theta = rotation angle (not implemented and used)
# beta = design parameter for perforation = ratio of Volume of (cylindrical) perforation to Volume of active/passive layer
#Experiment: Perforate "active" bilayer phase
materialFunctionParameter=[
# perforatedLayer = 'upper'
perforatedLayer = 'lower'
dataset_numbers = [0, 1, 2, 3, 4, 5]
for dataset_number in dataset_numbers:
print("------------------")
print(str(dataset_number) + "th data set")
print("------------------")
# path = os.getcwd() + '/experiment/perforated-bilayer/results_' + perforatedLayer + '/'
path = os.getcwd() + '/experiment/perforated-bilayer/results_' + perforatedLayer + '_' + str(dataset_number) + '/'
pythonPath = os.getcwd() + '/experiment/perforated-bilayer'
pythonModule = "perforated_wood_" + perforatedLayer
executable = os.getcwd() + '/build-cmake/src/Cell-Problem'
# ---------------------------------
# Setup Experiment
# ---------------------------------
gamma = 1.0
# ----- Define Parameters for Material Function --------------------
# [r, h, omega_flat, omega_target, theta, experimental_kappa]
# r = (thickness upper layer)/(thickness)
# h = thickness [meter]
# omega_flat = moisture content in the flat state before drying [%]
# omega_target = moisture content in the target state [%]
# theta = rotation angle (not implemented and used)
# beta = design parameter for perforation = ratio of Volume of (cylindrical) perforation to Volume of active/passive layer
#Experiment: Perforate "active"/"passive" bilayer phase
materialFunctionParameter=[
[ # Dataset Ratio r = 0.12
[0.12, 0.0047, 17.17547062, 8.959564147, 0.0, 0.0 ],
[0.12, 0.0047, 17.17547062, 8.959564147, 0.0, 0.05],
[0.12, 0.0047, 17.17547062, 8.959564147, 0.0, 0.1 ],
[0.12, 0.0047, 17.17547062, 8.959564147, 0.0, 0.15],
[0.12, 0.0047, 17.17547062, 8.959564147, 0.0, 0.2 ],
[0.12, 0.0047, 17.17547062, 8.959564147, 0.0, 0.25],
[0.12, 0.0047, 17.17547062, 8.959564147, 0.0, 0.3 ]
],
[ # Dataset Ratio r = 0.17
[0.17, 0.0049, 17.17547062, 8.959564147, 0.0, 0.0 ],
[0.17, 0.0049, 17.17547062, 8.959564147, 0.0, 0.05],
[0.17, 0.0049, 17.17547062, 8.959564147, 0.0, 0.1 ],
[0.17, 0.0049, 17.17547062, 8.959564147, 0.0, 0.15],
[0.17, 0.0049, 17.17547062, 8.959564147, 0.0, 0.2 ],
[0.17, 0.0049, 17.17547062, 8.959564147, 0.0, 0.25],
[0.17, 0.0049, 17.17547062, 8.959564147, 0.0, 0.3 ]
],
[ # Dataset Ratio r = 0.22
[0.22, 0.0053, 17.17547062, 8.959564147, 0.0, 0.0 ],
[0.22, 0.0053, 17.17547062, 8.959564147, 0.0, 0.05 ],
[0.22, 0.0053, 17.17547062, 8.959564147, 0.0, 0.1 ],
......@@ -138,62 +167,153 @@ materialFunctionParameter=[
[0.22, 0.0053, 17.17547062, 8.959564147, 0.0, 0.2 ],
[0.22, 0.0053, 17.17547062, 8.959564147, 0.0, 0.25 ],
[0.22, 0.0053, 17.17547062, 8.959564147, 0.0, 0.3 ]
]
],
[ # Dataset Ratio r = 0.34
[0.34, 0.0063, 17.17547062, 8.959564147, 0.0, 0.0 ],
[0.34, 0.0063, 17.17547062, 8.959564147, 0.0, 0.05],
[0.34, 0.0063, 17.17547062, 8.959564147, 0.0, 0.1 ],
[0.34, 0.0063, 17.17547062, 8.959564147, 0.0, 0.15],
[0.34, 0.0063, 17.17547062, 8.959564147, 0.0, 0.2 ],
[0.34, 0.0063, 17.17547062, 8.959564147, 0.0, 0.25],
[0.34, 0.0063, 17.17547062, 8.959564147, 0.0, 0.3 ]
],
[ # Dataset Ratio r = 0.43
[0.43, 0.0073, 17.17547062, 8.959564147, 0.0, 0.0 ],
[0.43, 0.0073, 17.17547062, 8.959564147, 0.0, 0.05],
[0.43, 0.0073, 17.17547062, 8.959564147, 0.0, 0.1 ],
[0.43, 0.0073, 17.17547062, 8.959564147, 0.0, 0.15],
[0.43, 0.0073, 17.17547062, 8.959564147, 0.0, 0.2 ],
[0.43, 0.0073, 17.17547062, 8.959564147, 0.0, 0.25],
[0.43, 0.0073, 17.17547062, 8.959564147, 0.0, 0.3 ]
],
[ # Dataset Ratio r = 0.49
[0.49, 0.008, 17.17547062, 8.959564147, 0.0, 0.0 ],
[0.49, 0.008, 17.17547062, 8.959564147, 0.0, 0.05],
[0.49, 0.008, 17.17547062, 8.959564147, 0.0, 0.1 ],
[0.49, 0.008, 17.17547062, 8.959564147, 0.0, 0.15],
[0.49, 0.008, 17.17547062, 8.959564147, 0.0, 0.2 ],
[0.49, 0.008, 17.17547062, 8.959564147, 0.0, 0.25],
[0.49, 0.008, 17.17547062, 8.959564147, 0.0, 0.3 ]
]
]
# ------ Loops through Parameters for Material Function -----------
for i in range(0,np.shape(materialFunctionParameter)[0]):
print("------------------")
print("New Loop")
print("------------------")
# Check output directory
outputPath = path + str(i)
isExist = os.path.exists(outputPath)
if not isExist:
# Create a new directory because it does not exist
os.makedirs(outputPath)
print("The new directory " + outputPath + " is created!")
# thread = threading.Thread(target=run_CellProblem(executable, pythonModule, pythonPath, LOGFILE))
# thread.start()
#TODO: apperently its not possible to pass a variable via subprocess and "calculate" another input value inside the python file.
# Therefore we use this instead.
SetParameterMaterialFunction(pythonPath + "/" + pythonModule, "param_r",materialFunctionParameter[i][0])
SetParameterMaterialFunction(pythonPath + "/" + pythonModule, "param_h",materialFunctionParameter[i][1])
SetParameterMaterialFunction(pythonPath + "/" + pythonModule, "param_omega_flat",materialFunctionParameter[i][2])
SetParameterMaterialFunction(pythonPath + "/" + pythonModule, "param_omega_target",materialFunctionParameter[i][3])
SetParameterMaterialFunction(pythonPath + "/" + pythonModule, "param_theta",materialFunctionParameter[i][4])
SetParameterMaterialFunction(pythonPath + "/" + pythonModule, "param_beta",materialFunctionParameter[i][5])
LOGFILE = outputPath + "/" + pythonModule + "_output" + "_" + str(i) + ".log"
processList = []
p = subprocess.Popen(executable + " " + pythonPath + " " + pythonModule
+ " -outputPath " + outputPath
+ " -gamma " + str(gamma)
+ " | tee " + LOGFILE, shell=True)
# p = subprocess.Popen(executable + " " + pythonPath + " " + pythonModule
# + " -outputPath " + outputPath
# + " -gamma " + str(gamma)
# + " -param_r " + str(materialFunctionParameter[i][0])
# + " -param_h " + str(materialFunctionParameter[i][1])
# + " -param_omega_flat " + str(materialFunctionParameter[i][2])
# + " -param_omega_target " + str(materialFunctionParameter[i][3])
# + " -phase2_angle " + str(materialFunctionParameter[i][4])
# + " | tee " + LOGFILE, shell=True)
p.wait() # wait
processList.append(p)
exit_codes = [p.wait() for p in processList]
# ---------------------------------------------------
# wait here for the result to be available before continuing
# thread.join()
f = open(outputPath+"/parameter.txt", "w")
f.write("r = "+str(materialFunctionParameter[i][0])+"\n")
f.write("h = "+str(materialFunctionParameter[i][1])+"\n")
f.write("omega_flat = "+str(materialFunctionParameter[i][2])+"\n")
f.write("omega_target = "+str(materialFunctionParameter[i][3])+"\n")
f.write("param_beta = "+str(materialFunctionParameter[i][5])+"\n")
f.close()
#
#--- Different moisture values for different thicknesses:
# materialFunctionParameter=[
# [ # Dataset Ratio r = 0.12
# [0.12, 0.0047, 17.32986047, 14.70179844, 0.0, 0.0 ],
# [0.12, 0.0047, 17.32986047, 13.6246, 0.0, 0.05],
# [0.12, 0.0047, 17.32986047, 12.42994508, 0.0, 0.1 ],
# [0.12, 0.0047, 17.32986047, 11.69773413, 0.0, 0.15],
# [0.12, 0.0047, 17.32986047, 11.14159987, 0.0, 0.2 ],
# [0.12, 0.0047, 17.32986047, 9.500670278, 0.0, 0.25],
# [0.12, 0.0047, 17.32986047, 9.005046347, 0.0, 0.3 ]
# ],
# [ # Dataset Ratio r = 0.17
# [0.17, 0.0049, 17.28772791 , 14.75453569, 0.0, 0.0 ],
# [0.17, 0.0049, 17.28772791 , 13.71227639, 0.0, 0.05],
# [0.17, 0.0049, 17.28772791 , 12.54975012, 0.0, 0.1 ],
# [0.17, 0.0049, 17.28772791 , 11.83455959, 0.0, 0.15],
# [0.17, 0.0049, 17.28772791 , 11.29089521, 0.0, 0.2 ],
# [0.17, 0.0049, 17.28772791 , 9.620608917, 0.0, 0.25],
# [0.17, 0.0049, 17.28772791 , 9.101671742, 0.0, 0.3 ]
# ],
# [ # Dataset Ratio r = 0.22
# [0.22, 0.0053, 17.17547062, 8.959564147, 0.0, 0.0 ],
# [0.22, 0.0053, 17.17547062, 8.959564147, 0.0, 0.05 ],
# [0.22, 0.0053, 17.17547062, 8.959564147, 0.0, 0.1 ],
# [0.22, 0.0053, 17.17547062, 8.959564147, 0.0, 0.15 ],
# [0.22, 0.0053, 17.17547062, 8.959564147, 0.0, 0.2 ],
# [0.22, 0.0053, 17.17547062, 8.959564147, 0.0, 0.25 ],
# [0.22, 0.0053, 17.17547062, 8.959564147, 0.0, 0.3 ]
# ],
# [ # Dataset Ratio r = 0.34
# [0.34, 0.0063, 17.14061081 , 14.98380876, 0.0, 0.0 ],
# [0.34, 0.0063, 17.14061081 , 13.97154915, 0.0, 0.05],
# [0.34, 0.0063, 17.14061081 , 12.77309253, 0.0, 0.1 ],
# [0.34, 0.0063, 17.14061081 , 12.00959929, 0.0, 0.15],
# [0.34, 0.0063, 17.14061081 , 11.42001731, 0.0, 0.2 ],
# [0.34, 0.0063, 17.14061081 , 9.561447179, 0.0, 0.25],
# [0.34, 0.0063, 17.14061081 , 8.964704969, 0.0, 0.3 ]
# ],
# [ # Dataset Ratio r = 0.43
# [0.43, 0.0073, 17.07559686 , 15.11316339, 0.0, 0.0 ],
# [0.43, 0.0073, 17.07559686 , 14.17997082, 0.0, 0.05],
# [0.43, 0.0073, 17.07559686 , 13.05739844, 0.0, 0.1 ],
# [0.43, 0.0073, 17.07559686 , 12.32309209, 0.0, 0.15],
# [0.43, 0.0073, 17.07559686 , 11.74608518, 0.0, 0.2 ],
# [0.43, 0.0073, 17.07559686 , 9.812372466, 0.0, 0.25],
# [0.43, 0.0073, 17.07559686 , 9.10519385 , 0.0, 0.3 ]
# ],
# [ # Dataset Ratio r = 0.49
# [0.49, 0.008, 17.01520754, 15.30614414, 0.0, 0.0 ],
# [0.49, 0.008, 17.01520754, 14.49463867, 0.0, 0.05],
# [0.49, 0.008, 17.01520754, 13.46629742, 0.0, 0.1 ],
# [0.49, 0.008, 17.01520754, 12.78388234, 0.0, 0.15],
# [0.49, 0.008, 17.01520754, 12.23057715, 0.0, 0.2 ],
# [0.49, 0.008, 17.01520754, 10.21852839, 0.0, 0.25],
# [0.49, 0.008, 17.01520754, 9.341730605, 0.0, 0.3 ]
# ]
# ]
# ------ Loops through Parameters for Material Function -----------
for i in range(0,np.shape(materialFunctionParameter)[1]):
print("------------------")
print("New Loop")
print("------------------")
# Check output directory
outputPath = path + str(i)
isExist = os.path.exists(outputPath)
if not isExist:
# Create a new directory because it does not exist
os.makedirs(outputPath)
print("The new directory " + outputPath + " is created!")
# thread = threading.Thread(target=run_CellProblem(executable, pythonModule, pythonPath, LOGFILE))
# thread.start()
#TODO: apperently its not possible to pass a variable via subprocess and "calculate" another input value inside the python file.
# Therefore we use this instead.
SetParameterMaterialFunction(pythonPath + "/" + pythonModule, "param_r",materialFunctionParameter[dataset_number][i][0])
SetParameterMaterialFunction(pythonPath + "/" + pythonModule, "param_h",materialFunctionParameter[dataset_number][i][1])
SetParameterMaterialFunction(pythonPath + "/" + pythonModule, "param_omega_flat",materialFunctionParameter[dataset_number][i][2])
SetParameterMaterialFunction(pythonPath + "/" + pythonModule, "param_omega_target",materialFunctionParameter[dataset_number][i][3])
SetParameterMaterialFunction(pythonPath + "/" + pythonModule, "param_theta",materialFunctionParameter[dataset_number][i][4])
SetParameterMaterialFunction(pythonPath + "/" + pythonModule, "param_beta",materialFunctionParameter[dataset_number][i][5])
LOGFILE = outputPath + "/" + pythonModule + "_output" + "_" + str(i) + ".log"
processList = []
p = subprocess.Popen(executable + " " + pythonPath + " " + pythonModule
+ " -outputPath " + outputPath
+ " -gamma " + str(gamma)
+ " | tee " + LOGFILE, shell=True)
# p = subprocess.Popen(executable + " " + pythonPath + " " + pythonModule
# + " -outputPath " + outputPath
# + " -gamma " + str(gamma)
# + " -param_r " + str(materialFunctionParameter[i][0])
# + " -param_h " + str(materialFunctionParameter[i][1])
# + " -param_omega_flat " + str(materialFunctionParameter[i][2])
# + " -param_omega_target " + str(materialFunctionParameter[i][3])
# + " -phase2_angle " + str(materialFunctionParameter[i][4])
# + " | tee " + LOGFILE, shell=True)
p.wait() # wait
processList.append(p)
exit_codes = [p.wait() for p in processList]
# ---------------------------------------------------
# wait here for the result to be available before continuing
# thread.join()
f = open(outputPath+"/parameter.txt", "w")
f.write("r = "+str(materialFunctionParameter[dataset_number][i][0])+"\n")
f.write("h = "+str(materialFunctionParameter[dataset_number][i][1])+"\n")
f.write("omega_flat = "+str(materialFunctionParameter[dataset_number][i][2])+"\n")
f.write("omega_target = "+str(materialFunctionParameter[dataset_number][i][3])+"\n")
f.write("param_beta = "+str(materialFunctionParameter[dataset_number][i][5])+"\n")
f.close()
#
......@@ -70,13 +70,13 @@ parameterSet.Phases=3
# Parameters of the model
# -- (thickness upper layer) / (thickness)
# param_r = 0.22
param_r = 0.22
param_r = 0.49
# -- thickness [meter]
param_h = 0.0053
param_h = 0.008
# -- moisture content in the flat state [%]
param_omega_flat = 17.17547062
param_omega_flat = 17.01520754
# -- moisture content in the target state [%]
param_omega_target = 8.959564147
param_omega_target = 9.341730605
# -- Drehwinkel
param_theta = 0.0
......@@ -225,8 +225,8 @@ parameterSet.gamma=1.0
## numLevels : Number of Levels on which solution is computed. starting with a 2x2x2 cube mesh.
## {start,finish} computes on all grid from 2^(start) to 2^finish refinement
#----------------------------------------------------
# parameterSet.numLevels= '3 3' # computes all levels from first to second entry
parameterSet.numLevels= '4 4'
parameterSet.numLevels= '3 3' # computes all levels from first to second entry
# parameterSet.numLevels= '4 4'
#############################################
# Assembly options
......
......@@ -70,13 +70,13 @@ parameterSet.Phases=3
# Parameters of the model
# -- (thickness upper layer) / (thickness)
# param_r = 0.22
param_r = 0.22
param_r = 0.49
# -- thickness [meter]
param_h = 0.0053
param_h = 0.008
# -- moisture content in the flat state [%]
param_omega_flat = 17.17547062
param_omega_flat = 17.01520754
# -- moisture content in the target state [%]
param_omega_target = 8.959564147
param_omega_target = 9.341730605
# -- Drehwinkel
param_theta = 0.0
......@@ -225,8 +225,8 @@ parameterSet.gamma=1.0
## numLevels : Number of Levels on which solution is computed. starting with a 2x2x2 cube mesh.
## {start,finish} computes on all grid from 2^(start) to 2^finish refinement
#----------------------------------------------------
# parameterSet.numLevels= '3 3' # computes all levels from first to second entry
parameterSet.numLevels= '4 4'
parameterSet.numLevels= '3 3' # computes all levels from first to second entry
# parameterSet.numLevels= '4 4'
#############################################
# Assembly options
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment