From 30d99725379f61b7ea5c62fdcf07d5c9acd813c9 Mon Sep 17 00:00:00 2001 From: Klaus <klaus.boehnlein@tu-dresden.de> Date: Tue, 10 Oct 2023 12:28:59 +0200 Subject: [PATCH] update more experiments and ParameterFile structure --- dune/microstructure/prestrainedMaterial.hh | 18 +- experiment/PAC/PAC.py | 13 +- experiment/PAC/PAC_caseI.py | 173 ++++++++++------- experiment/homogeneous.py | 4 +- experiment/material_neukamm.py | 8 +- experiment/material_orthotropic.py | 12 +- experiment/parametrized_laminate.py | 10 +- .../rotation-test/PolarPlotLocalEnergy.py | 6 +- .../isotrop_orthotrop_rotation.py | 112 ++++++++++- experiment/rotation-test/rotation_test.py | 172 ++++++++++------- .../wood-bilayer-variant/wood_inclusion.py | 85 ++++++++- .../wood_inclusion_test.py | 156 +++++++++------- .../wood_upper_laminate_test.py | 174 +++++++++++------- .../wood_upper_laminated.py | 83 ++++++++- .../wood-bilayer/wood_european_beech.py | 29 +-- experiment/wood-bilayer/wood_test.py | 1 - test/orthotropicrotation_1.py | 8 +- test/orthotropicrotation_2.py | 20 +- test/parametrized_laminate.py | 10 +- 19 files changed, 744 insertions(+), 350 deletions(-) diff --git a/dune/microstructure/prestrainedMaterial.hh b/dune/microstructure/prestrainedMaterial.hh index 067b4876..193cb5c8 100644 --- a/dune/microstructure/prestrainedMaterial.hh +++ b/dune/microstructure/prestrainedMaterial.hh @@ -171,8 +171,10 @@ Func2Tensor setupPrestrainPhase(const int phase){ double angle = 0; try { - module_.get("phase" + std::to_string(phase) + "_axis").toC<int>(axis); - module_.get("phase" + std::to_string(phase) + "_angle").toC<double>(angle); + // module_.get("phase" + std::to_string(phase) + "_axis").toC<int>(axis); + // module_.get("phase" + std::to_string(phase) + "_angle").toC<double>(angle); + axis = parameterSet_.get<int>("phase" + std::to_string(phase) + "_axis", 0); + angle = parameterSet_.get<double>("phase" + std::to_string(phase) + "_angle", 0); } catch(Dune::Exception&) { @@ -197,7 +199,8 @@ Func2Tensor setupPrestrainPhase(const int phase){ Dune::FieldMatrix<double,6,6> setupPhase(const int phase) { std::string phaseType; - module_.get("phase" + std::to_string(phase) + "_type").toC<std::string>(phaseType); + // module_.get("phase" + std::to_string(phase) + "_type").toC<std::string>(phaseType); + phaseType = parameterSet_.get<std::string>("phase" + std::to_string(phase) + "_type"); std::cout << "Setup phase "<< phase << " as " << phaseType << " material." << std::endl; @@ -235,8 +238,10 @@ Dune::FieldMatrix<double,6,6> setupPhase(const int phase) // printvector(std::cout, frameVector1, "frameVector1: ", "--"); // printvector(std::cout, frameVector2, "frameVector2: ", "--"); // printvector(std::cout, frameVector3, "frameVector3: ", "--"); - module_.get("phase" + std::to_string(phase) + "_axis").toC<int>(axis); - module_.get("phase" + std::to_string(phase) + "_angle").toC<double>(angle); + // module_.get("phase" + std::to_string(phase) + "_axis").toC<int>(axis); + // module_.get("phase" + std::to_string(phase) + "_angle").toC<double>(angle); + axis = parameterSet_.get<int>("phase" + std::to_string(phase) + "_axis", 0); + angle = parameterSet_.get<double>("phase" + std::to_string(phase) + "_angle", 0); } catch(Dune::Exception& e) { @@ -284,7 +289,8 @@ Dune::FieldMatrix<double,6,6> setupPhase(const int phase) localIndicatorFunction_ = localFunction(indicatorFunctionGVF_); int phases; - module_.get("Phases").toC<int>(phases); + // module_.get("Phases").toC<int>(phases); + phases = parameterSet_.get<int>("Phases"); std::cout << "---- Starting material setup... (Number of Phases: "<< phases << ") " << std::endl; L_.resize(phases); diff --git a/experiment/PAC/PAC.py b/experiment/PAC/PAC.py index 89733949..9e170631 100644 --- a/experiment/PAC/PAC.py +++ b/experiment/PAC/PAC.py @@ -6,6 +6,13 @@ import sys import numpy as np import elasticity_toolbox as elast +class ParameterSet(dict): + def __init__(self, *args, **kwargs): + super(ParameterSet, self).__init__(*args, **kwargs) + self.__dict__ = self + +parameterSet = ParameterSet() +#--------------------------------------------------------------- # Polymeric matrix material without prestrin # design parameter: fibre diameterthickness in mmm of fibre d param_r = 0.125 @@ -39,10 +46,10 @@ def indicatorFunction(x): return 2 # matrix # --- Number of material phases -Phases=2 +parameterSet.Phases=2 # --- PHASE 1 fibre -phase1_type="isotropic" +parameterSet.phase1_type="isotropic" # E in MPa and nu E = 7 nu = .47 @@ -56,7 +63,7 @@ def prestrain_phase1(x): # --- PHASE 2 # --- PHASE 1 fibre -phase2_type="isotropic" +parameterSet.phase2_type="isotropic" # E in MPa and nu E = 0.7 nu = 0.47 diff --git a/experiment/PAC/PAC_caseI.py b/experiment/PAC/PAC_caseI.py index c3056b7b..fce39744 100644 --- a/experiment/PAC/PAC_caseI.py +++ b/experiment/PAC/PAC_caseI.py @@ -13,49 +13,49 @@ import codecs import sys import threading -# Schreibe input datei für Parameter -def SetParametersCellProblem(ParameterSet, ParsetFilePath, outputPath): - print('----set Parameters -----') - with open(ParsetFilePath, 'r') as file: - filedata = file.read() - filedata = re.sub('(?m)^materialFunction\s?=.*','materialFunction = '+str(ParameterSet.materialFunction),filedata) - filedata = re.sub('(?m)^gamma\s?=.*','gamma='+str(ParameterSet.gamma),filedata) - filedata = re.sub('(?m)^numLevels\s?=.*','numLevels='+str(ParameterSet.numLevels)+' '+str(ParameterSet.numLevels) ,filedata) - filedata = re.sub('(?m)^outputPath\s?=\s?.*','outputPath='+str(outputPath),filedata) - f = open(ParsetFilePath,'w') - f.write(filedata) - f.close() - - -# Ändere Parameter der MaterialFunction -def SetParameterMaterialFunction(materialFunction, parameterName, parameterValue): - with open(Path+"/"+materialFunction+'.py', 'r') as file: - filedata = file.read() - filedata = re.sub('(?m)^'+str(parameterName)+'\s?=.*',str(parameterName)+' = '+str(parameterValue),filedata) - f = open(Path+"/"+materialFunction+'.py','w') - f.write(filedata) - f.close() - -# Rufe Programm zum Lösen des Cell-Problems auf -def run_CellProblem(executable, parset,write_LOG): - print('----- RUN Cell-Problem ----') - processList = [] - LOGFILE = "Cell-Problem_output.log" - print('LOGFILE:',LOGFILE) - print('executable:',executable) - if write_LOG: - p = subprocess.Popen(executable + parset - + " | tee " + LOGFILE, shell=True) - - else: - p = subprocess.Popen(executable + parset - + " | tee " + LOGFILE, shell=True) - - p.wait() # wait - processList.append(p) - exit_codes = [p.wait() for p in processList] - - return +# # Schreibe input datei für Parameter +# def SetParametersCellProblem(ParameterSet, ParsetFilePath, outputPath): +# print('----set Parameters -----') +# with open(ParsetFilePath, 'r') as file: +# filedata = file.read() +# filedata = re.sub('(?m)^materialFunction\s?=.*','materialFunction = '+str(ParameterSet.materialFunction),filedata) +# filedata = re.sub('(?m)^gamma\s?=.*','gamma='+str(ParameterSet.gamma),filedata) +# filedata = re.sub('(?m)^numLevels\s?=.*','numLevels='+str(ParameterSet.numLevels)+' '+str(ParameterSet.numLevels) ,filedata) +# filedata = re.sub('(?m)^outputPath\s?=\s?.*','outputPath='+str(outputPath),filedata) +# f = open(ParsetFilePath,'w') +# f.write(filedata) +# f.close() + + +# # Ändere Parameter der MaterialFunction +# def SetParameterMaterialFunction(materialFunction, parameterName, parameterValue): +# with open(Path+"/"+materialFunction+'.py', 'r') as file: +# filedata = file.read() +# filedata = re.sub('(?m)^'+str(parameterName)+'\s?=.*',str(parameterName)+' = '+str(parameterValue),filedata) +# f = open(Path+"/"+materialFunction+'.py','w') +# f.write(filedata) +# f.close() + +# # Rufe Programm zum Lösen des Cell-Problems auf +# def run_CellProblem(executable, parset,write_LOG): +# print('----- RUN Cell-Problem ----') +# processList = [] +# LOGFILE = "Cell-Problem_output.log" +# print('LOGFILE:',LOGFILE) +# print('executable:',executable) +# if write_LOG: +# p = subprocess.Popen(executable + parset +# + " | tee " + LOGFILE, shell=True) + +# else: +# p = subprocess.Popen(executable + parset +# + " | tee " + LOGFILE, shell=True) + +# p.wait() # wait +# processList.append(p) +# exit_codes = [p.wait() for p in processList] + +# return # Read effective quantites def ReadEffectiveQuantities(QFilePath = os.path.dirname(os.getcwd()) + '/outputs/QMatrix.txt', BFilePath = os.path.dirname(os.getcwd())+ '/outputs/BMatrix.txt'): @@ -92,22 +92,25 @@ def eval_energy(kappa,alpha,Q,B) : #### SET PARAMETERS #### ######################## # ----- Setup Paths ----- -Path = "./experiment/PAC" -# parset = ' ./experiment/wood-bilayer/cellsolver.parset.wood' -ParsetFile = Path + '/cellsolver.parset' -executable = 'build-cmake/src/Cell-Problem' -write_LOG = True # writes Cell-Problem output-LOG in "Cell-Problem_output.log" - +# Path = "./experiment/PAC" +# # parset = ' ./experiment/wood-bilayer/cellsolver.parset.wood' +# ParsetFile = Path + '/cellsolver.parset' +# executable = 'build-cmake/src/Cell-Problem' +# write_LOG = True # writes Cell-Problem output-LOG in "Cell-Problem_output.log" +path = os.getcwd() + '/experiment/rotation-test/results_caseI/' +pythonPath = os.getcwd() + '/experiment/PAC' +pythonModule = "PAC" +executable = os.getcwd() + '/build-cmake/src/Cell-Problem' # --------------------------------- # Setup Experiment # --------------------------------- -outputPath = Path + '/results_caseI/' +# outputPath = Path + '/results_caseI/' # ----- Define Input parameters -------------------- class ParameterSet: pass -ParameterSet.materialFunction = "PAC" +# ParameterSet.materialFunction = "PAC" ParameterSet.numLevels=4 case_=1 if case_==1: @@ -130,6 +133,9 @@ vol_=np.pi*ParameterSet.r**2 # h * epsilon_ * vol = vol_ epsilon_ = vol_/(ParameterSet.h*ParameterSet.vol) # gamma + + +# gamma = ParameterSet.t/epsilon_ ParameterSet.gamma = ParameterSet.t/epsilon_ # ----- Define Parameters for Material Function -------------------- @@ -138,30 +144,61 @@ materialFunctionParameter=[0.1, 0.2, 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 +# path = outputPath + str(i) +# isExist = os.path.exists(path) +# if not isExist: +# # Create a new directory because it does not existl +# os.makedirs(path) +# print("The new directory " + path + " is created!") +# # keine Parameter daher naechste Zeiel auskommentiert +# SetParameterMaterialFunction(ParameterSet.materialFunction, "param_eigenstrain",materialFunctionParameter[i]) +# SetParameterMaterialFunction(ParameterSet.materialFunction, "param_t", ParameterSet.t) +# SetParameterMaterialFunction(ParameterSet.materialFunction, "param_h", ParameterSet.h) +# SetParameterMaterialFunction(ParameterSet.materialFunction, "param_vol", ParameterSet.vol) +# SetParameterMaterialFunction(ParameterSet.materialFunction, "param_r", ParameterSet.r) +# SetParameterMaterialFunction(ParameterSet.materialFunction, "param_gamma", ParameterSet.gamma) +# SetParametersCellProblem(ParameterSet, ParsetFile, path) +# #Run Cell-Problem +# thread = threading.Thread(target=run_CellProblem(executable, " ./"+ParsetFile, write_LOG)) +# thread.start() + + + print("------------------") print("New Loop") print("------------------") # Check output directory - path = outputPath + str(i) - isExist = os.path.exists(path) + outputPath = path + str(i) + isExist = os.path.exists(outputPath) if not isExist: - # Create a new directory because it does not existl - os.makedirs(path) - print("The new directory " + path + " is created!") - # keine Parameter daher naechste Zeiel auskommentiert - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_eigenstrain",materialFunctionParameter[i]) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_t", ParameterSet.t) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_h", ParameterSet.h) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_vol", ParameterSet.vol) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_r", ParameterSet.r) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_gamma", ParameterSet.gamma) - SetParametersCellProblem(ParameterSet, ParsetFile, path) - #Run Cell-Problem - thread = threading.Thread(target=run_CellProblem(executable, " ./"+ParsetFile, write_LOG)) - thread.start() + # 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() + LOGFILE = outputPath + "/" + pythonModule + "_output" + "_" + str(i) + ".log" + processList = [] + p = subprocess.Popen(executable + " " + pythonPath + " " + pythonModule + + " -outputPath " + outputPath + + " -param_eigenstrain " + str(materialFunctionParameter[i]) + + " -param_t " + str(ParameterSet.t) + + " -param_h " + str(ParameterSet.h) + + " -param_vol " + str(ParameterSet.vol) + + " -param_r " + str(ParameterSet.r) + + " -param_gamma " + str(ParameterSet.gamma) + + " | 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() + # thread.join() f = open(path+"/parameter.txt", "w") f.write("param_eigenstrain = "+str(materialFunctionParameter[i])+"\n") f.close() diff --git a/experiment/homogeneous.py b/experiment/homogeneous.py index 538862a5..7217c81c 100644 --- a/experiment/homogeneous.py +++ b/experiment/homogeneous.py @@ -33,10 +33,10 @@ def indicatorFunction(x): # general_anisotropic : full compliance matrix C ###################################################################### # --- Number of material phases -Phases=1 +parameterSet.Phases=1 #--- Define different material phases: #- PHASE 1 -phase1_type="isotropic" +parameterSet.phase1_type="isotropic" materialParameters_phase1 = [80, 80] diff --git a/experiment/material_neukamm.py b/experiment/material_neukamm.py index cb1724b2..4d63960f 100644 --- a/experiment/material_neukamm.py +++ b/experiment/material_neukamm.py @@ -21,7 +21,7 @@ parameterSet.baseName= 'material_neukamm' #(needed for Output-Filename) parameterSet.gamma = 1.0 # --- Number of material phases -Phases = 3 +parameterSet.Phases = 3 #--- Indicator function for material phases # x[0] : y1-component @@ -53,15 +53,15 @@ def indicatorFunction(x): #--- Define different material phases: #- PHASE 1 -phase1_type="isotropic" +parameterSet.phase1_type="isotropic" materialParameters_phase1 = [80, 80] #- PHASE 2 -phase2_type="isotropic" +parameterSet.phase2_type="isotropic" materialParameters_phase2 = [80, 80] #- PHASE 3 -phase3_type="isotropic" +parameterSet.phase3_type="isotropic" materialParameters_phase3 = [60, 25] #--- Define prestrain function for each phase (also works with non-constant values) diff --git a/experiment/material_orthotropic.py b/experiment/material_orthotropic.py index 4c140c6e..0eb37bb3 100644 --- a/experiment/material_orthotropic.py +++ b/experiment/material_orthotropic.py @@ -22,7 +22,7 @@ parameterSet.baseName= 'material_orthotropic' #(needed for Output-Filename) parameterSet.gamma = 1.0 # --- Number of material phases -Phases = 3 +parameterSet.Phases = 3 #--- Indicator function for material phases def indicatorFunction(x): @@ -47,19 +47,19 @@ def indicatorFunction(x): #--- Define different material phases: #- PHASE 1 -phase1_type="orthotropic" +parameterSet.phase1_type="orthotropic" materialParameters_phase1 = [11.2e3,630,1190,700,230,960,0.63 ,0.49,0.37] # walnut parameters (values for compliance matrix) see [Dimwoodie; Timber its nature and behavior p.109] #- PHASE 2 -phase2_type="orthotropic" +parameterSet.phase2_type="orthotropic" # materialParameters_phase2 = [10.7e3,430,710,620,23,500, 0.51 ,0.38,0.31] # Norway spruce parameters (values for compliance matrix) see [Dimwoodie; Timber its nature and behavior p.109] materialParameters_phase2 = [11.2e3,630,1190,700,230,960,0.63 ,0.49,0.37] -phase2_axis = 2 -phase2_angle = np.pi/2.0 +parameterSet.phase2_axis = 2 +parameterSet.phase2_angle = np.pi/2.0 #- PHASE 3 -phase3_type="isotropic" +parameterSet.phase3_type="isotropic" materialParameters_phase3 = [60, 25] diff --git a/experiment/parametrized_laminate.py b/experiment/parametrized_laminate.py index 0ca84a2a..0fa4bbef 100644 --- a/experiment/parametrized_laminate.py +++ b/experiment/parametrized_laminate.py @@ -21,7 +21,7 @@ parameterSet.baseName= 'parametrized_laminate' #(needed for Output-Filename) parameterSet.gamma = 1.0 # --- Number of material phases -Phases = 4 +parameterSet.Phases = 4 #--- Indicator function for material phases def indicatorFunction(x): @@ -48,19 +48,19 @@ def indicatorFunction(x): #--- Define different material phases: #- PHASE 1 -phase1_type="isotropic" +parameterSet.phase1_type="isotropic" materialParameters_phase1 = [2.0, 0] #- PHASE 2 -phase2_type="isotropic" +parameterSet.phase2_type="isotropic" materialParameters_phase2 = [1.0, 0] #- PHASE 3 -phase3_type="isotropic" +parameterSet.phase3_type="isotropic" materialParameters_phase3 = [2.0, 0] #- PHASE 4 -phase4_type="isotropic" +parameterSet.phase4_type="isotropic" materialParameters_phase4 = [1.0, 0] #--- Define prestrain function for each phase (also works with non-constant values) diff --git a/experiment/rotation-test/PolarPlotLocalEnergy.py b/experiment/rotation-test/PolarPlotLocalEnergy.py index 5cb9d8de..5ca3a257 100644 --- a/experiment/rotation-test/PolarPlotLocalEnergy.py +++ b/experiment/rotation-test/PolarPlotLocalEnergy.py @@ -48,7 +48,7 @@ def ReadEffectiveQuantities(QFilePath, BFilePath): B = np.array([X[0][2], X[1][2], X[2][2]]) return Q, B -number=1 +number=4 kappa=np.zeros(number) for n in range(0,number): # Read from Date @@ -62,8 +62,8 @@ for n in range(0,number): B=np.transpose([B]) # - N=300 - length=.5 + N=500 + length=2 r, theta = np.meshgrid(np.linspace(0,length,N),np.radians(np.linspace(0, 360, N))) E=np.zeros(np.shape(r)) for i in range(0,N): diff --git a/experiment/rotation-test/isotrop_orthotrop_rotation.py b/experiment/rotation-test/isotrop_orthotrop_rotation.py index 1669e604..2afba12d 100644 --- a/experiment/rotation-test/isotrop_orthotrop_rotation.py +++ b/experiment/rotation-test/isotrop_orthotrop_rotation.py @@ -6,6 +6,24 @@ import sys import numpy as np import elasticity_toolbox as elast +class ParameterSet(dict): + def __init__(self, *args, **kwargs): + super(ParameterSet, self).__init__(*args, **kwargs) + self.__dict__ = self + +parameterSet = ParameterSet() +#--------------------------------------------------------------- +############################################# +# Paths +############################################# +# Path for results and logfile +parameterSet.outputPath='/home/klaus/Desktop/Dune_release/dune-microstructure/experiment/rotation-test/results' +parameterSet.baseName= 'isotrop_orthotrop_rotation' #(needed for Output-Filename) + +# Path for material description +# parameterSet.geometryFunctionPath =experiment/wood-bilayer/ + +#--------------------------------------------------------------- # Komposit beschreibt ein Material mit # oberer Schicht: orthotrop (Holz), in der Ebene gedreht # orientierung y_1-direction: L, y_2-direction: T, x_3-direction: R @@ -25,7 +43,8 @@ prestrain_wood=np.array([[-0.050821460301886785, 0, 0], [0, -2.134501332679245, 0], [0, 0, -0.8824453561509432]]) # rotation angle -param_theta = 1.5707963267948966 +# param_theta = '1.5707963267948966' +param_theta = '0.5' # untere Schicht: isotrop, ohne prestrain @@ -39,21 +58,35 @@ def indicatorFunction(x): return 2 #Phase2 # --- Number of material phases -Phases=2 +parameterSet.Phases=2 # --- PHASE 1 -phase1_type="general_anisotropic" +parameterSet.phase1_type="general_anisotropic" +# Drehung um theta um Achse 2 = x_3-Achse +# N=elast.rotation_matrix_compliance(2,param_theta) +# materialParameters_phase1 = np.dot(np.dot(N,compliance_wood),N.T) +# materialParameters_phase1 = (0.5*(materialParameters_phase1.T+materialParameters_phase1)).tolist() + + + # Drehung um theta um Achse 2 = x_3-Achse -N=elast.rotation_matrix_compliance(2,param_theta) -materialParameters_phase1 = np.dot(np.dot(N,compliance_wood),N.T) -materialParameters_phase1 = (0.5*(materialParameters_phase1.T+materialParameters_phase1)).tolist() +parameterSet.phase1_axis = 2 +# phase1_angle = 0.0 +# phase1_angle = float("1.5707963267948966") +# phase1_angle = float(param_theta) +parameterSet.phase1_angle = 0.5 +materialParameters_phase1 = compliance_wood + + # rotation of strain +# def prestrain_phase1(x): +# R=elast.rotation_matrix(2,param_theta) +# return np.dot(R,np.dot(np.array(prestrain_wood),R.T)).tolist() def prestrain_phase1(x): - R=elast.rotation_matrix(2,param_theta) - return np.dot(R,np.dot(np.array(prestrain_wood),R.T)).tolist() + return prestrain_wood # --- PHASE 2 -phase2_type="isotropic" +parameterSet.phase2_type="isotropic" # extract E and nu from wood E = 1/compliance_wood[0,0] nu = -compliance_wood[0,1]*E @@ -61,3 +94,64 @@ nu = -compliance_wood[0,1]*E materialParameters_phase2 = [E/(2*(1+nu)), (E*nu)/((1+nu)*(1-2*nu))] def prestrain_phase2(x): return [[0,0,0],[0,0,0],[0,0,0]] + +# --- Choose scale ratio gamma: +parameterSet.gamma=1.0 + + + + +############################################# +# Grid parameters +############################################# +## 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 + + +############################################# +# Assembly options +############################################# +parameterSet.set_IntegralZero = 1 #(default = false) +parameterSet.set_oneBasisFunction_Zero = 1 #(default = false) +#parameterSet.arbitraryLocalIndex = 7 #(default = 0) +#parameterSet.arbitraryElementNumber = 3 #(default = 0) + +############################################# +# Solver Options, Type: #1: CG - SOLVER , #2: GMRES - SOLVER, #3: QR - SOLVER (default), #4: UMFPACK - SOLVER +############################################# +parameterSet.Solvertype = 3 # recommended to use iterative solver (e.g GMRES) for finer grid-levels +parameterSet.Solver_verbosity = 0 #(default = 2) degree of information for solver output + + +############################################# +# Write/Output options #(default=false) +############################################# +# --- (Optional output) write Material / prestrain / Corrector functions to .vtk-Files: +parameterSet.write_materialFunctions = 1 # VTK indicator function for material/prestrain definition +#parameterSet.write_prestrainFunctions = 1 # VTK norm of B (currently not implemented) + +# --- (Additional debug output) +parameterSet.print_debug = 0 #(default=false) + +# --- Write Correctos to VTK-File: +parameterSet.write_VTK = 1 + +# --- (Optional output) L2Error, integral mean: +#parameterSet.write_L2Error = 1 +#parameterSet.write_IntegralMean = 1 + +# --- check orthogonality (75) from paper: +parameterSet.write_checkOrthogonality = 1 + +# --- Write corrector-coefficients to log-File: +#parameterSet.write_corrector_phi1 = 1 +#parameterSet.write_corrector_phi2 = 1 +#parameterSet.write_corrector_phi3 = 1 + +# --- Print Condition number of matrix (can be expensive): +#parameterSet.print_conditionNumber= 1 #(default=false) + +# --- write effective quantities to Matlab-folder for symbolic minimization: +parameterSet.write_toMATLAB = 1 # writes effective quantities to .txt-files QMatrix.txt and BMatrix.txt diff --git a/experiment/rotation-test/rotation_test.py b/experiment/rotation-test/rotation_test.py index 07d889e3..ed34f34a 100644 --- a/experiment/rotation-test/rotation_test.py +++ b/experiment/rotation-test/rotation_test.py @@ -13,49 +13,49 @@ import codecs import sys import threading -# Schreibe input datei für Parameter -def SetParametersCellProblem(ParameterSet, ParsetFilePath, outputPath): - print('----set Parameters -----') - with open(ParsetFilePath, 'r') as file: - filedata = file.read() - filedata = re.sub('(?m)^materialFunction\s?=.*','materialFunction = '+str(ParameterSet.materialFunction),filedata) - filedata = re.sub('(?m)^gamma\s?=.*','gamma='+str(ParameterSet.gamma),filedata) - filedata = re.sub('(?m)^numLevels\s?=.*','numLevels='+str(ParameterSet.numLevels)+' '+str(ParameterSet.numLevels) ,filedata) - filedata = re.sub('(?m)^outputPath\s?=\s?.*','outputPath='+str(outputPath),filedata) - f = open(ParsetFilePath,'w') - f.write(filedata) - f.close() - - -# Ändere Parameter der MaterialFunction -def SetParameterMaterialFunction(materialFunction, parameterName, parameterValue): - with open(Path+"/"+materialFunction+'.py', 'r') as file: - filedata = file.read() - filedata = re.sub('(?m)^'+str(parameterName)+'\s?=.*',str(parameterName)+' = '+str(parameterValue),filedata) - f = open(Path+"/"+materialFunction+'.py','w') - f.write(filedata) - f.close() - -# Rufe Programm zum Lösen des Cell-Problems auf -def run_CellProblem(executable, parset,write_LOG): - print('----- RUN Cell-Problem ----') - processList = [] - LOGFILE = "Cell-Problem_output.log" - print('LOGFILE:',LOGFILE) - print('executable:',executable) - if write_LOG: - p = subprocess.Popen(executable + parset - + " | tee " + LOGFILE, shell=True) - - else: - p = subprocess.Popen(executable + parset - + " | tee " + LOGFILE, shell=True) - - p.wait() # wait - processList.append(p) - exit_codes = [p.wait() for p in processList] - - return +# # Schreibe input datei für Parameter +# def SetParametersCellProblem(ParameterSet, ParsetFilePath, outputPath): +# print('----set Parameters -----') +# with open(ParsetFilePath, 'r') as file: +# filedata = file.read() +# filedata = re.sub('(?m)^materialFunction\s?=.*','materialFunction = '+str(ParameterSet.materialFunction),filedata) +# filedata = re.sub('(?m)^gamma\s?=.*','gamma='+str(ParameterSet.gamma),filedata) +# filedata = re.sub('(?m)^numLevels\s?=.*','numLevels='+str(ParameterSet.numLevels)+' '+str(ParameterSet.numLevels) ,filedata) +# filedata = re.sub('(?m)^outputPath\s?=\s?.*','outputPath='+str(outputPath),filedata) +# f = open(ParsetFilePath,'w') +# f.write(filedata) +# f.close() + + +# # Ändere Parameter der MaterialFunction +# def SetParameterMaterialFunction(materialFunction, parameterName, parameterValue): +# with open(Path+"/"+materialFunction+'.py', 'r') as file: +# filedata = file.read() +# filedata = re.sub('(?m)^'+str(parameterName)+'\s?=.*',str(parameterName)+' = '+str(parameterValue),filedata) +# f = open(Path+"/"+materialFunction+'.py','w') +# f.write(filedata) +# f.close() + +# # Rufe Programm zum Lösen des Cell-Problems auf +# def run_CellProblem(executable, parset,write_LOG): +# print('----- RUN Cell-Problem ----') +# processList = [] +# LOGFILE = "Cell-Problem_output.log" +# print('LOGFILE:',LOGFILE) +# print('executable:',executable) +# if write_LOG: +# p = subprocess.Popen(executable + parset +# + " | tee " + LOGFILE, shell=True) + +# else: +# p = subprocess.Popen(executable + parset +# + " | tee " + LOGFILE, shell=True) + +# p.wait() # wait +# processList.append(p) +# exit_codes = [p.wait() for p in processList] + +# return # Read effective quantites def ReadEffectiveQuantities(QFilePath = os.path.dirname(os.getcwd()) + '/outputs/QMatrix.txt', BFilePath = os.path.dirname(os.getcwd())+ '/outputs/BMatrix.txt'): @@ -92,25 +92,34 @@ def eval_energy(kappa,alpha,Q,B) : #### SET PARAMETERS #### ######################## # ----- Setup Paths ----- -Path = "./experiment/rotation-test" -# parset = ' ./experiment/wood-bilayer/cellsolver.parset.wood' -ParsetFile = Path + '/cellsolver.parset' -executable = 'build-cmake/src/Cell-Problem' -write_LOG = True # writes Cell-Problem output-LOG in "Cell-Problem_output.log" +# Path = "./experiment/rotation-test" +# # parset = ' ./experiment/wood-bilayer/cellsolver.parset.wood' +# ParsetFile = Path + '/cellsolver.parset' +# executable = 'build-cmake/src/Cell-Problem' +# write_LOG = True # writes Cell-Problem output-LOG in "Cell-Problem_output.log" +path = os.getcwd() + '/experiment/rotation-test/results/' +pythonPath = os.getcwd() + '/experiment/rotation-test' +pythonModule = "isotrop_orthotrop_rotation" +executable = os.getcwd() + '/build-cmake/src/Cell-Problem' +# # --------------------------------- +# # Setup Experiment +# # --------------------------------- +# outputPath = Path + '/results/' + +# # ----- Define Input parameters -------------------- +# class ParameterSet: +# pass + +# #ParameterSet.materialFunction = "isotrop_orthotrop_rotation" +# ParameterSet.materialFunction = "isotrop_orthotrop_rotation" +# ParameterSet.gamma=1.0 +# ParameterSet.numLevels=3 # --------------------------------- # Setup Experiment # --------------------------------- -outputPath = Path + '/results/' - -# ----- Define Input parameters -------------------- -class ParameterSet: - pass +gamma = 1.0 -#ParameterSet.materialFunction = "isotrop_orthotrop_rotation" -ParameterSet.materialFunction = "isotrop_orthotrop_rotation" -ParameterSet.gamma=1.0 -ParameterSet.numLevels=3 # ----- Define Parameters for Material Function -------------------- # Liste mit Drehwinkel theta @@ -118,24 +127,53 @@ materialFunctionParameter=[0, 2*np.pi/12, 4*np.pi/12, 6*np.pi/12] # ------ Loops through Parameters for Material Function ----------- for i in range(0,np.shape(materialFunctionParameter)[0]): +# print("------------------") +# print("New Loop") +# print("------------------") +# # Check output directory +# path = outputPath + str(i) +# isExist = os.path.exists(path) +# if not isExist: +# # Create a new directory because it does not exist +# os.makedirs(path) +# print("The new directory " + path + " is created!") +# SetParameterMaterialFunction(ParameterSet.materialFunction, "param_theta",materialFunctionParameter[i]) +# SetParametersCellProblem(ParameterSet, ParsetFile, path) +# #Run Cell-Problem +# thread = threading.Thread(target=run_CellProblem(executable, " ./"+ParsetFile, write_LOG)) +# thread.start() print("------------------") print("New Loop") print("------------------") # Check output directory - path = outputPath + str(i) - isExist = os.path.exists(path) + outputPath = path + str(i) + isExist = os.path.exists(outputPath) if not isExist: # Create a new directory because it does not exist - os.makedirs(path) - print("The new directory " + path + " is created!") - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_theta",materialFunctionParameter[i]) - SetParametersCellProblem(ParameterSet, ParsetFile, path) - #Run Cell-Problem - thread = threading.Thread(target=run_CellProblem(executable, " ./"+ParsetFile, write_LOG)) - thread.start() + os.makedirs(outputPath) + print("The new directory " + outputPath + " is created!") + + # thread = threading.Thread(target=run_CellProblem(executable, pythonModule, pythonPath, LOGFILE)) + # thread.start() + LOGFILE = outputPath + "/" + pythonModule + "_output" + "_" + str(i) + ".log" + + # angle_input = " float(" +str(materialFunctionParameter[i]) + ")" + # print('angle_input:', angle_input) + # print('str(materialFunctionParameter[i]):', str(materialFunctionParameter[i])) + processList = [] + p = subprocess.Popen(executable + " " + pythonPath + " " + pythonModule + + " -outputPath " + outputPath + + " -gamma " + str(gamma) + + " -param_theta " + str(materialFunctionParameter[i]) + + " -phase1_angle " + str(materialFunctionParameter[i]) + + " | 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() + # thread.join() f = open(path+"/parameter.txt", "w") f.write("theta = "+str(materialFunctionParameter[i])+"\n") f.close() diff --git a/experiment/wood-bilayer-variant/wood_inclusion.py b/experiment/wood-bilayer-variant/wood_inclusion.py index a93b6902..15fec129 100644 --- a/experiment/wood-bilayer-variant/wood_inclusion.py +++ b/experiment/wood-bilayer-variant/wood_inclusion.py @@ -6,6 +6,24 @@ import sys import numpy as np import elasticity_toolbox as elast +class ParameterSet(dict): + def __init__(self, *args, **kwargs): + super(ParameterSet, self).__init__(*args, **kwargs) + self.__dict__ = self + +parameterSet = ParameterSet() +#--------------------------------------------------------------- +############################################# +# Paths +############################################# +# Path for results and logfile +parameterSet.outputPath='/home/klaus/Desktop/Dune_release/dune-microstructure/experiment/wood-bilayer-variant/results_inclusion' +parameterSet.baseName= 'wood_inclusion' #(needed for Output-Filename) + +# Path for material description +# parameterSet.geometryFunctionPath =experiment/wood-bilayer/ + + #--------------------------------------------------------------- # Wooden bilayer, https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6191116/#pone.0205607.ref015 #--- define indicator function @@ -99,7 +117,7 @@ def indicatorFunction(x): return 2 # --- Number of material phases -Phases=3 +parameterSet.Phases=3 # --- PHASE 1 # y_1-direction: L @@ -107,7 +125,7 @@ Phases=3 # x_3-direction: R # phase1_type="orthotropic" # materialParameters_phase1 = [E_L,E_T,E_R,G_TL,G_RT,G_RL,nu_LT,nu_LR,nu_TR] -phase1_type="general_anisotropic" +parameterSet.phase1_type="general_anisotropic" [E_1,E_2,E_3]=[E_L,E_T,E_R] [nu_12,nu_13,nu_23]=[nu_LT,nu_LR,nu_TR] [nu_21,nu_31,nu_32]=[nu_TL,nu_RL,nu_RT] @@ -126,7 +144,7 @@ def prestrain_phase1(x): # y_1-direction: R # y_2-direction: L # x_3-direction: T -phase2_type="general_anisotropic" +parameterSet.phase2_type="general_anisotropic" [E_1,E_2,E_3]=[E_R,E_L,E_T] [nu_12,nu_13,nu_23]=[nu_RL,nu_RT,nu_LT] [nu_21,nu_31,nu_32]=[nu_LR,nu_TR,nu_TL] @@ -144,7 +162,7 @@ def prestrain_phase2(x): return [[1/param_h*delta_omega*alpha_R, 0, 0], [0,1/param_h*delta_omega*alpha_L,0], [0,0,1/param_h*delta_omega*alpha_T]] # --- PHASE 3 = approximation of a whole -phase3_type="isotropic" +parameterSet.phase3_type="isotropic" # E in MPa and nu E = 1 # nu = 0 @@ -152,3 +170,62 @@ nu = 0 materialParameters_phase3 = [E/(2*(1+nu)), (E*nu)/((1+nu)*(1-2*nu))] def prestrain_phase3(x): return [[0,0,0],[0,0,0],[0,0,0]] + + + + + +############################################# +# Grid parameters +############################################# +## 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= '4 4' # computes all levels from first to second entry + + +############################################# +# Assembly options +############################################# +parameterSet.set_IntegralZero = 1 #(default = false) +parameterSet.set_oneBasisFunction_Zero = 1 #(default = false) +#parameterSet.arbitraryLocalIndex = 7 #(default = 0) +#parameterSet.arbitraryElementNumber = 3 #(default = 0) + +############################################# +# Solver Options, Type: #1: CG - SOLVER , #2: GMRES - SOLVER, #3: QR - SOLVER (default), #4: UMFPACK - SOLVER +############################################# +parameterSet.Solvertype = 3 # recommended to use iterative solver (e.g GMRES) for finer grid-levels +parameterSet.Solver_verbosity = 0 #(default = 2) degree of information for solver output + + +############################################# +# Write/Output options #(default=false) +############################################# +# --- (Optional output) write Material / prestrain / Corrector functions to .vtk-Files: +parameterSet.write_materialFunctions = 1 # VTK indicator function for material/prestrain definition +#parameterSet.write_prestrainFunctions = 1 # VTK norm of B (currently not implemented) + +# --- (Additional debug output) +parameterSet.print_debug = 0 #(default=false) + +# --- Write Correctos to VTK-File: +parameterSet.write_VTK = 1 + +# --- (Optional output) L2Error, integral mean: +#parameterSet.write_L2Error = 1 +#parameterSet.write_IntegralMean = 1 + +# --- check orthogonality (75) from paper: +parameterSet.write_checkOrthogonality = 1 + +# --- Write corrector-coefficients to log-File: +#parameterSet.write_corrector_phi1 = 1 +#parameterSet.write_corrector_phi2 = 1 +#parameterSet.write_corrector_phi3 = 1 + +# --- Print Condition number of matrix (can be expensive): +#parameterSet.print_conditionNumber= 1 #(default=false) + +# --- write effective quantities to Matlab-folder for symbolic minimization: +parameterSet.write_toMATLAB = 1 # writes effective quantities to .txt-files QMatrix.txt and BMatrix.txt diff --git a/experiment/wood-bilayer-variant/wood_inclusion_test.py b/experiment/wood-bilayer-variant/wood_inclusion_test.py index d42ed1cc..9b23d6dc 100644 --- a/experiment/wood-bilayer-variant/wood_inclusion_test.py +++ b/experiment/wood-bilayer-variant/wood_inclusion_test.py @@ -13,49 +13,49 @@ import codecs import sys import threading -# Schreibe input datei für Parameter -def SetParametersCellProblem(ParameterSet, ParsetFilePath, outputPath): - print('----set Parameters -----') - with open(ParsetFilePath, 'r') as file: - filedata = file.read() - filedata = re.sub('(?m)^materialFunction\s?=.*','materialFunction = '+str(ParameterSet.materialFunction),filedata) - filedata = re.sub('(?m)^gamma\s?=.*','gamma='+str(ParameterSet.gamma),filedata) - filedata = re.sub('(?m)^numLevels\s?=.*','numLevels='+str(ParameterSet.numLevels)+' '+str(ParameterSet.numLevels) ,filedata) - filedata = re.sub('(?m)^outputPath\s?=\s?.*','outputPath='+str(outputPath),filedata) - f = open(ParsetFilePath,'w') - f.write(filedata) - f.close() - - -# Ändere Parameter der MaterialFunction -def SetParameterMaterialFunction(materialFunction, parameterName, parameterValue): - with open(Path+"/"+materialFunction+'.py', 'r') as file: - filedata = file.read() - filedata = re.sub('(?m)^'+str(parameterName)+'\s?=.*',str(parameterName)+' = '+str(parameterValue),filedata) - f = open(Path+"/"+materialFunction+'.py','w') - f.write(filedata) - f.close() - -# Rufe Programm zum Lösen des Cell-Problems auf -def run_CellProblem(executable, parset,write_LOG): - print('----- RUN Cell-Problem ----') - processList = [] - LOGFILE = "Cell-Problem_output.log" - print('LOGFILE:',LOGFILE) - print('executable:',executable) - if write_LOG: - p = subprocess.Popen(executable + parset - + " | tee " + LOGFILE, shell=True) +# # Schreibe input datei für Parameter +# def SetParametersCellProblem(ParameterSet, ParsetFilePath, outputPath): +# print('----set Parameters -----') +# with open(ParsetFilePath, 'r') as file: +# filedata = file.read() +# filedata = re.sub('(?m)^materialFunction\s?=.*','materialFunction = '+str(ParameterSet.materialFunction),filedata) +# filedata = re.sub('(?m)^gamma\s?=.*','gamma='+str(ParameterSet.gamma),filedata) +# filedata = re.sub('(?m)^numLevels\s?=.*','numLevels='+str(ParameterSet.numLevels)+' '+str(ParameterSet.numLevels) ,filedata) +# filedata = re.sub('(?m)^outputPath\s?=\s?.*','outputPath='+str(outputPath),filedata) +# f = open(ParsetFilePath,'w') +# f.write(filedata) +# f.close() - else: - p = subprocess.Popen(executable + parset - + " | tee " + LOGFILE, shell=True) - p.wait() # wait - processList.append(p) - exit_codes = [p.wait() for p in processList] +# # Ändere Parameter der MaterialFunction +# def SetParameterMaterialFunction(materialFunction, parameterName, parameterValue): +# with open(Path+"/"+materialFunction+'.py', 'r') as file: +# filedata = file.read() +# filedata = re.sub('(?m)^'+str(parameterName)+'\s?=.*',str(parameterName)+' = '+str(parameterValue),filedata) +# f = open(Path+"/"+materialFunction+'.py','w') +# f.write(filedata) +# f.close() + +# # Rufe Programm zum Lösen des Cell-Problems auf +# def run_CellProblem(executable, parset,write_LOG): +# print('----- RUN Cell-Problem ----') +# processList = [] +# LOGFILE = "Cell-Problem_output.log" +# print('LOGFILE:',LOGFILE) +# print('executable:',executable) +# if write_LOG: +# p = subprocess.Popen(executable + parset +# + " | tee " + LOGFILE, shell=True) - return +# else: +# p = subprocess.Popen(executable + parset +# + " | tee " + LOGFILE, shell=True) + +# p.wait() # wait +# processList.append(p) +# exit_codes = [p.wait() for p in processList] + +# return # Read effective quantites def ReadEffectiveQuantities(QFilePath = os.path.dirname(os.getcwd()) + '/outputs/QMatrix.txt', BFilePath = os.path.dirname(os.getcwd())+ '/outputs/BMatrix.txt'): @@ -92,23 +92,32 @@ def eval_energy(kappa,alpha,Q,B) : #### SET PARAMETERS #### ######################## # ----- Setup Paths ----- -Path = "./experiment/wood-bilayer-variant" -# parset = ' ./experiment/wood-bilayer/cellsolver.parset.wood' -ParsetFile = Path + '/cellsolver.parset.wood' -executable = 'build-cmake/src/Cell-Problem' -write_LOG = True # writes Cell-Problem output-LOG in "Cell-Problem_output.log" +# Path = "./experiment/wood-bilayer-variant" +# # parset = ' ./experiment/wood-bilayer/cellsolver.parset.wood' +# ParsetFile = Path + '/cellsolver.parset.wood' +# executable = 'build-cmake/src/Cell-Problem' +# write_LOG = True # writes Cell-Problem output-LOG in "Cell-Problem_output.log" +path = os.getcwd() + '/experiment/wood-bilayer-variant/results_inclusion/' +pythonPath = os.getcwd() + '/experiment/wood-bilayer-variant' +pythonModule = "wood_inclusion" +executable = os.getcwd() + '/build-cmake/src/Cell-Problem' +# # --------------------------------- +# # Setup Experiment +# # --------------------------------- +# outputPath = Path + '/results_inclusion/' + +# # ----- Define Input parameters -------------------- +# class ParameterSet: +# pass + +# ParameterSet.materialFunction = "wood_inclusion" +# ParameterSet.gamma=1.0 +# ParameterSet.numLevels=4 + # --------------------------------- # Setup Experiment # --------------------------------- -outputPath = Path + '/results_inclusion/' - -# ----- Define Input parameters -------------------- -class ParameterSet: - pass - -ParameterSet.materialFunction = "wood_inclusion" -ParameterSet.gamma=1.0 -ParameterSet.numLevels=4 +gamma = 1.0 # ----- Define Parameters for Material Function -------------------- # [r, h, omega_flat, omega_target, theta, experimental_kappa, width] width=width of upper inclusion @@ -131,25 +140,34 @@ for i in range(0,np.shape(materialFunctionParameter)[0]): print("New Loop") print("------------------") # Check output directory - path = outputPath + str(i) - isExist = os.path.exists(path) + outputPath = path + str(i) + isExist = os.path.exists(outputPath) if not isExist: # Create a new directory because it does not exist - os.makedirs(path) - print("The new directory " + path + " is created!") - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_r",materialFunctionParameter[i][0]) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_h",materialFunctionParameter[i][1]) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_omega_flat",materialFunctionParameter[i][2]) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_omega_target",materialFunctionParameter[i][3]) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_theta",materialFunctionParameter[i][4]) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_width",materialFunctionParameter[i][6]) - SetParametersCellProblem(ParameterSet, ParsetFile, path) - #Run Cell-Problem - thread = threading.Thread(target=run_CellProblem(executable, " ./"+ParsetFile, write_LOG)) - thread.start() + os.makedirs(outputPath) + print("The new directory " + outputPath + " is created!") + + # thread = threading.Thread(target=run_CellProblem(executable, pythonModule, pythonPath, LOGFILE)) + # thread.start() + LOGFILE = outputPath + "/" + pythonModule + "_output" + "_" + str(i) + ".log" + processList = [] + 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]) + + " -param_theta " + str(materialFunctionParameter[i][4]) + + " -param_width " + str(materialFunctionParameter[i][6]) + + " | 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() + # thread.join() f = open(path+"/parameter.txt", "w") f.write("r = "+str(materialFunctionParameter[i][0])+"\n") f.write("h = "+str(materialFunctionParameter[i][1])+"\n") diff --git a/experiment/wood-bilayer-variant/wood_upper_laminate_test.py b/experiment/wood-bilayer-variant/wood_upper_laminate_test.py index c3b12352..4cf2610a 100644 --- a/experiment/wood-bilayer-variant/wood_upper_laminate_test.py +++ b/experiment/wood-bilayer-variant/wood_upper_laminate_test.py @@ -14,48 +14,48 @@ import sys import threading # Schreibe input datei für Parameter -def SetParametersCellProblem(ParameterSet, ParsetFilePath, outputPath): - print('----set Parameters -----') - with open(ParsetFilePath, 'r') as file: - filedata = file.read() - filedata = re.sub('(?m)^materialFunction\s?=.*','materialFunction = '+str(ParameterSet.materialFunction),filedata) - filedata = re.sub('(?m)^gamma\s?=.*','gamma='+str(ParameterSet.gamma),filedata) - filedata = re.sub('(?m)^numLevels\s?=.*','numLevels='+str(ParameterSet.numLevels)+' '+str(ParameterSet.numLevels) ,filedata) - filedata = re.sub('(?m)^outputPath\s?=\s?.*','outputPath='+str(outputPath),filedata) - f = open(ParsetFilePath,'w') - f.write(filedata) - f.close() - - -# Ändere Parameter der MaterialFunction -def SetParameterMaterialFunction(materialFunction, parameterName, parameterValue): - with open(Path+"/"+materialFunction+'.py', 'r') as file: - filedata = file.read() - filedata = re.sub('(?m)^'+str(parameterName)+'\s?=.*',str(parameterName)+' = '+str(parameterValue),filedata) - f = open(Path+"/"+materialFunction+'.py','w') - f.write(filedata) - f.close() - -# Rufe Programm zum Lösen des Cell-Problems auf -def run_CellProblem(executable, parset,write_LOG): - print('----- RUN Cell-Problem ----') - processList = [] - LOGFILE = "Cell-Problem_output.log" - print('LOGFILE:',LOGFILE) - print('executable:',executable) - if write_LOG: - p = subprocess.Popen(executable + parset - + " | tee " + LOGFILE, shell=True) +# def SetParametersCellProblem(ParameterSet, ParsetFilePath, outputPath): +# print('----set Parameters -----') +# with open(ParsetFilePath, 'r') as file: +# filedata = file.read() +# filedata = re.sub('(?m)^materialFunction\s?=.*','materialFunction = '+str(ParameterSet.materialFunction),filedata) +# filedata = re.sub('(?m)^gamma\s?=.*','gamma='+str(ParameterSet.gamma),filedata) +# filedata = re.sub('(?m)^numLevels\s?=.*','numLevels='+str(ParameterSet.numLevels)+' '+str(ParameterSet.numLevels) ,filedata) +# filedata = re.sub('(?m)^outputPath\s?=\s?.*','outputPath='+str(outputPath),filedata) +# f = open(ParsetFilePath,'w') +# f.write(filedata) +# f.close() - else: - p = subprocess.Popen(executable + parset - + " | tee " + LOGFILE, shell=True) - p.wait() # wait - processList.append(p) - exit_codes = [p.wait() for p in processList] +# # Ändere Parameter der MaterialFunction +# def SetParameterMaterialFunction(materialFunction, parameterName, parameterValue): +# with open(Path+"/"+materialFunction+'.py', 'r') as file: +# filedata = file.read() +# filedata = re.sub('(?m)^'+str(parameterName)+'\s?=.*',str(parameterName)+' = '+str(parameterValue),filedata) +# f = open(Path+"/"+materialFunction+'.py','w') +# f.write(filedata) +# f.close() + +# # Rufe Programm zum Lösen des Cell-Problems auf +# def run_CellProblem(executable, parset,write_LOG): +# print('----- RUN Cell-Problem ----') +# processList = [] +# LOGFILE = "Cell-Problem_output.log" +# print('LOGFILE:',LOGFILE) +# print('executable:',executable) +# if write_LOG: +# p = subprocess.Popen(executable + parset +# + " | tee " + LOGFILE, shell=True) - return +# else: +# p = subprocess.Popen(executable + parset +# + " | tee " + LOGFILE, shell=True) + +# p.wait() # wait +# processList.append(p) +# exit_codes = [p.wait() for p in processList] + +# return # Read effective quantites def ReadEffectiveQuantities(QFilePath = os.path.dirname(os.getcwd()) + '/outputs/QMatrix.txt', BFilePath = os.path.dirname(os.getcwd())+ '/outputs/BMatrix.txt'): @@ -92,25 +92,34 @@ def eval_energy(kappa,alpha,Q,B) : #### SET PARAMETERS #### ######################## # ----- Setup Paths ----- -Path = "./experiment/wood-bilayer-variant" -# parset = ' ./experiment/wood-bilayer/cellsolver.parset.wood' -ParsetFile = Path + '/cellsolver.parset.wood' -executable = 'build-cmake/src/Cell-Problem' -write_LOG = True # writes Cell-Problem output-LOG in "Cell-Problem_output.log" +# Path = "./experiment/wood-bilayer-variant" +# # parset = ' ./experiment/wood-bilayer/cellsolver.parset.wood' +# ParsetFile = Path + '/cellsolver.parset.wood' +# executable = 'build-cmake/src/Cell-Problem' +# write_LOG = True # writes Cell-Problem output-LOG in "Cell-Problem_output.log" +path = os.getcwd() + '/experiment/wood-bilayer-variant/results_laminated/' +pythonPath = os.getcwd() + '/experiment/wood-bilayer-variant' +pythonModule = "wood_upper_laminated" +executable = os.getcwd() + '/build-cmake/src/Cell-Problem' # --------------------------------- # Setup Experiment # --------------------------------- -outputPath = Path + '/results_laminated/' +# outputPath = Path + '/results_laminated/' #outputPath = Path + '/results_square/' -# ----- Define Input parameters -------------------- -class ParameterSet: - pass +# # ----- Define Input parameters -------------------- +# class ParameterSet: +# pass -ParameterSet.materialFunction = "wood_upper_laminated" -#ParameterSet.materialFunction = "wood_square" -ParameterSet.gamma=1.0 -ParameterSet.numLevels=3 +# ParameterSet.materialFunction = "wood_upper_laminated" +# #ParameterSet.materialFunction = "wood_square" +# ParameterSet.gamma=1.0 +# ParameterSet.numLevels=3 + +# --------------------------------- +# Setup Experiment +# --------------------------------- +gamma = 1.0 # ----- Define Parameters for Material Function -------------------- # [r, h, omega_flat, omega_target, theta, experimental_kappa, width] width=width of upper laminate @@ -131,29 +140,60 @@ materialFunctionParameter=[ # ------ Loops through Parameters for Material Function ----------- for i in range(0,np.shape(materialFunctionParameter)[0]): +# print("------------------") +# print("New Loop") +# print("------------------") +# # Check output directory +# path = outputPath + str(i) +# isExist = os.path.exists(path) +# if not isExist: +# # Create a new directory because it does not exist +# os.makedirs(path) +# print("The new directory " + path + " is created!") +# SetParameterMaterialFunction(ParameterSet.materialFunction, "param_r",materialFunctionParameter[i][0]) +# SetParameterMaterialFunction(ParameterSet.materialFunction, "param_h",materialFunctionParameter[i][1]) +# SetParameterMaterialFunction(ParameterSet.materialFunction, "param_omega_flat",materialFunctionParameter[i][2]) +# SetParameterMaterialFunction(ParameterSet.materialFunction, "param_omega_target",materialFunctionParameter[i][3]) +# SetParameterMaterialFunction(ParameterSet.materialFunction, "param_theta",materialFunctionParameter[i][4]) +# SetParameterMaterialFunction(ParameterSet.materialFunction, "param_width",materialFunctionParameter[i][6]) +# SetParametersCellProblem(ParameterSet, ParsetFile, path) +# #Run Cell-Problem +# thread = threading.Thread(target=run_CellProblem(executable, " ./"+ParsetFile, write_LOG)) +# thread.start() + + print("------------------") print("New Loop") print("------------------") # Check output directory - path = outputPath + str(i) - isExist = os.path.exists(path) + outputPath = path + str(i) + isExist = os.path.exists(outputPath) if not isExist: # Create a new directory because it does not exist - os.makedirs(path) - print("The new directory " + path + " is created!") - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_r",materialFunctionParameter[i][0]) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_h",materialFunctionParameter[i][1]) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_omega_flat",materialFunctionParameter[i][2]) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_omega_target",materialFunctionParameter[i][3]) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_theta",materialFunctionParameter[i][4]) - SetParameterMaterialFunction(ParameterSet.materialFunction, "param_width",materialFunctionParameter[i][6]) - SetParametersCellProblem(ParameterSet, ParsetFile, path) - #Run Cell-Problem - thread = threading.Thread(target=run_CellProblem(executable, " ./"+ParsetFile, write_LOG)) - thread.start() + os.makedirs(outputPath) + print("The new directory " + outputPath + " is created!") + + # thread = threading.Thread(target=run_CellProblem(executable, pythonModule, pythonPath, LOGFILE)) + # thread.start() + LOGFILE = outputPath + "/" + pythonModule + "_output" + "_" + str(i) + ".log" + processList = [] + 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]) + + " -param_theta " + str(materialFunctionParameter[i][4]) + + " -param_width " + str(materialFunctionParameter[i][6]) + + " | 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() + # thread.join() f = open(path+"/parameter.txt", "w") f.write("r = "+str(materialFunctionParameter[i][0])+"\n") f.write("h = "+str(materialFunctionParameter[i][1])+"\n") diff --git a/experiment/wood-bilayer-variant/wood_upper_laminated.py b/experiment/wood-bilayer-variant/wood_upper_laminated.py index 467e0dc5..a46aef60 100644 --- a/experiment/wood-bilayer-variant/wood_upper_laminated.py +++ b/experiment/wood-bilayer-variant/wood_upper_laminated.py @@ -6,6 +6,24 @@ import sys import numpy as np import elasticity_toolbox as elast +class ParameterSet(dict): + def __init__(self, *args, **kwargs): + super(ParameterSet, self).__init__(*args, **kwargs) + self.__dict__ = self + +parameterSet = ParameterSet() +#--------------------------------------------------------------- +############################################# +# Paths +############################################# +# Path for results and logfile +parameterSet.outputPath='/home/klaus/Desktop/Dune_release/dune-microstructure/experiment/wood-bilayer-variant/results_laminated' +parameterSet.baseName= 'wood_upper_laminated' #(needed for Output-Filename) + +# Path for material description +# parameterSet.geometryFunctionPath =experiment/wood-bilayer/ + + #--------------------------------------------------------------- # Wooden bilayer, https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6191116/#pone.0205607.ref015 #--- define indicator function @@ -98,7 +116,7 @@ def indicatorFunction(x): return 2 # --- Number of material phases -Phases=3 +parameterSet.Phases=3 # --- PHASE 1 # y_1-direction: L @@ -106,7 +124,7 @@ Phases=3 # x_3-direction: R # phase1_type="orthotropic" # materialParameters_phase1 = [E_L,E_T,E_R,G_TL,G_RT,G_RL,nu_LT,nu_LR,nu_TR] -phase1_type="general_anisotropic" +parameterSet.phase1_type="general_anisotropic" [E_1,E_2,E_3]=[E_L,E_T,E_R] [nu_12,nu_13,nu_23]=[nu_LT,nu_LR,nu_TR] [nu_21,nu_31,nu_32]=[nu_TL,nu_RL,nu_RT] @@ -125,7 +143,7 @@ def prestrain_phase1(x): # y_1-direction: R # y_2-direction: L # x_3-direction: T -phase2_type="general_anisotropic" +parameterSet.phase2_type="general_anisotropic" [E_1,E_2,E_3]=[E_R,E_L,E_T] [nu_12,nu_13,nu_23]=[nu_RL,nu_RT,nu_LT] [nu_21,nu_31,nu_32]=[nu_LR,nu_TR,nu_TL] @@ -148,7 +166,7 @@ def prestrain_phase2(x): # x_3-direction: R # phase1_type="orthotropic" # materialParameters_phase1 = [E_L,E_T,E_R,G_TL,G_RT,G_RL,nu_LT,nu_LR,nu_TR] -phase3_type="general_anisotropic" +parameterSet.phase3_type="general_anisotropic" [E_1,E_2,E_3]=[E_T,E_L,E_R] [nu_12,nu_13,nu_23]=[nu_TL,nu_TR,nu_LR] [nu_21,nu_31,nu_32]=[nu_LT,nu_RT,nu_RL] @@ -162,3 +180,60 @@ compliance_S=np.array([[1/E_1, -nu_21/E_2, -nu_31/E_3, 0.0, materialParameters_phase3 = compliance_S def prestrain_phase3(x): return [[1/param_h*delta_omega*alpha_T, 0, 0], [0,1/param_h*delta_omega*alpha_L,0], [0,0,1/param_h*delta_omega*alpha_R]] + + + +############################################# +# Grid parameters +############################################# +## 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= '4 4' # computes all levels from first to second entry + + +############################################# +# Assembly options +############################################# +parameterSet.set_IntegralZero = 1 #(default = false) +parameterSet.set_oneBasisFunction_Zero = 1 #(default = false) +#parameterSet.arbitraryLocalIndex = 7 #(default = 0) +#parameterSet.arbitraryElementNumber = 3 #(default = 0) + +############################################# +# Solver Options, Type: #1: CG - SOLVER , #2: GMRES - SOLVER, #3: QR - SOLVER (default), #4: UMFPACK - SOLVER +############################################# +parameterSet.Solvertype = 3 # recommended to use iterative solver (e.g GMRES) for finer grid-levels +parameterSet.Solver_verbosity = 0 #(default = 2) degree of information for solver output + + +############################################# +# Write/Output options #(default=false) +############################################# +# --- (Optional output) write Material / prestrain / Corrector functions to .vtk-Files: +parameterSet.write_materialFunctions = 1 # VTK indicator function for material/prestrain definition +#parameterSet.write_prestrainFunctions = 1 # VTK norm of B (currently not implemented) + +# --- (Additional debug output) +parameterSet.print_debug = 0 #(default=false) + +# --- Write Correctos to VTK-File: +parameterSet.write_VTK = 1 + +# --- (Optional output) L2Error, integral mean: +#parameterSet.write_L2Error = 1 +#parameterSet.write_IntegralMean = 1 + +# --- check orthogonality (75) from paper: +parameterSet.write_checkOrthogonality = 1 + +# --- Write corrector-coefficients to log-File: +#parameterSet.write_corrector_phi1 = 1 +#parameterSet.write_corrector_phi2 = 1 +#parameterSet.write_corrector_phi3 = 1 + +# --- Print Condition number of matrix (can be expensive): +#parameterSet.print_conditionNumber= 1 #(default=false) + +# --- write effective quantities to Matlab-folder for symbolic minimization: +parameterSet.write_toMATLAB = 1 # writes effective quantities to .txt-files QMatrix.txt and BMatrix.txt diff --git a/experiment/wood-bilayer/wood_european_beech.py b/experiment/wood-bilayer/wood_european_beech.py index ed6c5974..3f321222 100644 --- a/experiment/wood-bilayer/wood_european_beech.py +++ b/experiment/wood-bilayer/wood_european_beech.py @@ -12,6 +12,17 @@ class ParameterSet(dict): self.__dict__ = self parameterSet = ParameterSet() +#--------------------------------------------------------------- +############################################# +# Paths +############################################# +# Path for results and logfile +parameterSet.outputPath='/home/klaus/Desktop/Dune_release/dune-microstructure/experiment/wood-bilayer/results' +parameterSet.baseName= 'wood_european_beech' #(needed for Output-Filename) + +# Path for material description +# parameterSet.geometryFunctionPath =experiment/wood-bilayer/ + #--------------------------------------------------------------- # Wooden bilayer, https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6191116/#pone.0205607.ref015 #--- define indicator function @@ -27,7 +38,7 @@ def indicatorFunction(x): return 2 #Phase2 # --- Number of material phases -Phases=2 +parameterSet.Phases=2 # Parameters of the model # -- (thickness upper layer) / (thickness) @@ -104,7 +115,7 @@ alpha_T=0.00462 # PLOS paper # x_3-direction: R # phase1_type="orthotropic" # materialParameters_phase1 = [E_L,E_T,E_R,G_TL,G_RT,G_RL,nu_LT,nu_LR,nu_TR] -phase1_type="general_anisotropic" +parameterSet.phase1_type="general_anisotropic" [E_1,E_2,E_3]=[E_L,E_T,E_R] [nu_12,nu_13,nu_23]=[nu_LT,nu_LR,nu_TR] [nu_21,nu_31,nu_32]=[nu_TL,nu_RL,nu_RT] @@ -125,7 +136,7 @@ def prestrain_phase1(x): # y_1-direction: R # y_2-direction: L # x_3-direction: T -phase2_type="general_anisotropic" +parameterSet.phase2_type="general_anisotropic" [E_1,E_2,E_3]=[E_R,E_L,E_T] [nu_12,nu_13,nu_23]=[nu_RL,nu_RT,nu_LT] [nu_21,nu_31,nu_32]=[nu_LR,nu_TR,nu_TL] @@ -144,7 +155,7 @@ def prestrain_phase2(x): # y_1-direction: L # y_2-direction: R # x_3-direction: T -phase3_type="general_anisotropic" +parameterSet.phase3_type="general_anisotropic" # Drehung um theta um Achse 2 = x_3-Achse N=elast.rotation_matrix_compliance(2,param_theta) materialParameters_phase3 = np.dot(np.dot(N,materialParameters_phase1),N.T) @@ -158,15 +169,7 @@ def prestrain_phase3(x): parameterSet.gamma=1.0 -############################################# -# Paths -############################################# -# Path for results and logfile -parameterSet.outputPath='/home/klaus/Desktop/Dune_release/dune-microstructure/experiment/wood-bilayer/results' -parameterSet.baseName= 'wood_european_beech' #(needed for Output-Filename) -# Path for material description -# parameterSet.geometryFunctionPath =experiment/wood-bilayer/ ############################################# # Grid parameters @@ -188,7 +191,7 @@ parameterSet.set_oneBasisFunction_Zero = 1 #(default = false) ############################################# # Solver Options, Type: #1: CG - SOLVER , #2: GMRES - SOLVER, #3: QR - SOLVER (default), #4: UMFPACK - SOLVER ############################################# -parameterSet.Solvertype = 3 # recommended to use iterative solver (e.g GMRES) for finer grid-levels +parameterSet.Solvertype = 2 # recommended to use iterative solver (e.g GMRES) for finer grid-levels parameterSet.Solver_verbosity = 0 #(default = 2) degree of information for solver output diff --git a/experiment/wood-bilayer/wood_test.py b/experiment/wood-bilayer/wood_test.py index b8784c7f..6f1d5df7 100644 --- a/experiment/wood-bilayer/wood_test.py +++ b/experiment/wood-bilayer/wood_test.py @@ -152,7 +152,6 @@ for i in range(0,np.shape(materialFunctionParameter)[0]): 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() diff --git a/test/orthotropicrotation_1.py b/test/orthotropicrotation_1.py index c17b0add..35a84ea8 100644 --- a/test/orthotropicrotation_1.py +++ b/test/orthotropicrotation_1.py @@ -33,19 +33,19 @@ def indicatorFunction(x): ###################################################################### # --- Number of material phases -Phases=3 +parameterSet.Phases=3 #--- Define different material phases: #- PHASE 1 -phase1_type="orthotropic" +parameterSet.phase1_type="orthotropic" materialParameters_phase1 = [11.2e3,630,1190,700,230,960,0.63,0.49,0.37] # Walnut parameters (values for compliance matrix) see [Dimwoodie; Timber its nature and behavior p.109] #- PHASE 2 -phase2_type="orthotropic" +parameterSet.phase2_type="orthotropic" materialParameters_phase2 = [16.3e3,620,1100,910,190,1180,0.43,0.49,0.38] # Birch parameters (values for compliance matrix) see [Dimwoodie; Timber its nature and behavior p.109] #- PHASE 3 -phase3_type="orthotropic" +parameterSet.phase3_type="orthotropic" materialParameters_phase3 = [10.7e3,430,710,620,23,500,0.51,0.38,0.31] # Norway spruce parameters (values for compliance matrix) see [Dimwoodie; Timber its nature and behavior p.109] diff --git a/test/orthotropicrotation_2.py b/test/orthotropicrotation_2.py index ff5757d6..c2acab67 100644 --- a/test/orthotropicrotation_2.py +++ b/test/orthotropicrotation_2.py @@ -33,27 +33,27 @@ def indicatorFunction(x): ###################################################################### # --- Number of material phases -Phases=3 +parameterSet.Phases=3 # *Rotate material frame of each phase by 180 degrees (pi) #--- Define different material phases: #- PHASE 1 -phase1_type="orthotropic" +parameterSet.phase1_type="orthotropic" materialParameters_phase1 = [11.2e3,630,1190,700,230,960,0.63,0.49,0.37] # Walnut parameters (values for compliance matrix) see [Dimwoodie; Timber its nature and behavior p.109] -phase1_axis = 0 -phase1_angle = np.pi +parameterSet.phase1_axis = 0 +parameterSet.phase1_angle = np.pi #- PHASE 2 -phase2_type="orthotropic" +parameterSet.phase2_type="orthotropic" materialParameters_phase2 = [16.3e3,620,1100,910,190,1180,0.43,0.49,0.38] # Birch parameters (values for compliance matrix) see [Dimwoodie; Timber its nature and behavior p.109] -phase2_axis = 1 -phase2_angle = np.pi +parameterSet.phase2_axis = 1 +parameterSet.phase2_angle = np.pi #- PHASE 3 -phase3_type="orthotropic" +parameterSet.phase3_type="orthotropic" materialParameters_phase3 = [10.7e3,430,710,620,23,500,0.51,0.38,0.31] # Norway spruce parameters (values for compliance matrix) see [Dimwoodie; Timber its nature and behavior p.109] -phase3_axis = 2 -phase3_angle = np.pi +parameterSet.phase3_axis = 2 +parameterSet.phase3_angle = np.pi #--- define prestrain function for each phase # (also works with non-constant values) diff --git a/test/parametrized_laminate.py b/test/parametrized_laminate.py index dad1d9b3..c26acd06 100644 --- a/test/parametrized_laminate.py +++ b/test/parametrized_laminate.py @@ -32,7 +32,7 @@ rho_2 = rho_1*theta_rho; parameterSet.gamma = 1.0 # --- Number of material phases -Phases = 4 +parameterSet.Phases = 4 #--- Indicator function for material phases def indicatorFunction(x): @@ -59,19 +59,19 @@ def indicatorFunction(x): #--- Define different material phases: #- PHASE 1 -phase1_type="isotropic" +parameterSet.phase1_type="isotropic" materialParameters_phase1 = [2.0, 0] #- PHASE 2 -phase2_type="isotropic" +parameterSet.phase2_type="isotropic" materialParameters_phase2 = [1.0, 0] #- PHASE 3 -phase3_type="isotropic" +parameterSet.phase3_type="isotropic" materialParameters_phase3 = [2.0, 0] #- PHASE 4 -phase4_type="isotropic" +parameterSet.phase4_type="isotropic" materialParameters_phase4 = [1.0, 0] #--- Define prestrain function for each phase (also works with non-constant values) -- GitLab