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

#include <CouplingCellService.h>

Inheritance diagram for coupling::services::CouplingCellServiceImpl< LinkedCell, dim >:
Collaboration diagram for coupling::services::CouplingCellServiceImpl< LinkedCell, dim >:

Classes

class  Wrapper
 
class  Wrapper4ApplyBoundaryForce
 
class  Wrapper4ApplyTemperature
 
class  Wrapper4ComputeAndSetCurrentVelocity
 
class  Wrapper4ComputeAndStoreTemperature
 
class  Wrapper4DistributeMomentum
 
class  Wrapper4PerturbateVelocity
 
class  Wrapper4ProcessInnerCouplingCellAfterMDTimestep
 
class  Wrapper4ProcessInnerCouplingCellAfterReceivingMacroscopicSolverData
 
class  Wrapper4ProcessInnerCouplingCellBeforeReceivingMacroscopicSolverData
 
class  Wrapper4ProcessInnerCouplingCellBeforeSendingMDSolverData
 
class  Wrapper4ProcessOuterCouplingCellAfterReceivingMacroscopicSolverData
 
class  Wrapper4ProcessOuterCouplingCellBeforeReceivingMacroscopicSolverData
 
class  Wrapper4ProcessOuterCouplingCellBeforeSendingMDSolverData
 

Public Member Functions

 CouplingCellServiceImpl (unsigned int ID, coupling::interface::MDSolverInterface< LinkedCell, dim > *mdSolverInterface, coupling::interface::MacroscopicSolverInterface< dim > *macroscopicSolverInterface, tarch::la::Vector< dim, unsigned int > numberProcesses, unsigned int rank, const coupling::configurations::ParticleInsertionConfiguration &particleInsertionConfiguration, const coupling::configurations::MomentumInsertionConfiguration &momentumInsertionConfiguration, const coupling::configurations::BoundaryForceConfiguration< dim > &boundaryForceConfiguration, const coupling::configurations::TransferStrategyConfiguration< dim > &transferStrategyConfiguration, const coupling::configurations::ParallelTopologyConfiguration &parallelTopologyConfiguration, const coupling::configurations::ThermostatConfiguration &thermostatConfiguration, unsigned int numberMDTimestepsPerCouplingCycle, const coupling::configurations::CouplingCellConfiguration< dim > &couplingCellConfiguration, const char *filterPipelineConfiguration, const tarch::utils::MultiMDService< dim > &multiMDService, unsigned int topologyOffset, int tws=0)
 
 CouplingCellServiceImpl (unsigned int ID, coupling::interface::MDSolverInterface< LinkedCell, dim > *mdSolverInterface, coupling::interface::MacroscopicSolverInterface< dim > *macroscopicSolverInterface, tarch::la::Vector< dim, unsigned int > numberProcesses, unsigned int rank, const coupling::configurations::ParticleInsertionConfiguration &particleInsertionConfiguration, const coupling::configurations::MomentumInsertionConfiguration &momentumInsertionConfiguration, const coupling::configurations::BoundaryForceConfiguration< dim > &boundaryForceConfiguration, const coupling::configurations::TransferStrategyConfiguration< dim > &transferStrategyConfiguration, const coupling::configurations::ParallelTopologyConfiguration &parallelTopologyConfiguration, const coupling::configurations::ThermostatConfiguration &thermostatConfiguration, unsigned int numberMDTimestepsPerCouplingCycle, const coupling::configurations::CouplingCellConfiguration< dim > &couplingCellConfiguration, const char *filterPipelineConfiguration, const tarch::utils::MultiMDService< dim > &multiMDService)
 
virtual ~CouplingCellServiceImpl ()
 
void sendFromMacro2MD (const coupling::datastructures::FlexibleCellContainer< dim > &macro2MDBuffer) override
 
double sendFromMD2Macro (const coupling::datastructures::FlexibleCellContainer< dim > &macroscopicSolverCellContainer) override
 
double applyFilterPipeline () override
 
void sendFromMacro2MDPreProcess () override
 
void sendFromMacro2MDPostProcess () override
 
void sendFromMD2MacroPreProcess () override
 
void sendFromMD2MacroPostProcess () override
 
void processInnerCouplingCellAfterMDTimestep () override
 
void computeAndStoreTemperature (double temperature) override
 
void applyTemperatureToMolecules (unsigned int t) override
 
void applyBoundaryForce (unsigned int t) override
 
void distributeMass (unsigned int t) override
 
void distributeMomentum (unsigned int t) override
 
void perturbateVelocity () override
 
void plotEveryMicroscopicTimestep (unsigned int t) override
 
void plotEveryMacroscopicTimestep (unsigned int t) override
 
void initFiltering () override
 
const coupling::filtering::FilterPipeline< I02, dim > * getFilterPipeline () const override
 
coupling::datastructures::LinkedCellContainer< LinkedCell, dim > & getCouplingCells ()
 
- Public Member Functions inherited from coupling::services::CouplingCellService< dim >
 CouplingCellService (unsigned int ID, unsigned int topologyOffset)
 
unsigned int getID () const
 

Private Member Functions

void initIndexVectors4Usher ()
 
tarch::la::Vector< dim, double > getPositionOfFirstLocalGhostCell () const
 
std::function< void(Wrapper &)> initCorrectApplicationOfThermostat (const coupling::configurations::ThermostatConfiguration &thermostatConfiguration)
 

Private Attributes

const unsigned int _numberMDTimestepsPerCouplingCycle
 
coupling::interface::MDSolverInterface< LinkedCell, dim > * _mdSolverInterface
 
coupling::interface::MacroscopicSolverInterface< dim > * _macroscopicSolverInterface
 
coupling::sendrecv::FromMacro2MD< coupling::datastructures::CouplingCell< dim >, dim > _fromMacro2MD
 
coupling::sendrecv::DataExchangeFromMacro2MD< dim > _deFromMacro2MD
 
coupling::sendrecv::FromMD2Macro< coupling::datastructures::CouplingCell< dim >, dim > _fromMD2Macro
 
coupling::sendrecv::DataExchangeFromMD2Macro< dim > _deFromMD2Macro
 
coupling::datastructures::LinkedCellContainer< LinkedCell, dim > _couplingCells
 
coupling::filtering::FilterPipeline< I02, dim > * _filterPipeline
 
const char * _filterPipelineConfiguration
 
const tarch::utils::MultiMDService< dim > _multiMDService
 
coupling::MomentumInsertion< LinkedCell, dim > * _momentumInsertion
 
coupling::configurations::MomentumInsertionConfiguration::MomentumInsertionType _momentumInsertionType
 
coupling::ParticleInsertion< LinkedCell, dim > * _particleInsertion
 
const tarch::la::Vector< dim, unsigned int > _numberLinkedCellsPerCouplingCell
 
const coupling::configurations::ParticleInsertionConfiguration::ParticleInsertionType _particleInsertionType
 
coupling::transferstrategies::TransferStrategy< LinkedCell, dim > * _transferStrategy
 
coupling::KineticEnergyController< LinkedCell, dim > _kineticEnergyController
 
coupling::BoundaryForceController< LinkedCell, dim > * _boundaryForceController
 
coupling::MomentumController< LinkedCell, dim > _momentumController
 
std::function< void(Wrapper &)> _applyAccordingToConfiguration
 
const std::string _microscopicFilename
 
const unsigned int _writeEveryMicroscopicTimestep
 
const std::string _macroscopicFilename
 
const unsigned int _writeEveryMacroscopicTimestep
 
tarch::la::Vector< 3, unsigned int > _usherCellStart [1<< dim]
 
tarch::la::Vector< 3, unsigned int > _usherCellEnd [1<< dim]
 
tarch::la::Vector< dim, unsigned int > _usherRange [1<< dim]
 
tarch::la::Vector< 3, unsigned int > _usherCellOffset [1<< dim]
 

Additional Inherited Members

- Protected Attributes inherited from coupling::services::CouplingCellService< dim >
const unsigned int _id
 
unsigned int _topologyOffset
 

Detailed Description

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

This class put together all ingredients for coupling MD and some macroscopic solver. It thus triggers send/recv-operations between the coupling tool and MD as well as between the coupling tool and the macroscopic solver.

Author
Philipp Neumann

Constructor & Destructor Documentation

◆ CouplingCellServiceImpl()

template<class LinkedCell, unsigned int dim>
coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::CouplingCellServiceImpl ( unsigned int ID,
coupling::interface::MDSolverInterface< LinkedCell, dim > * mdSolverInterface,
coupling::interface::MacroscopicSolverInterface< dim > * macroscopicSolverInterface,
tarch::la::Vector< dim, unsigned int > numberProcesses,
unsigned int rank,
const coupling::configurations::ParticleInsertionConfiguration & particleInsertionConfiguration,
const coupling::configurations::MomentumInsertionConfiguration & momentumInsertionConfiguration,
const coupling::configurations::BoundaryForceConfiguration< dim > & boundaryForceConfiguration,
const coupling::configurations::TransferStrategyConfiguration< dim > & transferStrategyConfiguration,
const coupling::configurations::ParallelTopologyConfiguration & parallelTopologyConfiguration,
const coupling::configurations::ThermostatConfiguration & thermostatConfiguration,
unsigned int numberMDTimestepsPerCouplingCycle,
const coupling::configurations::CouplingCellConfiguration< dim > & couplingCellConfiguration,
const char * filterPipelineConfiguration,
const tarch::utils::MultiMDService< dim > & multiMDService,
unsigned int topologyOffset,
int tws = 0 )

constructor. Arguments: mdSolverInterface - pointer to the MD solver interface macroscopicSolverInterface - pointer to the macroscopic solver interface numberProcesses - number of processes assuming a block-like domain decomposition rank - rank of the current process particleInsertionConfiguration - configuration object for (USHER-based) particle insertion and particle removal momentumInsertionConfiguration - configuration object which determines the momentum transfer on MD side transferStrategyConfiguration - configuration object which determines the respective transfer strategy parallelTopologyConfiguration - configuratio object which defines the parallel topology of the simulation (domain decomposition of the MD simulation) numberMDTimestepsPerCouplingCycle - number of MD time steps per coupling cycle couplingCellConfiguration - configuration object which determines the properties of the coupling cells topologyOffset - offset in linearized topology of ranks topologyGlobalNumberProcesses - global number of processes available in overall topology

Note: the interface pointers are used by the CouplingCellServiceImpl; they are not deleted at the end of the simulation since other (external) routines may use those as well.

◆ ~CouplingCellServiceImpl()

template<class LinkedCell, unsigned int dim>
virtual coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::~CouplingCellServiceImpl ( )
virtual

destructor. Frees dynamically allocated memory for particle insertion, momentum insertion and the transfer strategy.

Member Function Documentation

◆ applyBoundaryForce()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::applyBoundaryForce ( unsigned int t)
overridevirtual

applies a boundary force to molecules which are close to an open boundary.

Implements coupling::services::CouplingCellService< dim >.

◆ applyFilterPipeline()

template<class LinkedCell, unsigned int dim>
double coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::applyFilterPipeline ( )
overridevirtual

applies the filter pipeline and returns the runtime of this operation

Implements coupling::services::CouplingCellService< dim >.

◆ applyTemperatureToMolecules()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::applyTemperatureToMolecules ( unsigned int t)
overridevirtual

applies a thermostat in all non-ghost coupling cells.

Implements coupling::services::CouplingCellService< dim >.

◆ computeAndStoreTemperature()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::computeAndStoreTemperature ( double temperature)
overridevirtual

