Skip to content

Commit

Permalink
Implement the third set of NRBC for 1D Euler solver
Browse files Browse the repository at this point in the history
For the 1D Euler solver, implement the third set of NRBC documented in [NASA/TM-2003-212495-REV1](http://gltrs.grc.nasa.gov/Citations.aspx?id=498), i.e., NRBC type 3.  $\lambda$ is chosen to be 0.
  • Loading branch information
yungyuc committed Apr 30, 2024
1 parent bc9e26f commit 92316dd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
36 changes: 20 additions & 16 deletions cpp/modmesh/onedim/Euler1DCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,39 +153,43 @@ void Euler1DCore::march_half_so0(bool odd_plane)

void Euler1DCore::treat_boundary_so0()
{
/* Non-reflecting boundary condition (NRBC) type 3 with $\lambda=0$
* (the third set in Chang 05) */
// Set outside value from inside value.
{
// Left boundary.
size_t const ic = 0;
m_so0(ic, 0) = m_so0(ic + 2, 0);
m_so0(ic, 1) = m_so0(ic + 2, 1);
m_so0(ic, 2) = m_so0(ic + 2, 2);
size_t const ic = 1;
m_so0(ic, 0) = m_so0(ic + 1, 0);
m_so0(ic, 1) = m_so0(ic + 1, 1);
m_so0(ic, 2) = m_so0(ic + 1, 2);
}
{
// Right boundary.
size_t const ic = ncoord() - 1;
m_so0(ic, 0) = m_so0(ic - 2, 0);
m_so0(ic, 1) = m_so0(ic - 2, 1);
m_so0(ic, 2) = m_so0(ic - 2, 2);
size_t const ic = ncoord() - 2;
m_so0(ic, 0) = m_so0(ic - 1, 0);
m_so0(ic, 1) = m_so0(ic - 1, 1);
m_so0(ic, 2) = m_so0(ic - 1, 2);
}
}

void Euler1DCore::treat_boundary_so1()
{
/* Non-reflecting boundary condition (NRBC) type 3 with $\lambda=0$
* (the third set in Chang 05) */
// Set outside value from inside value.
{
// Left boundary.
size_t const ic = 0;
m_so1(ic, 0) = m_so1(ic + 2, 0);
m_so1(ic, 1) = m_so1(ic + 2, 1);
m_so1(ic, 2) = m_so1(ic + 2, 2);
size_t const ic = 1;
m_so1(ic, 0) = m_so1(ic + 1, 0);
m_so1(ic, 1) = m_so1(ic + 1, 1);
m_so1(ic, 2) = m_so1(ic + 1, 2);
}
{
// Right boundary.
size_t const ic = ncoord() - 1;
m_so1(ic, 0) = m_so1(ic - 2, 0);
m_so1(ic, 1) = m_so1(ic - 2, 1);
m_so1(ic, 2) = m_so1(ic - 2, 2);
size_t const ic = ncoord() - 2;
m_so1(ic, 0) = m_so1(ic - 1, 0);
m_so1(ic, 1) = m_so1(ic - 1, 1);
m_so1(ic, 2) = m_so1(ic - 1, 2);
}
}

Expand Down
2 changes: 1 addition & 1 deletion cpp/modmesh/onedim/Euler1DCore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ inline void Euler1DCore::march_alpha(size_t steps)
{
march_half1_alpha<ALPHA>();
treat_boundary_so0();
march_half2_alpha<ALPHA>();
treat_boundary_so1();
march_half2_alpha<ALPHA>();
}
}

Expand Down

0 comments on commit 92316dd

Please sign in to comment.