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