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

Fix relative path issue (hopefully)

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