Skip to content

Commit

Permalink
Added method to single-physics T/H driver to determine which calling …
Browse files Browse the repository at this point in the history
…ranks access full T/H solution fields. Refs enrico-dev#15
  • Loading branch information
aprilnovak committed Jun 21, 2019
1 parent 472c3df commit 2d776ad
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions include/enrico/heat_fluids_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class HeatFluidsDriver : public Driver {

virtual ~HeatFluidsDriver() = default;

//! Whether the calling rank has access to the fields returned
//! by the 'temperature', 'density', and 'fluid_mask' methods
//! \return Whether calling rank has access
virtual bool has_coupling_data() const = 0;

//! Get the temperature in each region
//! \return Temperature in each region as [K]
virtual xt::xtensor<double, 1> temperature() const = 0;
Expand Down
4 changes: 4 additions & 0 deletions include/enrico/nek_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class NekDriver : public HeatFluidsDriver {
//! initialization and finalization for each step.
void solve_step() final;

//! Whether the calling rank has access to the full thermal-hydraulic solution field.
//! Only Nek's master rank has access to the global data; data on other ranks is empty
bool has_coupling_data() const final { return comm_.rank == 0; }

xt::xtensor<double, 1> temperature() const final;

xt::xtensor<double, 1> density() const final;
Expand Down
2 changes: 2 additions & 0 deletions include/enrico/surrogate_heat_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class SurrogateHeatDriver : public HeatFluidsDriver {
//! \param node XML node containing settings for surrogate
explicit SurrogateHeatDriver(MPI_Comm comm, double pressure_bc, pugi::xml_node node);

bool has_coupling_data() const final { return true; }

//! Solves the heat-fluids surrogate solver
void solve_step() final;

Expand Down
6 changes: 4 additions & 2 deletions src/openmc_nek_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void OpenmcNekDriver::init_elem_fluid_mask()
// On Nek's master rank, fm gets global data. On Nek's other ranks, fm is empty
auto fm = nek_driver_->fluid_mask();
// Initialize elem_fluid_mask_ on Nek's master rank only
if (nek_driver_->comm_.rank == 0) {
if (nek_driver_->has_coupling_data()) {
elem_fluid_mask_ = fm;
}
// Since OpenMC's and Nek's master ranks are the same, we know that elem_fluid_mask_
Expand Down Expand Up @@ -418,7 +418,9 @@ void OpenmcNekDriver::update_density()
if (nek_driver_->active()) {
// On Nek's master rank, d gets global data. On Nek's other ranks, d is empty.
auto d = nek_driver_->density();
if (nek_driver_->comm_.rank == 0) {

// Update elem_densities_ on Nek's master rank only.
if (nek_driver_->has_coupling_data()) {
densities_ = d;
}

Expand Down

0 comments on commit 2d776ad

Please sign in to comment.