From b380b89da35efdf6c1fe1dc26f0d642c76fbff06 Mon Sep 17 00:00:00 2001
From: Klaus <klaus.boehnlein@tu-dresden.de>
Date: Fri, 10 Dec 2021 22:50:56 +0100
Subject: [PATCH] Update plot-q12

---
 inputs/cellsolver.parset | 10 ++++----
 src/Plotq12.py           | 51 +++++++++++++++++++++++++++++++---------
 2 files changed, 45 insertions(+), 16 deletions(-)

diff --git a/inputs/cellsolver.parset b/inputs/cellsolver.parset
index d3c2d621..535be32e 100644
--- a/inputs/cellsolver.parset
+++ b/inputs/cellsolver.parset
@@ -38,8 +38,8 @@ cellDomain = 1
 ########################################################################
 
 #numLevels =  1 3   # computes all levels from first to second entry
-numLevels = 3 3     # computes all levels from first to second entry
-#numLevels = 4 4    # computes all levels from first to second entry
+#numLevels = 3 3     # computes all levels from first to second entry
+numLevels = 4 4    # computes all levels from first to second entry
 #numLevels = 1 6
 
 
@@ -68,7 +68,7 @@ gamma=1.0
 beta = 2.0    # ratio between material parameters mu1 & mu2 .... beta = 1.0 corresponds to homogeneous case
 
 mu1=1.0
-lambda1=10.0
+lambda1=5.0
 
 
 
@@ -88,8 +88,8 @@ theta = 0.125
 
 
 
-#material_prestrain_imp= "parametrized_Laminate"
-material_prestrain_imp= "analytical_Example"
+material_prestrain_imp= "parametrized_Laminate"
+#material_prestrain_imp= "analytical_Example"
 #material_prestrain_imp ="isotropic_bilayer"
 #material_prestrain_imp= "circle_fiber"    #TEST
 
diff --git a/src/Plotq12.py b/src/Plotq12.py
index 403a7b66..ac3a9a53 100644
--- a/src/Plotq12.py
+++ b/src/Plotq12.py
@@ -49,23 +49,52 @@ RUN = True
 # RUN = False
 # make_Plot = False
 # make_Plot = True      # vll besser : Plot_muGamma
+counter = 0
+
+#material_prestrain_imp= "analytical_Example"
+material_prestrain_imp= "parametrized_Laminate"
 
 if RUN:
     for lambda1 in Lambda_Values:
         print("Run Cell-Problem for Lambda = ", lambda1)
+
+        # LOGFILE = "./harmonicmaps_intoR"+ str(targetDim) + "_" + str(order) + "_" + str(numLevels) + ".log"
+        LOGFILE = path + "/outputs/out_lambda" + str(counter) + ".log"
+        print("LOGFILE: ", LOGFILE)
+        counter += 1
         # print('gamma='+str(gamma))
-        with open(InputFilePath, 'r') as file:
-            filedata = file.read()
-        filedata = re.sub('(?m)^lambda1=.*','lambda1='+str(lambda1),filedata)
-        f = open(InputFilePath,'w')
-        f.write(filedata)
-        f.close()
+
+        # with open(InputFilePath, 'r') as file:
+        #     filedata = file.read()
+        # filedata = re.sub('(?m)^lambda1=.*','lambda1='+str(lambda1),filedata)
+        # f = open(InputFilePath,'w')
+        # f.write(filedata)
+        # f.close()
+
+        executable = './build-cmake/src/Cell-Problem'
+
         # Run Cell-Problem
-        subprocess.run(['./build-cmake/src/Cell-Problem', './inputs/cellsolver.parset'],
-                                             capture_output=True, text=True)
-        #Extract mu_gamma from Output-File
-        with open(OutputFilePath, 'r') as file:
-            output = file.read()
+        # p = subprocess.Popen(executable + " cellsolver.parset"
+        #                                             + " -lambda1 " + str(lambda1)
+        #                                             + " | tee " + LOGFILE, shell=True)
+        p = subprocess.Popen(executable + " " +path + "/inputs/cellsolver.parset"
+                                                    + " -lambda1 " + str(lambda1)
+                                                    + " -material_prestrain_imp " + str(material_prestrain_imp)
+                                                    + " | tee " + LOGFILE, shell=True)
+        p.wait() # wait
+
+        # subprocess.run(['./build-cmake/src/Cell-Problem', './inputs/cellsolver.parset'],
+        #                                      capture_output=True, text=True)
+
+
+
+
+        with open(LOGFILE, 'r') as file:
+            output  = file.read()
+
+        ###Extract q12 from Output-File
+        # with open(OutputFilePath, 'r') as file:
+        #     output = file.read()
         tmp = re.search(r'(?m)^q_onetwo=.*',output).group()
         s = re.findall(r"[-+]?\d*\.\d+|\d+", tmp)
         q12Value = float(s[0])
-- 
GitLab