This notebooks aims to collect the simulation output and to produce the plots.
In [1]:
%matplotlib inline
import numpy as np
import json
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.animation import FuncAnimation
from IPython.display import HTML
from scipy import interpolate
import os
from results import *
from os import listdir
from os.path import isfile, join
import re
In [2]:
scenario = "short-term"
files = {
"Detailed model": "cases/1/scenario_shortterm/model_complete/bc_pump/simulation.output.json",
"Simplified model": "cases/1/scenario_shortterm/model_simplified/bc_pump/simulation.output.json",
"No Biofouling": "cases/1/scenario_shortterm/model_complete/bc_pump/simulationwithoutbiofilm.output.json",
}
dict_dynamic = read_all_data(files)
ix_list = (1,2,4,34)
line_style_list = ('k-','k--','k-.','k:')
it_list = [0,20-1,40-1,-1]
In [3]:
case1 = "Detailed model"
case2 = "Simplified model"
case3 = "No Biofouling"
plot_dict = prepare_data_0(dict_dynamic,case1,case2,case3)
plot_curves_0(plot_dict, scenario=scenario)
In [4]:
plot_dict = prepare_data_1(dict_dynamic, case1, case2, case3)
plot_curves_1(plot_dict, scenario=scenario)
In [5]:
plot_dict = prepare_data_2(dict_dynamic, case1)
plot_curves_2(plot_dict, ix_list, line_style_list, scenario=scenario)
In [6]:
plot_dict = prepare_data_3(dict_dynamic, case1)
plot_curves_3(plot_dict, line_style_list, it_list)
In [7]:
variable = 'condenser.Rfbiofilm'
ymin = 0.0
ymax = 0.16
Rast = np.linspace(ymin, ymax, 100)
y2 = Rast
x2 = Rast / 0.62 * 1e3
plot_violins(dict_dynamic, case1, variable, x2, y2,
x2title = 'Aprox. Biofilm Thickness',
x2label = 'Thickness ($\mu$m)',
yname = 'Fouling resistance (10$^{-3}$ W/(m$^2$K))',
ymin=ymin, ymax=ymax, iy_list = (0, -1),
color1 = 'lightgray', color2 = 'black', factor = 1e3)
In [8]:
def get_fT(Tast):
sigmoid = 1 * np.exp(0.6221 * (Tast - 315.34)) / (1 + np.exp(0.6221 * (Tast - 315.34)))
k27_mf = 0.599
k_mf = 1.624e7 * Tast * np.exp(-1000 * 13.609 / 1.987 / Tast) * (1 - sigmoid)
f_T = k_mf/k27_mf
return f_T
variable = 'condenser.Tbf'
ymin = 303.
ymax = 322
y2 = np.linspace(ymin,ymax,100)
x2 = get_fT(y2)
plot_violins(dict_dynamic, case1, variable, x2, y2,
x2title = 'Temp. correction factor',
x2label = 'f$_T$ (-)',
yname = 'Biofilm Temperatre (K)',
ymin=ymin, ymax=ymax, iy_list = (0, -1),
color1 = 'bisque', color2 = 'red', )
In [9]:
def get_Jp_ast(vast):
Jp_ast = (-0.64471142125945 * vast + 1.06584376558659) / (1. + np.exp(20 * ((vast - 1.59))))
return Jp_ast
variable = 'condenser.vbf'
ymin = 0.99
ymax = 1.05
y2 = np.linspace(ymin,ymax,100)
x2 = get_Jp_ast(y2)
plot_violins(dict_dynamic, case1, variable, x2, y2,
x2title = 'Prod. flux of reference',
x2label = '$f_P^*$ (-)',
yname = 'Cooling water velocity (m/s)',
ymin=ymin, ymax=ymax, iy_list = (0, -1),
color1 = 'skyblue', color2 = 'blue')
In [10]:
variable = 'condenser.Rfbiofilm'
xvariable = 'condenser.L'
levels = (0.05, 0.075, 0.10, 0.125, 0.150)
color = "black"
title = 'Fouling resistance (10$^{-3}$ W/(m$^2$K))'
plot_contour(dict_dynamic, case1, variable, xvariable, levels, color, title, factor = 1e3)
In [11]:
variable = 'condenser.Tbf'
xvariable = 'condenser.L'
levels = (306,308,310,312,314,316,318,320,322)
color = "red"
title = 'Biofilm temperature (K) at {} days'
plot_contour(dict_dynamic, case1, variable, xvariable, levels, color, title)
In [12]:
scenario_ = scenario
mypath = "./pdfs/"
file_kind = "pdf"
onlyfiles = [f[:-4] for f in listdir(mypath) if (isfile(join(mypath, f)) and f[-len(file_kind):] == file_kind and re.match(scenario_,f))]
for name in onlyfiles:
name2 = name.replace("-","_").replace(".","_")
txt = r"\begin{figure} \centering \includegraphics[scale=0.5]{{"+name+r"}.pdf} \caption{"+name2+r"} \label{"+name2+r"} \end{figure}"
print("%s"%txt)
print()
In [ ]: