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

Non Uniform Roughness, Temperature and Heat Flux at Surface #1133

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

hgopalan
Copy link
Contributor

@hgopalan hgopalan commented Jul 12, 2024

Summary

This draft PR proposes a framework to include non-uniform roughness length, temperature and heat flux at the lower surface for handling spatially varying roughness length in large wind farms, spatial-temporal varying one-way roughness-based wave coupling, spatial-temporal varying temperature and sensible heat flux.

MOST is replaced with an explicit stratification based parametrization. Currently, the method does not work work terrains and will be updated in the future.

The data is read in an ascii format to avoid the netCDF dependency. Will create a separate preprocessing tool to convert netCDF data into the ascii format.

ToDo:

  1. Add wave-roughness information
  2. Add variable heat flux

Caution: It is assumed that the time-period of input dataset is greater than CFD run-time. This avoids the need for special one-sided interpolation at the end of the dataset.

Please check the type of change introduced:

  • Bugfix
  • [ x ] Feature
  • Code style update (formatting, renaming)
  • [ x ] Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Checklist

The following is included:

  • new unit-test(s)
  • [ x ] new regression test(s)
  • documentation for new capability

This PR was tested by running:

  • the unit tests
    • on GPU
    • on CPU
  • the regression tests
    • on GPU
    • [ x ] on CPU

Additional background

Issue Number:

Copy link
Contributor

@marchdf marchdf left a comment

Choose a reason for hiding this comment

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

Good work. Some things missing: docs, unit tests, reg tests ;) I haven't run any tests myself and will do so once you are closer to the finish line.

for (int lev = 0; lev < nlevels; ++lev) {
const auto& geom = repo.mesh().Geom(lev);
const auto& domain = geom.Domain();
amrex::MFItInfo mfi_info{};

const amrex::Real dz = geom.CellSize()[2];
Copy link
Contributor

Choose a reason for hiding this comment

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

use idim here instead of 2?

alphaT;
amrex::Real ustarthetastar = 0.0;
if (is_multi && is_surf_temp) {
const amrex::Real bh = 9.4;
Copy link
Contributor

Choose a reason for hiding this comment

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

are these hardcoded numbers never expected to change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I can move it to class variables if that's the better way of doing it.

for (int lev = 0; lev < nlevels; ++lev) {
const auto& geom = repo.mesh().Geom(lev);
const auto& domain = geom.Domain();
// Read dz
const amrex::Real dz = geom.CellSize()[2];
Copy link
Contributor

Choose a reason for hiding this comment

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

use idim here as well? and remove comment

const bool is_surf_temp = repo.field_exists("surf_temp");
const auto* m_surf_temp =
is_surf_temp ? &repo.get_field("surf_temp") : nullptr;
const bool is_multi = repo.field_exists("lowerz0");
Copy link
Contributor

Choose a reason for hiding this comment

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

would prefer a better name than is_multi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nothing came to mind.

Copy link
Contributor

Choose a reason for hiding this comment

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

has_variable_roughness or has_variable_surface ?

@@ -292,12 +341,17 @@ void ABLTempWallFunc::wall_model(
const auto& density = repo.get_field("density", rho_state);
const auto& alpha = repo.get_field("temperature_mueff");
const int nlevels = repo.num_active_levels();

const bool is_surf_temp = repo.field_exists("surf_temp");
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe has_surf_temp ?

Copy link
Contributor

Choose a reason for hiding this comment

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

and maybe for consistency: has_variable_surf_temp ?

auto& surf_temp = m_surf_temp(level);
auto& surf_temp_lower = m_surf_temp_lower(level);
auto& surf_temp_upper = m_surf_temp_upper(level);
// Copy Temperature to gpu
Copy link
Contributor

Choose a reason for hiding this comment

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

remove comment

const unsigned mesh_size = m_xloc.size();
const int index =
std::max(0, int(m_current_time / m_separation) - 1);
amrex::Print() << "Checking issues:" << m_Tloc.size() << " "
Copy link
Contributor

Choose a reason for hiding this comment

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

remove print statement

Tloc_ptr[(index + 1) * (mesh_size - 1) + ii];
}
}
level_surf_temp(i, j, k, 0) = locT1;
Copy link
Contributor

Choose a reason for hiding this comment

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

would it be better to store these 3 numbers into a 3 component field instead of 3 different fields? It would remove a whole bunch of LOCs

}
return;
}
amrex::Print() << "Changing:" << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

remove print statement

std::max(0, int(m_current_time / m_separation) - 1);
amrex::ParallelFor(
vbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
// compute the source term
Copy link
Contributor

Choose a reason for hiding this comment

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

remove comment

Copy link

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

Copy link

This PR was closed because it has been stalled for 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants