MaMiCo 1.2
Loading...
Searching...
No Matches
CouetteScenario Class Reference

Versatile configurable Couette flow test for noise-filtered multi-instance Nie coupling. More...

#include <CouetteScenario.h>

Inheritance diagram for CouetteScenario:
Collaboration diagram for CouetteScenario:

Classes

struct  CouplingBuffer
 holds the buffers for the data transfer More...
 
struct  TimingValues
 holds all the variables for the time measurement of a simulation More...
 

Public Member Functions

 CouetteScenario ()
 simple constructor
 
virtual ~CouetteScenario ()
 a dummy destructor
 
void run () override
 runs the simulation
 
void init () override
 initialises everthing necessary for the test
 
void runOneCouplingCycle (int cycle) override
 combines the functioniality necessary for a cycle of the coupled simulation
 
coupling::solvers::AbstractCouetteSolver< 3 > * getSolver () override
 
- Public Member Functions inherited from Scenario
 Scenario (std::string scenarioname)
 
const coupling::services::ParallelTimeIntegrationService< 3 > * getTimeIntegrationService () const
 

Protected Member Functions

void getRootRank ()
 initialises all MPI variables
 
void twsLoop ()
 Executes the entire test several times for a range of time-window-size parameters.
 
void parseConfigurations ()
 reads the configuration from the xml file and calls parseCouetteScenarioConfiguration()
 
void initSolvers ()
 initialises the macro and micro solver according to the setup from the xml file and pre-proccses them
 
void advanceMacro (int cycle)
 advances the continuum solver and collects data to send to md (fillSendBuffer())
 
void varyMD (int cycle)
 
void advanceMicro (int cycle)
 advances the md solver for one coupling time step and collect the data for the coupling
 
void computeSNR (int cycle)
 used to compute signal-to-noise ratio, stores values in _sum_noise and _sum_signal
 
void twoWayCoupling (int cycle)
 sets up the boundaries in the macro solver for the coupling and applies the values from the md in the macro solver
 
void shutdown ()
 finalize the time measurement, and cleans up at the end of the simulation
 
tarch::la::Vector< 3, unsigned int > getGlobalNumberCouplingCells (const simplemd::configurations::MolecularDynamicsConfiguration &simpleMDConfig, const coupling::configurations::MaMiCoConfiguration< 3 > &mamicoConfig) const
 
void allocateMacro2mdBuffer (coupling::interface::MacroscopicSolverInterface< 3 > &msi)
 allocates the send buffer (with values for all coupling cells).
 
void allocateMd2macroBuffer (coupling::interface::MacroscopicSolverInterface< 3 > &msi)
 
template<class Container_T>
void write2CSV (Container_T &md2macroBuffer, int couplingCycle) const
 write coupling cells that have been received from MD to csv file
 
void fillSendBuffer (const double density, const coupling::solvers::AbstractCouetteSolver< 3 > &couetteSolver, coupling::datastructures::FlexibleCellContainer< 3 > &macro2MDBuffer) const
 fills send buffer with data from macro/continuum solver
 
coupling::solvers::AbstractCouetteSolver< 3 > * getCouetteSolver (const double dx, const double dt)
 
coupling::interface::MacroscopicSolverInterface< 3 > * getCouetteSolverInterface (const double dx, tarch::la::Vector< 3, double > mdOffset, tarch::la::Vector< 3, double > mamicoMeshsize, tarch::la::Vector< 3, unsigned int > globalNumberCouplingCells, unsigned int outerRegion)
 

Protected Attributes

int _rank
 the rank of the current MPI process in the local time domain
 
bool _isRootRank
 if this is the world global root process
 
int _tws
 
simplemd::configurations::MolecularDynamicsConfiguration _simpleMDConfig
 the config data and information for SimpleMD
 
coupling::configurations::MaMiCoConfiguration< 3 > _mamicoConfig
 the config data and information for MaMiCo
 
coupling::configurations::CouetteConfig _cfg
 the CouetteConfig for the current setup
 
unsigned int _mdStepCounter
 the counter for the time steps, which are done within the md
 
coupling::solvers::AbstractCouetteSolver< 3 > * _couetteSolver
 the current macro/continuum solver
 
tarch::utils::MultiMDService< 3 > * _multiMDService
 
coupling::services::MultiMDCellService< MY_LINKEDCELL, 3 > * _multiMDCellService
 
CouplingBuffer _couplingBuffer
 the current buffer for the coupling
 
std::vector< coupling::interface::MDSolverInterface< MY_LINKEDCELL, 3 > * > _mdSolverInterface
 the interface to the md solver
 
coupling::InstanceHandling< MY_LINKEDCELL, 3 > * _instanceHandling
 
std::default_random_engine _generator
 
double _sum_signal
 
double _sum_noise
 
TimingValues _tv
 a instance of the timingValues
 
coupling::MultiMDMediator< MY_LINKEDCELL, 3 > * _multiMDMediator
 
- Protected Attributes inherited from Scenario
std::unique_ptr< coupling::services::ParallelTimeIntegrationService< 3 > > _timeIntegrationService
 

Detailed Description

Versatile configurable Couette flow test for noise-filtered multi-instance Nie coupling.

Features, depending on couette.xml config file: -> one-way or two-way coupling -> statup or oscillating flow scenario -> using analytical or Lattice Bolzmann Couette flow solver -> using (multi-instance) SimpleMD or synthetic MD data (with Gaussian noise) -> CSV output option for filtered data -> ability to delay scenario startup or two-way coupling for filter initialisation time -> signal-to-noise ratio (SNR) computation (between filter output and macroscopic solver) -> runtime measurements and logging separately for coupled simulation components -> 'tws-loop' feature for testing many POD time-window-size parameters in a single run -> dynamic multi-instance MD, adapt number of MD instances according to defined error

