MaMiCo 1.2
Loading...
Searching...
No Matches
coupling::services::MultiMDCellService< LinkedCell, dim > Class Template Reference

#include <MultiMDCellService.h>

Collaboration diagram for coupling::services::MultiMDCellService< LinkedCell, dim >:

Public Member Functions

 MultiMDCellService (std::vector< coupling::interface::MDSolverInterface< LinkedCell, dim > * > mdSolverInterfaces, coupling::interface::MacroscopicSolverInterface< dim > *macroscopicSolverInterface, simplemd::configurations::MolecularDynamicsConfiguration &mdConfiguration, coupling::configurations::MaMiCoConfiguration< dim > &mamicoConfiguration, const char *filterPipelineConfiguration, tarch::utils::MultiMDService< dim > &multiMDService, int tws=0)
 
coupling::services::CouplingCellService< dim > & getCouplingCellService (unsigned int localIndex)
 
void plotEveryMacroscopicTimestepforCouplingCellService (unsigned int localIndex, int cycle)
 
void plotEveryMacroscopicTimestep (int cycle)
 
void computeAndStoreTemperature (double temp)
 
void sendFromMacro2MD (const coupling::datastructures::FlexibleCellContainer< dim > &macro2mdCouplingCellContainer)
 
void bcastFromMacro2MD (const std::vector< coupling::datastructures::CouplingCell< dim > * > &couplingCellsFromMacroscopicSolver, const I00 *const indices)
 
void sumUpCouplingCellsFromMamico ()
 
double reduceFromMD2Macro (const std::vector< coupling::datastructures::CouplingCell< dim > * > &couplingCellsFromMacroscopicSolver, const I00 *const indices)
 
double sendFromMD2Macro (const coupling::datastructures::FlexibleCellContainer< dim > &md2macroCouplingCells)
 
void preprocessingForMD2Macro (const coupling::datastructures::FlexibleCellContainer< dim > &cells)
 
unsigned int rmMDSimulation (coupling::InstanceHandling< LinkedCell, dim > &instanceHandling, const unsigned int &index)
 
void removeSimulationBlock ()
 
void addSimulationBlock ()
 
unsigned int addMDSimulation (coupling::InstanceHandling< LinkedCell, dim > &instanceHandling, coupling::interface::MacroscopicSolverInterface< dim > *macroscopicSolverInterface, const unsigned int &slot)
 
unsigned int getLocalNumberOfMDSimulations () const
 
void finishCycle (const unsigned int &cycle, coupling::InstanceHandling< LinkedCell, dim > &instanceHandling)
 
void writeCheckpoint (const unsigned int &cycle, const coupling::InstanceHandling< LinkedCell, dim > &instanceHandling) const
 
void constructFilterPipelines ()
 

Private Member Functions

unsigned int computeTopologyOffset () const
 
unsigned int computeScalarNumberProcesses () const
 
coupling::services::CouplingCellService< dim > * createCouplingCellServiceDummy (unsigned int ID, coupling::interface::MacroscopicSolverInterface< dim > *macroscopicSolverInterface, simplemd::configurations::MolecularDynamicsConfiguration &mdConfiguration, tarch::utils::MultiMDService< dim > &multiMDService, coupling::configurations::MaMiCoConfiguration< dim > &mamicoConfiguration, unsigned int topologyOffset) const
 

Private Attributes

unsigned int _localNumberMDSimulations
 
unsigned int _totalNumberMDSimulations
 
coupling::services::CouplingCellService< dim > ** _couplingCellServices
 
tarch::utils::MultiMDService< dim > & _multiMDService
 
unsigned int _topologyOffset
 
const int _tws
 
const unsigned int _intNumberProcesses
 
coupling::datastructures::FlexibleCellContainer< dim > _couplingCells
 
coupling::datastructures::FlexibleCellContainer< dim > _sumCouplingCells
 
simplemd::configurations::MolecularDynamicsConfiguration & _mdConfiguration
 
coupling::configurations::MaMiCoConfiguration< dim > & _mamicoConfiguration
 
