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

Integrate inflow-outflow BC into ABL #1321

Merged
merged 10 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions amr-wind/boundary_conditions/BCInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ void BCIface::set_bcfuncs()
m_field.register_custom_bc<FixedGradientBC>(ori);
}

if ((m_field.name() == "velocity") // only velocity for now
&& (bct == BC::mass_inflow_outflow)) {
if (((m_field.name() == "velocity") ||
(m_field.name() == "temperature")) &&
(bct == BC::mass_inflow_outflow)) {

m_field.register_custom_bc<MassInflowOutflowBC>(ori);
}
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/boundary_conditions/MassInflowOutflowBC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ void MassInflowOutflowBC::operator()(
}
}

} // namespace amr_wind
} // namespace amr_wind
10 changes: 7 additions & 3 deletions amr-wind/wind_energy/ABLBoundaryPlane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,9 @@ void ABLBoundaryPlane::read_header()

if (std::all_of(
m_fields.begin(), m_fields.end(), [ori](const auto* fld) {
return fld->bc_type()[ori] != BC::mass_inflow;
return (
(fld->bc_type()[ori] != BC::mass_inflow) &&
(fld->bc_type()[ori] != BC::mass_inflow_outflow));
})) {
continue;
}
Expand Down Expand Up @@ -850,7 +852,8 @@ void ABLBoundaryPlane::read_file(const bool nph_target_time)
auto ori = oit();

if ((!m_in_data.is_populated(ori)) ||
(field.bc_type()[ori] != BC::mass_inflow)) {
((field.bc_type()[ori] != BC::mass_inflow) &&
(field.bc_type()[ori] != BC::mass_inflow_outflow))) {
continue;
}