sets the temperature value in all coupling cells. If the value of temperature is -1.0, we set the local temperature of each coupling cell (and just store this value in the coupling cell). Otherwise, we apply the given temperature in all cells. In the latter case, this also resembles a first thermostat-like operation.

Implements coupling::services::CouplingCellService< dim >.

◆ distributeMass()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::distributeMass ( unsigned int t)
overridevirtual

distributes mass in the system.

Implements coupling::services::CouplingCellService< dim >.

◆ distributeMomentum()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::distributeMomentum ( unsigned int t)
overridevirtual

distributes momentum in MD. Should typically be called after force accumulation since momentum distribution may depend on current forces.

Implements coupling::services::CouplingCellService< dim >.

◆ getCouplingCells()

template<class LinkedCell, unsigned int dim>
coupling::datastructures::LinkedCellContainer< LinkedCell, dim > & coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::getCouplingCells ( )
inline

Creates a new filter from scratch and appends it to a sequence that is part of this service's filter pipelining system. For that, the desired sequence's identifier and two functions are needed:

  • applyScalar What to do with scalar properties of the sequence's Coupling Cells.
  • applyVector: What to do with properties stored as vectors of the sequence's of Coupling Cells. returns the coupling cells. This functions is meant to be used in test scenarios and for debugging only! DO NOT USE IT FOR OTHER PURPOSES!

◆ getFilterPipeline()

template<class LinkedCell, unsigned int dim>
const coupling::filtering::FilterPipeline< I02, dim > * coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::getFilterPipeline ( ) const
inlineoverridevirtual

◆ initFiltering()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::initFiltering ( )
inlineoverridevirtual

Initialises the _filterPipeline member. Called from _multiMDCellService's constructFilterPipelines(). Make sure to delete _filterPipeline in ~CouplingCellServiceImpl()

Reimplemented from coupling::services::CouplingCellService< dim >.

◆ initIndexVectors4Usher()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::initIndexVectors4Usher ( )
private

initialises the index structures for USHER scheme

◆ perturbateVelocity()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::perturbateVelocity ( )
overridevirtual

applies a new velocity to each particle according to its cell's mean velocity.

Implements coupling::services::CouplingCellService< dim >.

◆ plotEveryMacroscopicTimestep()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::plotEveryMacroscopicTimestep ( unsigned int t)
overridevirtual

◆ plotEveryMicroscopicTimestep()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::plotEveryMicroscopicTimestep ( unsigned int t)
overridevirtual

plots coupling cell and molecule information at some time step t. The correct triggering of plotting needs to be established from the main coupling loop which is outside the coupling tool (not included in this function).

Implements coupling::services::CouplingCellService< dim >.

◆ processInnerCouplingCellAfterMDTimestep()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::processInnerCouplingCellAfterMDTimestep ( )
overridevirtual

carries out coupling-dependent operations (such as sampling) on the non-ghost coupling cells after each MD time step. This method needs thus to be called from the MD simulation.

Implements coupling::services::CouplingCellService< dim >.

◆ sendFromMacro2MD()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::sendFromMacro2MD ( const coupling::datastructures::FlexibleCellContainer< dim > & macro2MDBuffer)
overridevirtual

sends information from macroscopic solver to MD. The cell information from the macroscopic solver is handed over as a flexible cell container The coupling tool internally triggers send/recv-operations (this also comprises the distributed memory parallelisation via MPI) and writes the respective information to the coupling cells of the tool

Implements coupling::services::CouplingCellService< dim >.

◆ sendFromMacro2MDPostProcess()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::sendFromMacro2MDPostProcess ( )
overridevirtual

◆ sendFromMacro2MDPreProcess()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::sendFromMacro2MDPreProcess ( )
overridevirtual

◆ sendFromMD2Macro()

template<class LinkedCell, unsigned int dim>
double coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::sendFromMD2Macro ( const coupling::datastructures::FlexibleCellContainer< dim > & macroscopicSolverCellContainer)
overridevirtual

