Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't limit in the bc routine when using WENOZ #135

Merged
merged 4 commits into from
Jul 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 36 additions & 18 deletions Godunov/hydro_godunov_ppm.H
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ void SetXBCs ( const int i, const int j, const int k, const int n,
{
sedge2 = -amrex::Real(0.2)*s(domlo-1,j,k,n) + amrex::Real(0.75)*s(domlo,j, k, n)
+amrex::Real(0.5)*s(domlo+1,j,k,n) - amrex::Real(0.05)*s(domlo+2,j,k,n);
if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
sedge2 = amrex::max(sedge2, amrex::min(s(domlo+1,j,k,n), s(domlo,j,k,n)));
sedge2 = amrex::min(sedge2, amrex::max(s(domlo+1,j,k,n), s(domlo,j,k,n)));
}
Expand All @@ -236,15 +237,17 @@ void SetXBCs ( const int i, const int j, const int k, const int n,

sedge1 = -amrex::Real(0.2)*s(domlo-1,j,k,n) + amrex::Real(0.75)*s(domlo ,j,k,n)
+ amrex::Real(0.5)*s(domlo+1,j,k,n) - amrex::Real(0.05)*s(domlo+2,j,k,n);
if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
sedge1 = amrex::max(sedge1, amrex::min(s(domlo+1,j,k,n), s(domlo,j,k,n)));
sedge1 = amrex::min(sedge1, amrex::max(s(domlo+1,j,k,n), s(domlo,j,k,n)));
}

sp = sedge2;
sm = sedge1;

if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
if ( (sp - s(domlo+1,j,k,n))*(s(domlo+1,j,k,n) - sm) <= amrex::Real(0.0))
{
sp = s(domlo+1,j,k,n);
Expand All @@ -264,7 +267,8 @@ void SetXBCs ( const int i, const int j, const int k, const int n,
{
sedge1 = -amrex::Real(0.2)*s(domhi+1,j,k,n) + amrex::Real(0.75)*s(domhi,j,k, n)
+amrex::Real(0.5)*s(domhi-1,j,k,n) - amrex::Real(0.05)*s(domhi-2,j,k,n);
if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
sedge1 = amrex::max(sedge1, amrex::min(s(domhi-1,j,k,n), s(domhi,j,k,n)));
sedge1 = amrex::min(sedge1, amrex::max(s(domhi-1,j,k,n), s(domhi,j,k,n)));
}
Expand All @@ -276,15 +280,17 @@ void SetXBCs ( const int i, const int j, const int k, const int n,

sedge2 = -amrex::Real(0.2)*s(domhi+1,j,k,n) + amrex::Real(0.75)*s(domhi ,j,k,n)
+amrex::Real(0.5)*s(domhi-1,j,k,n) - amrex::Real(0.05)*s(domhi-2,j,k,n);
if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
sedge2 = amrex::max(sedge2, amrex::min(s(domhi-1,j,k,n), s(domhi,j,k,n)));
sedge2 = amrex::min(sedge2, amrex::max(s(domhi-1,j,k,n), s(domhi,j,k,n)));
}

sp = sedge2;
sm = sedge1;

if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
if( (sp - s(domhi-1,j,k,n))*(s(domhi-1,j,k,n) - sm) <= amrex::Real(0.0))
{
sp = s(domhi-1,j,k,n);
Expand Down Expand Up @@ -316,7 +322,8 @@ void SetYBCs ( const int i, const int j, const int k, const int n,
{
sedge2 = -amrex::Real(0.2)*s(i,domlo-1,k,n) + amrex::Real(0.75)*s(i,domlo ,k,n)
+amrex::Real(0.5)*s(i,domlo+1,k,n) - amrex::Real(0.05)*s(i,domlo+2,k,n);
if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
sedge2 = amrex::max(sedge2, amrex::min(s(i,domlo+1,k,n), s(i,domlo,k,n)));
sedge2 = amrex::min(sedge2, amrex::max(s(i,domlo+1,k,n), s(i,domlo,k,n)));
}
Expand All @@ -328,15 +335,17 @@ void SetYBCs ( const int i, const int j, const int k, const int n,

sedge1 = -amrex::Real(0.2)*s(i,domlo-1,k,n) + amrex::Real(0.75)*s(i,domlo ,k,n)
+amrex::Real(0.5)*s(i,domlo+1,k,n) - amrex::Real(0.05)*s(i,domlo+2,k,n);
if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
sedge1 = amrex::max(sedge1, amrex::min(s(i,domlo+1,k,n), s(i,domlo,k,n)));
sedge1 = amrex::min(sedge1, amrex::max(s(i,domlo+1,k,n), s(i,domlo,k,n)));
}

sp = sedge2;
sm = sedge1;

if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
if ( (sp - s(i,domlo+1,k,n))*(s(i,domlo+1,k,n) - sm) <= amrex::Real(0.0))
{
sp = s(i,domlo+1,k,n);
Expand All @@ -356,7 +365,8 @@ void SetYBCs ( const int i, const int j, const int k, const int n,
{
sedge1 = -amrex::Real(0.2)*s(i,domhi+1,k,n) + amrex::Real(0.75)*s(i,domhi ,k,n)
+amrex::Real(0.5)*s(i,domhi-1,k,n) - amrex::Real(0.05)*s(i,domhi-2,k,n);
if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
sedge1 = amrex::max(sedge1, amrex::min(s(i,domhi-1,k,n), s(i,domhi,k,n)));
sedge1 = amrex::min(sedge1, amrex::max(s(i,domhi-1,k,n), s(i,domhi,k,n)));
}
Expand All @@ -368,15 +378,17 @@ void SetYBCs ( const int i, const int j, const int k, const int n,

sedge2 = -amrex::Real(0.2)*s(i,domhi+1,k,n) + amrex::Real(0.75)*s(i,domhi ,k,n)
+amrex::Real(0.5)*s(i,domhi-1,k,n) - amrex::Real(0.05)*s(i,domhi-2,k,n);
if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
sedge2 = amrex::max(sedge2, amrex::min(s(i,domhi-1,k,n), s(i,domhi,k,n)));
sedge2 = amrex::min(sedge2, amrex::max(s(i,domhi-1,k,n), s(i,domhi,k,n)));
}

sp = sedge2;
sm = sedge1;

if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
if( (sp - s(i,domhi-1,k,n))*(s(i,domhi-1,k,n) - sm) <= amrex::Real(0.0)){
sp = s(i,domhi-1,k,n);
sm = s(i,domhi-1,k,n);
Expand Down Expand Up @@ -408,7 +420,8 @@ void SetZBCs ( const int i, const int j, const int k, const int n,
{
sedge2 = -amrex::Real(0.2)*s(i,j,domlo-1,n) + amrex::Real(0.75)*s(i,j,domlo ,n)
+amrex::Real(0.5)*s(i,j,domlo+1,n) - amrex::Real(0.05)*s(i,j,domlo+2,n);
if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
sedge2 = amrex::max(sedge2, amrex::min(s(i,j,domlo+1,n), s(i,j,domlo,n)));
sedge2 = amrex::min(sedge2, amrex::max(s(i,j,domlo+1,n), s(i,j,domlo,n)));
}
Expand All @@ -420,15 +433,17 @@ void SetZBCs ( const int i, const int j, const int k, const int n,

sedge1 = -amrex::Real(0.2)*s(i,j,domlo-1,n) + amrex::Real(0.75)*s(i,j,domlo ,n)
+amrex::Real(0.5)*s(i,j,domlo+1,n) - amrex::Real(0.05)*s(i,j,domlo+2,n);
if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
sedge1 = amrex::max(sedge1, amrex::min(s(i,j,domlo+1,n), s(i,j,domlo,n)));
sedge1 = amrex::min(sedge1, amrex::max(s(i,j,domlo+1,n), s(i,j,domlo,n)));
}

sp = sedge2;
sm = sedge1;

if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
if ( (sp - s(i,j,domlo+1,n))*(s(i,j,domlo+1,n) - sm) <= 0. )
{
sp = s(i,j,domlo+1,n);
Expand All @@ -448,7 +463,8 @@ void SetZBCs ( const int i, const int j, const int k, const int n,
{
sedge1 = -amrex::Real(0.2)*s(i,j,domhi+1,n) + amrex::Real(0.75)*s(i,j,domhi ,n)
+amrex::Real(0.5)*s(i,j,domhi-1,n) - amrex::Real(0.05)*s(i,j,domhi-2,n);
if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
sedge1 = amrex::max(sedge1, amrex::min(s(i,j,domhi-1,n), s(i,j,domhi,n)));
sedge1 = amrex::min(sedge1, amrex::max(s(i,j,domhi-1,n), s(i,j,domhi,n)));
}
Expand All @@ -460,15 +476,17 @@ void SetZBCs ( const int i, const int j, const int k, const int n,

sedge2 = -amrex::Real(0.2)*s(i,j,domhi+1,n) + amrex::Real(0.75)*s(i,j,domhi ,n)
+amrex::Real(0.5)*s(i,j,domhi-1,n) - amrex::Real(0.05)*s(i,j,domhi-2,n);
if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
sedge2 = amrex::max(sedge2, amrex::min(s(i,j,domhi-1,n), s(i,j,domhi,n)));
sedge2 = amrex::min(sedge2, amrex::max(s(i,j,domhi-1,n), s(i,j,domhi,n)));
}

sp = sedge2;
sm = sedge1;

if constexpr (! std::is_same_v<nolimiter,Limiter>) {
if constexpr ( (! std::is_same_v<nolimiter,Limiter>) &&
(! std::is_same_v<wenoz,Limiter>) ) {
if ( (sp - s(i,j,domhi-1,n))*(s(i,j,domhi-1,n) - sm) <= 0. )
{
sp = s(i,j,domhi-1,n);
Expand Down