1
$\begingroup$

I'm pretty new to the DG method and have been writing a 1D code to help me understand the coding aspect. With respect a reference, I've been following these notes https://www3.nd.edu/~zxu2/acms60790S15/DG-general-approach.pdf. Where my confusion is comes from how to define the computational cells. In the notes the author defines

$$ x_{i} = 0.5(x_{i-1/2} + x_{i+1/2})\\ I_{i} = [x_{i-1/2},x_{i+1/2}]. $$

From a practical point of view, I am defining my mesh as follows

do i=1,ne
   x_r(i) = a + (i+0.5)*dx
   x_l(i) = a + (i-0.5)*dx
   x_c(i) = 0.5*(x_r(i) + x_l(i))
end do 

As a note, a refers to the left side of the domain, i.e. [a,b]. $x_{i+1/2}$ is x_r and $x_{i-1/2}$ is x_l. So my question is whether or not that is how I am supposed to define the left and right grid points. I know that in structured finite volume methods, thats how you calculate the grid points at the half points (faces). Thanks!

$\endgroup$
3
  • $\begingroup$ Note that, according to your formulas, you cand write equivalently x_c(i) = a + i * dx. $\endgroup$ Dec 2, 2019 at 3:09
  • $\begingroup$ Correct, however the point in question is x_r and x_l, and whether or not thats how they should be practically calculated (in code). Thanks for the comment though. $\endgroup$
    – Motig
    Dec 2, 2019 at 4:04
  • $\begingroup$ Is it necessary that the cells all have the same size? In some fluid dynamics problems, the cell sizes may differ. $\endgroup$ Dec 2, 2019 at 10:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.