-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #380 from TristanHehnen/master
BUWFZJ: Added Initial Plotting Scripts for Parallel Panel Simulation
- Loading branch information
Showing
10 changed files
with
3,130 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...arallel_Panel/Computational_Results/2023/BUWFZJ/NIST_Parallel_Panel_BUWFZJ_cmp_config.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Exp_Filename ,Exp_Header_Row,Exp_Data_Row,Exp_x_Col_Name,Exp_y_Col_Name,Exp_Data_Label ,Exp_Marker_Style,Cmp_Filename ,Cmp_Header_Row,Cmp_Data_Row,Cmp_x_Col_Name,Cmp_y_Col_Name,Cmp_Data_Label,Cmp_Marker_Style,Cmp_Line_Style,Plot_Title ,Plot_x_Label,Plot_y_Label ,Plot_x_Min,Plot_x_Max,Plot_y_Min,Plot_y_Max,Plot_Legend_Location,Plot_Filename | ||
PMMA_HRR_qrad_R6.csv ,1,3,Time,HRR,Exp ,o ,PP_C5_01_cat_hrr.csv ,2,3,Time,HRR,Sim (2.0 cm), ,- ,NIST Parallel Panels ,Time (s),Heat Release Rate (kW),0,900,0,4000,upper right ,NIST_Parallel_Panel_HRR_BUWFZJ.pdf |
23 changes: 23 additions & 0 deletions
23
...T_Parallel_Panel/Computational_Results/2023/BUWFZJ/NIST_Parallel_Panel_plot_BUWFZJ_cmp.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/python3 | ||
# T. Hehnen | ||
# 24 August 2023 | ||
|
||
import sys | ||
sys.path.append('../../../../../../macfp-db/Utilities/') | ||
|
||
import macfp | ||
import importlib | ||
importlib.reload(macfp) # use for development (while making changes to macfp.py) | ||
import matplotlib.pyplot as plt | ||
|
||
macfp.dataplot(config_filename='NIST_Parallel_Panel_BUWFZJ_cmp_config.csv', | ||
institute='BUW-FZJ', | ||
revision='MaCFP-3, Tsukuba, 2023', | ||
expdir='../../../Experimental_Data/', | ||
cmpdir='./Output/', | ||
pltdir='./Output/Plots/', | ||
close_figs=True, | ||
verbose=True, | ||
plot_list=['all']) | ||
|
||
# plt.show() |
363 changes: 363 additions & 0 deletions
363
...wth/NIST_Parallel_Panel/Computational_Results/2023/BUWFZJ/Output/MaCFP_Burner_04_devc.csv
Large diffs are not rendered by default.
Oops, something went wrong.
278 changes: 278 additions & 0 deletions
278
...wth/NIST_Parallel_Panel/Computational_Results/2023/BUWFZJ/Output/MaCFP_Burner_08_devc.csv
Large diffs are not rendered by default.
Oops, something went wrong.
183 changes: 183 additions & 0 deletions
183
...wth/NIST_Parallel_Panel/Computational_Results/2023/BUWFZJ/Output/MaCFP_Burner_09_devc.csv
Large diffs are not rendered by default.
Oops, something went wrong.
131 changes: 131 additions & 0 deletions
131
...wth/NIST_Parallel_Panel/Computational_Results/2023/BUWFZJ/Output/MaCFP_Burner_10_devc.csv
Large diffs are not rendered by default.
Oops, something went wrong.
977 changes: 977 additions & 0 deletions
977
...Growth/NIST_Parallel_Panel/Computational_Results/2023/BUWFZJ/Output/PP_C5_01_cat_devc.csv
Large diffs are not rendered by default.
Oops, something went wrong.
978 changes: 978 additions & 0 deletions
978
..._Growth/NIST_Parallel_Panel/Computational_Results/2023/BUWFZJ/Output/PP_C5_01_cat_hrr.csv
Large diffs are not rendered by default.
Oops, something went wrong.
175 changes: 175 additions & 0 deletions
175
...NIST_Parallel_Panel/Computational_Results/2023/BUWFZJ/plot_burner_heat_flux_centerline.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
#!/usr/bin/python3 | ||
# T. Hehnen | ||
# 24 August 2023 | ||
|
||
import sys | ||
sys.path.append('../../../../../../macfp-db/Utilities/') | ||
|
||
import os | ||
import macfp | ||
import importlib | ||
importlib.reload(macfp) # use for development (while making changes to macfp.py) | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
import pandas as pd | ||
|
||
plt.close('all') | ||
|
||
|
||
# Define general information. | ||
# ------------------------------ | ||
# Basic information about cases. | ||
burner_sim_info = { | ||
"MaCFP_Burner_04": { | ||
"FluidCells": "2.0 cm", | ||
"fps": 2}, | ||
"MaCFP_Burner_08": { | ||
"FluidCells": "1.0 cm", | ||
"fps": 2}, | ||
"MaCFP_Burner_09": { | ||
"FluidCells": "0.5 cm", | ||
"fps": 2}, | ||
# "MaCFP_Burner_10": { | ||
# "FluidCells": "0.5 cm", | ||
# "fps": 2} | ||
} | ||
|
||
# Initialise simulation data collection. | ||
burner_sims = dict() | ||
sim_dir = os.path.join("Output") | ||
|
||
|
||
# Device heights, in cm. | ||
heights = [20, 50, 75, 100] | ||
# Interesting times, in s. | ||
desired_times = [20, 40, 60, 80] | ||
|
||
# Define headers for experiment data extraction. | ||
hf_labels = ["HF_z20", "HF_z50", "HF_z75", "HF_z100"] | ||
u_hf_labels = ["u_exp_HF_z20", "u_exp_HF_z50", "u_exp_HF_z75", "u_exp_HF_z100"] | ||
# Define headers for simulation data extraction. | ||
devc_labels = ["HF_y0_z20", "HF_y0_z50", "HF_y0_z75", "HF_y0_z100"] | ||
|
||
# Define plot elements. | ||
colors = ['green', 'red', 'purple', 'brown'] | ||
line_styles = ['-', '--', '-.', ':'] | ||
|
||
|
||
# Read experiment data. | ||
# ------------------------------ | ||
# Read centre line heat flux to empty panel, from experiment. | ||
centreline_hf_path = os.path.join("..", "..", "..", "Experimental_Data", | ||
"Burner_HF_Centerline_multi-layer.csv") | ||
# First row as header and row with units skipped. | ||
centreline_hf_df = pd.read_csv(centreline_hf_path, header=0, skiprows=[1]) | ||
|
||
|
||
# Read simulation data. | ||
# ------------------------------ | ||
# Collect simulation responses. | ||
for sim_label in burner_sim_info: | ||
# Add dictionary per simulation setup. | ||
if sim_label not in list(burner_sims): | ||
# Prevent overwriting existing data ('CHID_hrr' and 'CHID_devc'). | ||
burner_sims[sim_label] = dict() | ||
|
||
# Read 'CHID_devc.csv'-file as Pandas DataFrame. | ||
devc_path = os.path.join(sim_dir, f"{sim_label}_devc.csv") | ||
devc_df = pd.read_csv(devc_path, sep=',', header=1) | ||
burner_sims[sim_label]["DEVC"] = devc_df | ||
|
||
# Simulation response. | ||
sim_fluxes = list() | ||
for time_id, desired_time in enumerate(desired_times): | ||
flux_avrgs = list() | ||
# Define time window to average over. | ||
base_frame = desired_time * burner_sim_info[sim_label]["fps"] | ||
frame_window = 3 | ||
|
||
# Go over desired DEVC labels. | ||
for devc_label in devc_labels: | ||
# Get CHID_devc data. | ||
devc_data = burner_sims[sim_label]["DEVC"] | ||
|
||
# Find time window over which to average. | ||
t_min = int(base_frame - frame_window) | ||
t_max = int(base_frame + frame_window + 1) | ||
# Compute average within the above window. | ||
flux_avrg = np.average(devc_data[devc_label][t_min:t_max].to_numpy()) | ||
flux_avrgs.append(flux_avrg) | ||
|
||
# Collect fluxes per time step. | ||
sim_fluxes.append(flux_avrgs) | ||
|
||
# Collect fluxes per sim setup. | ||
burner_sims[sim_label]["Fluxes"] = sim_fluxes | ||
|
||
|
||
# Create empty figure? | ||
f = macfp.plot_to_fig(x_data=[0,1], y_data=[0,1], marker_style='None',line_style='None') | ||
|
||
|
||
# Plot experiment data points per time step. | ||
for time_id, time_step in enumerate(centreline_hf_df["Time"]): | ||
# Get centre line heat flux per time step. | ||
hf_centre = centreline_hf_df.iloc[time_id][hf_labels].to_numpy() | ||
# Get related uncertainty. | ||
hf_u_centre = centreline_hf_df.iloc[time_id][u_hf_labels].to_numpy() | ||
|
||
# Define data series label. | ||
ds_label = f"Exp ({time_step} s)" | ||
|
||
# Plot experiment data points per time step. | ||
f = macfp.plot_to_fig(x_data=hf_centre, | ||
y_data=heights, | ||
data_label=ds_label, | ||
x_min=0,x_max=80, | ||
y_min=0,y_max=180, | ||
x_label='Heat Flux [kW/m²]', | ||
y_label='Height [cm]', | ||
marker_style='o', | ||
marker_edge_color=colors[time_id], | ||
marker_fill_color=colors[time_id], | ||
line_style=' ', | ||
show_legend=True, | ||
figure_right_adjust=0, | ||
legend_fontsize=10, | ||
figure_handle=f) | ||
|
||
# Draw error bars from reported experiment uncertainty, per time step. | ||
plt.errorbar(hf_centre, heights, | ||
xerr=hf_u_centre, | ||
capsize=4, fmt=' ', | ||
ecolor=colors[time_id]) | ||
|
||
|
||
# Plot simulation data points per time step. | ||
for sim_id, sim_label in enumerate(list(burner_sims)): | ||
# Get fluid cell size for setup. | ||
cell_size = burner_sim_info[sim_label]["FluidCells"] | ||
|
||
# burner_sims[sim_label]['Fluxes'] | ||
for time_id, time_step in enumerate(centreline_hf_df["Time"]): | ||
# Define data series label. | ||
ds_label = f"Sim ({time_step} s, {cell_size})" | ||
f = macfp.plot_to_fig(x_data=burner_sims[sim_label]['Fluxes'][time_id], | ||
y_data=heights, | ||
data_label=ds_label, | ||
x_min=0,x_max=80, | ||
y_min=0,y_max=180, | ||
x_label='Heat Flux [kW/m²]', | ||
y_label='Height [cm]', | ||
line_color=colors[time_id], | ||
line_style=line_styles[sim_id], | ||
show_legend=True, | ||
figure_right_adjust=0, | ||
legend_fontsize=10, | ||
figure_handle=f) | ||
|
||
|
||
# fig.tight_layout(pad=1.0, h_pad=0.0, w_pad=0.0, rect=[0.05, 0.05, 0.90, 0.95]) | ||
|
||
plot_dir = os.path.join(sim_dir, "Plots", "Burner_heatflux.pdf") | ||
plt.savefig(plot_dir) | ||
|
||
# plt.show() |