From 706b6d499991f3e43cb9df98ccea6259bb4aa2c8 Mon Sep 17 00:00:00 2001 From: Klaus <klaus.boehnlein@tu-dresden.de> Date: Tue, 19 Oct 2021 18:37:14 +0200 Subject: [PATCH] Update & remove old Files --- src/Plotq3-Angle.py | 298 ------------------------------------ src/Plotq3-Angle2.py | 339 ----------------------------------------- src/Plotq3-AngleOld.py | 246 ------------------------------ src/Plotq3-AngleV1.py | 147 ------------------ src/plot-q3-gamma.py | 6 +- 5 files changed, 4 insertions(+), 1032 deletions(-) delete mode 100644 src/Plotq3-Angle.py delete mode 100644 src/Plotq3-Angle2.py delete mode 100644 src/Plotq3-AngleOld.py delete mode 100644 src/Plotq3-AngleV1.py diff --git a/src/Plotq3-Angle.py b/src/Plotq3-Angle.py deleted file mode 100644 index 0d3b277b..00000000 --- a/src/Plotq3-Angle.py +++ /dev/null @@ -1,298 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import sympy as sym -import math -import os -import subprocess -import fileinput -import re -import matlab.engine -import sys -from ClassifyMin import * -from HelperFunctions import * -# from CellScript import * -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.cm as cm -from vtk.util import numpy_support -from pyevtk.hl import gridToVTK -import time -import matplotlib.ticker as ticker - -# from matplotlib import rc -# rc('text', usetex=True) # Use LaTeX font -# -# import seaborn as sns -# sns.set(color_codes=True) - - -def format_func(value, tick_number): - # find number of multiples of pi/2 - N = int(np.round(2 * value / np.pi)) - if N == 0: - return "0" - elif N == 1: - return r"$\pi/2$" - elif N == 2: - return r"$\pi$" - elif N % 2 > 0: - return r"${0}\pi/2$".format(N) - else: - return r"${0}\pi$".format(N // 2) - - - - -def find_nearest(array, value): - array = np.asarray(array) - idx = (np.abs(array - value)).argmin() - return array[idx] - - -def find_nearestIdx(array, value): - array = np.asarray(array) - idx = (np.abs(array - value)).argmin() - return idx - - -InputFile = "/inputs/computeMuGamma.parset" -OutputFile = "/outputs/outputMuGamma.txt" -# --------- Run from src folder: -path_parent = os.path.dirname(os.getcwd()) -os.chdir(path_parent) -path = os.getcwd() -print(path) -InputFilePath = os.getcwd()+InputFile -OutputFilePath = os.getcwd()+OutputFile -print("InputFilepath: ", InputFilePath) -print("OutputFilepath: ", OutputFilePath) -print("Path: ", path) - -print('---- Input parameters: -----') -# mu1 = 10.0 -# rho1 = 1.0 -# alpha = 2.56140350877193 #2.56140350877193, 4.0852130325814535 -# beta = 2.0 #5.0 -# theta = 1.0/4.0 -# theta = 1.0/8.0 # 0.5 -# theta = 0.075 # 0.5 -# mu1 = 10.0 -# rho1 = 1.0 -# alpha = 10 -# beta = 40.0 -# theta = 0.125 - - - -mu1 = 10.0 -rho1 = 1.0 -alpha = 10.0 -beta = 2.0 #5.0 -theta = 1.0/8.0 -# - - -# mu1 = 10.0 -# rho1 = 1.0 -# # alpha = 10.02021333 -# alpha = 10.0 -# beta = 2.0 -# theta = 0.125 - - - -# mu1 = 10.0 -# rho1 = 1.0 -# # alpha = 10.02021333 -# alpha = 9.0 -# beta = 2.0 -# theta = 0.075 - -# -# mu1 = 10.0 -# rho1 = 1.0 -# alpha = 4.0 -# beta = 10.0 -# theta = 1.0/4.0 - -# alpha = 10 #1.05263158 -# beta = 40.0 #5.0 -# # theta = 1.0/4.0 -# theta = 1.0/8.0 # 0.5 -# -# -# alpha = 2.0 -# beta = 2.0 #5.0 -# theta = 1/4.0 -# rho1 = 1.0 -# mu1 = 10.0 - -# InterestingParameterSet : -# mu1 = 10.0 -# rho1 = 1.0 -# alpha = 10 -# beta = 40.0 - - -# theta = 0.124242 -# gamma = 0.75 -#set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value -# gamma = '0' -# gamma = 'infinity' -# gamma = 0.5 -# gamma = 0.25 - -print('mu1: ', mu1) -print('rho1: ', rho1) -print('alpha: ', alpha) -print('beta: ', beta) -print('theta: ', theta) -# print('gamma:', gamma) -print('----------------------------') - -# ---------------------------------------------------------------- - - -gamma_min = 0.01 -gamma_max = 3.0 -Gamma_Values = np.linspace(gamma_min, gamma_max, num=100) # TODO variable Input Parameters...alpha,beta... -print('(Input) Gamma_Values:', Gamma_Values) -# mu_gamma = [] - -# Gamma_Values = '0' - -# # --- Options -# # make_Plot = False -make_Plot = True - -# Get values for mu_Gamma -GetMuGammaVec = np.vectorize(GetMuGamma) -muGammas = GetMuGammaVec(beta,theta,Gamma_Values,mu1,rho1, InputFilePath ,OutputFilePath ) -print('muGammas:', muGammas) - -q12 = 0.0 -q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) -q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) -print('q1: ', q1) -print('q2: ', q2) -b1 = prestrain_b1(rho1, beta, alpha,theta) -b2 = prestrain_b2(rho1, beta, alpha,theta) -q3_star = math.sqrt(q1*q2) -print('q3_star:', q3_star) - -# TODO these have to be compatible with input parameters!!! -# compute certain ParameterValues that this makes sense -# b1 = q3_star -# b2 = q1 -print('b1: ', b1) -print('b2: ', b2) - -# return classifyMin(q1, q2, q3, q12, b1, b2, print_Cases, print_Output) - - - -# classifyMin_anaVec = np.vectorize(classifyMin_ana) -# G, angles, Types, curvature = classifyMin_anaVec(alpha, beta, theta, muGammas, mu1, rho1) -classifyMin_anaVec = np.vectorize(classifyMin_ana) -G, angles, Types, curvature = classifyMin_anaVec(alpha, beta, theta, muGammas, mu1, rho1) - -# _,angles,_,_ = classifyMin_anaVec(alpha, beta, theta, muGammas, mu1, rho1) - -print('angles:', angles) - - - - -# idx = find_nearestIdx(muGammas, q3_star) -# print('GammaValue Idx closest to q_3^*', idx) -# gammaClose = Gamma_Values[idx] -# print('GammaValue(Idx) with mu_gamma closest to q_3^*', gammaClose) - - - - - - -# Make Plot -if make_Plot: - # plt.figure() - # - # - # - # - # # plt.title(r'angle$-\mu_\gamma(\gamma)$-Plot') - # # plt.title(r'angle$-\gamma$-Plot') - # # plt.plot(Gamma_Values, angles) - # # plt.scatter(Gamma_Values, angles) - # plt.plot(muGammas, angles) - # plt.scatter(muGammas, angles) - # # plt.axis([0, 6, 0, 20]) - # # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') - # # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') - # plt.axvline(x = q1, color = 'b', linestyle = ':', label='$q_1$') - # plt.axvline(x = q2, color = 'r', linestyle = 'dashed', label='$q_2$') - # # plt.axvline(x = q3_star, color = 'r', linestyle = 'dashed', label='$\gamma^*$') - - - - f,ax=plt.subplots(1) - ax.plot(muGammas, angles) - ax.scatter(muGammas, angles) - plt.xlabel("$q_3$") - plt.ylabel("angle") - ax.grid(True) - # ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) - # ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12)) - - # ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 4)) - # ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12)) - # ax.yaxis.set_major_formatter(plt.FuncFormatter(format_func)) - - # ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$')) - # ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.25)) - - - # ax.yaxis.set_major_formatter(ticker.FuncFormatter( - # lambda val,pos: '{:.0g}$\pi$'.format(2*val/np.pi) if val !=0 else '0')) - # ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.5*np.pi)) - - - ax.axvline(x = q1, color = 'b', linestyle = ':', label='$q_1$') - ax.axvline(x = q2, color = 'r', linestyle = 'dashed', label='$q_2$') - ax.legend() - # ax.set(xlim=(1.750, 1.880), ylim=(0, math.pi/2.0)) - ax.set(xlim=(1.760, 1.880), ylim=(-0.1, np.pi/4.0)) - # ax.set_yticks([0, np.pi/4 ,np.pi/2]) - # labels = ['$0$', r'$\pi/4$', r'$\pi/2$'] - ax.set_yticks([0, np.pi/8, np.pi/4 ]) - labels = ['$0$',r'$\pi/8$', r'$\pi/4$'] - ax.set_yticklabels(labels) - - # Plot Gamma Value that is closest to q3_star - # plt.axvline(x = gammaClose, color = 'b', linestyle = 'dashed', label='$\gamma^*$') - # plt.axvspan(gamma_min, gammaClose, color='red', alpha=0.5) - # plt.axvspan(gammaClose, gamma_max, color='green', alpha=0.5) - - plt.xlabel("$q_3(\gamma)$") - # plt.xlabel("$\gamma$") - plt.ylabel("angle") - plt.legend(loc='upper center') - - plt.show() - - - - - # plt.figure() - # plt.title(r'angle$-\mu_\gamma(\gamma)$-Plot') - # plt.plot(muGammas, angles) - # plt.scatter(muGammas, angles) - # # plt.axis([0, 6, 0, 20]) - # # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') - # # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') - # plt.axvline(x = 1.90476, color = 'b', linestyle = ':', label='$q_1$') - # plt.axvline(x = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') - # plt.xlabel("$\mu_\gamma$") - # plt.ylabel("angle") - # plt.legend() - # plt.show() - # diff --git a/src/Plotq3-Angle2.py b/src/Plotq3-Angle2.py deleted file mode 100644 index 9e25264d..00000000 --- a/src/Plotq3-Angle2.py +++ /dev/null @@ -1,339 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import sympy as sym -import math -import os -import subprocess -import fileinput -import re -import matlab.engine -import sys -from ClassifyMin import * -from HelperFunctions import * -# from CellScript import * -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.cm as cm -from vtk.util import numpy_support -from pyevtk.hl import gridToVTK -import time -import matplotlib.ticker as ticker - -# from matplotlib import rc -# rc('text', usetex=True) # Use LaTeX font -# -# import seaborn as sns -# sns.set(color_codes=True) - - -def format_func(value, tick_number): - # find number of multiples of pi/2 - N = int(np.round(2 * value / np.pi)) - if N == 0: - return "0" - elif N == 1: - return r"$\pi/2$" - elif N == 2: - return r"$\pi$" - elif N % 2 > 0: - return r"${0}\pi/2$".format(N) - else: - return r"${0}\pi$".format(N // 2) - - - - -def find_nearest(array, value): - array = np.asarray(array) - idx = (np.abs(array - value)).argmin() - return array[idx] - - -def find_nearestIdx(array, value): - array = np.asarray(array) - idx = (np.abs(array - value)).argmin() - return idx - - -InputFile = "/inputs/computeMuGamma.parset" -OutputFile = "/outputs/outputMuGamma.txt" -# --------- Run from src folder: -path_parent = os.path.dirname(os.getcwd()) -os.chdir(path_parent) -path = os.getcwd() -print(path) -InputFilePath = os.getcwd()+InputFile -OutputFilePath = os.getcwd()+OutputFile -print("InputFilepath: ", InputFilePath) -print("OutputFilepath: ", OutputFilePath) -print("Path: ", path) - -print('---- Input parameters: -----') -# mu1 = 10.0 -# rho1 = 1.0 -# alpha = 2.56140350877193 #2.56140350877193, 4.0852130325814535 -# beta = 2.0 #5.0 -# theta = 1.0/4.0 -# theta = 1.0/8.0 # 0.5 -# theta = 0.075 # 0.5 -# mu1 = 10.0 -# rho1 = 1.0 -alpha = 10 -# beta = 40.0 -# theta = 0.125 - -mu1 = 10.0 -rho1 = 1.0 -# alpha = 2.0 -beta = 2.0 #5.0 -# theta = 1.0/4.0 -theta = 1.0/8.0 -# - - - -# mu1 = 10.0 -# rho1 = 1.0 -# alpha = 10.0 -# beta = 2.0 #5.0 -# theta = 1.0/8.0 -# # - - -# mu1 = 10.0 -# rho1 = 1.0 -# # alpha = 10.02021333 -# alpha = 10.0 -# beta = 2.0 -# theta = 0.125 - - - -# mu1 = 10.0 -# rho1 = 1.0 -# # alpha = 10.02021333 -# alpha = 9.0 -# beta = 2.0 -# theta = 0.075 - -# -# mu1 = 10.0 -# rho1 = 1.0 -# alpha = 4.0 -# beta = 10.0 -# theta = 1.0/4.0 - -# alpha = 10 #1.05263158 -# beta = 40.0 #5.0 -# # theta = 1.0/4.0 -# theta = 1.0/8.0 # 0.5 -# -# -# alpha = 2.0 -# beta = 2.0 #5.0 -# theta = 1/4.0 -# rho1 = 1.0 -# mu1 = 10.0 - -# InterestingParameterSet : -# mu1 = 10.0 -# rho1 = 1.0 -# alpha = 10 -# beta = 40.0 - - -# theta = 0.124242 -# gamma = 0.75 -#set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value -# gamma = '0' -# gamma = 'infinity' -# gamma = 0.5 -# gamma = 0.25 - -print('mu1: ', mu1) -print('rho1: ', rho1) -print('alpha: ', alpha) -print('beta: ', beta) -print('theta: ', theta) -# print('gamma:', gamma) -print('----------------------------') - -# ---------------------------------------------------------------- - - -gamma_min = 0.01 -gamma_max = 1.0 -Gamma_Values = np.linspace(gamma_min, gamma_max, num=100) # TODO variable Input Parameters...alpha,beta... -print('(Input) Gamma_Values:', Gamma_Values) -# mu_gamma = [] - -# Gamma_Values = '0' - -# # --- Options -# # make_Plot = False -make_Plot = True - -# Get values for mu_Gamma -GetMuGammaVec = np.vectorize(GetMuGamma) -muGammas = GetMuGammaVec(beta,theta,Gamma_Values,mu1,rho1, InputFilePath ,OutputFilePath ) -print('muGammas:', muGammas) - -q12 = 0.0 -q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) -q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) -print('q1: ', q1) -print('q2: ', q2) -b1 = prestrain_b1(rho1, beta, alpha,theta) -b2 = prestrain_b2(rho1, beta, alpha,theta) -q3_star = math.sqrt(q1*q2) -print('q3_star:', q3_star) - -# TODO these have to be compatible with input parameters!!! -# compute certain ParameterValues that this makes sense -# b1 = q3_star -# b2 = q1 -print('b1: ', b1) -print('b2: ', b2) - -# return classifyMin(q1, q2, q3, q12, b1, b2, print_Cases, print_Output) - - - -# classifyMin_anaVec = np.vectorize(classifyMin_ana) -# G, angles, Types, curvature = classifyMin_anaVec(alpha, beta, theta, muGammas, mu1, rho1) -classifyMin_anaVec = np.vectorize(classifyMin_ana) -G, angles, Types, curvature = classifyMin_anaVec(alpha, beta, theta, muGammas, mu1, rho1) - -# _,angles,_,_ = classifyMin_anaVec(alpha, beta, theta, muGammas, mu1, rho1) - -print('angles:', angles) - - - - -idx = find_nearestIdx(muGammas, q3_star) -print('GammaValue Idx closest to q_3^*', idx) -gammaClose = Gamma_Values[idx] -print('GammaValue(Idx) with mu_gamma closest to q_3^*', gammaClose) - - - -determinantVec = np.vectorize(determinant) - -detValues = determinantVec(q1,q2,muGammas,q12) -print('detValues:', detValues) - - -detZeroidx = find_nearestIdx(detValues, 0) -print('idx where det nearest to zero', idx) -gammaClose = Gamma_Values[detZeroidx] -print('gammaClose:', gammaClose) - - -# Make Plot -if make_Plot: - # plt.figure() - # - # - # - # - # # plt.title(r'angle$-\mu_\gamma(\gamma)$-Plot') - # # plt.title(r'angle$-\gamma$-Plot') - plt.plot(Gamma_Values, angles) - plt.scatter(Gamma_Values, angles) - # plt.plot(muGammas, angles) - # plt.scatter(muGammas, angles) - # # plt.axis([0, 6, 0, 20]) - # # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') - # # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') - # plt.axvline(x = q1, color = 'b', linestyle = ':', label='$q_1$') - # plt.axvline(x = q2, color = 'r', linestyle = 'dashed', label='$q_2$') - # # plt.axvline(x = q3_star, color = 'r', linestyle = 'dashed', label='$\gamma^*$') - - - - f,ax=plt.subplots(1) - # ax.plot(muGammas, angles) - # ax.scatter(muGammas, angles) - - ax.plot(Gamma_Values, angles) - ax.scatter(Gamma_Values, angles) - - - plt.xlabel("$q_3$") - plt.xlabel("$\gamma$") - plt.ylabel("angle") - ax.grid(True) - - - # ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) - # ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12)) - - # ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 4)) - # ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12)) - # ax.yaxis.set_major_formatter(plt.FuncFormatter(format_func)) - - # ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$')) - # ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.25)) - - - # ax.yaxis.set_major_formatter(ticker.FuncFormatter( - # lambda val,pos: '{:.0g}$\pi$'.format(2*val/np.pi) if val !=0 else '0')) - # ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.5*np.pi)) - - # ---------------------------- show pi values ------------------------------------ - # ax.axvline(x = q1, color = 'b', linestyle = ':', label='$q_1$') - # ax.axvline(x = q2, color = 'r', linestyle = 'dashed', label='$q_2$') - # ax.legend() - # # ax.set(xlim=(1.750, 1.880), ylim=(0, math.pi/2.0)) - # ax.set(xlim=(1.760, 1.880), ylim=(-0.1, np.pi/4.0)) - # # ax.set_yticks([0, np.pi/4 ,np.pi/2]) - # # labels = ['$0$', r'$\pi/4$', r'$\pi/2$'] - # ax.set_yticks([0, np.pi/8, np.pi/4 ]) - # labels = ['$0$',r'$\pi/8$', r'$\pi/4$'] - # ax.set_yticklabels(labels) - # --------------------------------------------------------------- - - ax.legend() - # ax.set(xlim=(1.750, 1.880), ylim=(0, math.pi/2.0)) - - # ax.set(xlim=(1.760, 1.880), ylim=(-0.1, np.pi/4.0)) - # ax.set(xlim=(1.760, 1.880), ylim=(-0.1, np.pi/4.0)) - # ax.set_yticks([0, np.pi/4 ,np.pi/2]) - # labels = ['$0$', r'$\pi/4$', r'$\pi/2$'] - ax.set_yticks([0, np.pi/8, np.pi/4 ]) - labels = ['$0$',r'$\pi/8$', r'$\pi/4$'] - ax.set_yticklabels(labels) - - - # Plot Gamma Value that is closest to q3_star - ax.axvline(x = gammaClose, color = 'b', linestyle = 'dashed', label='$\gamma^*$') - ax.axvspan(gamma_min, gammaClose, color='red', alpha=0.5) - ax.axvspan(gammaClose, gamma_max, color='green', alpha=0.5) - - - - - # plt.xlabel("$q_3(\gamma)$") - plt.xlabel("$\gamma$") - plt.ylabel("angle") - plt.legend(loc='upper center') - - plt.show() - - - - - # plt.figure() - # plt.title(r'angle$-\mu_\gamma(\gamma)$-Plot') - # plt.plot(muGammas, angles) - # plt.scatter(muGammas, angles) - # # plt.axis([0, 6, 0, 20]) - # # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') - # # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') - # plt.axvline(x = 1.90476, color = 'b', linestyle = ':', label='$q_1$') - # plt.axvline(x = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') - # plt.xlabel("$\mu_\gamma$") - # plt.ylabel("angle") - # plt.legend() - # plt.show() - # diff --git a/src/Plotq3-AngleOld.py b/src/Plotq3-AngleOld.py deleted file mode 100644 index b46195d8..00000000 --- a/src/Plotq3-AngleOld.py +++ /dev/null @@ -1,246 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import sympy as sym -import math -import os -import subprocess -import fileinput -import re -import matlab.engine -import sys -from ClassifyMin import * -# from CellScript import * -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.cm as cm -from vtk.util import numpy_support -from pyevtk.hl import gridToVTK -import time -# from subprocess import Popen, PIPE -#import sys - -# unabhängig von alpha... -def GetMuGamma(beta,theta,gamma,mu1,rho1, InputFilePath = os.path.dirname(os.getcwd()) +"/inputs/computeMuGamma.parset"): - # ------------------------------------ get mu_gamma ------------------------------ - # ---Scenario 1.1: extreme regimes - if gamma == '0': - print('extreme regime: gamma = 0') - mu_gamma = (1.0/6.0)*arithmeticMean(mu1, beta, theta) # = q2 - print("mu_gamma:", mu_gamma) - elif gamma == 'infinity': - print('extreme regime: gamma = infinity') - mu_gamma = (1.0/6.0)*harmonicMean(mu1, beta, theta) # = q1 - print("mu_gamma:", mu_gamma) - else: - # --- Scenario 1.2: compute mu_gamma with 'Compute_MuGamma' (much faster than running full Cell-Problem) - # print("Run computeMuGamma for Gamma = ", gamma) - with open(InputFilePath, 'r') as file: - filedata = file.read() - filedata = re.sub('(?m)^gamma=.*','gamma='+str(gamma),filedata) - # filedata = re.sub('(?m)^alpha=.*','alpha='+str(alpha),filedata) - filedata = re.sub('(?m)^beta=.*','beta='+str(beta),filedata) - filedata = re.sub('(?m)^theta=.*','theta='+str(theta),filedata) - filedata = re.sub('(?m)^mu1=.*','mu1='+str(mu1),filedata) - filedata = re.sub('(?m)^rho1=.*','rho1='+str(rho1),filedata) - f = open(InputFilePath,'w') - f.write(filedata) - f.close() - # --- Run Cell-Problem - - # Check Time - # t = time.time() - # subprocess.run(['./build-cmake/src/Cell-Problem', './inputs/cellsolver.parset'], - # capture_output=True, text=True) - # --- Run Cell-Problem_muGama -> faster - # subprocess.run(['./build-cmake/src/Cell-Problem_muGamma', './inputs/cellsolver.parset'], - # capture_output=True, text=True) - # --- Run Compute_muGamma (2D Problem much much faster) - - subprocess.run(['./build-cmake/src/Compute_MuGamma', './inputs/computeMuGamma.parset'], - capture_output=True, text=True) - # print('elapsed time:', time.time() - t) - - #Extract mu_gamma from Output-File TODO: GENERALIZED THIS FOR QUANTITIES OF INTEREST - with open(OutputFilePath, 'r') as file: - output = file.read() - tmp = re.search(r'(?m)^mu_gamma=.*',output).group() # Not necessary for Intention of Program t output Minimizer etc..... - s = re.findall(r"[-+]?\d*\.\d+|\d+", tmp) - mu_gamma = float(s[0]) - # print("mu_gamma:", mu_gammaValue) - # -------------------------------------------------------------------------------------- - return mu_gamma - - - - -InputFile = "/inputs/computeMuGamma.parset" -OutputFile = "/outputs/outputMuGamma.txt" -# path = os.getcwd() -# InputFilePath = os.getcwd()+InputFile -# OutputFilePath = os.getcwd()+OutputFile -# --------- Run from src folder: -path_parent = os.path.dirname(os.getcwd()) -os.chdir(path_parent) -path = os.getcwd() -print(path) -InputFilePath = os.getcwd()+InputFile -OutputFilePath = os.getcwd()+OutputFile -print("InputFilepath: ", InputFilePath) -print("OutputFilepath: ", OutputFilePath) -print("Path: ", path) - - -#1. Define Inputs Gamma-Array.. -#2. for(i=0; i<length(array)) ..compute Q_hom, B_eff from Cell-Problem -#3 - -# matrix = np.loadtxt(path + 'Qmatrix.txt', usecols=range(3)) -# print(matrix) - -# Use Shell Commands: -# subprocess.run('ls', shell=True) - - -#--------------------------------------------------------------- - -# -------------------------- Input Parameters -------------------- -mu1 = 10.0 -rho1 = 1.0 -alpha = 10 #1.05263158 -beta = 40.0 #5.0 -# theta = 1.0/4.0 -theta = 1.0/8.0 # 0.5 - -# InterestingParameterSet : -# mu1 = 10.0 -# rho1 = 1.0 -# alpha = 10 -# beta = 40.0 -# theta = 1.0/8.0 - - -#set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value -# gamma = '0' -# gamma = 'infinity' -# gamma = 0.5 - -print('---- Input parameters: -----') -print('mu1: ', mu1) -print('rho1: ', rho1) -print('alpha: ', alpha) -print('beta: ', beta) -print('theta: ', theta) -# print('gamma:', gamma) -print('----------------------------') -# ---------------------------------------------------------------- - - - - - -Gamma_Values = np.linspace(0.01, 5, num=20) # TODO variable Input Parameters...alpha,beta... -print('(Input) Gamma_Values:', Gamma_Values) -# mu_gamma = [] - - -# -# # --- Options -# RUN = True -# # RUN = False -# # make_Plot = False -make_Plot = True # vll besser : Plot_muGamma -# -# if RUN: -# for gamma in Gamma_Values: -# print("Run Cell-Problem for Gamma = ", gamma) -# # print('gamma='+str(gamma)) -# with open(InputFilePath, 'r') as file: -# filedata = file.read() -# filedata = re.sub('(?m)^gamma=.*','gamma='+str(gamma),filedata) -# f = open(InputFilePath,'w') -# f.write(filedata) -# f.close() -# # --- Run Cell-Problem -# t = time.time() -# # subprocess.run(['./build-cmake/src/Cell-Problem', './inputs/cellsolver.parset'], -# # capture_output=True, text=True) -# # --- Run Cell-Problem_muGama -> faster -# # subprocess.run(['./build-cmake/src/Cell-Problem_muGamma', './inputs/cellsolver.parset'], -# # capture_output=True, text=True) -# # --- Run Compute_muGamma (2D Problem much much faster) -# subprocess.run(['./build-cmake/src/Compute_MuGamma', './inputs/computeMuGamma.parset'], -# capture_output=True, text=True) -# print('elapsed time:', time.time() - t) -# -# #Extract mu_gamma from Output-File TODO: GENERALIZED THIS FOR QUANTITIES OF INTEREST -# with open(OutputFilePath, 'r') as file: -# output = file.read() -# tmp = re.search(r'(?m)^mu_gamma=.*',output).group() # Not necessary for Intention of Program t output Minimizer etc..... -# s = re.findall(r"[-+]?\d*\.\d+|\d+", tmp) -# mu_gammaValue = float(s[0]) -# print("mu_gamma:", mu_gammaValue) -# mu_gamma.append(mu_gammaValue) -# # ------------end of for-loop ----------------- -# print("(Output) Values of mu_gamma: ", mu_gamma) -# # ----------------end of if-statement ------------- -# -# # mu_gamma=[2.06099, 1.90567, 1.905] -# # mu_gamma=[2.08306, 1.905, 1.90482, 1.90479, 1.90478, 1.90477] -# -# ##Gamma_Values = np.linspace(0.01, 20, num=12) : -# #mu_gamma= [2.08306, 1.91108, 1.90648, 1.90554, 1.90521, 1.90505, 1.90496, 1.90491, 1.90487, 1.90485, 1.90483, 1.90482] -# -# ##Gamma_Values = np.linspace(0.01, 2.5, num=12) -# # mu_gamma=[2.08306, 2.01137, 1.96113, 1.93772, 1.92592, 1.91937, 1.91541, 1.91286, 1.91112, 1.90988, 1.90897, 1.90828] -# -# # Gamma_Values = np.linspace(0.01, 2.5, num=6) -# # mu_gamma=[2.08306, 1.95497, 1.92287, 1.91375, 1.9101, 1.90828] - - -GetMuGammaVec = np.vectorize(GetMuGamma) -muGammas = GetMuGammaVec(beta,theta,Gamma_Values,mu1,rho1) - - -classifyMin_anaVec = np.vectorize(classifyMin_ana) - -G, angles, Types, curvature = classifyMin_anaVec(alpha, beta, theta, muGammas, mu1, rho1) -# _,angles,_,_ = classifyMin_anaVec(alpha, beta, theta, muGammas, mu1, rho1) - -print('angles:', angles) - -# Make Plot -if make_Plot: - plt.figure() - plt.title(r'angle$-\mu_\gamma(\gamma)$-Plot') - plt.plot(muGammas, angles) - plt.scatter(muGammas, angles) - # plt.axis([0, 6, 0, 20]) - # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') - # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') - plt.axvline(x = 1.90476, color = 'b', linestyle = ':', label='$q_1$') - plt.axvline(x = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') - plt.xlabel("$\mu_\gamma$") - plt.ylabel("angle") - plt.legend() - plt.show() - -# -# # ------------- RUN Matlab symbolic minimization program -# eng = matlab.engine.start_matlab() -# # s = eng.genpath(path + '/Matlab-Programs') -# s = eng.genpath(path) -# eng.addpath(s, nargout=0) -# # print('current Matlab folder:', eng.pwd(nargout=1)) -# eng.cd('Matlab-Programs', nargout=0) #switch to Matlab-Programs folder -# # print('current Matlab folder:', eng.pwd(nargout=1)) -# Inp = False -# print('Run symbolic Minimization...') -# G, angle, type, kappa = eng.symMinimization(Inp,Inp,Inp,Inp, nargout=4) #Name of program:symMinimization -# # G, angle, type, kappa = eng.symMinimization(Inp,Inp,Inp,Inp,path + "/outputs", nargout=4) #Optional: add Path -# G = np.asarray(G) #cast Matlab Outout to numpy array -# -# # --- print Output --- -# print('Minimizer G:') -# print(G) -# print('angle:', angle) -# print('type:', type ) -# print('curvature:', kappa) diff --git a/src/Plotq3-AngleV1.py b/src/Plotq3-AngleV1.py deleted file mode 100644 index cd07176c..00000000 --- a/src/Plotq3-AngleV1.py +++ /dev/null @@ -1,147 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import sympy as sym -import math -import os -import subprocess -import fileinput -import re -import matlab.engine -import sys -from ClassifyMin import * -from HelperFunctions import * -# from CellScript import * -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.cm as cm -from vtk.util import numpy_support -from pyevtk.hl import gridToVTK -import time - - - - -InputFile = "/inputs/computeMuGamma.parset" -OutputFile = "/outputs/outputMuGamma.txt" -# --------- Run from src folder: -path_parent = os.path.dirname(os.getcwd()) -os.chdir(path_parent) -path = os.getcwd() -print(path) -InputFilePath = os.getcwd()+InputFile -OutputFilePath = os.getcwd()+OutputFile -print("InputFilepath: ", InputFilePath) -print("OutputFilepath: ", OutputFilePath) -print("Path: ", path) - -print('---- Input parameters: -----') -mu1 = 10.0 -rho1 = 1.0 -alpha = 2.8 -beta = 2.0 -theta = 1.0/4.0 -# gamma = 0.75 -#set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value -# gamma = '0' -# gamma = 'infinity' -# gamma = 0.5 - - -print('mu1: ', mu1) -print('rho1: ', rho1) -print('alpha: ', alpha) -print('beta: ', beta) -print('theta: ', theta) -# print('gamma:', gamma) -print('----------------------------') - -# ---------------------------------------------------------------- - - - - - -Gamma_Values = np.linspace(0.01, 5, num=15) # TODO variable Input Parameters...alpha,beta... -print('(Input) Gamma_Values:', Gamma_Values) -# mu_gamma = [] - - -# -# # --- Options -# RUN = True -# # RUN = False -# # make_Plot = False -make_Plot = True # vll besser : Plot_muGamma -# -# if RUN: -# for gamma in Gamma_Values: -# print("Run Cell-Problem for Gamma = ", gamma) -# # print('gamma='+str(gamma)) -# with open(InputFilePath, 'r') as file: -# filedata = file.read() -# filedata = re.sub('(?m)^gamma=.*','gamma='+str(gamma),filedata) -# f = open(InputFilePath,'w') -# f.write(filedata) -# f.close() -# # --- Run Cell-Problem -# t = time.time() -# # subprocess.run(['./build-cmake/src/Cell-Problem', './inputs/cellsolver.parset'], -# # capture_output=True, text=True) -# # --- Run Cell-Problem_muGama -> faster -# # subprocess.run(['./build-cmake/src/Cell-Problem_muGamma', './inputs/cellsolver.parset'], -# # capture_output=True, text=True) -# # --- Run Compute_muGamma (2D Problem much much faster) -# subprocess.run(['./build-cmake/src/Compute_MuGamma', './inputs/computeMuGamma.parset'], -# capture_output=True, text=True) -# print('elapsed time:', time.time() - t) -# -# #Extract mu_gamma from Output-File TODO: GENERALIZED THIS FOR QUANTITIES OF INTEREST -# with open(OutputFilePath, 'r') as file: -# output = file.read() -# tmp = re.search(r'(?m)^mu_gamma=.*',output).group() # Not necessary for Intention of Program t output Minimizer etc..... -# s = re.findall(r"[-+]?\d*\.\d+|\d+", tmp) -# mu_gammaValue = float(s[0]) -# print("mu_gamma:", mu_gammaValue) -# mu_gamma.append(mu_gammaValue) -# # ------------end of for-loop ----------------- -# print("(Output) Values of mu_gamma: ", mu_gamma) -# # ----------------end of if-statement ------------- -# -# # mu_gamma=[2.06099, 1.90567, 1.905] -# # mu_gamma=[2.08306, 1.905, 1.90482, 1.90479, 1.90478, 1.90477] -# -# ##Gamma_Values = np.linspace(0.01, 20, num=12) : -# #mu_gamma= [2.08306, 1.91108, 1.90648, 1.90554, 1.90521, 1.90505, 1.90496, 1.90491, 1.90487, 1.90485, 1.90483, 1.90482] -# -# ##Gamma_Values = np.linspace(0.01, 2.5, num=12) -# # mu_gamma=[2.08306, 2.01137, 1.96113, 1.93772, 1.92592, 1.91937, 1.91541, 1.91286, 1.91112, 1.90988, 1.90897, 1.90828] -# -# # Gamma_Values = np.linspace(0.01, 2.5, num=6) -# # mu_gamma=[2.08306, 1.95497, 1.92287, 1.91375, 1.9101, 1.90828] - - -GetMuGammaVec = np.vectorize(GetMuGamma) -muGammas = GetMuGammaVec(beta,theta,Gamma_Values,mu1,rho1) - - -classifyMin_anaVec = np.vectorize(classifyMin_ana) - -G, angles, Types, curvature = classifyMin_anaVec(alpha, beta, theta, muGammas, mu1, rho1) -# _,angles,_,_ = classifyMin_anaVec(alpha, beta, theta, muGammas, mu1, rho1) - -print('angles:', angles) - -# Make Plot -if make_Plot: - plt.figure() - plt.title(r'angle$-\mu_\gamma(\gamma)$-Plot') - plt.plot(muGammas, angles) - plt.scatter(muGammas, angles) - # plt.axis([0, 6, 0, 20]) - # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') - # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') - plt.axvline(x = 1.90476, color = 'b', linestyle = ':', label='$q_1$') - plt.axvline(x = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') - plt.xlabel("$\mu_\gamma$") - plt.ylabel("angle") - plt.legend() - plt.show() diff --git a/src/plot-q3-gamma.py b/src/plot-q3-gamma.py index 9d44bdf7..616f2f67 100644 --- a/src/plot-q3-gamma.py +++ b/src/plot-q3-gamma.py @@ -127,7 +127,8 @@ mpl.rcParams["font.size"] = "9" width = 6.28 *0.5 height = width / 1.618 fig = plt.figure() -ax = plt.axes((0.15,0.18,0.8,0.8)) +# ax = plt.axes((0.15,0.18,0.8,0.8)) +ax = plt.axes((0.15,0.21 ,0.8,0.75)) ax.tick_params(axis='x',which='major', direction='out',pad=3) ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) ax.xaxis.set_major_locator(MultipleLocator(0.5)) @@ -141,7 +142,8 @@ markerfacecolor='orange', # marker facecolor markeredgecolor='black', # marker edgecolor markeredgewidth=1, # marker edge width # linestyle='--', # line style will be dash line -linewidth=1) # line width +linewidth=1, +zorder=3) # line width ax.set_xlabel(r"$\gamma$") -- GitLab