In [1]:
benchmark_id = '3a.1'
line_plots = [
    dict(name='free_energy', layout=dict(log_y=True, x_label=r'<i>t</i>', y_label=r'&#8497;', range_y=[1.8e6, 2.4e6], title="Free Energy v Time")),
    dict(name='solid_fraction', layout=dict(log_y=True, x_label=r'<i>t</i>')),
    dict(name='tip_position', layout=dict(log_y=True, x_label=r'<i>t</i>')),
    dict(name='phase_field_1500', layout=dict(aspect_ratio=1.0))
]
contour_plots = []
efficiency = True
In [2]:
# Parameters
benchmark_id = "8a.1"
line_plots = [
    {
        "name": "free_energy_1",
        "layout": {
            "x_label": "Time [a.u.]",
            "y_label": "Free Energy, &#8497;&nbsp;[a.u.]",
            "title": "<i>r</i><sub>0</sub>=0.99<i>r</i><sup>*</sup>",
        },
    },
    {
        "name": "solid_fraction_1",
        "layout": {
            "x_label": "Time [a.u.]",
            "y_label": "Solid Fraction, [a.u.]",
            "title": "<i>r</i><sub>0</sub>=0.99<i>r</i><sup>*</sup>",
        },
    },
    {
        "name": "free_energy_2",
        "layout": {
            "x_label": "Time [a.u.]",
            "y_label": "Free Energy, &#8497;&nbsp;[a.u.]",
            "title": "<i>r</i><sub>0</sub>=<i>r</i><sup>*</sup>",
        },
    },
    {
        "name": "solid_fraction_2",
        "layout": {
            "x_label": "Time [a.u.]",
            "y_label": "Solid Fraction, [a.u.]",
            "title": "<i>r</i><sub>0</sub>=<i>r</i><sup>*</sup>",
        },
    },
    {
        "name": "free_energy_3",
        "layout": {
            "x_label": "Time [a.u.]",
            "y_label": "Free Energy, &#8497;&nbsp;[a.u.]",
            "title": "<i>r</i><sub>0</sub>=1.01<i>r</i><sup>*</sup>",
        },
    },
    {
        "name": "solid_fraction_3",
        "layout": {
            "x_label": "Time [a.u.]",
            "y_label": "Solid Fraction, [a.u.]",
            "title": "<i>r</i><sub>0</sub>=1.01<i>r</i><sup>*</sup>",
        },
    },
]
contour_plots = [
    {
        "name": "phase_field_1",
        "columns": ["x", "y", "z"],
        "mask_z": [0.1, 0.9],
        "layout": {
            "levelset": 0.5,
            "range": [-10, 10],
            "title": "Solid / Liquid Boundary at t=200, <i>r</i><sub>0</sub>=0.99<i>r</i><sup>*</sup>",
        },
    },
    {
        "name": "phase_field_2",
        "columns": ["x", "y", "z"],
        "mask_z": [0.1, 0.9],
        "layout": {
            "levelset": 0.5,
            "range": [-10, 10],
            "title": "Solid / Liquid Boundary at t=200, <i>r</i><sub>0</sub>=<i>r</i><sup>*</sup>",
        },
    },
    {
        "name": "phase_field_3",
        "columns": ["x", "y", "z"],
        "mask_z": [0.1, 0.9],
        "layout": {
            "levelset": 0.5,
            "range": [-10, 10],
            "title": "Solid / Liquid Boundary at t=200, <i>r</i><sub>0</sub>=1.01<i>r</i><sup>*</sup>",
        },
    },
]
In [3]:
from IPython.display import display_markdown

display_markdown(f'''
# Benchmark { benchmark_id } Results

All results for the [{ benchmark_id } benchmark specification](../../benchmarks/benchmark{ benchmark_id }.ipynb/).
''', raw=True)

Benchmark 8a.1 Results

All results for the 8a.1 benchmark specification.

In [4]:
# To generate the comparison notebooks use:
# 
# papermill template.ipynb benchmark{version}.ipynb -f bm{version}.yaml
#
In [5]:
from IPython.display import HTML

HTML('''<script>
code_show=true; 
function code_toggle() {
 if (code_show){
 $('div.input').hide();
 $('div.prompt').hide();
 } else {
 $('div.input').show();
$('div.prompt').show();
 }
 code_show = !code_show
} 
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input type="submit" value="Code Toggle"></form>''')
Out[5]:
In [6]:
#from IPython.display import HTML, display
#from time import sleep

#display(HTML("""
#<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
#"""))

#sleep(0.1)

from IPython.display import HTML, display, display_markdown
from time import sleep

#import logging
#logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.DEBUG)

display(HTML("""
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
"""))

sleep(0.1)


from pfhub.main import line_plot, levelset_plot, get_table_data_style, plot_order_of_accuracy, get_result_data, efficiency_plot
#import itables.interactive
from itables import init_notebook_mode

init_notebook_mode(all_interactive=False)
In [7]:
colors = dict()

for x in line_plots:
    fig = line_plot(
        data_name=x['name'],
        benchmark_id=benchmark_id,
        layout=x['layout'],
        columns=x.get('columns', ('x', 'y'))
    )
    if 'extra_lines' in x:
        for kwargs in x['extra_lines']:
            fig.add_scatter(**kwargs)  
    for datum in fig['data']:
        name = datum['name']
        color = datum['line']['color']
        datum['line']['color'] = colors.get(name, color)
        colors[name] = datum['line']['color']
    fig.show()
In [8]:
for x in contour_plots:
    data = get_result_data([x['name']], [benchmark_id], x['columns'])

    levelset_plot(
        data,
        layout=x['layout'],
        mask_func=lambda df: (x['mask_z'][0] < df.z) & (df.z < x['mask_z'][1]),
        columns=x['columns']
    ).show()
In [9]:
if efficiency:
    efficiency_plot(benchmark_id).show()
    display_markdown("<span class='plotly-footnote' >* Wall time divided by the total simulated time.</span>", raw=True)

* Wall time divided by the total simulated time.

In [10]:
display_markdown(f'''
# Table of Results

Table of { benchmark_id } benchmark result uploads.
''', raw=True)

Table of Results

Table of 8a.1 benchmark result uploads.

In [11]:
## Currently switching off interactive tables as these are not converted to HTML properly.
## This might improve when jupyter-nbcovert is updated to a later version.

init_notebook_mode(all_interactive=False)
get_table_data_style(benchmark_id, pfhub_path='../..')
Out[11]:
Timestamp Name Code Author GitHub ID
2022-08-31 fipy_8a_10.5281/zenodo.7199253 fipy Daniel Wheeler None
2019-10-16 fipy_8a_fake FiPy Daniel Wheeler wd15
2019-10-16 fipy_8a_fake_fake FiPy Daniel Wheeler wd15
Upload Benchmark Results