Paper Results - Short-term Scenario

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

Initial Estimate constructors


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]


Reading cases/1/scenario_shortterm/model_complete/bc_pump/simulation.output.json
Reading cases/1/scenario_shortterm/model_simplified/bc_pump/simulation.output.json
Reading cases/1/scenario_shortterm/model_complete/bc_pump/simulationwithoutbiofilm.output.json

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)


Fouling resistance (10$^{-3}$ W/(m$^2$K))
/Users/jaimenms/PycharmProjects/celldeposit-condenser/.venv/lib/python3.6/site-packages/numpy/ma/core.py:6442: MaskedArrayFutureWarning: In the future the default for ma.minimum.reduce will be axis=0, not the current None, to match np.minimum.reduce. Explicitly pass 0 or None to silence this warning.
  return self.reduce(a)
/Users/jaimenms/PycharmProjects/celldeposit-condenser/.venv/lib/python3.6/site-packages/numpy/ma/core.py:6442: MaskedArrayFutureWarning: In the future the default for ma.maximum.reduce will be axis=0, not the current None, to match np.maximum.reduce. Explicitly pass 0 or None to silence this warning.
  return self.reduce(a)

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)


Biofilm temperature (K) at {} days
/Users/jaimenms/PycharmProjects/celldeposit-condenser/.venv/lib/python3.6/site-packages/numpy/ma/core.py:6442: MaskedArrayFutureWarning: In the future the default for ma.minimum.reduce will be axis=0, not the current None, to match np.minimum.reduce. Explicitly pass 0 or None to silence this warning.
  return self.reduce(a)
/Users/jaimenms/PycharmProjects/celldeposit-condenser/.venv/lib/python3.6/site-packages/numpy/ma/core.py:6442: MaskedArrayFutureWarning: In the future the default for ma.maximum.reduce will be axis=0, not the current None, to match np.maximum.reduce. Explicitly pass 0 or None to silence this warning.
  return self.reduce(a)

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()


\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve2_condenser.k}.pdf} \caption{short_term_curve2_condenser_k} \label{short_term_curve2_condenser_k} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve1_condenser.vbfoutlet}.pdf} \caption{short_term_curve1_condenser_vbfoutlet} \label{short_term_curve1_condenser_vbfoutlet} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve0_condenser.Pext}.pdf} \caption{short_term_curve0_condenser_Pext} \label{short_term_curve0_condenser_Pext} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve1_condenser.Rfbiofilmoutlet}.pdf} \caption{short_term_curve1_condenser_Rfbiofilmoutlet} \label{short_term_curve1_condenser_Rfbiofilmoutlet} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve1_condenser.Tbfinlet}.pdf} \caption{short_term_curve1_condenser_Tbfinlet} \label{short_term_curve1_condenser_Tbfinlet} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_violin_condenser.Rfbiofilm}.pdf} \caption{short_term_violin_condenser_Rfbiofilm} \label{short_term_violin_condenser_Rfbiofilm} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_violin_condenser.vbf}.pdf} \caption{short_term_violin_condenser_vbf} \label{short_term_violin_condenser_vbf} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_violin_condenser.Tbf}.pdf} \caption{short_term_violin_condenser_Tbf} \label{short_term_violin_condenser_Tbf} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve3_condenser.vbf}.pdf} \caption{short_term_curve3_condenser_vbf} \label{short_term_curve3_condenser_vbf} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve1_condenser.vbfinlet}.pdf} \caption{short_term_curve1_condenser_vbfinlet} \label{short_term_curve1_condenser_vbfinlet} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve3_condenser.Tbf}.pdf} \caption{short_term_curve3_condenser_Tbf} \label{short_term_curve3_condenser_Tbf} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve2_condenser.vbf}.pdf} \caption{short_term_curve2_condenser_vbf} \label{short_term_curve2_condenser_vbf} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve1_condenser.T}.pdf} \caption{short_term_curve1_condenser_T} \label{short_term_curve1_condenser_T} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve2_condenser.Rfbiofilm}.pdf} \caption{short_term_curve2_condenser_Rfbiofilm} \label{short_term_curve2_condenser_Rfbiofilm} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve2_condenser.Tbf}.pdf} \caption{short_term_curve2_condenser_Tbf} \label{short_term_curve2_condenser_Tbf} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve0_condenser.Qtotal}.pdf} \caption{short_term_curve0_condenser_Qtotal} \label{short_term_curve0_condenser_Qtotal} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve0_node_A.w}.pdf} \caption{short_term_curve0_node_A_w} \label{short_term_curve0_node_A_w} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve1_condenser.Rfbiofilminlet}.pdf} \caption{short_term_curve1_condenser_Rfbiofilminlet} \label{short_term_curve1_condenser_Rfbiofilminlet} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve3_condenser.mf}.pdf} \caption{short_term_curve3_condenser_mf} \label{short_term_curve3_condenser_mf} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_contour_condenser.Tbf}.pdf} \caption{short_term_contour_condenser_Tbf} \label{short_term_contour_condenser_Tbf} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve0_condenser.kcond}.pdf} \caption{short_term_curve0_condenser_kcond} \label{short_term_curve0_condenser_kcond} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve0_node_A.P}.pdf} \caption{short_term_curve0_node_A_P} \label{short_term_curve0_node_A_P} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve3_condenser.T}.pdf} \caption{short_term_curve3_condenser_T} \label{short_term_curve3_condenser_T} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_contour_condenser.Rfbiofilm}.pdf} \caption{short_term_contour_condenser_Rfbiofilm} \label{short_term_contour_condenser_Rfbiofilm} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve3_condenser.Rfbiofilm}.pdf} \caption{short_term_curve3_condenser_Rfbiofilm} \label{short_term_curve3_condenser_Rfbiofilm} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve2_condenser.T}.pdf} \caption{short_term_curve2_condenser_T} \label{short_term_curve2_condenser_T} \end{figure}

\begin{figure} \centering \includegraphics[scale=0.5]{{short-term_curve1_condenser.Tbfoutlet}.pdf} \caption{short_term_curve1_condenser_Tbfoutlet} \label{short_term_curve1_condenser_Tbfoutlet} \end{figure}


In [ ]: