<jupyter_start><jupyter_text>This notebook plots temperature fronts for a few $gamma_0$ values with m=0 and m=3/2 for the time and space dependent cases.<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
import math
from scipy import interpolate
from scipy import integrate
import time
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from math import sqrt
from math import pi
import matplotlib.font_manager as fm
import matplotlib.ticker as mtick
from matplotlib.ticker import ScalarFormatter
from scipy import optimize
from labellines import labelLine, labelLines
import csv<jupyter_output><empty_output><jupyter_text>Import initial conditions<jupyter_code>#Import show() function for plotting 
%run C:\Users\wbenn/Marshak_Wave_Scripts/Marshak_3T/SelfSimilar_main/show.ipynb
#Import initial conditions
%run C:\Users\wbenn/Marshak_Wave_Scripts/Marshak_3T/SelfSimilar_main/initial_conditions.ipynb<jupyter_output><empty_output><jupyter_text>Define constants<jupyter_code>n = 3
T0=1
c=29.9792458
a=0.01372
kappa0=100
xmax=1.2
rho = 3.0
Cve=0.1*rho
Cvi=.05*rho
alpha = a*c*4*T0**(-n)/(3*(n+4)*kappa0*Cve)
A = sqrt(1/(2*alpha))
tol = 1e-12
gamma0=0
m=0
ICt = [g(xmax-tol,xmax),gprime(xmax-tol,xmax), h(xmax-tol,xmax)]
ICs = [g(xmax-tol,xmax),gprime(xmax-tol,xmax), f(xmax-tol,xmax)]<jupyter_output><empty_output><jupyter_text>Optimization functions to find ximax<jupyter_code>#Time dependent optimize functions
#using BDF to solve time dependent eqs 1,2
opt_fun_BDF_time = lambda xm: integrate.solve_ivp(RHSfun_time, (xm-tol,1e-10), [g(xm-tol,xm),gprime(xm-tol,xm), h(xm-tol,xm)], 
                                         method='BDF', max_step = 1e-4).y[0][-1] - 1
#Using DOP853 to solve time dependent
opt_fun_DOP_time = lambda xm: integrate.solve_ivp(RHSfun_time, (xm-tol,0), [g(xm-tol,xm),gprime(xm-tol,xm), h(xm-tol,xm)], 
                                         method='DOP853', max_step = 1e-4).y[0][-1] - 1
#Space dependent(BDF) eqs 2,3
opt_fun_BDF_space = lambda xm: integrate.solve_ivp(RHSfun_space, (xm-tol,1e-10), [g(xm-tol,xm),gprime(xm-tol,xm), f(xm-tol,xm)], 
                                         method='BDF', max_step = 1e-4).y[0][-1] - 1<jupyter_output><empty_output><jupyter_text>Plots<jupyter_code># pick gamma0 values to plot#Plots
gamma0_list = [0,.05,0.5]
I = len(gamma0_list)
#colors for plotting
cmap = plt.get_cmap("tab10")<jupyter_output><empty_output><jupyter_text>Time dependent $\gamma_0$ plots  m=3/2<jupyter_code>#Plot of time dependent with sample gamma0 values, m = 3/2
plt.figure(1)
m=3/2
ax=plt.gca()
for j in range(I):
    gamma0=gamma0_list[j]
    minval = optimize.brentq(opt_fun_DOP_time, .8,1.2)
    print(minval)
    sol = integrate.solve_ivp(RHSfun_time, (minval-tol,0), ICt, method='DOP853', max_step = 1e-4)
    X=[minval]
    Y1=[0]
    Y2=[0]
    for i in range(len(sol.t)):
        X.append(sol.t[i])
        Y1.append(sol.y[0][i])
        Y2.append(sol.y[2][i])
    plt.plot(X, Y1, label=r"K=%.2f" %(gamma0), c = cmap(j))
    plt.plot(X, Y2,'--', c = cmap(j))
    
ax.text(.9,.4,r'$\gamma_0=0.5$',horizontalalignment='center', verticalalignment='center',rotation=270,fontsize = 12,c=cmap(2))
ax.text(1,.2,r'$\gamma_0=0.05$',horizontalalignment='center', verticalalignment='center',rotation=270,fontsize = 12,c=cmap(1))
ax.text(1.15,.2,r'$\gamma_0=0$',horizontalalignment='center', verticalalignment='center',rotation=270,fontsize = 12,c=cmap(0))

plt.xlabel(r"Normalized Distance $\xi$")
plt.ylabel("Normalized Temperature")
#plt.title(r"Time Dependent $\gamma$ m=3/2")

show("timedependentm=1.5")<jupyter_output>C:\Users\wbenn\Anaconda3\lib\site-packages\ipykernel_launcher.py:11: RuntimeWarning: invalid value encountered in double_scalars
  # This is added back by InteractiveShellApp.init_path()<jupyter_text>m=0<jupyter_code>plt.figure(2)
ax=plt.gca()
m=0
ax=plt.gca()
for j in range(I):
    gamma0=gamma0_list[j]
    minval = optimize.brentq(opt_fun_DOP_time, .8,1.2)
    print(minval)
    sol = integrate.solve_ivp(RHSfun_time, (minval-tol,0), ICt, method='DOP853', max_step = 1e-4)
    X=[minval]
    Y1=[0]
    Y2=[0]
    for i in range(len(sol.t)):
        X.append(sol.t[i])
        Y1.append(sol.y[0][i])
        Y2.append(sol.y[2][i])
    plt.plot(X, Y1, label=r"K=%.2f" %(gamma0), c = cmap(j))
    plt.plot(X, Y2,'--', c = cmap(j))
    
ax.text(.9,.4,r'$\gamma_0=0.5$',horizontalalignment='center', verticalalignment='center',rotation=270,fontsize = 12,c=cmap(2))
ax.text(1.03,.2,r'$\gamma_0=0.05$',horizontalalignment='center', verticalalignment='center',rotation=270,fontsize = 12,c=cmap(1))
ax.text(1.15,.2,r'$\gamma_0=0$',horizontalalignment='center', verticalalignment='center',rotation=270,fontsize = 12,c=cmap(0))

plt.xlabel(r"Normalized Distance $\xi$")
plt.ylabel("Normalized Temperature")
show("timedependentm=0")<jupyter_output><empty_output><jupyter_text>Space dependent $\gamma_0$ plots   m=3/2<jupyter_code>#Plot of space dependent with sample K values
plt.figure(3)
m=3/2
ax=plt.gca()
for j in range(I):
    gamma0=gamma0_list[j]
    minval = optimize.brentq(opt_fun_BDF_space, .8,1.2)
    print(minval)
    sol = integrate.solve_ivp(RHSfun_space, (minval-tol,1e-10), ICs, method='BDF', max_step = 1e-4)
    X=[minval]
    Y1=[0]
    Y2=[0]
    for i in range(len(sol.t)):
        X.append(sol.t[i])
        Y1.append(sol.y[0][i])
        Y2.append(sol.y[2][i])
    plt.plot(X, Y1, label=r"K=%.2f" %(gamma0), c = cmap(j))
    plt.plot(X, Y2,'--', c = cmap(j))
ax.text(.89,.45,r'$\gamma_0=0.5$',horizontalalignment='center', verticalalignment='center',rotation=270,fontsize = 12,c=cmap(2))
ax.text(1,.2,r'$\gamma_0=0.05$',horizontalalignment='center', verticalalignment='center',rotation=270,fontsize = 12,c=cmap(1))
ax.text(1.15,.2,r'$\gamma_0=0$',horizontalalignment='center', verticalalignment='center',rotation=270,fontsize = 12,c=cmap(0))
plt.xlabel(r"Normalized Distance $\xi$")
plt.ylabel("Normalized Temperature")
#plt.title(r"Space Dependent $\gamma$ m=3/2")

show("spacedependent_m=1.5")<jupyter_output><empty_output><jupyter_text>m =0<jupyter_code>plt.figure(4)
m=0
ax=plt.gca()
for j in range(I):
    gamma0=gamma0_list[j]
    minval = optimize.brentq(opt_fun_BDF_space, .8,1.2)
    print(minval)
    sol = integrate.solve_ivp(RHSfun_space, (minval-tol,1e-10), ICs, method='BDF', max_step = 1e-4)
    X=[minval]
    Y1=[0]
    Y2=[0]
    for i in range(len(sol.t)):
        X.append(sol.t[i])
        Y1.append(sol.y[0][i])
        Y2.append(sol.y[2][i])
    plt.plot(X, Y1, label=r"K=%.2f" %(gamma0), c = cmap(j))
    plt.plot(X, Y2,'--', c = cmap(j))
ax.text(.9,.4,r'$\gamma_0=0.5$',horizontalalignment='center', verticalalignment='center',rotation=270,fontsize = 12,c=cmap(2))
ax.text(1.08,.2,r'$\gamma_=0.05$',horizontalalignment='center', verticalalignment='center',rotation=270,fontsize = 12,c=cmap(1))
ax.text(1.15,.2,r'$\gamma_0=0$',horizontalalignment='center', verticalalignment='center',rotation=270,fontsize = 12,c=cmap(0))
plt.xlabel(r"Normalized Distance $\xi$")
plt.ylabel("Normalized Temperature")
#plt.title(r"Space Dependent $\gamma$ m=0")

show("spacedependent_m=0")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1785214225707085, 'fraction_numerical': 0.050546065527863344, 'mean_word_length': 5.184415584415585, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '59559', 'license': 'MIT', 'n_tokens_mistral': 3165, 'n_tokens_neox': 2958, 'n_words': 455, 'path': '.ipynb_checkpoints/MarshakWave_temperature_plots-checkpoint.ipynb', 'repo_name': 'DrRyanMc/SelfSimilar', 'size': '7142'}