From 322a1627f106fe783ea3fc741db23f94a21a6c9f Mon Sep 17 00:00:00 2001
From: weisse02 <andreas.weissenbrunner@ptb.de>
Date: Fri, 17 Mar 2023 18:35:47 +0100
Subject: [PATCH] added a script that plots profiles for the paper

---
 HelpingFunctions/get_fully_SA.py |  2 +-
 PlotProfiles_for_paper.py        | 93 ++++++++++++++++++++++++++++++++
 plot_coeffs.py                   | 19 +++----
 3 files changed, 104 insertions(+), 10 deletions(-)
 create mode 100644 PlotProfiles_for_paper.py

diff --git a/HelpingFunctions/get_fully_SA.py b/HelpingFunctions/get_fully_SA.py
index 9d41d1e..087ab6e 100644
--- a/HelpingFunctions/get_fully_SA.py
+++ b/HelpingFunctions/get_fully_SA.py
@@ -34,4 +34,4 @@ def get_fully_SA(r):
     # plt.plot(r_fully_o,u_fully_o)
     # plt.plot(r,f_fully(r))
     return np.nan_to_num(f_fully(r))
-    #  --------------------------------------------------------------
\ No newline at end of file
+    #  --------------------------------------------------------------
diff --git a/PlotProfiles_for_paper.py b/PlotProfiles_for_paper.py
new file mode 100644
index 0000000..706a0d9
--- /dev/null
+++ b/PlotProfiles_for_paper.py
@@ -0,0 +1,93 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Fri Mar 17 18:09:39 2023
+
+@author: weisse02
+
+
+plot 2D profiles for paper
+"""
+
+# 
+
+
+import wx
+import matplotlib
+from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
+from matplotlib.figure import Figure
+import matplotlib.colors as mcolors
+
+import numpy as np
+
+from matplotlib.ticker import MaxNLocator
+
+import os
+import scipy.interpolate as interpol
+import matplotlib.pyplot as plt
+import json
+from math import pi
+import sys
+#
+sys.path.append('./HelpingFunctions')
+sys.path.append('./FlowProfiles')
+sys.path.append('./')
+from FlowMeter import FlowMeter 
+from Flow_class import Elbow_profile
+#sys.path.append('../../FlowProfiles')
+# import gh-class from global directory 
+#from class_flowprofiles import flowprofiles
+#sys.path.append('E:/NextCloud/GlobalPyFunc/')
+from niceplot import *
+#from Integrate2D import Tri_Int
+
+#from get_fully_SA import get_fully_SA
+#from GetElbowProfile import GetElbowProfile
+#import Integrate2D 
+import Integrate2D as int2d
+# python debugger
+import pandas as pd
+
+
+# sys.path.append('E:/NextCloud/GlobalPyFunc/')
+
+def get_fully_SA(r):
+    #  --------------------------------------------------------------
+    R    = 0.1/2
+    uvol = 0.4
+    # get fully developed flow profile from Spalart-Allmaras Simulation
+    fullyfile = os.path.abspath("./HelpingFunctions/ProfileLine_SA.csv")
+    fullydata = pd.read_csv(fullyfile)
+    fullydata = fullydata.rename(columns={"U:0": "U_0", "U:1": "U_1" , "U:2": "U_2","Points:0": "x","Points:1": "y","Points:2": "z"})
+    u_fully_o = fullydata.U_2 / uvol
+    r_fully_o = fullydata.y /R
+    #r_fully_o = np.append(r_fully_o, 1)
+    #print(r_fully_o)
+    #u_fully_o[-1] = 0
+    # a function that can be evaluated at any r by (linear) interpolation
+    #f_fully = interpol.interp1d(r_fully_o,u_fully_o,fill_value=0)
+    #print(u_fully_o)
+    f_fully = interpol.Akima1DInterpolator(r_fully_o,u_fully_o)
+    #f_fully = np.nan_to_num(f_fully)
+    # plt.figure()
+    # plt.plot(r_fully_o,u_fully_o)
+    # plt.plot(r,f_fully(r))
+    return np.nan_to_num(f_fully(r))
+    #  --------------------------------------------------------------
+
+
+
+
+
+flow = Elbow_profile('Double_S_Elbow')
+ufully = get_fully_SA(flow.r.ravel())
+Rks = [0.51,1.67375,3.38375]
+rk = 1.17604257
+dls = [0,5,10]
+dist = 6
+for dl in dls:
+    u = flow.get_profile(Rk=rk,dl=dl,dist=dist,addfully=False)
+    u = u.reshape(3,-1)
+    u[2] += ufully
+    nicecontour(flow.x,flow.y,u,minval=0.48,maxval=1.13,scalefac=0.3)
+    plt.tight_layout()
+    plt.savefig("C:/Users/weisse02/PTBbox/VirtMet/Auswertung_paper/Profile_plots/" + flow.case + "_rk_" + str(rk) + "_dist_" + str(dist) + "_dl_" + str(dl) + ".pdf")
\ No newline at end of file
diff --git a/plot_coeffs.py b/plot_coeffs.py
index 763a900..95bd60d 100644
--- a/plot_coeffs.py
+++ b/plot_coeffs.py
@@ -6,7 +6,7 @@ Created on Tue Feb 28 14:09:14 2023
 """
 
 from Flow_class import *
-
+import matplotlib.pyplot as plt
 
 MEDIUM_SIZE = 20
 plt.rc('font', size=MEDIUM_SIZE)          # controls default text sizes
@@ -18,7 +18,7 @@ plt.rc('legend', fontsize=MEDIUM_SIZE)    # legend fontsize
 plt.rc('figure', titlesize=MEDIUM_SIZE)
 
 savepath = "C:/Users/weisse02/PTBbox/VirtMet/Auswertung_paper/Mode_Plots/Coeffs_plot/"
-case = "Double_S_Elbow"
+case = "DoubleElbow"
 coeffs,modes,umean = loadPODres(case)
 
 flow = Elbow_profile(case)
@@ -29,19 +29,20 @@ dldist,distdl = np.meshgrid(flow.dl,flow.dist,indexing="ij")
 
 # plot over rk, dist
 nicecontour(rkdist.ravel(),distrk.ravel(),coeffs[:,0,:,0].ravel(),polar=False,equalsize =False)
-plt.xlabel("Rc in D")
-plt.ylabel("Distance z in D")
+plt.xlabel("$R_c$ in $D$")
+plt.ylabel("$z$ in $D$")
 plt.tight_layout()
+
 plt.savefig(savepath + case + "_M0_rcdist.pdf")
 
-nicecontour(rkdl.ravel(),dlrk.ravel(),coeffs[:,:,0,0].ravel(),polar=False,equalsize =False)
-plt.xlabel("Rc in D")
-plt.ylabel("dl in D")
+nicecontour(rkdl.ravel(),dlrk.ravel(),coeffs[:,:,10,0].ravel(),polar=False,equalsize =False)
+plt.xlabel("$R_c$ in $D$")
+plt.ylabel("$d_l$ in $D$")
 plt.tight_layout()
 plt.savefig(savepath + case + "_M0_rcdl_dist0.pdf")
 
 nicecontour(dldist.ravel(),distdl.ravel(),coeffs[0,:,:,0].ravel(),polar=False,equalsize =False)
-plt.xlabel("Rc in D")
-plt.ylabel("dl in D")
+plt.xlabel("$d_l$ in $D$")
+plt.ylabel("$z$ in $D$")
 plt.tight_layout()
 plt.savefig(savepath + case + "_M0_dldist_rk0.pdf")
-- 
GitLab