From f9f499b6926339f96b3ff260495b8782c045555c Mon Sep 17 00:00:00 2001 From: Michael B Kuhn <31661049+mbkuhn@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:20:24 -0600 Subject: [PATCH] only modify velocity of water during ocean waves initialization (#1164) --- .../relaxation_zones/linear_waves_ops.H | 14 ++++++-------- .../relaxation_zones/stokes_waves_ops.H | 12 +++++------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/amr-wind/ocean_waves/relaxation_zones/linear_waves_ops.H b/amr-wind/ocean_waves/relaxation_zones/linear_waves_ops.H index 92ad15bc5f..f780192e7a 100644 --- a/amr-wind/ocean_waves/relaxation_zones/linear_waves_ops.H +++ b/amr-wind/ocean_waves/relaxation_zones/linear_waves_ops.H @@ -73,7 +73,7 @@ struct InitDataOp 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( @@ -87,10 +87,6 @@ struct InitDataOp 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.; } }); @@ -99,9 +95,11 @@ struct InitDataOp 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; + } }); } } diff --git a/amr-wind/ocean_waves/relaxation_zones/stokes_waves_ops.H b/amr-wind/ocean_waves/relaxation_zones/stokes_waves_ops.H index 9a419e6f47..7d8f4a3a86 100644 --- a/amr-wind/ocean_waves/relaxation_zones/stokes_waves_ops.H +++ b/amr-wind/ocean_waves/relaxation_zones/stokes_waves_ops.H @@ -113,10 +113,6 @@ struct InitDataOp 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.; } }); @@ -125,9 +121,11 @@ struct InitDataOp 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; + } }); } }