Skip to content

Commit

Permalink
only modify velocity of water during ocean waves initialization (#1164)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbkuhn authored Jul 26, 2024
1 parent ce6ba26 commit f9f499b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
14 changes: 6 additions & 8 deletions amr-wind/ocean_waves/relaxation_zones/linear_waves_ops.H
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct InitDataOp<LinearWaves>

phi(i, j, k) = eta - zc;

if (phi(i, j, k) >= 0) {
if (phi(i, j, k) + 0.5 * dx[2] >= 0) {
vel(i, j, k, 0) =
omega * wave_height / 2.0 *
std::cosh(
Expand All @@ -87,10 +87,6 @@ struct InitDataOp<LinearWaves>
wave_number * (zc - zsl + water_depth)) /
std::sinh(wave_number * water_depth) *
std::sin(phase);
} else {
vel(i, j, k, 0) = 0.;
vel(i, j, k, 1) = 0.;
vel(i, j, k, 2) = 0.;
}
});

Expand All @@ -99,9 +95,11 @@ struct InitDataOp<LinearWaves>
gbx3, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
const amrex::Real z = problo[2] + (k + 0.5) * dx[2];
phi(i, j, k) = zsl - z;
vel(i, j, k, 0) = 0.0;
vel(i, j, k, 1) = 0.0;
vel(i, j, k, 2) = 0.0;
if (phi(i, j, k) + 0.5 * dx[2] >= 0) {
vel(i, j, k, 0) = 0.0;
vel(i, j, k, 1) = 0.0;
vel(i, j, k, 2) = 0.0;
}
});
}
}
Expand Down
12 changes: 5 additions & 7 deletions amr-wind/ocean_waves/relaxation_zones/stokes_waves_ops.H
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ struct InitDataOp<StokesWaves>
vel(i, j, k, 0) = u_w;
vel(i, j, k, 1) = v_w;
vel(i, j, k, 2) = w_w;
} else {
vel(i, j, k, 0) = 0.;
vel(i, j, k, 1) = 0.;
vel(i, j, k, 2) = 0.;
}
});

Expand All @@ -125,9 +121,11 @@ struct InitDataOp<StokesWaves>
gbx3, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
const amrex::Real z = problo[2] + (k + 0.5) * dx[2];
phi(i, j, k) = zero_sea_level - z;
vel(i, j, k, 0) = 0.0;
vel(i, j, k, 1) = 0.0;
vel(i, j, k, 2) = 0.0;
if (phi(i, j, k) + 0.5 * dx[2] >= 0) {
vel(i, j, k, 0) = 0.0;
vel(i, j, k, 1) = 0.0;
vel(i, j, k, 2) = 0.0;
}
});
}
}
Expand Down

0 comments on commit f9f499b

Please sign in to comment.