Skip to content

Commit

Permalink
Fixes for ALM restart
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf committed Dec 10, 2024
1 parent 6acdd39 commit b2efa43
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
10 changes: 10 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,16 @@ void Actuator::post_regrid_actions()
{
BL_PROFILE("amr-wind::actuator::Actuator::post_regrid_actions");

amrex::Vector<int> act_proc_count(amrex::ParallelDescriptor::NProcs(), 0);
for (auto& act : m_actuators) {
auto& info = act->info();
if (info.root_proc == -1) {
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

0 comments on commit b2efa43

Please sign in to comment.