Skip to content

Commit

Permalink
Fixes for ALM restart (#1400)
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf authored Dec 11, 2024
1 parent 6acdd39 commit 04b3fe8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 73 deletions.
14 changes: 14 additions & 0 deletions amr-wind/wind_energy/actuator/Actuator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ void Actuator::post_regrid_actions()
{
BL_PROFILE("amr-wind::actuator::Actuator::post_regrid_actions");

const bool compute_root_proc = std::any_of(
m_actuators.begin(), m_actuators.end(),
[](const auto& act) { return act->info().root_proc == -1; });
if (compute_root_proc) {
amrex::Vector<int> act_proc_count(
amrex::ParallelDescriptor::NProcs(), 0);
for (auto& act : m_actuators) {
auto& info = act->info();
info.procs =
utils::determine_influenced_procs(m_sim.mesh(), info.bound_box);
utils::determine_root_proc(act->info(), act_proc_count);
}
}

for (auto& act : m_actuators) {
act->determine_influenced_procs();
}
Expand Down
5 changes: 5 additions & 0 deletions amr-wind/wind_energy/actuator/ActuatorModel.H
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public:

virtual const ActInfo& info() const = 0;

virtual ActInfo& info() = 0;

virtual void read_inputs(const utils::ActParser&) = 0;

virtual void determine_influenced_procs() = 0;
Expand Down Expand Up @@ -116,6 +118,9 @@ public:
//! Return the core info object for this actuator instance
const ActInfo& info() const override { return m_data.info(); }

//! Return the core info object for this actuator instance
ActInfo& info() override { return m_data.info(); }

//! Return the meta info object for this actuator instance
const auto& meta() const { return m_data.meta(); }

Expand Down
7 changes: 7 additions & 0 deletions amr-wind/wind_energy/actuator/turbine/fast/FastIface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ void FastIface::init_turbine(const int local_id)

case SimMode::restart: {
fast_restart_turbine(fi);
prepare_netcdf_file(fi);
break;
}
}
Expand Down Expand Up @@ -367,6 +368,12 @@ void FastIface::prepare_netcdf_file(FastTurbine& fi)
}

const std::string fname = m_output_dir + "/" + fi.tlabel + ".nc";

// Don't overwrite existing
if (amrex::FileSystem::Exists(fname)) {
return;
}

auto ncf = ncutils::NCFile::create(fname, NC_CLOBBER | NC_NETCDF4);
const std::string nt_name = "num_time_steps";
const std::string np_name = "num_vel_points";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ tagging.T1_level_3_zone.T1_level_3_zone.zaxis = 0.0 0.0 151.2
#---- actuator defs ----
Actuator.labels = T0 T1
Actuator.T0.type = TurbineFastLine
Actuator.T0.openfast_input_file = nrel5mw.fst
Actuator.T0.base_position = 0.0 -250.0 -90.0
Actuator.T0.rotor_diameter = 126.0
Actuator.T0.hub_height = 90.0
Expand All @@ -127,7 +126,6 @@ Actuator.T0.output_frequency = 1
Actuator.T0.density = 1.225
Actuator.T0.num_blades = 3
Actuator.T1.type = TurbineFastLine
Actuator.T1.openfast_input_file = nrel5mw.fst
Actuator.T1.base_position = 0.0 250.0 -90.0
Actuator.T1.rotor_diameter = 126.0
Actuator.T1.hub_height = 90.0
Expand Down
71 changes: 0 additions & 71 deletions test/test_files/act_uniform_alm_restart/nrel5mw.fst

This file was deleted.

0 comments on commit 04b3fe8

Please sign in to comment.