diff --git a/Project2/LyX/DiscussionAndConclusion.lyx b/Project2/LyX/DiscussionAndConclusion.lyx index 94a813ae36af5deab172ea96e53d06b5cd7c308e..d8aa73fa3e0e6ebc0a78fbad9991fd03d3ad1ffb 100644 --- a/Project2/LyX/DiscussionAndConclusion.lyx +++ b/Project2/LyX/DiscussionAndConclusion.lyx @@ -155,12 +155,14 @@ If a traffic jam occurs, there is a simple approach to dissolve it, again. The cars should hold a longer distance to the car ahead, - to make sure that the density of cars at the end of the traffic flow is smaller then before. + to make sure that the density of cars at the end of the traffic flow is smaller then before, + increasing the flux function. With this, a rarefaction wave will build and the traffic flow will be dissolved over time. If cars hold a short distance to the cars in front, - the density at the end of the traffic jam will probably be higher then before, - resulting in a certain increase in the significance of the traffic jam. + the density at the end of the traffic jam will probably be higher then in the beginning, + leading to a smaller flux function at the end of the traffic flow, + resulting in more cars entering the traffic flow than leaving it. \end_layout \begin_layout Standard @@ -189,11 +191,7 @@ Use a non-linear model for the velocity of cars. \begin_layout Enumerate It is unrealistic, that the velocity of cars is linearly proportional to the density of cars. - -\end_layout - -\begin_layout Enumerate -In a more realistic scenario, + In a more realistic scenario, the velocity of cars would decrease faster for higher densities and slower for lower densities. \end_layout diff --git a/Project2/LyX/Figures/Convergence_abs.pdf b/Project2/LyX/Figures/Convergence_abs.pdf index 5ed3fdfe12e6115ff81d6096e3e4e4eaf4971316..c1f76eed9552708aed931cc5817f14298c5cb779 100644 Binary files a/Project2/LyX/Figures/Convergence_abs.pdf and b/Project2/LyX/Figures/Convergence_abs.pdf differ diff --git a/Project2/LyX/Figures/Convergence_rel.pdf b/Project2/LyX/Figures/Convergence_rel.pdf index 72c34b15a4a4c8c6b64356a50610bbcb8218af97..6291fd4bffd334c9f438bf5c92ffb76c6a5f4dfd 100644 Binary files a/Project2/LyX/Figures/Convergence_rel.pdf and b/Project2/LyX/Figures/Convergence_rel.pdf differ diff --git a/Project2/LyX/Figures/Problem_2_3_1D.pdf b/Project2/LyX/Figures/Problem_2_3_1D.pdf index c49bd15f24d04db24cac6f5f31d254f2dba622cf..9ede8c6e4e30f802c8017dc027c4b89896c8b206 100644 Binary files a/Project2/LyX/Figures/Problem_2_3_1D.pdf and b/Project2/LyX/Figures/Problem_2_3_1D.pdf differ diff --git a/Project2/LyX/Figures/Problem_2_3_3D.pdf b/Project2/LyX/Figures/Problem_2_3_3D.pdf index e816679a96453a95143f973766b109b83754e36a..f90743f7697ab83c6d7a7ef835e9262d43ade1cc 100644 Binary files a/Project2/LyX/Figures/Problem_2_3_3D.pdf and b/Project2/LyX/Figures/Problem_2_3_3D.pdf differ diff --git a/Project2/LyX/Figures/Problem_2_3_abs_error.pdf b/Project2/LyX/Figures/Problem_2_3_abs_error.pdf index 62b80b23d17222c947e061bb063c71ebac807d3c..5eb0680d292c73ee21a1fb1212ec00c7058a033e 100644 Binary files a/Project2/LyX/Figures/Problem_2_3_abs_error.pdf and b/Project2/LyX/Figures/Problem_2_3_abs_error.pdf differ diff --git a/Project2/LyX/Implementation.lyx b/Project2/LyX/Implementation.lyx index 02dcbeb7f56196b82b44c3051fb32a1ed02f2e16..5b2d6a1ce7fad54da8b016222b1969cfe581f1ba 100644 --- a/Project2/LyX/Implementation.lyx +++ b/Project2/LyX/Implementation.lyx @@ -90,6 +90,13 @@ \begin_layout Section Implementation +\begin_inset CommandInset label +LatexCommand label +name "sec:Implementation" + +\end_inset + + \end_layout \begin_layout Subsection @@ -99,7 +106,29 @@ Discretization with Finite Differences and Rusanov Discretization \begin_layout Standard The partial differential equation will be solved numerically with the finite-difference scheme and a Rusanov discretization, which adds a small amount of artificial diffusion to stabilize the advective term. - In the discrete terms, + +\begin_inset Formula +\begin{align} +u_{t}+f(u)_{x} & =0\\ +\Rightarrow u_{t}^{\epsilon}+f(u_{t}^{\epsilon})_{x} & =u_{xx}^{\epsilon} +\end{align} + +\end_inset + +where +\begin_inset Formula $u^{\epsilon}$ +\end_inset + + is the solution with the added diffusion. + The upper index +\begin_inset Formula $\epsilon$ +\end_inset + + will be dropped for more readability. +\end_layout + +\begin_layout Standard +In the discrete terms, the upper index \begin_inset Formula $\cdot^{j}$ \end_inset @@ -123,10 +152,7 @@ The partial differential equation will be solved numerically with the finite-dif \end_inset the distance between two grid points on an uniform grid. -\end_layout - -\begin_layout Standard -Discretizing the time with a simple explicit Euler method and the space with the aforementioned Rusanov discretization yields the discretized formulation. + Discretizing the time with a simple explicit Euler method and the space with the aforementioned Rusanov discretization yields the discretized formulation. \begin_inset Formula \begin{align} \frac{u_{i}^{j+1}-u_{i}^{j}}{\Delta t} & +\frac{1}{\Delta x}\left(F_{i+\frac{1}{2}}^{j}-F_{i-\frac{1}{2}}^{j}\right)=0\\ @@ -136,20 +162,15 @@ M & \sim\max\left|f'\right| \end_inset -Reformulating this to +Reformulate this to \begin_inset Formula $u_{i}^{j+1}$ \end_inset - yields an explicit scheme for time-step + to get an explicit scheme for time-step \begin_inset Formula $j+1$ \end_inset -, - depending only on time-step -\begin_inset Formula $j$ -\end_inset - -. + results in \begin_inset Formula \begin{equation} u_{i}^{j+1}=u_{i}^{j}-\frac{\Delta t}{\Delta x}\left(F_{i+\frac{1}{2}}^{j}-F_{i-\frac{1}{2}}^{i}\right) @@ -166,7 +187,7 @@ The CFL-Condition as a Stability Criteria \begin_layout Standard To ensure numerical stability, - the cfl-condion has to hold true, + the cfl-condition has to hold true, which reads \begin_inset Formula \begin{equation} @@ -183,7 +204,8 @@ To ensure numerical stability, \begin_inset Formula $f(u)=a(u)u$ \end_inset -. + (for more information, + see Project 1). \end_layout \begin_layout Subsection @@ -227,7 +249,7 @@ A convergence analysis was performed to ensure the numerical implementation's co norm and its relative counterpart \begin_inset Formula \begin{align} -\mathcal{L}_{1}(u) & =\int\left|u-u_{\text{exact}}\right|d\Omega\\ +\mathcal{L}_{1}(u) & =\int_{\Omega}\left|u-u_{\text{exact}}\right|d\Omega\\ \mathcal{L}_{1,\text{rel}}(u) & =\frac{\mathcal{L}_{1}(u)}{\int_{\Omega}\left|u_{\text{exact}}\right|d\Omega} \end{align} @@ -259,7 +281,7 @@ u(x,t)=\begin{cases} \end_inset -For the derivation of the analytical solution see Section +For the derivation of the analytical solution see the upcoming Section \begin_inset CommandInset ref LatexCommand ref reference "subsec:AnalyticalSolution_2.3" @@ -271,18 +293,6 @@ nolink "false" \end_inset . - -\begin_inset Note Note -status open - -\begin_layout Plain Layout -ToDo: - Add a reference to where the analytical solution is computed -\end_layout - -\end_inset - - \end_layout \begin_layout Standard @@ -311,7 +321,7 @@ status open \begin_layout Plain Layout The numerical scheme converges with an order somewhat below first order. - The x-axis shows the number of cells and the y-axis the + The x-axis shows the cell size and the y-axis the \begin_inset Formula $\mathcal{L}_{1,\text{rel}}$ \end_inset @@ -342,7 +352,7 @@ The convergence was inspected on a domain \end_inset with -\begin_inset Formula $\Delta x\in[10,100,1.000,10.000]$ +\begin_inset Formula $\Delta x\in[0.7,0.07,0.007,0.0007]$ \end_inset ). @@ -366,7 +376,7 @@ nolink "false" \end_inset - indicates the the numerical scheme converges with an order somewhat below first order. + indicates that the numerical scheme converges with an order somewhat below first order. Therefore, a refined grid results in a more accurate solution. For diff --git a/Project2/LyX/Introduction.lyx b/Project2/LyX/Introduction.lyx index 0713711b8884ea22e0e382c3e186650e6ddfe31c..bab0d9a3b5d32766afa83324403808bcd21cf594 100644 --- a/Project2/LyX/Introduction.lyx +++ b/Project2/LyX/Introduction.lyx @@ -104,9 +104,9 @@ Traffic jams occur in our everyday life. Most people use the road, either by car, bus or bike, - every day to get to their job, - do grocery shopping, - to meet friends or to get to their hobbies. + to get to their job, + meet friends, + do grocery shopping or to get to their hobbies. Through this enormous use of the road, traffic jams occur. Traffic jams lead to a smaller speed of vehicles, @@ -114,19 +114,9 @@ Traffic jams occur in our everyday life. \end_layout \begin_layout Standard -The arising engineering question is, - how to reduce these traffic jams? - With a reduction of traffic jams, - the traffic quality can increase, - with less time on the road. - However, - to reduce traffic jams it is essential to understand how these work. - -\end_layout - -\begin_layout Standard -For this, - it is necessary to study the underlying mathematical model of traffic jams, +The arising question is, + how to reduce these traffic jams to increase the quality of these. + This work investigates the underlying mathematical model of traffic jams, which states a smaller vehicle speed at higher number densities. \begin_inset Float figure placement document @@ -147,7 +137,9 @@ status open \begin_inset Caption Standard \begin_layout Plain Layout -Image by Al Gг from Pixabay +High number densities of cars lead to a smaller speed of those, + resulting in traffic jams. + Image by Al Gг from Pixabay \end_layout \end_inset @@ -159,7 +151,7 @@ Image by Al Gг from Pixabay \begin_inset Note Note -status open +status collapsed \begin_layout Plain Layout Engineering Problem: @@ -274,7 +266,7 @@ where \begin_inset Formula $V(u)$ \end_inset - is the velocity of vehicles, + the velocity of vehicles, depending on the number density and \begin_inset Formula $b-a$ \end_inset @@ -291,6 +283,13 @@ u\big|_{x=a}=u_{\text{in}} is assumed to hold true. This inflow boundary condition models the number of arriving cars at the beginning of the road. + In this work, + +\begin_inset Formula $u_{\text{in}}=u(x=x_{\text{in}})$ +\end_inset + + will be utilized, + making it consistent with the initial distribution. \end_layout \begin_layout Standard @@ -306,16 +305,11 @@ u\big|_{x=x_{\text{in}}} & =u_{\text{in}} \end_inset -In this work, - -\begin_inset Formula $u_{\text{in}}$ -\end_inset - - will be used as -\begin_inset Formula $u_{0}(x=x_{\text{in}})$ +with the flux function +\begin_inset Formula $f(u)$ \end_inset - making it consistent with the initial distribution. +. The main assumption for this model is, that the vehicle velocity depends on the number density \begin_inset Formula @@ -328,24 +322,16 @@ V(u)\propto(1-u) Increasing number densities lead to a decreased vehicle velocity and vice versa. Finally, the velocity is scaled to its maximum value -\begin_inset Formula $V_{\text{max}}$ -\end_inset - - and this maximum value is set to -\begin_inset Formula $1$ -\end_inset - - ( \begin_inset Formula $V_{\text{max}}=1$ \end_inset -), +, resulting in \begin_inset Formula \begin{align} V(u) & =V_{\text{max}}(1-u)\\ & =(1-u)\\ -\Rightarrow u_{t}+\left(u(1-u)\right)_{x} & =0,\quad x\in[a,b]\\ +\Rightarrow u_{t}+\left((1-u)u\right)_{x} & =0,\quad x\in[a,b]\\ \Leftrightarrow u_{t}+\left(f(u)\right)_{x} & =0\\ \text{for: }f(u) & =u(1-u) \end{align} @@ -361,7 +347,7 @@ Arising Research Questions \end_layout \begin_layout Standard -From this mathematical model and the physical background some research questions arise. +From the mathematical model and the physical background some research questions arise. \end_layout \begin_layout Enumerate @@ -387,9 +373,67 @@ Is it more efficient to have a high distance or short distance between the cars? but less cars are on the road. \end_layout +\begin_layout Subsection +Format of this Work +\end_layout + +\begin_layout Standard +Section +\begin_inset CommandInset ref +LatexCommand ref +reference "sec:Theory-and-Methods" +plural "false" +caps "false" +noprefix "false" +nolink "false" + +\end_inset + + will introduce the theoretical background to solve the aforementioned general conservation law analytically. + In Section +\begin_inset CommandInset ref +LatexCommand ref +reference "sec:Implementation" +plural "false" +caps "false" +noprefix "false" +nolink "false" + +\end_inset + + a method to solve the equation numerically, + will be introduced and Section +\begin_inset CommandInset ref +LatexCommand ref +reference "sec:Results" +plural "false" +caps "false" +noprefix "false" +nolink "false" + +\end_inset + + will show different examples for both, + the analytical and numerical, + solution. + Finally, + Section +\begin_inset CommandInset ref +LatexCommand ref +reference "sec:Discussion-and-Conclusion" +plural "false" +caps "false" +noprefix "false" +nolink "false" + +\end_inset + + will discuss the results and gives a small outlook. +\end_layout + \begin_layout Standard \begin_inset Note Note -status open +status collapsed \begin_layout Plain Layout Relevant research questions diff --git a/Project2/LyX/Results.lyx b/Project2/LyX/Results.lyx index 8078ebb75770dcc77d0dac54e837a368d068d90f..c1dd0f49c2c39f01eac0da3ebe70fd8ac23f4856 100644 --- a/Project2/LyX/Results.lyx +++ b/Project2/LyX/Results.lyx @@ -106,12 +106,75 @@ name "sec:Results" \end_layout +\begin_layout Standard +In the following Section different examples will be investigated with both, + analytical and numerical, + solutions. + Section +\begin_inset CommandInset ref +LatexCommand ref +reference "subsec:Formation-of-Discontinuities" +plural "false" +caps "false" +noprefix "false" +nolink "false" + +\end_inset + + shows the analytical calculation of the time of a discontinuity, + Section +\begin_inset CommandInset ref +LatexCommand ref +reference "subsec:A-Second-Model-Problem" +plural "false" +caps "false" +noprefix "false" +nolink "false" + +\end_inset + + shows the analytical and numerical solution for a more complex problem, + which is still a model problem. + Finally, + Sections +\begin_inset CommandInset ref +LatexCommand ref +reference "subsec:ConnectionToTrafficFlowProblem" +plural "false" +caps "false" +noprefix "false" +nolink "false" + +\end_inset + + (analytical and numerical) and +\begin_inset CommandInset ref +LatexCommand ref +reference "subsec:A-Second-Traffic-Flow-Problem" +plural "false" +caps "false" +noprefix "false" +nolink "false" + +\end_inset + + (numerical) solve a problem, + related to traffic flows. +\end_layout + \begin_layout Subsection Formation of Discontinuities for the convex flux function \begin_inset Formula $f(u)=u^{2}$ \end_inset +\begin_inset CommandInset label +LatexCommand label +name "subsec:Formation-of-Discontinuities" + +\end_inset + + \end_layout \begin_layout Standard @@ -142,14 +205,10 @@ u_{0}(x)=\begin{cases} \end_inset - -\end_layout - -\begin_layout Standard -For this example, - it is interesting to calculate the time when a discontinuity is first formed. - For this, - equation +It is interesting to calculate the time, + when a discontinuity occurs, + to analyze the breaking time of the analytical solution. + Equation \begin_inset CommandInset ref LatexCommand ref reference "eq:FormationDiscontinuities" @@ -160,7 +219,7 @@ nolink "false" \end_inset - will be used. + will be used for this. \end_layout \begin_layout Standard @@ -187,11 +246,15 @@ On the right part of the domain ( \end_inset -Conclude from this that for time +Conclude from this that the solution is valid for +\begin_inset Formula $t<\frac{1}{4}$ +\end_inset + + and for \begin_inset Formula $t=\frac{1}{4}$ \end_inset - a first shock forms. + a first discontinuity forms. \end_layout \begin_layout Subsection @@ -200,6 +263,13 @@ A Second Model Problem with \end_inset +\begin_inset CommandInset label +LatexCommand label +name "subsec:A-Second-Model-Problem" + +\end_inset + + \end_layout \begin_layout Standard @@ -224,15 +294,7 @@ u_{0}(x)=\begin{cases} 2x & ,x\in(0,\frac{1}{2}]\\ 1 & ,x\in(\frac{1}{2},1]\\ 3-2x & ,x\in(1,\frac{3}{2}] -\end{cases} -\end{equation} - -\end_inset - -and the derivative of the initial state -\begin_inset Formula -\begin{equation} -u_{0}'(x)=\begin{cases} +\end{cases}\qquad u_{0}'(x)=\begin{cases} 2 & ,x\in(0,\frac{1}{2}]\\ 0 & ,x\in(\frac{1}{2},1]\\ -2 & ,x\in(1,\frac{3}{2}] @@ -245,7 +307,7 @@ u_{0}'(x)=\begin{cases} \end_layout \begin_layout Standard -For the solution the steps described in section +The steps from section \begin_inset CommandInset ref LatexCommand ref reference "sec:Theory-and-Methods" @@ -256,7 +318,7 @@ nolink "false" \end_inset - will be utilized. + will be utilized to find an analytical solution. First, calculate the characteristic with \begin_inset Formula @@ -270,7 +332,7 @@ x & =x_{0}+tu_{0}(x_{0})\\ & =\begin{cases} x_{0}\left(1+2t\right) & ,0<x_{0}\leq\frac{1}{2}\\ x_{0}+t & ,\frac{1}{2}<x_{0}\leq1\\ -x_{0}\left(1-2t\right)+3t & ,\frac{1}{2}<x_{0}\leq1 +x_{0}\left(1-2t\right)+3t & ,1<x_{0}\leq\frac{3}{2} \end{cases}\\ \Leftrightarrow x_{0} & =\begin{cases} \frac{x}{1+2t} & ,0<x_{0}=\frac{x}{1+2t}\leq\frac{1}{2}\\ @@ -281,8 +343,7 @@ x-t & ,\frac{1}{2}<x_{0}=x-t\leq1\\ \end_inset -In the second step, - the solution will be calculated based on formula +The final solution can be found with formula \begin_inset CommandInset ref LatexCommand ref reference "eq:GeneralAnalyticalSolution" @@ -413,6 +474,13 @@ Visualization of the solution of the scalar PDE and its flux function over space initially there are some point-wise discrepancies, shown by the absolute error, indicating problems of the numerical implementation. +\begin_inset CommandInset label +LatexCommand label +name "fig:A-Second-Model-Problem" + +\end_inset + + \end_layout \end_inset @@ -429,6 +497,49 @@ Visualization of the solution of the scalar PDE and its flux function over space \end_layout +\begin_layout Standard +Figure +\begin_inset CommandInset ref +LatexCommand ref +reference "fig:A-Second-Model-Problem" +plural "false" +caps "false" +noprefix "false" +nolink "false" + +\end_inset + + visualizes the solution to the problem over space and time. + It can be seen, + that the numerical solution is an almost perfect match with the analytical solution. + However, + initially there are some point-wise discrepancies between both solutions, + indicating some problems with the numerical solution. + Reasons for this can be the choice of the artificial diffusion, + defined by +\begin_inset Formula $M$ +\end_inset + +. + +\end_layout + +\begin_layout Standard +The initial distribution slowly dissolves towards the inflow value +\begin_inset Formula $u_{\text{in}}=0$ +\end_inset + +, + faster at the side of the inflow condition, + than the other side. + The flux function behaves similar but more smooth, + as the quadratic flux function increases non-linear with the property +\begin_inset Formula $u$ +\end_inset + +. +\end_layout + \begin_layout Subsection Creating a Connection to the Traffic Flow Problem with a Riemann Problem \begin_inset CommandInset label @@ -1021,11 +1132,21 @@ nolink "false" \end_inset the velocity of cars for different densities. - It can be seen that the velocity decreases linearly for an increasing number of cars, + The velocity decreases linearly for an increasing number of cars, connecting this problem to the traffic flow model. + The initial distribution shows a traffic flow on the area +\begin_inset Formula $x\in[0,1]$ +\end_inset + +, + while the remaining street is empty. \end_layout -\begin_layout Standard +\begin_layout Remark +Connecting the flux function to the initial traffic flow problem. +\end_layout + +\begin_layout Remark The flux has its maximum for a density of \begin_inset Formula $u=0.5$ \end_inset @@ -1036,21 +1157,21 @@ The flux has its maximum for a density of \end_inset , - the highest flux is reached for a balance of number of cars and velocity of those. + the highest flux is reached for a balance between the number of cars and velocity of those. For a very small number of cars ( \begin_inset Formula $u\to0$ \end_inset ), - the velocity of those cars is the highest, + those cars can dry very fast, but the total number of cars passing the street is very small. On the other hand, for a very high number of cars ( \begin_inset Formula $u\to1$ \end_inset -) the velocity of the cars goes close to zero, - while many cars are on the street. +) the cars drive very slow, + but many cars are on the street. Therefore, to reach the highest number of cars going from place A to place B, the distance from one car to the next car is mandatory. @@ -1058,11 +1179,7 @@ The flux has its maximum for a density of decreasing the total number of cars on the street, nor should it be too small, decreasing the velocity of those cars on the street. - -\end_layout - -\begin_layout Standard -A traffic flow can finally be avoided by maximizing the flow of cars on a street. + A traffic flow can finally be avoided by maximizing the flow of cars on a street. This can be achieved by choosing the number of cars such that the flux function \begin_inset Formula $f(u)=uV(u)$ \end_inset @@ -1084,7 +1201,7 @@ name "subsec:AnalyticalSolution_2.3" \begin_layout Standard Two solve the Riemann problem analytically, first note that the flux function is not convex, - but concave with + but concave \begin_inset Formula \begin{align} f(u) & =2u(1-u)\\ @@ -1120,11 +1237,7 @@ nolink "false" \end_inset . - -\end_layout - -\begin_layout Standard -The Riemann problem at position + The Riemann problem at position \begin_inset Formula $x=0$ \end_inset @@ -1251,37 +1364,26 @@ w_{r} & ,\xi>f'(w_{r}) & =\begin{cases} \frac{3}{4} & ,x<1-t\\ \frac{2-\frac{x-1}{t}}{4} & ,1-t\leq x\leq1+2t\\ -0 & ,x>1+2t +0 & ,1+2t<x \end{cases} \end{align} \end_inset Combining both Riemann problems again, - gives the complete analytical solution + yields the complete analytical solution \begin_inset Formula \begin{equation} u(x,t)=\begin{cases} 0 & ,x\leq\frac{1}{2}t\\ \frac{3}{4} & ,\frac{1}{2}t<x<1-t\\ \frac{2-\frac{x-1}{t}}{4} & ,1-t\leq x\leq1+2t\\ -0 & ,x>1+2t +0 & ,1+2t<x \end{cases} \end{equation} \end_inset - -\begin_inset Note Note -status open - -\begin_layout Plain Layout -When is it valid? - And when not? -\end_layout - -\end_inset - However, this solution is only valid for a certain time-period \begin_inset Formula $t\in[0,T^{c}]$ @@ -1292,7 +1394,6 @@ However, \end_inset is the time in which the Rarefaction wave and the shock wave are at the same position. - Checking the time when the position of the shock wave is at the left side of the Rarefaction wave yields \begin_inset Formula \begin{align} \frac{1}{2}T^{c} & =1-T^{c}\\ @@ -1373,7 +1474,7 @@ status open \begin_inset Caption Standard \begin_layout Plain Layout -Solution at +Solution at breaking time \begin_inset Formula $t=T^{c}$ \end_inset @@ -1382,7 +1483,7 @@ Solution at \begin_inset Formula $t=T^{c}$ \end_inset - is visualized for + are visualized for \begin_inset Formula $u$ \end_inset @@ -1391,6 +1492,7 @@ Solution at \end_inset (right). + At the breaking time a new problem is formed. \begin_inset CommandInset label LatexCommand label @@ -1449,7 +1551,7 @@ Solution for \end_inset . - The numerical solution (left) and analytical solution (right) show an almost perfect match. + The numerical solution (left) and analytical solution (center) show an almost perfect match. This can be verified by the absolute error (right). \begin_inset CommandInset label LatexCommand label @@ -1529,7 +1631,7 @@ nolink "false" verifying the correct calculation of the intersection time. On the right, - the initial flux and and flux at the intersection time is visualized. + the initial flux and the flux at the intersection time are visualized. Figure \begin_inset CommandInset ref LatexCommand ref @@ -1546,12 +1648,12 @@ nolink "false" \end_layout \begin_layout Standard -Relating the solutions to the physical setup of a traffic flow yields several results +Relating the solutions to the physical setup of a traffic flow yields \end_layout \begin_layout Enumerate If a traffic flow occurs on the center of a road, - with no cars before and after the traffic flow, + with an empty road elsewhere, this traffic flow will dissolve from itself \end_layout @@ -1575,6 +1677,13 @@ The maximum flux is neither reached for the highest nor the smallest number dens \begin_layout Subsection A Second Traffic Flow Simulation with Complex Initial Data +\begin_inset CommandInset label +LatexCommand label +name "subsec:A-Second-Traffic-Flow-Problem" + +\end_inset + + \end_layout \begin_layout Standard @@ -1628,18 +1737,23 @@ Both distributions are similar on a major part of the domain , where the density of cars increases stepwise, introducing a traffic flow with stepwise increasing significance. - The number of cars for distribution A decreases on + The number of cars for distribution A increases on \begin_inset Formula $x\in(2.5,3.5]$ \end_inset - indicating a dissolution of the traffic flow, - while the significance further increases for distribution B. + indicating a further significance of the traffic flow, + while it dissolves for initial data B. + Initial data B also allows the initial flux to take its maximum on +\begin_inset Formula $x\in(2.5,3.5]$ +\end_inset + +. \end_layout \begin_layout Standard The traffic flow model is again satisfied, - as the velocity decreases for increasing densities of car (see Section + as the velocity decreases for increasing densities of cars (see Section \begin_inset CommandInset ref LatexCommand ref reference "sec:Introduction" @@ -1701,6 +1815,11 @@ Solution for The traffic flow is not dissolved and its significance is even increased. At the final time, the maximum number of cars is reached on the whole street. + The initial flux has its maximum on the interior of the domain and a higher value on the inflow than the outflow, + leading to a bigger the traffic flow. + This flux behavior is conserved over time, + which prevents the traffic flow to be dissolved. + \begin_inset CommandInset label LatexCommand label name "fig:TrafficFlow_A" @@ -1762,6 +1881,10 @@ Solution for The rarefaction wave at the right-most Riemann problem reduces the density of cars, resulting in a free flow of cars, again. + The initial flux function takes its maximum on the outflow. + Therefore, + more cars can leave the traffic flow than enter. + This behavior is conserved over time and allows the traffic flow to dissolve from itself. \begin_inset CommandInset label LatexCommand label name "fig:TrafficFlow_B" @@ -1831,8 +1954,7 @@ nolink "false" . Notice that the traffic flow is successfully dissolved for initial distribution B, - while the traffic flow's front moves away from the traffic flow for initial distribution B, - even increasing the significance of the traffic flow. + while its significance is even increased for distribution A. \end_layout \begin_layout Standard @@ -1842,12 +1964,12 @@ The flux function is concave ( ) and the initial distribution shows several Riemann problems, at each step. - For each Riemann problem in initial data A, - + Each Riemann problem in initial data A results in a shock solution, + as \begin_inset Formula $u_{l}<u_{r}$ \end_inset - indicating a shock solution. +. This shock moves towards the left as the shock speed \begin_inset Formula $s=\frac{f(u_{l})-f(u_{r})}{u_{l}-u_{r}}<0$ \end_inset @@ -1888,12 +2010,13 @@ Note that the flux function maximizes for \end_inset the flux reaches its highest value at the initial distribution and decreases after. - This results in the increasing significance of the traffic jam. + This results in the increasing significance of the traffic jam, + as more cars enter the traffic flow than leave it. Problem B, on the other hand, is initialized in a way that the flux of cars is maximized at the end of the traffic flow. This results in a step-wise dissolution from the traffic jam, - as the cars in the end of the traffic jam will drive faster compared to those in the beginning and the center of the traffic jam. + as more cars leave the traffic jam than enter it. \begin_inset Note Note status open diff --git a/Project2/LyX/TheoryAndMethods.lyx b/Project2/LyX/TheoryAndMethods.lyx index 833a9e6db8563570dc7421f0c438b4b738dd26ea..e0d067ea6c998f9d7a786d968d6b20e6db337750 100644 --- a/Project2/LyX/TheoryAndMethods.lyx +++ b/Project2/LyX/TheoryAndMethods.lyx @@ -127,19 +127,20 @@ and reformulate the problem to \begin_inset Formula \begin{equation} \begin{cases} -u_{t}+f'(u)u_{x}\\ +u_{t}+f'(u)u_{x}=0\\ u(x,t=0)=u_{0}(x) \end{cases}\label{eq:gProblem_General} \end{equation} \end_inset -As a first step, +To find an analytical solution to this problem, the time derivative of \begin_inset Formula $u(x(t),t)$ \end_inset - will be calculated + will be calculated, + in the first step. \begin_inset Formula \begin{equation} \frac{d}{dt}u(x(t),t)=u_{t}\cancel{\frac{dt}{dt}}+u_{x}\frac{dx}{dt}=u_{t}+u_{x}f'(u)\overset{!}{=}0\label{eq:u_General} @@ -147,7 +148,7 @@ As a first step, \end_inset -from this it can be concluded that +It can be concluded that \begin_inset Formula $u(x(t),t)$ \end_inset @@ -188,7 +189,7 @@ concludes, \begin_inset Formula \begin{align} dx & =f'\left(u_{0}(x_{0})\right)dt\\ -\Leftrightarrow\int_{x(t=0)}^{x(t)}1dx & =\int_{0}^{1}f'\left(u_{0}(x_{0})\right)dt=f'\left(u_{0}(x_{0})\right)t\\ +\Leftrightarrow\int_{x(t=0)}^{x(t)}1dx & =\int_{t=0}^{t}f'\left(u_{0}(x_{0})\right)dt=f'\left(u_{0}(x_{0})\right)t\\ \Rightarrow x(t) & =x_{0}+f'\left(u_{0}(x_{0})\right)t \end{align} @@ -231,7 +232,7 @@ A natural arising question is, . However, - the PDE is only fulfilled under the constraint + the PDE is only satisfied under the constraint \begin_inset Formula $1+u_{0}'(x-f'(u(x,t))t)+f''(u(x,t))\neq0$ \end_inset @@ -247,14 +248,18 @@ literal "false" \end_layout \begin_layout Proof -\begin_inset Formula $1+u_{0}'(x-f'(u(x,t))t)+f''(u(x,t))\neq0$ +\begin_inset Formula $u(x,t)$ \end_inset - has to be fulfilled to transform -\begin_inset Formula $u(x,t)$ + is a solution to the general conservation law +\begin_inset Formula $u_{t}+f(u)_{x}=0$ \end_inset - into a solution + for +\begin_inset Formula $1+u_{0}'(x-f'(u(x,t))t)+f''(u(x,t))\neq0$ +\end_inset + + \end_layout \begin_layout Proof @@ -264,6 +269,21 @@ First, \end_inset . +\begin_inset Note Note +status open + +\begin_layout Plain Layout +Check the derivatives, + especially +\begin_inset Formula $u_{t}$ +\end_inset + + +\end_layout + +\end_inset + + \end_layout \begin_layout Proof @@ -293,7 +313,7 @@ Inserting the expressions for \begin{align} u_{t}+f(u)_{x} & =-u_{0}'(v)\left(\cancel{f'(u)}+tf''(u)u_{t}\right)+u_{0}'(v)\left(f\cancel{'(u)}-tf''(u)f(u)_{x}\right)\\ & =-u_{0}'(v)tf''(u)\left(u_{t}+f(u)u_{x}\right)\\ -\Leftrightarrow\left(u_{t}+f(u)_{x}\right) & \left(1+u_{0}'(v)t+f''(u)\right)=0 +\Leftrightarrow\left(u_{t}+f(u)_{x}\right)\left(1+u_{0}'(v)t+f''(u)\right) & =0 \end{align} \end_inset @@ -362,11 +382,11 @@ u(x,t) & =u_{0}\left(\underbrace{x-f'(u(x,t)t}_{v(x,t)}\right) \end_inset -and calculate the spatial derivative ( +and calculate the spatial derivative \begin_inset Formula $u_{x}$ \end_inset -) of this + of this \begin_inset Formula \begin{align} u_{x} & =\frac{\partial}{\partial x}u_{0}(v)=u_{0}'(v)\frac{\partial v}{\partial x}=u_{0}'(v)\frac{\partial}{\partial x}\left(x-f'(u)t\right)\\ @@ -405,7 +425,7 @@ Rarefaction waves \end_layout \begin_layout Standard -Two different classes of waves can be identifies, +Two different classes of waves can be identified, based on the characteristics of the original PDE problem; rarefaction waves and compression waves. \end_layout @@ -414,7 +434,7 @@ Two different classes of waves can be identifies, Rarefaction waves, on the one hand, occur when characteristics diverge and yield smooth and continuous solutions to the PDE. - The shape of the rarefaction wave is determined by the flux function. + The shape of rarefaction waves is determined by the flux function. Compression waves, on the other hand, occur when characteristics converge to each other and will cross. @@ -646,8 +666,8 @@ end{tikzpicture} \begin_layout Plain Layout Rarefaction and Compression waves. - Rarefaction waves occur for diverging characteristics, - while compression waves arise for converging characteristics at the point of intersection a discontinuity solution will form. + Rarefaction waves occur for diverging characteristics and yield a continuous solution. + Compression waves arise for converging characteristics and form a discontinuity at the point of intersection. \end_layout \end_inset @@ -678,13 +698,11 @@ Consider the PDE \end_inset . - The Rankine-Hugoniot condition yields an, - explicit, - expression for the speed of a shock ( + The Rankine-Hugoniot condition yields an explicit expression for the speed of a shock \begin_inset Formula $s$ \end_inset -), +, given a shock occurs (see \begin_inset CommandInset citation LatexCommand cite @@ -714,7 +732,7 @@ with \end_layout \begin_layout Proof -The Rankine-Hugoniot Condition +A shock travels with velocity \begin_inset Formula $s=\frac{f(u_{l})-f(u_{r})}{u_{l}-u_{r}}$ \end_inset @@ -723,20 +741,12 @@ The Rankine-Hugoniot Condition \begin_layout Proof Consider the following assumptions: -\end_layout - -\begin_layout Proof -The solution to the scalar conservation problem + The solution to the scalar conservation problem \begin_inset Formula $u_{t}+f(u)_{x}$ \end_inset - is yields a shock -\end_layout - -\begin_layout Proof -The shock, - moving with a positive velocity, - along a path is represented by + yields a shock. + The shock moves with a positive velocity along a path and is represented by \begin_inset Formula $u_{l}(t)$ \end_inset @@ -744,10 +754,8 @@ The shock, \begin_inset Formula $u_{r}(t)$ \end_inset - -\end_layout - -\begin_layout Proof +. + \begin_inset Formula $u_{l}$ \end_inset @@ -755,11 +763,8 @@ The shock, \begin_inset Formula $u_{r}$ \end_inset - are locally constant -\end_layout - -\begin_layout Proof -The shock speed is represented by + are locally constant. + The shock speed is represented by \begin_inset Formula $s=\frac{\Delta x}{\Delta t}$ \end_inset @@ -771,7 +776,11 @@ Consider the window \begin_inset Formula $R=[x_{1},x_{1}+\Delta x]\times[t_{1},t_{1}+\Delta t]$ \end_inset - around the shock. + around the shock and integrate the PDE around the shock (the window +\begin_inset Formula $R$ +\end_inset + +) over space and time \end_layout \begin_layout Proof @@ -1032,15 +1041,7 @@ Schematic Figure of Rankine-Hugoniot condition window for a convex flux function \end_inset - -\end_layout - -\begin_layout Proof -Start by integrating the PDE around the shock (the window -\begin_inset Formula $R$ -\end_inset - -) over space and time + \begin_inset Formula \begin{align} 0 & =\iint_{R}\left(u_{t}+f(u)_{x}\right)dxdt\\ @@ -1073,7 +1074,7 @@ Now, \begin{equation} \begin{array}{cc} u(t_{1})=u_{r} & u(t_{1}+\Delta t)=u_{l}\\ -f(u(x_{1}))=f(u_{r}) & f(u(x_{1}+\Delta x))=u_{r} +f(u(x_{1}))=f(u_{l}) & f(u(x_{1}+\Delta x))=f(u_{r}) \end{array} \end{equation} @@ -1082,7 +1083,7 @@ f(u(x_{1}))=f(u_{r}) & f(u(x_{1}+\Delta x))=u_{r} and simplify the integrals to \begin_inset Formula \begin{align} -0 & =\int_{x_{1}}^{x_{1}+\Delta x}\underbrace{(u_{l}-u_{r})}_{\text{constant}}dx+\int_{t_{1}}^{t_{1}+\Delta t}\left(f(u_{r})-f(u_{l})\right)dt\\ +0 & =\int_{x_{1}}^{x_{1}+\Delta x}\underbrace{(u_{l}-u_{r})}_{\text{constant}}dx+\int_{t_{1}}^{t_{1}+\Delta t}\underbrace{\left(f(u_{r})-f(u_{l})\right)}_{\text{constant}}dt\\ & =(u_{l}-u_{r})\Delta x+\left(f(u_{r})-f(u_{l})\right)\Delta t\\ \Leftrightarrow\frac{\Delta x}{\Delta t} & =\frac{f(u_{l})-f(u_{r})}{u_{l}-u_{r}}=s\label{eq:RH} \end{align} @@ -1275,7 +1276,7 @@ Schematic visualization of a Riemann problem. \end_layout \begin_layout Standard -For the Riemann problem there can be found two different classes of solutions (see +There are two classes of solutions for the Riemann problem (see \begin_inset CommandInset citation LatexCommand cite key "Intro_ConsLaw_2021" @@ -1310,14 +1311,15 @@ Shock Solution: \end_inset by a discontinuous solution, - where the discontinuity moves with the speed s, + where the discontinuity moves with speed s, derived by the Rankine-Hugoniot condition \end_layout \begin_layout Standard -In the following assume the flux function to be convex. +In the following, + assume the flux function to be convex. All derivates can be performed for a concave flux function in the same manner, - but will produce different results. + but will produce slightly different results. \end_layout \begin_layout Subsubsection @@ -1335,8 +1337,7 @@ A continuous similarity solution occurs under the condition \end_inset , - where two different characteristics, - which will not cross. + where two different characteristics will not cross. \begin_inset Formula \[ x=f'(u_{l})t\qquad x=f'(u_{r})t @@ -1364,7 +1365,7 @@ In between these two characteristics, \begin{equation} u(x,t)=\begin{cases} u_{l} & ,\frac{x}{t}\leq f'(u_{l})\\ -v(\frac{x}{t}) & ,f'(u_{l}<x<f'(u_{r})\\ +v(\frac{x}{t}) & ,f'(u_{l})<x<f'(u_{r})\\ u_{r} & ,\frac{x}{t}\geq f'(u_{r}) \end{cases}\label{eq:SimilaritySolutionAbstract} \end{equation} @@ -1431,7 +1432,7 @@ Where Note that this inverse exists, as the flux function is convex and therefore the second derivative is positive. Now, - insert the solution + insert the equation \begin_inset CommandInset ref LatexCommand ref reference "eq:v_x/t" @@ -1442,7 +1443,7 @@ nolink "false" \end_inset - into the general solution + into the equation \begin_inset CommandInset ref LatexCommand ref reference "eq:SimilaritySolutionAbstract" @@ -1479,7 +1480,7 @@ Contrary to the similarity solution, \end_inset . - For the shock solution two characteristics cross, + In this scenario two characteristics cross, yielding a discontinuous solution with a jump. This jump moves with the shock speed \begin_inset Formula $s$ @@ -1503,7 +1504,7 @@ nolink "false" \begin{equation} u(x,t)=\begin{cases} u_{l} & ,\frac{x}{t}\leq s\\ -u_{r} & ,x<\frac{x}{t} +u_{r} & ,s<\frac{x}{t} \end{cases}\qquad\text{with: }s=\frac{f(u_{l})-f(u_{r})}{u_{l}-u_{r}} \end{equation} @@ -1527,7 +1528,7 @@ Weak solutions can simplify mathematical problems by introducing some test funct \end_inset . - Weak solutions have two important properties + Weak solutions have two important properties. \end_layout \begin_layout Enumerate @@ -1544,7 +1545,7 @@ No Derivatives: \begin_inset Formula $f(u)$ \end_inset - as they are moved to the test function + as they are moved to the test function. \end_layout \begin_layout Enumerate @@ -1554,7 +1555,7 @@ Solution Space: \series default The solution space of weak solutions is much larger then the solution space for strong solutions. - Weak solutions can even include more then one solution for a given problem + Weak solutions can even include more then one solution for a given problem. \end_layout \begin_layout Standard @@ -1591,7 +1592,7 @@ The weak form then reads: \end_inset -Note that in the last step integration by parts and the property that the test function vanishes on the boundaries was utilized. +Note that in the last step integration by parts and the property that the test function vanishes on the boundaries were utilized. Any function \begin_inset Formula $u(x,t)$ \end_inset @@ -1647,7 +1648,7 @@ f'(u_{l})>s>f'(u_{r}) \end_inset . - Conclude from this + Conclude from this for a convex flux function \end_layout \begin_layout Enumerate diff --git a/Project2/src/Problem_2_3.ipynb b/Project2/src/Problem_2_3.ipynb index f9791baa5e374130495168c0b3a02348fd887266..532edcb30711b82e806466580d518f16140e31e4 100644 --- a/Project2/src/Problem_2_3.ipynb +++ b/Project2/src/Problem_2_3.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 37, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -12,7 +12,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -43,7 +43,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -89,7 +89,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -131,7 +131,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -165,7 +165,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -174,7 +174,7 @@ "0.375" ] }, - "execution_count": 42, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -192,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -202,7 +202,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -221,14 +221,14 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_20214/3866153160.py:17: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", + "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_49601/3866153160.py:17: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", " fig.show()\n" ] }, @@ -265,7 +265,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -274,7 +274,7 @@ "(<Figure size 640x480 with 1 Axes>, <Axes: xlabel='x', ylabel='f(u)'>)" ] }, - "execution_count": 46, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" }, @@ -297,7 +297,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -324,7 +324,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -351,7 +351,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -365,7 +365,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_20214/1589535761.py:8: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", + "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_49601/1589535761.py:8: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", " fig.show()\n" ] }, @@ -393,16 +393,16 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 15, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_20214/1239769646.py:12: RuntimeWarning: divide by zero encountered in divide\n", + "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_49601/1239769646.py:12: RuntimeWarning: divide by zero encountered in divide\n", " (2 - (x-1)/t)/4,\n", - "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_20214/346561436.py:3: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", + "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_49601/346561436.py:3: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", " fig.show()\n" ] }, @@ -425,20 +425,20 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 16, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_20214/1239769646.py:12: RuntimeWarning: divide by zero encountered in divide\n", + "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_49601/1239769646.py:12: RuntimeWarning: divide by zero encountered in divide\n", " (2 - (x-1)/t)/4,\n", "/Users/janhabscheid/Documents/git/ddm/Project2/src/SystemGeneric.py:358: RuntimeWarning: divide by zero encountered in divide\n", " rel_error = abs_error / np.abs(u_analytical)\n", "/Users/janhabscheid/Documents/git/ddm/Project2/src/SystemGeneric.py:358: RuntimeWarning: invalid value encountered in divide\n", " rel_error = abs_error / np.abs(u_analytical)\n", - "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_20214/71401304.py:3: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", + "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_49601/71401304.py:3: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", " fig.show()\n" ] }, @@ -477,13 +477,15 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 17, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ + "Nx: [ 10 100 1000 10000]\n", + "dx: [0.7 0.07 0.007 0.0007]\n", "CFL Condition: True, CFL number: 0.00013392857142857144\n", "CFL Condition: True, CFL number: 0.001339285714285714\n", "CFL Condition: True, CFL number: 0.013392857142857142\n", @@ -494,7 +496,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_20214/1324504847.py:40: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", + "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_49601/3459604413.py:43: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", " fig.show()\n" ] }, @@ -544,6 +546,9 @@ "# dx = np.array([10e-3, 10e-2, 10e-1, 10e-0])\n", "x0, x1 = -2, 5\n", "dx = (x1 - x0) / Nx\n", + "\n", + "print(f'Nx: {Nx}')\n", + "print(f'dx: {dx}')\n", "# Nx = (x1 - x0) / dx\n", "\n", "NTime = 1_000\n", @@ -588,7 +593,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -599,13 +604,13 @@ "<>:16: SyntaxWarning: invalid escape sequence '\\D'\n", "<>:7: SyntaxWarning: invalid escape sequence '\\D'\n", "<>:16: SyntaxWarning: invalid escape sequence '\\D'\n", - "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_20214/2350136093.py:7: SyntaxWarning: invalid escape sequence '\\D'\n", + "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_49601/2350136093.py:7: SyntaxWarning: invalid escape sequence '\\D'\n", " axs.set_xlabel('$\\Delta x$')\n", - "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_20214/2350136093.py:16: SyntaxWarning: invalid escape sequence '\\D'\n", + "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_49601/2350136093.py:16: SyntaxWarning: invalid escape sequence '\\D'\n", " axs.set_xlabel('$\\Delta x$')\n", - "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_20214/2350136093.py:12: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", + "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_49601/2350136093.py:12: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", " fig.show()\n", - "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_20214/2350136093.py:21: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", + "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_49601/2350136093.py:21: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", " fig.show()\n" ] }, @@ -663,7 +668,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -677,11 +682,11 @@ "name": "stderr", "output_type": "stream", "text": [ - "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_20214/2362550528.py:2: RuntimeWarning: overflow encountered in multiply\n", + "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_49601/2362550528.py:2: RuntimeWarning: overflow encountered in multiply\n", " f = lambda u: 2 * u * (1 - u)\n", "/Users/janhabscheid/Documents/git/ddm/Project2/src/SystemGeneric.py:203: RuntimeWarning: invalid value encountered in subtract\n", " 1 / self.dx * (upwind_n_1 - upwind_n_2)\n", - "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_20214/521724299.py:35: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", + "/var/folders/v_/5q1gkdc53z34pdsfnpkx2t340000gn/T/ipykernel_49601/521724299.py:35: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n", " fig.show()\n" ] },