SetDirectory[$HomeDirectory<>"/Documents/handouts/math467/BurgersEquation"]

Shock

Clear[char]

uL=2;uR=1;x0=1;capC[u_]:=(u^2)/2

rh=(capC[uR]-capC[uL])/(uR-uL);xs[t_]:=rh*t+x0

xs[t]

char[x_,xi_,u_]:=(x-xi)/u

Show[Plot[Table[char[x,xi,uL],{xi,-10,6,1/2}],{x,-2,6},PlotRange->{0,4},RegionFunction->Function[{x,t},t>(x-x0)2/3],PlotStyle->Thin],Plot[Table[char[x,xi,uR],{xi,-10,6,1/2}],{x,-2,6},PlotRange->{0,4},RegionFunction->Function[{x,t},t<(x-x0)2/3],PlotStyle->Thin],Plot[Callout[(x-x0)2/3,"shock",{{2,4/3},Above}],{x,-2,6},PlotRange->{0,4}],AxesLabel->{"\!\(\*TemplateBox[<|"boxes" -> FormBox[
StyleBox["x", "TI"], TraditionalForm], "errors" -> {}, "input" -> "x", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)","\!\(\*TemplateBox[<|"boxes" -> FormBox[
StyleBox["t", "TI"], TraditionalForm], "errors" -> {}, "input" -> "t", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)"},Ticks->{{{1,"\!\(\*TemplateBox[<|"boxes" -> FormBox[
SubscriptBox[
StyleBox["x", "TI"], "0"], TraditionalForm], "errors" -> {}, "input" -> "x_{0}", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)"}},None},Epilog->{Text["\!\(\*TemplateBox[<|"boxes" -> FormBox[
RowBox[{
StyleBox["u", "TI"], 
RowBox[{"(", 
RowBox[{
StyleBox["x", "TI"], ",", 
StyleBox["t", "TI"]}], ")"}], "==", 
SubscriptBox[
StyleBox["u", "TI"], 
StyleBox["L", "TI"]]}], TraditionalForm], "errors" -> {}, "input" -> "u(x, t)=u_{L}", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)",{1,3}],Text["\!\(\*TemplateBox[<|"boxes" -> FormBox[
RowBox[{
StyleBox["u", "TI"], 
RowBox[{"(", 
RowBox[{
StyleBox["x", "TI"], ",", 
StyleBox["t", "TI"]}], ")"}], "==", 
SubscriptBox[
StyleBox["u", "TI"], 
StyleBox["R", "TI"]]}], TraditionalForm], "errors" -> {}, "input" -> "u(x, t)=u_{R}", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)",{4,1}]},BaseStyle->FontSize->12,AspectRatio->1/2]

Export["quasilinear-shock.pdf",%,"PDF"]

Export["quasilinear-shock.eps",%%,"EPS"]

Rarefaction

Clear[char]

uL=1;uR=2;x0=1;capC[u_]:=(u^2)/2

rh=(capC[uR]-capC[uL])/(uR-uL);xs[t_]:=rh*t+x0

xs[t]

char[x_,xi_,u_]:=(x-xi)/u

Show[Plot[Table[char[x,xi,uL],{xi,-10,x0,1/2}],{x,-2,6},PlotRange->{0,4},RegionFunction->Function[{x,t},t>(x-x0)2/3]],Plot[Table[char[x,xi,uR],{xi,x0,6,1/2}],{x,-2,6},PlotRange->{0,4},RegionFunction->Function[{x,t},t<(x-x0)2/3]],Plot[Table[(x-x0)/u,{u,uL,uR,(uR-uL)/10}],{x,-2,6},PlotRange->{0,4},PlotStyle->Thin,RegionFunction->Function[{x,t},(x-x0)/uR<t<(x-x0)/uL]],AxesLabel->{"\!\(\*TemplateBox[<|"boxes" -> FormBox[
StyleBox["x", "TI"], TraditionalForm], "errors" -> {}, "input" -> "x", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)","\!\(\*TemplateBox[<|"boxes" -> FormBox[
StyleBox["t", "TI"], TraditionalForm], "errors" -> {}, "input" -> "t", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)"},Ticks->{{{1,"\!\(\*TemplateBox[<|"boxes" -> FormBox[
SubscriptBox[
StyleBox["x", "TI"], "0"], TraditionalForm], "errors" -> {}, "input" -> "x_{0}", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)"}},None},Epilog->{Text["\!\(\*TemplateBox[<|"boxes" -> FormBox[
RowBox[{
StyleBox["u", "TI"], 
RowBox[{"(", 
RowBox[{
StyleBox["x", "TI"], ",", 
StyleBox["t", "TI"]}], ")"}], "==", 
SubscriptBox[
StyleBox["u", "TI"], 
StyleBox["L", "TI"]]}], TraditionalForm], "errors" -> {}, "input" -> "u(x, t)=u_{L}", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)",{1,3},Background->White],Text["\!\(\*TemplateBox[<|"boxes" -> FormBox[
RowBox[{
StyleBox["u", "TI"], 
RowBox[{"(", 
RowBox[{
StyleBox["x", "TI"], ",", 
StyleBox["t", "TI"]}], ")"}], "==", 
SubscriptBox[
StyleBox["u", "TI"], 
StyleBox["R", "TI"]]}], TraditionalForm], "errors" -> {}, "input" -> "u(x, t)=u_{R}", "state" -> "Boxes"|>,"TeXAssistantTemplate"]\)",{5,1},Background->White],Text["rarefaction",{4,2}]},BaseStyle->FontSize->12,AspectRatio->1/2]

Export["quasilinear-rarefaction.pdf",%,"PDF"]

Export["quasilinear-rarefaction.eps",%%,"EPS"]