Changes between Version 9 and Version 10 of u/ehansen/buildcode
- Timestamp:
- 10/31/11 19:00:07 (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
u/ehansen/buildcode
v9 v10 30 30 Where [[latex($\tilde{U}$)]] is the global solution as opposed to the local solution [[latex($U$)]]. However, we already know that the global solution can be written in terms of its fluxes. You just use equation (1) with a specific control volume: 31 31 32 [[latex($\int^{x_{i+\frac{1}{2}}}_{x_{i - \frac{1}{2}}} \tilde{U}(x,t^{n+1}) \ \mathrm{d}x = \int^{x_{i+\frac{1}{2}}}_{x_{i - \frac{1}{2}}} \tilde{U}(x,t^{n}) \ \mathrm{d}x \ + \ \int_{t^{n}}^{t^{n+1}}F(\tilde{U}(x_{i-\frac{1}{2}},t)) \ \mathrm{d}t \ - \\int_{t^{n}}^{t^{n+1}} F(\tilde{U}(x_{i+\frac{1}{2}},t)) \ \mathrm{d}t \hspace{1 in} (3)$)]]32 [[latex($\int^{x_{i+\frac{1}{2}}}_{x_{i - \frac{1}{2}}} \tilde{U}(x,t^{n+1}) \ \mathrm{d}x = \int^{x_{i+\frac{1}{2}}}_{x_{i - \frac{1}{2}}} \tilde{U}(x,t^{n}) \ \mathrm{d}x + \int_{t^{n}}^{t^{n+1}}F(\tilde{U}(x_{i-\frac{1}{2}},t)) \ \mathrm{d}t - \int_{t^{n}}^{t^{n+1}} F(\tilde{U}(x_{i+\frac{1}{2}},t)) \ \mathrm{d}t \hspace{1 in} (3)$)]] 33 33 34 34 The trick is to write the global solution in terms of the local solution. This can be done through a transformation of coordinates: … … 36 36 [[latex($\tilde{U}(x,t) = U_{i+\frac{1}{2}}(\bar{x},\bar{t}) \hspace{1 in} (4)$)]] 37 37 38 Where [[latex($\bar{x}=x-x_{i+\frac{1}{2}}$)]] and [[latex($\bar{t}=t-t^n$)]]38 Where 39 39 40 [[latex($ \ \ \bar{x}=x-x_{i+\frac{1}{2}} \ \ \mathrm{and} \ \ \bar{t}=t-t^n \hspace{1 in} (5)$)]] 41 42 Now we can combine (4) and (5) to get: 43 44 [[latex($\tilde{U}((x_{i-\frac{1}{2}},t) = U_{i-\frac{1}{2}}(0) = constant \hspace{1 in} (6)$)]] 45 [[latex($\tilde{U}({x_{i+\frac{1}{2}},t) = U_{i+\frac{1}{2}}(0) = constant \hspace{1 in} (7)$)]] 46 47 Substitute (6) and (7) into (3), and then that result into (2) gives: 48 49 [[latex($U_{i}^{n+1} = \frac{1}{\Delta x} \int^{x_{i+\frac{1}{2}}}_{x_{i - \frac{1}{2}}} \tilde{U}(x,t^{n}) \ \mathrm{d}x + \frac{1}{\Delta x} \int_{t^{n}}^{t^{n+1}}F(U_{i-\frac{1}{2}}(0,t)) \ \mathrm{d}t - \frac{1}{\Delta x} \int_{t^{n}}^{t^{n+1}} F(U_{i+\frac{1}{2}}(0,t)) \ \mathrm{d}t \hspace{1 in} (8)$)]] 50 51 Just looking at the right hand side of (8)...the first term can be rewritten just by using the definition of cell average that we defined in (2), and since the flux integrands are now constants, those integrals can be simplified. The final equation reads: 52 53 [[latex($U_{i}^{n+1}=U_{i}^{n}+\frac{\Delta t}{\Delta x}[F(U_{i-\frac{1}{2}}(0))-F(U_{{i+\frac{1}{2}}(0)) \hspace{1 in} (9)$)]] 40 54 [[BR]] 41 55 == Program Outline ==