sends information from MD to the macroscopic solver. After the send/recv-operations (this also comprises the distributed memory parallelisation scenario), the information from the coupling tool is written to the buffer couplingCellsFromMacroscopicSolver together with the respective global cell indices (-> indices).

Returns
The runtime of filtering related code in usec.

Implements coupling::services::CouplingCellService< dim >.

◆ sendFromMD2MacroPostProcess()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::sendFromMD2MacroPostProcess ( )
inlineoverridevirtual

◆ sendFromMD2MacroPreProcess()

template<class LinkedCell, unsigned int dim>
void coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::sendFromMD2MacroPreProcess ( )
overridevirtual

Member Data Documentation

◆ _boundaryForceController

template<class LinkedCell, unsigned int dim>
coupling::BoundaryForceController<LinkedCell, dim>* coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_boundaryForceController
private

controls and apply boundary forces to molecules close to open boundaries.

◆ _couplingCells

template<class LinkedCell, unsigned int dim>
coupling::datastructures::LinkedCellContainer<LinkedCell, dim> coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_couplingCells
private

storage for coupling cells in coupling tool

◆ _filterPipeline

template<class LinkedCell, unsigned int dim>
coupling::filtering::FilterPipeline<I02, dim>* coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_filterPipeline
private

filter pipeline, used to apply filters in sendFromMD2Macro

◆ _filterPipelineConfiguration

template<class LinkedCell, unsigned int dim>
const char* coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_filterPipelineConfiguration
private

parameters needed in initFiltering()

◆ _fromMacro2MD

template<class LinkedCell, unsigned int dim>
coupling::sendrecv::FromMacro2MD<coupling::datastructures::CouplingCell<dim>, dim> coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_fromMacro2MD
private

for quantity transfer between solvers

◆ _kineticEnergyController

template<class LinkedCell, unsigned int dim>
coupling::KineticEnergyController<LinkedCell, dim> coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_kineticEnergyController
private

controls the kinetic energy of the system, i.e. maintains temperature in case of changing mass/momentum.

◆ _macroscopicSolverInterface

template<class LinkedCell, unsigned int dim>
coupling::interface::MacroscopicSolverInterface<dim>* coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_macroscopicSolverInterface
private

interface for macroscopic solver

◆ _mdSolverInterface

template<class LinkedCell, unsigned int dim>
coupling::interface::MDSolverInterface<LinkedCell, dim>* coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_mdSolverInterface
private

interface for MD solver

◆ _microscopicFilename

template<class LinkedCell, unsigned int dim>
const std::string coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_microscopicFilename
private

information for plotting

◆ _momentumController

template<class LinkedCell, unsigned int dim>
coupling::MomentumController<LinkedCell, dim> coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_momentumController
private

controls/ maintains momentum, e.g. after particle insertion

◆ _momentumInsertion

template<class LinkedCell, unsigned int dim>
coupling::MomentumInsertion<LinkedCell, dim>* coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_momentumInsertion
private

needed for insertion of momentum

◆ _numberMDTimestepsPerCouplingCycle

template<class LinkedCell, unsigned int dim>
const unsigned int coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_numberMDTimestepsPerCouplingCycle
private

number of MD time steps in each coupling cycle

◆ _particleInsertion

template<class LinkedCell, unsigned int dim>
coupling::ParticleInsertion<LinkedCell, dim>* coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_particleInsertion
private

needed for insertion of particles, e.g. USHER

◆ _transferStrategy

template<class LinkedCell, unsigned int dim>
coupling::transferstrategies::TransferStrategy<LinkedCell, dim>* coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_transferStrategy
private

coupling strategy

◆ _usherCellStart

template<class LinkedCell, unsigned int dim>
tarch::la::Vector<3, unsigned int> coupling::services::CouplingCellServiceImpl< LinkedCell, dim >::_usherCellStart[1<< dim]
private

index vectors for block-usher scheme —————————————————–


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