Expand Down Expand Up @@ -895,7 +898,8 @@ void ABLBoundaryPlane::populate_data(
for (amrex::OrientationIter oit; oit != nullptr; ++oit) {
auto ori = oit();
if ((!m_in_data.is_populated(ori)) ||
(fld.bc_type()[ori] != BC::mass_inflow)) {
((fld.bc_type()[ori] != BC::mass_inflow) &&
(fld.bc_type()[ori] != BC::mass_inflow_outflow))) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion amr-wind/wind_energy/ABLFillInflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void ABLFillInflow::fillpatch_sibling_fields(
const auto bct = ibctype[ori];
const int dir = ori.coordDir();
for (int i = 0; i < m_field.num_comp(); ++i) {
if (bct == BC::mass_inflow) {
if ((bct == BC::mass_inflow) || (bct == BC::mass_inflow_outflow)) {
if (side == amrex::Orientation::low) {
ph_bcrec[i].setLo(dir, amrex::BCType::foextrap);
fp_bcrec[i].setLo(
Expand Down
3 changes: 2 additions & 1 deletion amr-wind/wind_energy/ABLFillMPL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ void ABLFillMPL::fillpatch_sibling_fields(
const auto bct = ibctype[ori];
const int dir = ori.coordDir();
for (int i = 0; i < m_field.num_comp(); ++i) {
if (bct == BC::mass_inflow) {
if ((bct == BC::mass_inflow) ||
(bct == BC::mass_inflow_outflow)) {
if (side == amrex::Orientation::low) {
lbcrec[i].setLo(dir, amrex::BCType::foextrap);
} else {
Expand Down
6 changes: 4 additions & 2 deletions amr-wind/wind_energy/ABLModulatedPowerLaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ void ABLModulatedPowerLaw::set_velocity(

for (amrex::OrientationIter oit; oit != nullptr; ++oit) {
auto ori = oit();
if (bctype[ori] != BC::mass_inflow) {
if ((bctype[ori] != BC::mass_inflow) &&
(bctype[ori] != BC::mass_inflow_outflow)) {
continue;
}

Expand Down Expand Up @@ -240,7 +241,8 @@ void ABLModulatedPowerLaw::set_temperature(

for (amrex::OrientationIter oit; oit != nullptr; ++oit) {
auto ori = oit();
if (bctype[ori] != BC::mass_inflow) {
if ((bctype[ori] != BC::mass_inflow) &&
(bctype[ori] != BC::mass_inflow_outflow)) {
continue;
}

Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ endif()
# Regression tests excluded from CI with a test dependency
#=============================================================================
add_test_red(abl_bndry_input_native abl_bndry_output_native)
add_test_red(abl_bndry_input_native_inout abl_bndry_output_native)
add_test_red(abl_godunov_restart abl_godunov)
add_test_red(abl_bndry_input_amr_native abl_bndry_output_native)
add_test_red(abl_bndry_input_amr_native_xhi abl_bndry_output_native)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# SIMULATION STOP #
#.......................................#
time.stop_time = 22000.0 # Max (simulated) time to evolve
time.max_step = 10 # Max number of time steps
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# TIME STEP COMPUTATION #
#.......................................#
time.fixed_dt = 0.4 # Use this constant dt if > 0
time.cfl = 0.95 # CFL factor
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# INPUT AND OUTPUT #
#.......................................#
io.restart_file = "../abl_bndry_output_native/chk00005"
time.plot_interval = 10 # Steps between plot files
time.checkpoint_interval = -1 # Steps between checkpoint files
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# PHYSICS #
#.......................................#
incflo.gravity = 0. 0. -9.81 # Gravitational force (3D)
incflo.density = 1.0 # Reference density
incflo.use_godunov = 1
incflo.diffusion_type = 2
transport.viscosity = 1.0e-5
transport.laminar_prandtl = 0.7
transport.turbulent_prandtl = 0.3333
turbulence.model = Smagorinsky
Smagorinsky_coeffs.Cs = 0.135
incflo.physics = ABL
ICNS.source_terms = CoriolisForcing GeostrophicForcing
ABL.reference_temperature = 290.0
CoriolisForcing.east_vector = 1.0 0.0 0.0
CoriolisForcing.north_vector = 0.0 1.0 0.0
CoriolisForcing.latitude = 90.0
CoriolisForcing.rotational_time_period = 125663.706143592
GeostrophicForcing.geostrophic_wind = 10.0 0.0 0.0
incflo.velocity = 10.0 0.0 0.0
ABL.temperature_heights = 0.0 2000.0
ABL.temperature_values = 290.0 290.0
ABL.perturb_temperature = false
ABL.cutoff_height = 50.0
ABL.perturb_velocity = true
ABL.perturb_ref_height = 50.0
ABL.Uperiods = 4.0
ABL.Vperiods = 4.0
ABL.deltaU = 1.0
ABL.deltaV = 1.0
ABL.kappa = .41
ABL.surface_roughness_z0 = 0.01
ABL.bndry_file = "../abl_bndry_output_native/bndry_files"
ABL.bndry_io_mode = 1
ABL.bndry_var_names = velocity temperature
ABL.bndry_output_format = native
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# ADAPTIVE MESH REFINEMENT #
#.......................................#
amr.n_cell = 48 48 48 # Grid cells at coarsest AMRlevel
amr.max_level = 0 # Max AMR level in hierarchy
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# GEOMETRY #
#.......................................#
geometry.prob_lo = 0. 0. 0. # Lo corner coordinates
geometry.prob_hi = 1000. 1000. 1000. # Hi corner coordinates
geometry.is_periodic = 0 0 0 # Periodicity x y z (0/1)
# Boundary conditions
xlo.type = "mass_inflow_outflow"
xlo.density = 1.0
xlo.temperature = 0.0

xhi.type = "mass_inflow_outflow"
xhi.density = 1.0
xhi.temperature = 0.0

ylo.type = "mass_inflow_outflow"
ylo.density = 1.0
ylo.temperature = 0.0

yhi.type = "mass_inflow_outflow"
yhi.density = 1.0
yhi.temperature = 0.0

zlo.type = "wall_model"
zhi.type = "slip_wall"
zhi.temperature_type = "fixed_gradient"
zhi.temperature = 0.0
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# VERBOSITY #
#.......................................#
incflo.verbose = 0 # incflo_level
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ABL.kappa = .41
ABL.surface_roughness_z0 = 0.01
ABL.bndry_file = "bndry_files"
ABL.bndry_io_mode = 0
ABL.bndry_planes = ylo xlo xhi
ABL.bndry_planes = ylo xlo yhi xhi
ABL.bndry_output_start_time = 2.0
ABL.bndry_var_names = velocity temperature
ABL.bndry_output_format = native
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,17 @@ io.output_default_variables = 1
amr.n_cell = 16 8 16 # Grid cells at coarsest AMRlevel
amr.blocking_factor = 4
amr.max_level = 0 # Max AMR level in hierarchy
fabarray.mfiter_tile_size = 1024 1024 1024

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# GEOMETRY #
#.......................................#
geometry.prob_lo = 0.0 0.0 0.0 # Lo corner coordinates
geometry.prob_hi = 1.0 0.5 1.0 # Hi corner coordinates
geometry.is_periodic = 0 1 0 # Periodicity x y z (0/1)
geometry.is_periodic = 0 0 0 # Periodicity x y z (0/1)

# Boundary conditions
TwoLayer.bottom_vel = -1.0 0.0 0.0
TwoLayer.top_vel = 1.0 0.0 0.0
TwoLayer.bottom_vel = -1.0 -0.5 0.0
TwoLayer.top_vel = 1.0 0.5 0.0
TwoLayer.init_perturb = 0.9
TwoLayer.z_partition = 0.5

Expand All @@ -66,5 +65,13 @@ xhi.type = "mass_inflow_outflow"
xhi.density = 1.0
xhi.velocity.inflow_outflow_type = TwoLayer

ylo.type = "mass_inflow_outflow"
ylo.density = 1.0
ylo.velocity.inflow_outflow_type = TwoLayer

yhi.type = "mass_inflow_outflow"
yhi.density = 1.0
yhi.velocity.inflow_outflow_type = TwoLayer

zlo.type = "slip_wall"
zhi.type = "slip_wall"
Loading