385 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			385 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
{
 | 
						|
 "cells": [
 | 
						|
  {
 | 
						|
   "cell_type": "code",
 | 
						|
   "execution_count": null,
 | 
						|
   "metadata": {
 | 
						|
    "scrolled": true
 | 
						|
   },
 | 
						|
   "outputs": [],
 | 
						|
   "source": [
 | 
						|
    "from main import testing_ALE, testing_defs_ALE, testing_defs_ALE_CT\n",
 | 
						|
    "#testing_defs_ALE(solver_to_use='LU')\n",
 | 
						|
    "#testing_defs_ALE_CT(solver_to_use='LU')\n",
 | 
						|
    "dict_mt, dict_ct = testing_ALE(solver_to_use='LU') # 'LU', 'Krylov'"
 | 
						|
   ]
 | 
						|
  },
 | 
						|
  {
 | 
						|
   "cell_type": "code",
 | 
						|
   "execution_count": null,
 | 
						|
   "metadata": {},
 | 
						|
   "outputs": [],
 | 
						|
   "source": [
 | 
						|
    "import matplotlib.pyplot as plt\n",
 | 
						|
    "def testing_comparative_plots(dict_fields_mt: dict, dict_fields_ct: dict, *args) -> None:\n",
 | 
						|
    "    \"\"\"\n",
 | 
						|
    "    Computes error figures between the schemes with Jacobian evaluation at times {n, n+1}, i.e.\n",
 | 
						|
    "    with explicit and implicit treatment of the time-derivative term.\n",
 | 
						|
    "    ...\n",
 | 
						|
    "    \n",
 | 
						|
    "    Input Parameters\n",
 | 
						|
    "    ----------------\n",
 | 
						|
    "    dict_fields_mt : tuple -> (dict, dict, dict)\n",
 | 
						|
    "        tuple containing dictionaries of fields (def, vel, pre) from the iNSE ALE Monolithic solver.\n",
 | 
						|
    "    \n",
 | 
						|
    "    dict_fields_ct : tupel -> (dict, dict, dict)\n",
 | 
						|
    "        tuple containing dictionaries of fields (def, vel, pre) from the iNSE ALE CT solver. \n",
 | 
						|
    "    \"\"\"\n",
 | 
						|
    "    print(\"\\nComputing error figures for both schemes...\\n\")\n",
 | 
						|
    "    # Creates dictionaries for \"expanding\" and \"contracting\" functions\n",
 | 
						|
    "    # Time dictionary\n",
 | 
						|
    "    time_list = {\n",
 | 
						|
    "        'MT': {jac_name: [] for jac_name in dict_fields_mt.keys()},\n",
 | 
						|
    "        'CT': {jac_name: [] for jac_name in dict_fields_ct.keys()}\n",
 | 
						|
    "    }\n",
 | 
						|
    "    # Numerical dissipation dictionary --> int (| J^{n+1} u^{n+1} - J^{n} u^{n} |)\n",
 | 
						|
    "    dis_value_exp = {\n",
 | 
						|
    "        'MT': {jac_name: [] for jac_name in dict_fields_mt.keys()},\n",
 | 
						|
    "        'CT': {jac_name: [] for jac_name in dict_fields_ct.keys()}\n",
 | 
						|
    "    }\n",
 | 
						|
    "    dis_value_con = {\n",
 | 
						|
    "        'MT': {jac_name: [] for jac_name in dict_fields_mt.keys()},\n",
 | 
						|
    "        'CT': {jac_name: [] for jac_name in dict_fields_ct.keys()}\n",
 | 
						|
    "    }\n",
 | 
						|
    "    # Physical dissipation dictionary --> int ( 2*mu* | eps(u) |^2 )\n",
 | 
						|
    "    eps_value_exp = {\n",
 | 
						|
    "        'MT': {jac_name: [] for jac_name in dict_fields_mt.keys()},\n",
 | 
						|
    "        'CT': {jac_name: [] for jac_name in dict_fields_ct.keys()}\n",
 | 
						|
    "    }\n",
 | 
						|
    "    eps_value_con = {\n",
 | 
						|
    "        'MT': {jac_name: [] for jac_name in dict_fields_mt.keys()},\n",
 | 
						|
    "        'CT': {jac_name: [] for jac_name in dict_fields_ct.keys()}\n",
 | 
						|
    "    }\n",
 | 
						|
    "    # 'delta' values dictionary\n",
 | 
						|
    "    delta_value_exp = {\n",
 | 
						|
    "        'MT': {jac_name: [] for jac_name in dict_fields_mt.keys()},\n",
 | 
						|
    "        'CT': {jac_name: [] for jac_name in dict_fields_ct.keys()}\n",
 | 
						|
    "    }\n",
 | 
						|
    "    delta_value_con = {\n",
 | 
						|
    "        'MT': {jac_name: [] for jac_name in dict_fields_mt.keys()},\n",
 | 
						|
    "        'CT': {jac_name: [] for jac_name in dict_fields_ct.keys()}\n",
 | 
						|
    "    }\n",
 | 
						|
    "    # Normalized 'delta' values dictionary (w.r.t physical dissipation)\n",
 | 
						|
    "    delta_hat_value_exp = {\n",
 | 
						|
    "        'MT': {jac_name: [] for jac_name in dict_fields_mt.keys()},\n",
 | 
						|
    "        'CT': {jac_name: [] for jac_name in dict_fields_ct.keys()}\n",
 | 
						|
    "    }\n",
 | 
						|
    "    delta_hat_value_con = {\n",
 | 
						|
    "        'MT': {jac_name: [] for jac_name in dict_fields_mt.keys()},\n",
 | 
						|
    "        'CT': {jac_name: [] for jac_name in dict_fields_ct.keys()}\n",
 | 
						|
    "    }\n",
 | 
						|
    "    # Normalized 'delta' values dictionary (w.r.t numerical dissipation)\n",
 | 
						|
    "    delta_hat_dis_exp = {\n",
 | 
						|
    "        'MT': {jac_name: [] for jac_name in dict_fields_mt.keys()},\n",
 | 
						|
    "        'CT': {jac_name: [] for jac_name in dict_fields_ct.keys()}\n",
 | 
						|
    "    }\n",
 | 
						|
    "    delta_hat_dis_con = {\n",
 | 
						|
    "        'MT': {jac_name: [] for jac_name in dict_fields_mt.keys()},\n",
 | 
						|
    "        'CT': {jac_name: [] for jac_name in dict_fields_ct.keys()}\n",
 | 
						|
    "    }\n",
 | 
						|
    "    # Iterate over the different cases in MT (Monolithic) and CT (Chorin-Temam) schemes\n",
 | 
						|
    "    for scheme in ['MT', 'CT']: # 'MT', 'CT'\n",
 | 
						|
    "        if scheme == 'MT':\n",
 | 
						|
    "            dict_fields = dict_fields_mt\n",
 | 
						|
    "        else:\n",
 | 
						|
    "            dict_fields = dict_fields_ct\n",
 | 
						|
    "        # Iterate over different cases 'j_implicit', 'j_explicit'\n",
 | 
						|
    "        for jac_name in dict_fields.keys():\n",
 | 
						|
    "            dict_vel = dict_fields[jac_name][1]\n",
 | 
						|
    "            for i in range(len(dict_vel['High_Osc_exp'])):\n",
 | 
						|
    "                # Saving time steps\n",
 | 
						|
    "                time_list[scheme][jac_name].append(dict_vel['High_Osc_exp'][i][1])\n",
 | 
						|
    "                # Add 'delta' values\n",
 | 
						|
    "                delta_value_exp[scheme][jac_name].append(dict_vel['High_Osc_exp'][i][2])\n",
 | 
						|
    "                #delta_value_con[scheme][jac_name].append(dict_vel['High_Osc_con'][i][2])\n",
 | 
						|
    "                # Add physical dissipation\n",
 | 
						|
    "                eps_value_exp[scheme][jac_name].append(dict_vel['High_Osc_exp'][i][3])\n",
 | 
						|
    "                #eps_value_con[scheme][jac_name].append(dict_vel['High_Osc_con'][i][3])\n",
 | 
						|
    "                # Add numerical dissipation\n",
 | 
						|
    "                dis_value_exp[scheme][jac_name].append(dict_vel['High_Osc_exp'][i][4])\n",
 | 
						|
    "                #dis_value_con[scheme][jac_name].append(dict_vel['High_Osc_con'][i][4])\n",
 | 
						|
    "                # Compute normalized 'delta' values w.r.t the physical dissipation\n",
 | 
						|
    "                delta_hat_value_exp[scheme][jac_name].append(dict_vel['High_Osc_exp'][i][2]/dict_vel['High_Osc_exp'][i][3])\n",
 | 
						|
    "                #delta_hat_value_con[scheme][jac_name].append(dict_vel['High_Osc_con'][i][2]/dict_vel['High_Osc_con'][i][3])\n",
 | 
						|
    "                # Compute normalized 'delta' values w.r.t the numerical dissipation\n",
 | 
						|
    "                delta_hat_dis_exp[scheme][jac_name].append(dict_vel['High_Osc_exp'][i][2]/dict_vel['High_Osc_exp'][i][4])\n",
 | 
						|
    "                #delta_hat_dis_con[scheme][jac_name].append(dict_vel['High_Osc_con'][i][2]/dict_vel['High_Osc_con'][i][4])\n",
 | 
						|
    "\n",
 | 
						|
    "    # Auxiliary indexes for plotting\n",
 | 
						|
    "    # TODO: Test this line and automatize the \"100\"!\n",
 | 
						|
    "    init = 0\n",
 | 
						|
    "    out = 101 #len(time_list['CT']['j_implicit']) # at tau = 0.01, T = 2 --> 200 time steps\n",
 | 
						|
    "\n",
 | 
						|
    "    # ---------------------- #\n",
 | 
						|
    "    # DELTA VALUE CASE\n",
 | 
						|
    "    # ---------------------- #\n",
 | 
						|
    "    # CASE CT\n",
 | 
						|
    "    plt.subplots(figsize=(10, 4))\n",
 | 
						|
    "    # Top \n",
 | 
						|
    "    lf_ax = plt.subplot(1, 2, 2)\n",
 | 
						|
    "    lf_j_exp, = lf_ax.plot(time_list['CT']['j_explicit'][init:out], delta_value_exp['CT']['j_explicit'][init:out], color='blue', ls='--')\n",
 | 
						|
    "    lf_j_imp, = lf_ax.plot(time_list['CT']['j_implicit'][init:out], delta_value_exp['CT']['j_implicit'][init:out], color='blue')\n",
 | 
						|
    "    lf_ax.set_xlabel(r\"Simulation time [t]\")\n",
 | 
						|
    "    lf_ax.set_ylabel(r\"$\\delta_{CT}$\", color='blue')\n",
 | 
						|
    "    lf_ax.set_title(r\"Residual Energy $\\delta_{CT}$\")\n",
 | 
						|
    "    lf_ax.tick_params(axis='y', labelcolor='blue')\n",
 | 
						|
    "    lf_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    #rh_ax = lf_ax.twinx()\n",
 | 
						|
    "    #rh_j_exp, = rh_ax.plot(time_list['CT']['j_explicit'][init:out], delta_value_con['CT']['j_explicit'][init:out], color='red', ls='--')\n",
 | 
						|
    "    #rh_j_imp, = rh_ax.plot(time_list['CT']['j_implicit'][init:out], delta_value_con['CT']['j_implicit'][init:out], color='red')\n",
 | 
						|
    "    #rh_ax.set_ylabel(r\"$\\delta_{CT}$ def. II\", color='red')\n",
 | 
						|
    "    #rh_ax.tick_params(axis='y', labelcolor='red')\n",
 | 
						|
    "    #rh_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    plt.legend((lf_j_exp, lf_j_imp), (r'CT $\\bigstar\\bigstar = n$', r'CT $\\bigstar\\bigstar = n+1$'), loc='center right')\n",
 | 
						|
    "    plt.grid(True)\n",
 | 
						|
    "    # CASE M\n",
 | 
						|
    "    # Bottom\n",
 | 
						|
    "    lf_ax = plt.subplot(1, 2, 1)\n",
 | 
						|
    "    lf_j_exp, = lf_ax.plot(time_list['MT']['j_explicit'][init:out], delta_value_exp['MT']['j_explicit'][init:out], color='blue', ls='--')\n",
 | 
						|
    "    lf_j_imp, = lf_ax.plot(time_list['MT']['j_implicit'][init:out], delta_value_exp['MT']['j_implicit'][init:out], color='blue')\n",
 | 
						|
    "    lf_ax.set_xlabel(r\"Simulation time [t]\")\n",
 | 
						|
    "    lf_ax.set_ylabel(r\"$\\delta_{M}$\", color='blue')\n",
 | 
						|
    "    lf_ax.set_title(r\"Residual Energy $\\delta_{M}$\")\n",
 | 
						|
    "    lf_ax.tick_params(axis='y', labelcolor='blue')\n",
 | 
						|
    "    lf_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    #rh_ax = lf_ax.twinx()\n",
 | 
						|
    "    #rh_j_exp, = rh_ax.plot(time_list['MT']['j_explicit'][init:out], delta_value_con['MT']['j_explicit'][init:out], color='red', ls='--')\n",
 | 
						|
    "    #rh_j_imp, = rh_ax.plot(time_list['MT']['j_implicit'][init:out], delta_value_con['MT']['j_implicit'][init:out], color='red')\n",
 | 
						|
    "    #rh_ax.set_ylabel(r\"$\\delta_{M}$ def. II\", color='red')\n",
 | 
						|
    "    #rh_ax.tick_params(axis='y', labelcolor='red')\n",
 | 
						|
    "    #rh_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    plt.legend((lf_j_exp, lf_j_imp), (r'M $\\bigstar\\bigstar = n$', r'M $\\bigstar\\bigstar = n+1$'), loc='center right')\n",
 | 
						|
    "    plt.grid(True)\n",
 | 
						|
    "    plt.subplots_adjust(hspace=0.8)\n",
 | 
						|
    "    plt.tight_layout()\n",
 | 
						|
    "    plt.savefig('Comparison_Delta_Value_GCL_{}_Solver_{}.png'.format(args[0], args[1]), dpi=300)\n",
 | 
						|
    "    plt.close()\n",
 | 
						|
    "\n",
 | 
						|
    "    # ---------------------- #\n",
 | 
						|
    "    # NORMALIZED DELTA CASE (w.r.t physical dissipation)\n",
 | 
						|
    "    # ---------------------- #\n",
 | 
						|
    "    plt.subplots(figsize=(10, 4))\n",
 | 
						|
    "    # CASE CT\n",
 | 
						|
    "    # Top\n",
 | 
						|
    "    lf_ax = plt.subplot(1, 2, 2)\n",
 | 
						|
    "    lf_j_exp, = lf_ax.plot(time_list['CT']['j_explicit'][init:out], delta_hat_value_exp['CT']['j_explicit'][init:out], color='blue', ls='--')\n",
 | 
						|
    "    lf_j_imp, = lf_ax.plot(time_list['CT']['j_implicit'][init:out], delta_hat_value_exp['CT']['j_implicit'][init:out], color='blue')\n",
 | 
						|
    "    lf_ax.set_xlabel(r\"Simulation time [t]\")\n",
 | 
						|
    "    lf_ax.set_ylabel(r\"$\\hat{\\delta}_{CT}$\", color='blue')\n",
 | 
						|
    "    lf_ax.set_title(r\"Normalized value $\\hat{\\delta}_{CT}$\")\n",
 | 
						|
    "    lf_ax.tick_params(axis='y', labelcolor='blue')\n",
 | 
						|
    "    lf_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    #rh_ax = lf_ax.twinx()\n",
 | 
						|
    "    #rh_j_exp, = rh_ax.plot(time_list['CT']['j_explicit'][init:out], delta_hat_value_con['CT']['j_explicit'][init:out], color='red', ls='--')\n",
 | 
						|
    "    #rh_j_imp, = rh_ax.plot(time_list['CT']['j_implicit'][init:out], delta_hat_value_con['CT']['j_implicit'][init:out], color='red')\n",
 | 
						|
    "    #rh_ax.set_ylabel(r\"$\\hat{\\delta}_{CT}$ def. II\", color='red')\n",
 | 
						|
    "    #rh_ax.tick_params(axis='y', labelcolor='red')\n",
 | 
						|
    "    #rh_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    plt.legend((lf_j_exp, lf_j_imp), (r'CT $\\bigstar\\bigstar = n$', r'CT $\\bigstar\\bigstar = n+1$'), loc='lower right')\n",
 | 
						|
    "    plt.grid(True)\n",
 | 
						|
    "    # CASE M\n",
 | 
						|
    "    # Bottom\n",
 | 
						|
    "    lf_ax = plt.subplot(1, 2, 1)\n",
 | 
						|
    "    lf_j_exp, = lf_ax.plot(time_list['MT']['j_explicit'][init:out], delta_hat_value_exp['MT']['j_explicit'][init:out], color='blue', ls='--')\n",
 | 
						|
    "    lf_j_imp, = lf_ax.plot(time_list['MT']['j_implicit'][init:out], delta_hat_value_exp['MT']['j_implicit'][init:out], color='blue')\n",
 | 
						|
    "    lf_ax.set_xlabel(r\"Simulation time [t]\")\n",
 | 
						|
    "    lf_ax.set_ylabel(r\"$\\hat{\\delta}_{M}$\", color='blue')\n",
 | 
						|
    "    lf_ax.set_title(r\"Normalized value $\\hat{\\delta}_{M}$\")\n",
 | 
						|
    "    lf_ax.tick_params(axis='y', labelcolor='blue')\n",
 | 
						|
    "    lf_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    #rh_ax = lf_ax.twinx()\n",
 | 
						|
    "    #rh_j_exp, = rh_ax.plot(time_list['MT']['j_explicit'][init:out], delta_hat_value_con['MT']['j_explicit'][init:out], color='red', ls='--')\n",
 | 
						|
    "    #rh_j_imp, = rh_ax.plot(time_list['MT']['j_implicit'][init:out], delta_hat_value_con['MT']['j_implicit'][init:out], color='red')\n",
 | 
						|
    "    #rh_ax.set_ylabel(r\"$\\hat{\\delta}_{M}$ def. II\", color='red')\n",
 | 
						|
    "    #rh_ax.tick_params(axis='y', labelcolor='red')\n",
 | 
						|
    "    #rh_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    plt.legend((lf_j_exp, lf_j_imp), (r'M $\\bigstar\\bigstar = n$', r'M $\\bigstar\\bigstar = n+1$'), loc='upper right')\n",
 | 
						|
    "    plt.grid(True)\n",
 | 
						|
    "    plt.subplots_adjust(hspace=0.8)\n",
 | 
						|
    "    plt.tight_layout()\n",
 | 
						|
    "    plt.savefig('Comparison_Delta_Hat_Value_GCL_{}_solver_{}.png'.format(args[0], args[1]), dpi=300)\n",
 | 
						|
    "    plt.close()\n",
 | 
						|
    "\n",
 | 
						|
    "    # ---------------------- #\n",
 | 
						|
    "    # NORMALIZED DELTA CASE (w.r.t numerical dissipation)\n",
 | 
						|
    "    # ---------------------- #\n",
 | 
						|
    "    plt.subplots(figsize=(10, 4))\n",
 | 
						|
    "    # CASE CT\n",
 | 
						|
    "    # Top\n",
 | 
						|
    "    lf_ax = plt.subplot(1, 2, 2)\n",
 | 
						|
    "    lf_j_exp, = lf_ax.plot(time_list['CT']['j_explicit'][init:out], delta_hat_dis_exp['CT']['j_explicit'][init:out], color='blue', ls='--')\n",
 | 
						|
    "    lf_j_imp, = lf_ax.plot(time_list['CT']['j_implicit'][init:out], delta_hat_dis_exp['CT']['j_implicit'][init:out], color='blue')\n",
 | 
						|
    "    lf_ax.set_xlabel(r\"Simulation time [t]\")\n",
 | 
						|
    "    lf_ax.set_ylabel(r\"$\\hat{\\delta}_{CT}$ dis. \", color='blue')\n",
 | 
						|
    "    lf_ax.set_title(r\"Normalized value $\\hat{\\delta}_{CT}$ (dis)\")\n",
 | 
						|
    "    lf_ax.tick_params(axis='y', labelcolor='blue')\n",
 | 
						|
    "    lf_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    #rh_ax = lf_ax.twinx()\n",
 | 
						|
    "    #rh_j_exp, = rh_ax.plot(time_list['CT']['j_explicit'][init:out], delta_hat_dis_con['CT']['j_explicit'][init:out], color='red', ls='--')\n",
 | 
						|
    "    #rh_j_imp, = rh_ax.plot(time_list['CT']['j_implicit'][init:out], delta_hat_dis_con['CT']['j_implicit'][init:out], color='red')\n",
 | 
						|
    "    #rh_ax.set_ylabel(r\"$\\hat{\\delta}_{CT}$ def. II\", color='red')\n",
 | 
						|
    "    #rh_ax.tick_params(axis='y', labelcolor='red')\n",
 | 
						|
    "    #rh_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    plt.legend((lf_j_exp, lf_j_imp), (r'CT $\\bigstar\\bigstar = n$', r'CT $\\bigstar\\bigstar = n+1$'), loc='lower right')\n",
 | 
						|
    "    plt.grid(True)\n",
 | 
						|
    "    # CASE M\n",
 | 
						|
    "    # Bottom\n",
 | 
						|
    "    lf_ax = plt.subplot(1, 2, 1)\n",
 | 
						|
    "    lf_j_exp, = lf_ax.plot(time_list['MT']['j_explicit'][init:out], delta_hat_dis_exp['MT']['j_explicit'][init:out], color='blue', ls='--')\n",
 | 
						|
    "    lf_j_imp, = lf_ax.plot(time_list['MT']['j_implicit'][init:out], delta_hat_dis_exp['MT']['j_implicit'][init:out], color='blue')\n",
 | 
						|
    "    lf_ax.set_xlabel(r\"Simulation time [t]\")\n",
 | 
						|
    "    lf_ax.set_ylabel(r\"$\\hat{\\delta}_{M}$ dis.\", color='blue')\n",
 | 
						|
    "    lf_ax.set_title(r\"Normalized value $\\hat{\\delta}_{M}$ (dis)\")\n",
 | 
						|
    "    lf_ax.tick_params(axis='y', labelcolor='blue')\n",
 | 
						|
    "    lf_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    #rh_ax = lf_ax.twinx()\n",
 | 
						|
    "    #rh_j_exp, = rh_ax.plot(time_list['MT']['j_explicit'][init:out], delta_hat_dis_con['MT']['j_explicit'][init:out], color='red', ls='--')\n",
 | 
						|
    "    #rh_j_imp, = rh_ax.plot(time_list['MT']['j_implicit'][init:out], delta_hat_dis_con['MT']['j_implicit'][init:out], color='red')\n",
 | 
						|
    "    #rh_ax.set_ylabel(r\"$\\hat{\\delta}_{M}$ def. II\", color='red')\n",
 | 
						|
    "    #rh_ax.tick_params(axis='y', labelcolor='red')\n",
 | 
						|
    "    #rh_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    plt.legend((lf_j_exp, lf_j_imp), (r'M $\\bigstar\\bigstar = n$', r'M $\\bigstar\\bigstar = n+1$'), loc='lower right')\n",
 | 
						|
    "    plt.grid(True)\n",
 | 
						|
    "    plt.subplots_adjust(hspace=0.8)\n",
 | 
						|
    "    plt.tight_layout()\n",
 | 
						|
    "    plt.savefig('Comparison_Delta_Hat_Dis_Value_GCL_{}_solver_{}.png'.format(args[0], args[1]), dpi=300)\n",
 | 
						|
    "    plt.close()\n",
 | 
						|
    "\n",
 | 
						|
    "    # ---------------------- #\n",
 | 
						|
    "    # PHYSICAL DISSIPATION PLOT\n",
 | 
						|
    "    # ---------------------- #\n",
 | 
						|
    "    plt.subplots(figsize=(10, 4))\n",
 | 
						|
    "    # CASE CT\n",
 | 
						|
    "    # Top\n",
 | 
						|
    "    lf_ax = plt.subplot(1, 2, 2)\n",
 | 
						|
    "    lf_j_exp, = lf_ax.plot(time_list['CT']['j_explicit'][init:out], eps_value_exp['CT']['j_explicit'][init:out], color='blue', ls='--')\n",
 | 
						|
    "    lf_j_imp, = lf_ax.plot(time_list['CT']['j_implicit'][init:out], eps_value_exp['CT']['j_implicit'][init:out], color='blue')\n",
 | 
						|
    "    lf_ax.set_xlabel(r\"Simulation time [t]\")\n",
 | 
						|
    "    lf_ax.set_ylabel(r\"CT\", color='blue')\n",
 | 
						|
    "    lf_ax.set_title(r\"Physical Dissipation (CT)\")\n",
 | 
						|
    "    lf_ax.tick_params(axis='y', labelcolor='blue')\n",
 | 
						|
    "    lf_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    #rh_ax = lf_ax.twinx()\n",
 | 
						|
    "    #rh_j_exp, = rh_ax.plot(time_list['CT']['j_explicit'][init:out], eps_value_con['CT']['j_explicit'][init:out], color='red', ls='--')\n",
 | 
						|
    "    #rh_j_imp, = rh_ax.plot(time_list['CT']['j_implicit'][init:out], eps_value_con['CT']['j_implicit'][init:out], color='red')\n",
 | 
						|
    "    #rh_ax.set_ylabel(r\"On def. II\", color='red')\n",
 | 
						|
    "    #rh_ax.tick_params(axis='y', labelcolor='red')\n",
 | 
						|
    "    #rh_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    plt.legend((lf_j_exp, lf_j_imp), \\\n",
 | 
						|
    "        (r'CT $\\star\\star = n$', r'CT $\\bigstar\\bigstar = n+1$'), loc='lower right')\n",
 | 
						|
    "    plt.grid(True)\n",
 | 
						|
    "    # CASE M\n",
 | 
						|
    "    # Bottom\n",
 | 
						|
    "    lf_ax = plt.subplot(1, 2, 1)\n",
 | 
						|
    "    lf_j_exp, = lf_ax.plot(time_list['MT']['j_explicit'][init:out], eps_value_exp['MT']['j_explicit'][init:out], color='blue', ls='--')\n",
 | 
						|
    "    lf_j_imp, = lf_ax.plot(time_list['MT']['j_implicit'][init:out], eps_value_exp['MT']['j_implicit'][init:out], color='blue')\n",
 | 
						|
    "    lf_ax.set_xlabel(r\"Simulation time [t]\")\n",
 | 
						|
    "    lf_ax.set_ylabel(r\"M\", color='blue')\n",
 | 
						|
    "    lf_ax.set_title(r\"Physical Dissipation (M)\")\n",
 | 
						|
    "    lf_ax.tick_params(axis='y', labelcolor='blue')\n",
 | 
						|
    "    lf_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    #rh_ax = lf_ax.twinx()\n",
 | 
						|
    "    #rh_j_exp, = rh_ax.plot(time_list['MT']['j_explicit'][init:out], eps_value_con['MT']['j_explicit'][init:out], color='red', ls='--')\n",
 | 
						|
    "    #rh_j_imp, = rh_ax.plot(time_list['MT']['j_implicit'][init:out], eps_value_con['MT']['j_implicit'][init:out], color='red')\n",
 | 
						|
    "    #rh_ax.set_ylabel(r\"On def. II\", color='red')\n",
 | 
						|
    "    #rh_ax.tick_params(axis='y', labelcolor='red')\n",
 | 
						|
    "    #rh_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    plt.legend((lf_j_exp, lf_j_imp), (r'M $\\bigstar\\bigstar = n$', r'M $\\bigstar\\bigstar = n+1$'), loc='lower right')\n",
 | 
						|
    "    plt.grid(True)\n",
 | 
						|
    "    plt.subplots_adjust(hspace=0.8)\n",
 | 
						|
    "    plt.tight_layout()\n",
 | 
						|
    "    plt.savefig('Comparison_Eps_Value_GCL_{}_solver_{}.png'.format(args[0], args[1]), dpi=300)\n",
 | 
						|
    "    plt.close()\n",
 | 
						|
    "\n",
 | 
						|
    "    # ---------------------- #\n",
 | 
						|
    "    # NUMERICAL DISSIPATION PLOT\n",
 | 
						|
    "    # ---------------------- #\n",
 | 
						|
    "    plt.subplots(figsize=(10, 4))\n",
 | 
						|
    "    # CASE CT\n",
 | 
						|
    "    # Top\n",
 | 
						|
    "    lf_ax = plt.subplot(1, 2, 2)\n",
 | 
						|
    "    lf_j_exp, = lf_ax.plot(time_list['CT']['j_explicit'][init:out], dis_value_exp['CT']['j_explicit'][init:out], color='blue', ls='--')\n",
 | 
						|
    "    lf_j_imp, = lf_ax.plot(time_list['CT']['j_implicit'][init:out], dis_value_exp['CT']['j_implicit'][init:out], color='blue')\n",
 | 
						|
    "    lf_ax.set_xlabel(r\"Simulation time [t]\")\n",
 | 
						|
    "    lf_ax.set_ylabel(r\"CT\", color='blue')\n",
 | 
						|
    "    lf_ax.set_title(r\"Numerical Dissipation (CT)\")\n",
 | 
						|
    "    lf_ax.tick_params(axis='y', labelcolor='blue')\n",
 | 
						|
    "    lf_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    #rh_ax = lf_ax.twinx()\n",
 | 
						|
    "    #rh_j_exp, = rh_ax.plot(time_list['CT']['j_explicit'][init:out], dis_value_con['CT']['j_explicit'][init:out], color='red', ls='--')\n",
 | 
						|
    "    #rh_j_imp, = rh_ax.plot(time_list['CT']['j_implicit'][init:out], dis_value_con['CT']['j_implicit'][init:out], color='red')\n",
 | 
						|
    "    #rh_ax.set_ylabel(r\"On def. II\", color='red')\n",
 | 
						|
    "    #rh_ax.tick_params(axis='y', labelcolor='red')\n",
 | 
						|
    "    #rh_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    plt.legend((lf_j_exp, lf_j_imp), (r'CT $\\bigstar\\bigstar = n$', r'CT $\\bigstar\\bigstar = n+1$'), loc='lower right')\n",
 | 
						|
    "    plt.grid(True)\n",
 | 
						|
    "    # CASE M\n",
 | 
						|
    "    # Bottom\n",
 | 
						|
    "    lf_ax = plt.subplot(1, 2, 1)\n",
 | 
						|
    "    lf_j_exp, = lf_ax.plot(time_list['MT']['j_explicit'][init:out], dis_value_exp['MT']['j_explicit'][init:out], color='blue', ls='--')\n",
 | 
						|
    "    lf_j_imp, = lf_ax.plot(time_list['MT']['j_implicit'][init:out], dis_value_exp['MT']['j_implicit'][init:out], color='blue')\n",
 | 
						|
    "    lf_ax.set_xlabel(r\"Simulation time [t]\")\n",
 | 
						|
    "    lf_ax.set_ylabel(r\"M\", color='blue')\n",
 | 
						|
    "    lf_ax.set_title(r\"Numerical Dissipation (M)\")\n",
 | 
						|
    "    lf_ax.tick_params(axis='y', labelcolor='blue')\n",
 | 
						|
    "    lf_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    #rh_ax = lf_ax.twinx()\n",
 | 
						|
    "    #rh_j_exp, = rh_ax.plot(time_list['MT']['j_explicit'][init:out], dis_value_con['MT']['j_explicit'][init:out], color='red', ls='--')\n",
 | 
						|
    "    #rh_j_imp, = rh_ax.plot(time_list['MT']['j_implicit'][init:out], dis_value_con['MT']['j_implicit'][init:out], color='red')\n",
 | 
						|
    "    #rh_ax.set_ylabel(r\"On def. II\", color='red')\n",
 | 
						|
    "    #rh_ax.tick_params(axis='y', labelcolor='red')\n",
 | 
						|
    "    #rh_ax.ticklabel_format(style='sci', axis='y', scilimits=(0,0))\n",
 | 
						|
    "    plt.legend((lf_j_exp, lf_j_imp), (r'M $\\bigstar\\bigstar = n$', r'M $\\bigstar\\bigstar = n+1$'), loc='lower right')\n",
 | 
						|
    "    plt.grid(True)\n",
 | 
						|
    "    plt.subplots_adjust(hspace=0.8)\n",
 | 
						|
    "    plt.tight_layout()\n",
 | 
						|
    "    plt.savefig('Comparison_Num_Dis_Value_GCL_{}_solver_{}.png'.format(args[0], args[1]), dpi=300)\n",
 | 
						|
    "    plt.close()\n",
 | 
						|
    "    print(\"\\nAll computations done and figures saved...\\n\")\n",
 | 
						|
    "    print(\"\\n------------------------------------------\\n\")\n",
 | 
						|
    "    return None\n",
 | 
						|
    "\n",
 | 
						|
    "testing_comparative_plots(dict_mt, dict_ct, True, 'LU')"
 | 
						|
   ]
 | 
						|
  },
 | 
						|
  {
 | 
						|
   "cell_type": "code",
 | 
						|
   "execution_count": null,
 | 
						|
   "metadata": {},
 | 
						|
   "outputs": [],
 | 
						|
   "source": []
 | 
						|
  }
 | 
						|
 ],
 | 
						|
 "metadata": {
 | 
						|
  "kernelspec": {
 | 
						|
   "display_name": "Python 3",
 | 
						|
   "language": "python",
 | 
						|
   "name": "python3"
 | 
						|
  },
 | 
						|
  "language_info": {
 | 
						|
   "codemirror_mode": {
 | 
						|
    "name": "ipython",
 | 
						|
    "version": 3
 | 
						|
   },
 | 
						|
   "file_extension": ".py",
 | 
						|
   "mimetype": "text/x-python",
 | 
						|
   "name": "python",
 | 
						|
   "nbconvert_exporter": "python",
 | 
						|
   "pygments_lexer": "ipython3",
 | 
						|
   "version": "3.6.9"
 | 
						|
  }
 | 
						|
 },
 | 
						|
 "nbformat": 4,
 | 
						|
 "nbformat_minor": 2
 | 
						|
}
 |