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

Perform prepare_boundaries at correct times #1302

Merged
merged 3 commits into from
Oct 21, 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
4 changes: 2 additions & 2 deletions amr-wind/equation_systems/PDEBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void PDEMgr::prepare_boundaries()
field_ops::copy(
nph_field, new_field, 0, 0, new_field.num_comp(),
new_field.num_grow());
// Insert fill physical boundary condition call here
nph_field.fillphysbc(nph_time);
}
for (auto& eqn : scalar_eqns()) {
eqn->fields().field.advance_states();
Expand All @@ -125,7 +125,7 @@ void PDEMgr::prepare_boundaries()
field_ops::copy(
nph_field, new_field, 0, 0, new_field.num_comp(),
new_field.num_grow());
// Insert fill physical boundary condition call here
nph_field.fillphysbc(nph_time);
}
}

Expand Down
5 changes: 1 addition & 4 deletions amr-wind/wind_energy/ABLBoundaryPlane.H
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ public:

bool is_data_newer_than(const amrex::Real time) const
{
// Will replace with m_in_data.tinterp()
return (m_intended_interp_time - time > 1e-12);
return (m_in_data.tinterp() - time > 1e-12);
}

io_mode mode() const { return m_io_mode; }
Expand Down Expand Up @@ -195,8 +194,6 @@ private:
//! Start outputting after this time
amrex::Real m_out_start_time{0.0};

amrex::Real m_intended_interp_time{0.0};

#ifdef AMR_WIND_USE_NETCDF
//! NetCDF time output counter
size_t m_out_counter{0};
Expand Down
5 changes: 1 addition & 4 deletions amr-wind/wind_energy/ABLBoundaryPlane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,15 +767,13 @@ void ABLBoundaryPlane::read_file(const bool nph_target_time)
}

// populate planes and interpolate
const amrex::Real time = m_time.new_time();
const amrex::Real conditional_time =
const amrex::Real time =
m_time.new_time() + (nph_target_time ? 0.5 : 0.0) *
(m_time.current_time() - m_time.new_time());
AMREX_ALWAYS_ASSERT((m_in_times[0] <= time) && (time < m_in_times.back()));

// return early if current data files can still be interpolated in time
if ((m_in_data.tn() <= time) && (time < m_in_data.tnp1())) {
m_intended_interp_time = conditional_time;
m_in_data.interpolate(time);
return;
}
Expand Down Expand Up @@ -871,7 +869,6 @@ void ABLBoundaryPlane::read_file(const bool nph_target_time)
}
}

m_intended_interp_time = conditional_time;
m_in_data.interpolate(time);
}

Expand Down
7 changes: 2 additions & 5 deletions amr-wind/wind_energy/ABLFillInflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void ABLFillInflow::fillphysbc(
FieldFillPatchOps<FieldBCDirichlet>::fillphysbc(
lev, time, mfab, nghost, fstate);

m_bndry_plane.populate_data(lev, m_time.new_time(), m_field, mfab);
m_bndry_plane.populate_data(lev, time, m_field, mfab);
}

void ABLFillInflow::fillpatch_sibling_fields(
Expand Down Expand Up @@ -105,10 +105,7 @@ void ABLFillInflow::fillpatch_sibling_fields(

if (!plane_data_unchanged) {
for (int i = 0; i < static_cast<int>(mfabs.size()); i++) {
// use new_time to populate boundary data instead of half-time
// to avoid interpolating from precursor data
m_bndry_plane.populate_data(
lev, m_time.new_time(), m_field, *mfabs[i], 0, i);
m_bndry_plane.populate_data(lev, time, m_field, *mfabs[i], 0, i);
}
}
}
Expand Down