diff --git a/inputs/cellsolver.parset b/inputs/cellsolver.parset index 1b3fb6f8bba60146ac1c2dc3a4d1a92b641d2665..2979e77475f7d8fc8201820bb712c46b6dc33b88 100644 --- a/inputs/cellsolver.parset +++ b/inputs/cellsolver.parset @@ -14,7 +14,7 @@ ### Remove/Comment this when running via Python-Script: -#outputPath = "../../outputs" +outputPath=/home/klaus/Desktop/DUNE/dune-microstructure/test @@ -47,7 +47,7 @@ numLevels=2 2 ######################################################################################## # --- Choose scale ratio gamma: -gamma=0.45 +gamma=1.0 ############################################# diff --git a/microstructure_testsuite/helper_functions.py b/microstructure_testsuite/helper_functions.py index 1e3e3c1ea65700ba2339b9841761ed5b5b7104a0..ff67f20ec7b5918c1ae39ac6efb890eba6e77780 100644 --- a/microstructure_testsuite/helper_functions.py +++ b/microstructure_testsuite/helper_functions.py @@ -110,7 +110,7 @@ def listToString(s): return (str1.join(str(e) for e in s)) -def SetParametersCellProblem(mu_,lambda_,rho_,alpha,beta,theta,gamma,gridLevel, ParsetFilePath = os.path.dirname(os.getcwd()) +"/inputs/cellsolver.parset"): +def SetParametersCellProblem(mu_,lambda_,rho_,alpha,beta,theta,gamma,gridLevel, ParsetFilePath = os.path.dirname(os.getcwd()) +"/inputs/cellsolver.parset", outputPath = os.path.dirname(os.getcwd()) + '/outputs' ): print('----set Parameters -----') with open(ParsetFilePath, 'r') as file: filedata = file.read() @@ -125,6 +125,7 @@ def SetParametersCellProblem(mu_,lambda_,rho_,alpha,beta,theta,gamma,gridLevel, filedata = re.sub('(?m)^mu1\s?=.*','mu1='+str(mu_[0]),filedata) filedata = re.sub('(?m)^rho1\s?=.*','rho1='+str(rho_[0]),filedata) filedata = re.sub('(?m)^lambda1\s?=.*','lambda1='+str(lambda_[0]),filedata) + filedata = re.sub('(?m)^outputPath\s?=\s?.*','outputPath='+str(outputPath),filedata) f = open(ParsetFilePath,'w') f.write(filedata) f.close() diff --git a/microstructure_testsuite/microstructure_testsuite.py b/microstructure_testsuite/microstructure_testsuite.py index f5b073128f65b31de18c1c4717529c646b337d10..a02d798bf81c414f9194c62685d47cac0432e872 100644 --- a/microstructure_testsuite/microstructure_testsuite.py +++ b/microstructure_testsuite/microstructure_testsuite.py @@ -12,6 +12,7 @@ from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator import codecs import sys from helper_functions import * +import threading #------------------------------------------------------------------------------------------------------- ######################## @@ -25,6 +26,8 @@ BFilePath = os.path.dirname(os.getcwd())+ '/outputs/BMatrix.txt' ParsetFilePath = os.path.dirname(os.getcwd()) +"/inputs/cellsolver.parset" parset = ' ../inputs/cellsolver.parset' executable = ' ../build-cmake/src/Cell-Problem' +print('outputPath:', outputPath) + # ----- Define Input parameters -------------------- phases = 2 # number of phases @@ -48,7 +51,7 @@ gamma=1.0 #scale ratio # --- Choose grid-Level for computation: -gridLevel = 3 +gridLevel = 2 ############################################# # Choose preferred Geometry/Prestrain/Material //TODO: Add Option for more Phases @@ -79,8 +82,8 @@ write_VTK = False write_L2Error = False write_IntegralMean = False -write_LOG = False # writes Cell-Problem output-LOG in "Cell-Problem_output.log" -# write_LOG = True # writes Cell-Problem output-LOG in "Cell-Problem_output.log" +# write_LOG = False # writes Cell-Problem output-LOG in "Cell-Problem_output.log" +write_LOG = True # writes Cell-Problem output-LOG in "Cell-Problem_output.log" #---- Some of the old Material definitions use the following input parameters: (not needed when using "two_phase_material_x"): -------- mu1 = mu_[0] @@ -110,31 +113,40 @@ print('---------------------------------------------------------') ########################################################################################################### #Set Parameters -SetParametersCellProblem(mu_,lambda_,rho_,alpha,beta,theta,gamma,gridLevel, ParsetFilePath) - +SetParametersCellProblem(mu_,lambda_,rho_,alpha,beta,theta,gamma,gridLevel, ParsetFilePath, outputPath) #Run Cell-Problem -run_CellProblem(executable, - parset, - gridLevel, - gamma, - mu1, - lambda1, - rho1, - alpha, - beta, - theta, - material_prestrain_imp, - outputPath, - write_materialFunctions, - write_prestrainFunctions, - write_VTK, - write_L2Error, - write_IntegralMean, - write_LOG - ) +thread = threading.Thread(target=run_CellProblem(executable, + parset, + gridLevel, + gamma, + mu1, + lambda1, + rho1, + alpha, + beta, + theta, + material_prestrain_imp, + outputPath, + write_materialFunctions, + write_prestrainFunctions, + write_VTK, + write_L2Error, + write_IntegralMean, + write_LOG + ) + ) + + + +thread.start() + +# wait here for the result to be available before continuing +thread.join() print('---------------------------------------------------------') + + #Read effective quantities print('Read effective quantities...') Q, B = ReadEffectiveQuantities(QFilePath,BFilePath) diff --git a/src/Cell-Problem.cc b/src/Cell-Problem.cc index 348371e34edccaf7bb7e63853165062ea5dfd332..9744b6ed3b896542066589a52cf89d5005743f0e 100644 --- a/src/Cell-Problem.cc +++ b/src/Cell-Problem.cc @@ -870,7 +870,8 @@ int main(int argc, char *argv[]) //--- Output setter // std::string outputPath = parameterSet.get("outputPath", "../../outputs/output.txt"); // std::string outputPath = parameterSet.get("outputPath", "/home/klaus/Desktop/DUNE/dune-microstructure/outputs/output.txt"); - std::string outputPath = parameterSet.get("outputPath", "/home/klaus/Desktop/DUNE/dune-microstructure/outputs"); +// std::string outputPath = parameterSet.get("outputPath", "/home/klaus/Desktop/DUNE/dune-microstructure/outputs"); + std::string outputPath = parameterSet.get("outputPath", "../../outputs"); // std::string MatlabPath = parameterSet.get("MatlabPath", "/home/klaus/Desktop/DUNE/dune-microstructure/Matlab-Programs"); // std::string outputPath = "/home/klaus/Desktop/DUNE/dune-microstructure/outputs/output.txt"; std::fstream log;