const std::string _filterPipelineConfiguration
 
coupling::interface::MacroscopicSolverInterface< dim > * _macroscopicSolverInterface
 
unsigned int _blockOffset
 
std::vector< bool > _listActiveMDSimulations
 
unsigned int _nextFreeBlock
 
std::vector< int > _warmupPhase
 
coupling::filtering::FilterPipeline< I14, dim > * _postMultiInstanceFilterPipeline
 
coupling::sendrecv::FromMD2Macro< coupling::datastructures::CouplingCell< dim >, dim > _fromMD2Macro
 

Detailed Description

template<class LinkedCell, unsigned int dim>
class coupling::services::MultiMDCellService< LinkedCell, dim >

service to couple various MD simulations to a single instance of a macroscopic solver. We currently consider only one layout: global ranks are linearly split into blocks of size numberProcesses. Each block may run several MD simulations. Each of these simulations has one mdSolverInterface (handed over in the constructor as vector).

Author
Philipp Neumann

Member Function Documentation

◆ addMDSimulation()

template<class LinkedCell, unsigned int dim>
unsigned int coupling::services::MultiMDCellService< LinkedCell, dim >::addMDSimulation ( coupling::InstanceHandling< LinkedCell, dim > & instanceHandling,
coupling::interface::MacroscopicSolverInterface< dim > * macroscopicSolverInterface,
const unsigned int & slot )
inline

Adds CouplingCellService at appropriate slot

Returns
true if this process needs another md simulation initialized false otherwise

◆ addSimulationBlock()

template<class LinkedCell, unsigned int dim>
void coupling::services::MultiMDCellService< LinkedCell, dim >::addSimulationBlock ( )
inline

In order to make space for new simulation slots We need to add one slot to the local coupling cell service implementations and also one slot per macroOnly cell service. As the topologyOffset per MacroOnly cell service changes, we re-initialize these as well.

◆ bcastFromMacro2MD()

template<class LinkedCell, unsigned int dim>
void coupling::services::MultiMDCellService< LinkedCell, dim >::bcastFromMacro2MD ( const std::vector< coupling::datastructures::CouplingCell< dim > * > & couplingCellsFromMacroscopicSolver,
const I00 *const indices )
inline

broadcasts data from macroscopic solver to all MD simulations

◆ getCouplingCellService()

template<class LinkedCell, unsigned int dim>
coupling::services::CouplingCellService< dim > & coupling::services::MultiMDCellService< LinkedCell, dim >::getCouplingCellService ( unsigned int localIndex)
inline

get access to coupling cell services. This is required potentially by each MD simulation to incorporate cell-local thermostat, mass and momentum transfer

◆ plotEveryMacroscopicTimestepforCouplingCellService()

template<class LinkedCell, unsigned int dim>
void coupling::services::MultiMDCellService< LinkedCell, dim >::plotEveryMacroscopicTimestepforCouplingCellService ( unsigned int localIndex,
int cycle )
inline

Forward Plotting to coupling cell services if not NULL!

◆ preprocessingForMD2Macro()

template<class LinkedCell, unsigned int dim>
void coupling::services::MultiMDCellService< LinkedCell, dim >::preprocessingForMD2Macro ( const coupling::datastructures::FlexibleCellContainer< dim > & cells)
inline

preprocessing operations for reducing data from MD instances to macro

◆ reduceFromMD2Macro()

template<class LinkedCell, unsigned int dim>
double coupling::services::MultiMDCellService< LinkedCell, dim >::reduceFromMD2Macro ( const std::vector< coupling::datastructures::CouplingCell< dim > * > & couplingCellsFromMacroscopicSolver,
const I00 *const indices )
inline

reduce data from MD simulations, averages over them (only macroscopic mass/momentum is considered) and writes the result back into couplingCellsFromMacroscopicSolver.

Returns
The runtime of filtering related code in usec.

◆ removeSimulationBlock()

template<class LinkedCell, unsigned int dim>
void coupling::services::MultiMDCellService< LinkedCell, dim >::removeSimulationBlock ( )
inline

