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

using mac vel within wall function. #874

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
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
28 changes: 24 additions & 4 deletions amr-wind/wind_energy/ABLWallFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@

constexpr int idim = 2;
const auto& repo = velocity.repo();
auto& umac = repo.get_field("u_mac");
auto& vmac = repo.get_field("v_mac");
const auto& density = repo.get_field("density", rho_state);
const auto& viscosity = repo.get_field("velocity_mueff");
const int nlevels = repo.num_active_levels();
Expand All @@ -178,6 +180,8 @@

const auto& rho_lev = density(lev);
auto& vold_lev = velocity.state(FieldState::Old)(lev);
auto& umac_lev = umac(lev);
auto& vmac_lev = vmac(lev);
auto& vel_lev = velocity(lev);
const auto& eta_lev = viscosity(lev);

Expand All @@ -191,6 +195,8 @@
const auto& bx = mfi.validbox();
auto varr = vel_lev.array(mfi);
auto vold_arr = vold_lev.array(mfi);
auto umac_arr = umac_lev.array(mfi);
auto vmac_arr = vmac_lev.array(mfi);
auto den = rho_lev.array(mfi);
auto eta = eta_lev.array(mfi);

Expand All @@ -200,8 +206,12 @@
amrex::bdryLo(bx, idim),
[=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
const amrex::Real mu = eta(i, j, k);
const amrex::Real uu = vold_arr(i, j, k, 0);
const amrex::Real vv = vold_arr(i, j, k, 1);
// const amrex::Real uu = vold_arr(i, j, k, 0);
// const amrex::Real vv = vold_arr(i, j, k, 1);
Comment on lines +209 to +210

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
const amrex::Real uu =
0.5 * (umac_arr(i, j, k) + umac_arr(i + 1, j, k));
const amrex::Real vv =
0.5 * (vmac_arr(i, j, k) + umac_arr(i, j + 1, k));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure that you don't mix vmac_arr with umac_arr !

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

const amrex::Real wspd = std::sqrt(uu * uu + vv * vv);

// Dirichlet BC
Expand Down Expand Up @@ -299,6 +309,8 @@

BL_PROFILE("amr-wind::ABLTempWallFunc");
auto& velocity = repo.get_field("velocity");
auto& umac = repo.get_field("u_mac");
auto& vmac = repo.get_field("v_mac");
const auto& density = repo.get_field("density", rho_state);
const auto& alpha = repo.get_field("temperature_mueff");
const int nlevels = repo.num_active_levels();
Expand All @@ -310,6 +322,8 @@

const auto& rho_lev = density(lev);
auto& vold_lev = velocity.state(FieldState::Old)(lev);
auto& umac_lev = umac(lev);
auto& vmac_lev = vmac(lev);
auto& told_lev = temperature.state(FieldState::Old)(lev);
auto& theta = temperature(lev);
const auto& eta_lev = alpha(lev);
Expand All @@ -323,6 +337,8 @@
for (amrex::MFIter mfi(theta, mfi_info); mfi.isValid(); ++mfi) {
const auto& bx = mfi.validbox();
auto vold_arr = vold_lev.array(mfi);
auto umac_arr = umac_lev.array(mfi);
auto vmac_arr = vmac_lev.array(mfi);
auto told_arr = told_lev.array(mfi);
auto tarr = theta.array(mfi);
auto den = rho_lev.array(mfi);
Expand All @@ -334,8 +350,12 @@
amrex::bdryLo(bx, idim),
[=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
const amrex::Real alphaT = eta(i, j, k);
const amrex::Real uu = vold_arr(i, j, k, 0);
const amrex::Real vv = vold_arr(i, j, k, 1);
// const amrex::Real uu = vold_arr(i, j, k, 0);
// const amrex::Real vv = vold_arr(i, j, k, 1);
Comment on lines +353 to +354

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
const amrex::Real uu =
0.5 * (umac_arr(i, j, k) + umac_arr(i + 1, j, k));
const amrex::Real vv =
0.5 * (vmac_arr(i, j, k) + umac_arr(i, j + 1, k));
const amrex::Real wspd = std::sqrt(uu * uu + vv * vv);
const amrex::Real theta2 = told_arr(i, j, k);
tarr(i, j, k - 1) = den(i, j, k) *
Expand Down
Loading