Skip to content

Commit

Permalink
prevent wall scalar values from being limited
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnonaka committed Jul 30, 2024
1 parent aca1032 commit 6ae4a2f
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions BDS/hydro_bds_edge_state_3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,48 @@ BDS::ComputeSlopes ( Box const& bx,
Array1D<Real, 1, 8> smax;
Array1D<Real, 1, 8> sc;

Array1D<bool, 1, 8> allow_change;
for (int mm=1; mm<=8; ++mm) {
allow_change(mm) = true;
}

if ( i==dlo.x && lo_x_physbc ) {
allow_change(1) = false;
allow_change(2) = false;
allow_change(3) = false;
allow_change(4) = false;
}
if ( i==dhi.x+1 && hi_x_physbc ) {
allow_change(5) = false;
allow_change(6) = false;
allow_change(7) = false;
allow_change(8) = false;
}
if ( j==dlo.y && lo_y_physbc ) {
allow_change(1) = false;
allow_change(2) = false;
allow_change(5) = false;
allow_change(6) = false;
}
if ( j==dhi.y+1 && hi_y_physbc ) {
allow_change(3) = false;
allow_change(4) = false;
allow_change(7) = false;
allow_change(8) = false;
}
if ( k==dlo.z && lo_z_physbc ) {
allow_change(1) = false;
allow_change(3) = false;
allow_change(5) = false;
allow_change(7) = false;
}
if ( k==dhi.z+1 && hi_z_physbc ) {
allow_change(2) = false;
allow_change(4) = false;
allow_change(6) = false;
allow_change(8) = false;
}

// compute initial estimates of slopes from unlimited corner points
// sx
slopes(i,j,k,0) = 0.25*(( sint(i+1,j ,k ) + sint(i+1,j+1,k )
Expand Down Expand Up @@ -345,7 +387,9 @@ BDS::ComputeSlopes ( Box const& bx,
s(i ,j ,k-1,icomp),s(i ,j-1,k ,icomp),s(i-1,j ,k ,icomp),s(i ,j ,k ,icomp));

for(int mm=1; mm<=8; ++mm){
sc(mm) = max(min(sc(mm), smax(mm)), smin(mm));
if (allow_change(mm)) {
sc(mm) = max(min(sc(mm), smax(mm)), smin(mm));
}
}

// iterative loop
Expand All @@ -367,7 +411,7 @@ BDS::ComputeSlopes ( Box const& bx,

// count how many nodes are larger(smaller) than the cell-centered value
for(int mm=1; mm<=8; ++mm){
if (diff(mm) > eps) {
if (diff(mm) > eps && allow_change(mm)) {
kdp = kdp+1;
}
}
Expand All @@ -377,6 +421,9 @@ BDS::ComputeSlopes ( Box const& bx,
// ordered heuristic limiting
for(int mm=1; mm<=8; ++mm){

// don't allow boundary nodes to change value
if (!allow_change(mm)) continue;

// how many node values are left to potentially adjust
if (kdp<1) {
div = 1.0;
Expand Down Expand Up @@ -410,6 +457,9 @@ BDS::ComputeSlopes ( Box const& bx,
// symmetric heuristic limiting
for(int mm=1; mm<=8; ++mm){

// don't allow boundary nodes to change value
if (!allow_change(mm)) continue;

div = kdp;

if (diff(mm)>eps) {
Expand Down

0 comments on commit 6ae4a2f

Please sign in to comment.