Author
Piet Jarmatz

Member Function Documentation

◆ advanceMacro()

void CouetteScenario::advanceMacro ( int cycle)
inlineprotected

advances the continuum solver and collects data to send to md (fillSendBuffer())

Parameters
cyclethe number of the current coupling time step

◆ advanceMicro()

void CouetteScenario::advanceMicro ( int cycle)
inlineprotected

advances the md solver for one coupling time step and collect the data for the coupling

Parameters
cyclethe number of the current coupling time step

◆ allocateMacro2mdBuffer()

void CouetteScenario::allocateMacro2mdBuffer ( coupling::interface::MacroscopicSolverInterface< 3 > & msi)
inlineprotected

allocates the send buffer (with values for all coupling cells).

Parameters
msimacroscopic solver interface for the continuum solver

◆ allocateMd2macroBuffer()

void CouetteScenario::allocateMd2macroBuffer ( coupling::interface::MacroscopicSolverInterface< 3 > & msi)
inlineprotected

allocates the recv-buffer. This buffer contains all global inner coupling cells, but only on rank 0. On all other ranks, no cells are stored and a NULL ptr is returned

◆ computeSNR()

void CouetteScenario::computeSNR ( int cycle)
inlineprotected

used to compute signal-to-noise ratio, stores values in _sum_noise and _sum_signal

todo@ use more cells

◆ fillSendBuffer()

void CouetteScenario::fillSendBuffer ( const double density,
const coupling::solvers::AbstractCouetteSolver< 3 > & couetteSolver,
coupling::datastructures::FlexibleCellContainer< 3 > & macro2MDBuffer ) const
inlineprotected

fills send buffer with data from macro/continuum solver

Parameters
densitythe general density of the fluid
couetteSolverthe continuum solver
macro2MDBufferthe bufffer to send data from macro to micro
globalCellIndices4SendBufferthe global linearized indices of the coupling cells in the buffer

◆ getCouetteSolver()

coupling::solvers::AbstractCouetteSolver< 3 > * CouetteScenario::getCouetteSolver ( const double dx,
const double dt )
inlineprotected
Returns
the correct macro/continuum solver for the given setup
Parameters
dxthe grid size (equidistant mesh)
dtthe time step

◆ getCouetteSolverInterface()

coupling::interface::MacroscopicSolverInterface< 3 > * CouetteScenario::getCouetteSolverInterface ( const double dx,
tarch::la::Vector< 3, double > mdOffset,
tarch::la::Vector< 3, double > mamicoMeshsize,
tarch::la::Vector< 3, unsigned int > globalNumberCouplingCells,
unsigned int outerRegion )
inlineprotected
Returns
the interface for the macro/continuum solver
Parameters
couetteSolverthe macro/continuum solver
mdOffsetthe offset of the md domain from (0.0.0)
mamicoMeshsize
globalNumberCouplingCellsthe total number coupling cells for the whole domain
outerRegion
Todo
piet, what is the mamicoMeshsize & the outer layer

◆ getGlobalNumberCouplingCells()

tarch::la::Vector< 3, unsigned int > CouetteScenario::getGlobalNumberCouplingCells ( const simplemd::configurations::MolecularDynamicsConfiguration & simpleMDConfig,
const coupling::configurations::MaMiCoConfiguration< 3 > & mamicoConfig ) const
inlineprotected

computes global number of coupling cells from configs. Required by couette solver interface before CouplingCellService is initialised!

◆ getSolver()

coupling::solvers::AbstractCouetteSolver< 3 > * CouetteScenario::getSolver ( )
inlineoverridevirtual

Implements Scenario.

◆ init()

void CouetteScenario::init ( )
inlineoverridevirtual

initialises everthing necessary for the test

triggers initMPI(), parseConfiguration(), and initSolvers()

Implements Scenario.

◆ run()

void CouetteScenario::run ( )
inlineoverridevirtual

runs the simulation

triggers void init(), runOneCouplingCycle() and shutdown()

Implements Scenario.

◆ runOneCouplingCycle()

void CouetteScenario::runOneCouplingCycle ( int cycle)
inlineoverridevirtual

combines the functioniality necessary for a cycle of the coupled simulation

it advances the macro (advanceMacro()) and micro solver (advanceMicro), computes the signal to noise ratio (computeSNR()) and sends the data from the macro to the micro solver (twoWayCoupling())

Implements Scenario.

◆ twoWayCoupling()

void CouetteScenario::twoWayCoupling ( int cycle)
inlineprotected

sets up the boundaries in the macro solver for the coupling and applies the values from the md in the macro solver

Parameters
cyclecurrent time step of the coupled simulation

◆ write2CSV()

template<class Container_T>
void CouetteScenario::write2CSV ( Container_T & md2macroBuffer,
int couplingCycle ) const
inlineprotected

write coupling cells that have been received from MD to csv file

Parameters
recvBufferthe buffer for the data, which comes from md
recvIndicesthe indices for the macr cells in the buffer
couplingCyclethe current number of coupling cycle

Member Data Documentation

◆ _generator

std::default_random_engine CouetteScenario::_generator
protected
Todo
piet

◆ _multiMDCellService

coupling::services::MultiMDCellService<MY_LINKEDCELL, 3>* CouetteScenario::_multiMDCellService
protected
Todo
piet

◆ _multiMDService

tarch::utils::MultiMDService<3>* CouetteScenario::_multiMDService
protected
Todo
piet

◆ _sum_noise

double CouetteScenario::_sum_noise
protected
Todo
piet

◆ _sum_signal

double CouetteScenario::_sum_signal
protected
Todo
piet

◆ _tws

int CouetteScenario::_tws
protected
Todo
Piet

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