Skip to content
Snippets Groups Projects
Select Git revision
  • c2c46dbc31d6f1d57b54dd07d2398c73c5bef8e5
  • master default protected
  • dev_2022
  • patch-1
  • develop
  • 50-use-ubuntus-libhidapi
  • issue-highLevelDispatch
  • issue-highLevelDesign
  • issue-motorStartBug
  • issue-commandLayerDesign
  • v1.0
  • v0.4-rc.13
  • v0.4-rc.12
  • v0.4-rc.11
  • v0.4-rc.10
  • v0.4-rc.9
  • v0.3-rc.8
  • v0.3-rc.7
  • v0.3-rc.6
  • v0.3-rc.5
  • v0.3-rc.4
  • v0.3-rc.3
  • v0.3-rc.2
  • v0.3-rc.1
  • v0.3-rc
  • v0.2
  • v0.1.1
  • v0.1
28 results

process.py

Blame
    • Tim Stadtmann's avatar
      c2c46dbc
      Add script for preprocessing before doc-build · c2c46dbc
      Tim Stadtmann authored
      The MATLAB-extension for Sphinx runs into an infinite loop if a class
      contains an enumeration definition. The implemented python parser script
      comments out all enumerations (a reverse function is also implemented).
      In a future release, a release-script will automate the calls of
      preprocess(), make html and postprocess().
      c2c46dbc
      History
      Add script for preprocessing before doc-build
      Tim Stadtmann authored
      The MATLAB-extension for Sphinx runs into an infinite loop if a class
      contains an enumeration definition. The implemented python parser script
      comments out all enumerations (a reverse function is also implemented).
      In a future release, a release-script will automate the calls of
      preprocess(), make html and postprocess().
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    VisConvergence.py 3.10 KiB
    '''
    Jan Habscheid
    Jan.Habscheid@rwth-aachen.de
    '''
    
    import matplotlib.pyplot as plt
    import numpy as np
    from scipy.interpolate import interp1d
    
    # Load data
    data = np.load('../Data/Convergence.npz')
    
    # Extract data
    number_cells_vec = data['number_cells_vec']
    y_A_error_L2 = data['y_A_error_L2']
    y_C_error_L2 = data['y_C_error_L2']
    y_S_error_L2 = data['y_S_error_L2']
    phi_error_L2 = data['phi_error_L2']
    p_error_L2 = data['p_error_L2']
    y_A_error_inf = data['y_A_error_inf']
    y_C_error_inf = data['y_C_error_inf']
    y_S_error_inf = data['y_S_error_inf']
    phi_error_inf = data['phi_error_inf']
    p_error_inf = data['p_error_inf']
    
    # Reference order
    x_ref = [1e+1, 1e+5]
    O1_2_ref = [10e+4, 10e+0]
    O2_2_ref = [10e-3, 10e-11]
    # O3_2_ref = [10e-8, 10e-20]
    O1_inf_ref = [10e+4, 10e+0]
    O2_inf_ref = [10e-4, 10e-12]
    # O3_inf_ref = [10e-1, 10e-13]
    Ref_Ord_marker = ['--', ':', '-.']
    
    
    # Plot the results
    fig, axs = plt.subplots(ncols=2, figsize=(30, 10))
    labelsize = 35
    lw = 6
    legend_width = 5
    ms = 25
    axs[0].loglog(number_cells_vec[:-1], y_A_error_L2, 'o-', label='$y_A$', lw=lw, ms=ms)
    axs[0].loglog(number_cells_vec[:-1], y_C_error_L2, 'o-', label='$y_C$', lw=lw, ms=ms)
    axs[0].loglog(number_cells_vec[:-1], y_S_error_L2, 'o-', label='$y_S$', lw=lw, ms=ms)
    axs[0].loglog(number_cells_vec[:-1], phi_error_L2, 'o-', label='$\\varphi$', lw=lw, ms=ms)
    axs[0].loglog(number_cells_vec[:-1], p_error_L2, 'o-', label='$p$', lw=lw, ms=ms)
    axs[0].loglog(x_ref, O1_2_ref, Ref_Ord_marker[0], color='tab:gray', label='$O(nx)^1$', lw=lw, ms=ms)
    axs[0].loglog(x_ref, O2_2_ref, Ref_Ord_marker[1], color='tab:gray', label='$O(nx)^2$', lw=lw, ms=ms)
    # axs[0].loglog(x_ref, O3_2_ref, Ref_Ord_marker[2], color='tab:gray', label='$O(nx)^3$', lw=lw, ms=ms)
    axs[0].set_xlabel('log(nx)', fontsize=labelsize)
    axs[0].set_ylabel('log($L_2$)', fontsize=labelsize)
    axs[0].grid()
    axs[0].tick_params(axis='both', labelsize=labelsize)
    
    axs[1].loglog(number_cells_vec[:-1], y_A_error_inf, 'o-', lw=lw, ms=ms)
    axs[1].loglog(number_cells_vec[:-1], y_C_error_inf, 'o-', lw=lw, ms=ms)
    axs[1].loglog(number_cells_vec[:-1], y_S_error_inf, 'o-', lw=lw, ms=ms)
    axs[1].loglog(number_cells_vec[:-1], phi_error_inf, 'o-', lw=lw, ms=ms)
    axs[1].loglog(number_cells_vec[:-1], p_error_inf, 'o-', lw=lw, ms=ms)
    axs[1].loglog(x_ref, O1_inf_ref, Ref_Ord_marker[0], color='tab:gray', lw=lw, ms=ms)
    axs[1].loglog(x_ref, O2_inf_ref, Ref_Ord_marker[1], color='tab:gray', label='$O(nx)^2$', lw=lw, ms=ms)
    # axs[1].loglog(x_ref, O3_inf_ref, Ref_Ord_marker[2], color='tab:gray', lw=lw, ms=ms)
    axs[1].set_xlabel('log(nx)', fontsize=labelsize)
    axs[1].set_ylabel('log($L_\infty$)', fontsize=labelsize)
    axs[1].grid()
    axs[1].tick_params(axis='both', labelsize=labelsize)
    
    # order = [0, 5, 1, 7, 2, 6, 3, 4] 
    order = [0, 5, 1, 6, 2, 3, 4] 
    lines_labels = [ax.get_legend_handles_labels() for ax in fig.axes]
    lines, labels = [sum(lol, []) for lol in zip(*lines_labels)]
    lgnd = fig.legend([lines[i] for i in order], [labels[i] for i in order], bbox_to_anchor=(0.81,1.2), ncol=5, fontsize=labelsize)
    for line in lgnd.get_lines():
        line.set_linewidth(legend_width)
    
    fig.tight_layout()
    fig.savefig('../Figures/Convergence.svg', bbox_inches='tight')
    fig.show()