In case there is exactly one free slot available per local comm, remove one slot per comm (that is, one block of simulations)

◆ rmMDSimulation()

template<class LinkedCell, unsigned int dim>
unsigned int coupling::services::MultiMDCellService< LinkedCell, dim >::rmMDSimulation ( coupling::InstanceHandling< LinkedCell, dim > & instanceHandling,
const unsigned int & index )
inline

removes the last simulation which has been added.

◆ sendFromMacro2MD()

template<class LinkedCell, unsigned int dim>
void coupling::services::MultiMDCellService< LinkedCell, dim >::sendFromMacro2MD ( const coupling::datastructures::FlexibleCellContainer< dim > & macro2mdCouplingCellContainer)
inline

send data from macroscopic solver to all MD simulations

◆ sendFromMD2Macro()

template<class LinkedCell, unsigned int dim>
double coupling::services::MultiMDCellService< LinkedCell, dim >::sendFromMD2Macro ( const coupling::datastructures::FlexibleCellContainer< dim > & md2macroCouplingCells)
inline

collects data from MD simulations, averages over them (only macroscopic mass/momentum is considered) and writes the result back into couplingCellsFromMacroscopicSolver.

◆ sumUpCouplingCellsFromMamico()

template<class LinkedCell, unsigned int dim>
void coupling::services::MultiMDCellService< LinkedCell, dim >::sumUpCouplingCellsFromMamico ( )
inline

Creates the sum over all instances' coupling cells, in order to reduce the amount of communication needed.

Member Data Documentation

◆ _couplingCellServices

template<class LinkedCell, unsigned int dim>
coupling::services::CouplingCellService<dim>** coupling::services::MultiMDCellService< LinkedCell, dim >::_couplingCellServices
private

total number of MD simulations

◆ _mdConfiguration

template<class LinkedCell, unsigned int dim>
simplemd::configurations::MolecularDynamicsConfiguration& coupling::services::MultiMDCellService< LinkedCell, dim >::_mdConfiguration
private

used to reduce all local coupling cells before sending from md 2 macro

◆ _multiMDService

template<class LinkedCell, unsigned int dim>
tarch::utils::MultiMDService<dim>& coupling::services::MultiMDCellService< LinkedCell, dim >::_multiMDService
private

pointers of CouplingCellService type, one for each MD simulation

◆ _nextFreeBlock

template<class LinkedCell, unsigned int dim>
unsigned int coupling::services::MultiMDCellService< LinkedCell, dim >::_nextFreeBlock
private

One entry per (in-)active md simulation, totals to _totalNumberMDSimulations

◆ _postMultiInstanceFilterPipeline

template<class LinkedCell, unsigned int dim>
coupling::filtering::FilterPipeline<I14, dim>* coupling::services::MultiMDCellService< LinkedCell, dim >::_postMultiInstanceFilterPipeline
private

Counts the number of remaining warmup cycles after this simulation has been added. This is only relevent for simulations added during the simulation.

◆ _sumCouplingCells

template<class LinkedCell, unsigned int dim>
coupling::datastructures::FlexibleCellContainer<dim> coupling::services::MultiMDCellService< LinkedCell, dim >::_sumCouplingCells
private

used to store in MD data in sendFromMD2Macro

◆ _totalNumberMDSimulations

template<class LinkedCell, unsigned int dim>
unsigned int coupling::services::MultiMDCellService< LinkedCell, dim >::_totalNumberMDSimulations
private

number of MD simulations run on the current rank. This can differ for different blocks, i.e. different topologyOffset values.

◆ _tws

template<class LinkedCell, unsigned int dim>
const int coupling::services::MultiMDCellService< LinkedCell, dim >::_tws
private

topology offset

◆ _warmupPhase

template<class LinkedCell, unsigned int dim>
std::vector<int> coupling::services::MultiMDCellService< LinkedCell, dim >::_warmupPhase
private

Points to the next block, to which a simulation should be added.


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