NGen
Loading...
Searching...
No Matches
NgenSimulation Class Reference

#include <NgenSimulation.hpp>

+ Collaboration diagram for NgenSimulation:

Public Types

using hy_features_t = hy_features::HY_Features
 

Public Member Functions

 NgenSimulation (Simulation_Time const &sim_time, std::vector< std::shared_ptr< ngen::Layer > > layers, std::unordered_map< std::string, int > catchment_indexes, std::unordered_map< std::string, int > nexus_indexes, int mpi_rank, int mpi_num_procs)
 
 NgenSimulation ()=delete
 
 ~NgenSimulation ()
 
void run_catchments ()
 Run the catchment formulations for the full configured duration of the simulation.
 
void run_routing (std::string const &t_route_config_file_with_path)
 Run t-route on nexus outflow values written to files during run_catchments() for the full configured duration of the simulation.
 
void run_routing_bmi (hy_features_t &features, std::string const &t_route_config_file_with_path)
 Run t-route via BMI on the stored nexus outflow values for the full configured duration of the simulation.
 
int get_nexus_index (std::string const &nexus_id) const
 
double get_nexus_outflow (int nexus_index, int timestep_index) const
 
size_t get_num_output_times () const
 
std::string get_timestamp_for_step (int step) const
 

Private Member Functions

void advance_models_one_output_step ()
 
template<class Archive >
void serialize (Archive &ar)
 

Private Attributes

int simulation_step_
 
std::shared_ptr< Simulation_Timesim_time_
 
std::vector< std::shared_ptr< ngen::Layer > > layers_
 
std::unordered_map< std::string, int > catchment_indexes_
 
std::vector< double > catchment_outflows_
 
std::unordered_map< std::string, int > nexus_indexes_
 
std::vector< double > nexus_downstream_flows_
 
int mpi_rank_
 
int mpi_num_procs_
 

Member Typedef Documentation

◆ hy_features_t

Constructor & Destructor Documentation

◆ NgenSimulation() [1/2]

NgenSimulation::NgenSimulation ( Simulation_Time const & sim_time,
std::vector< std::shared_ptr< ngen::Layer > > layers,
std::unordered_map< std::string, int > catchment_indexes,
std::unordered_map< std::string, int > nexus_indexes,
int mpi_rank,
int mpi_num_procs )

◆ NgenSimulation() [2/2]

NgenSimulation::NgenSimulation ( )
delete

◆ ~NgenSimulation()

NgenSimulation::~NgenSimulation ( )
default

Member Function Documentation

◆ advance_models_one_output_step()

void NgenSimulation::advance_models_one_output_step ( )
private

◆ get_nexus_index()

int NgenSimulation::get_nexus_index ( std::string const & nexus_id) const

References nexus_indexes_.

◆ get_nexus_outflow()

double NgenSimulation::get_nexus_outflow ( int nexus_index,
int timestep_index ) const

◆ get_num_output_times()

size_t NgenSimulation::get_num_output_times ( ) const

◆ get_timestamp_for_step()

std::string NgenSimulation::get_timestamp_for_step ( int step) const

◆ run_catchments()

void NgenSimulation::run_catchments ( )

Run the catchment formulations for the full configured duration of the simulation.

Can be configured to capture calculated runoff values in catchment_outflows_ and nexus_downstream_flows_ for subsequent output and consumption by run_routing_bmi()

References advance_models_one_output_step(), Simulation_Time::advance_timestep(), catchment_indexes_, catchment_outflows_, get_num_output_times(), nexus_downstream_flows_, nexus_indexes_, sim_time_, and simulation_step_.

◆ run_routing()

void NgenSimulation::run_routing ( std::string const & t_route_config_file_with_path)

Run t-route on nexus outflow values written to files during run_catchments() for the full configured duration of the simulation.

References Simulation_Time::get_output_interval_seconds(), Simulation_Time::get_total_output_times(), mpi_rank_, and sim_time_.

◆ run_routing_bmi()

void NgenSimulation::run_routing_bmi ( NgenSimulation::hy_features_t & features,
std::string const & t_route_config_file_with_path )

Run t-route via BMI on the stored nexus outflow values for the full configured duration of the simulation.

References Simulation_Time::get_total_output_times(), mpi_num_procs_, mpi_rank_, nexus_downstream_flows_, nexus_indexes_, hy_features::identifiers::separator, and sim_time_.

◆ serialize()

template<class Archive >
void NgenSimulation::serialize ( Archive & ar)
private

Member Data Documentation

◆ catchment_indexes_

std::unordered_map<std::string, int> NgenSimulation::catchment_indexes_
private

◆ catchment_outflows_

std::vector<double> NgenSimulation::catchment_outflows_
private

◆ layers_

std::vector<std::shared_ptr<ngen::Layer> > NgenSimulation::layers_
private

◆ mpi_num_procs_

int NgenSimulation::mpi_num_procs_
private

Referenced by run_routing_bmi().

◆ mpi_rank_

int NgenSimulation::mpi_rank_
private

Referenced by run_routing(), and run_routing_bmi().

◆ nexus_downstream_flows_

std::vector<double> NgenSimulation::nexus_downstream_flows_
private

◆ nexus_indexes_

std::unordered_map<std::string, int> NgenSimulation::nexus_indexes_
private

◆ sim_time_

◆ simulation_step_

int NgenSimulation::simulation_step_
private

The documentation for this class was generated from the following files: