LCOV - code coverage report
Current view: top level - coupling/transferstrategies - TransferStrategy4SchwarzCoupling.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 4 0
Test Date: 2026-08-21 15:14:06 Functions: 0.0 % 2 0

            Line data    Source code
       1              : // Copyright (C) 2015 Technische Universitaet Muenchen
       2              : // This file is part of the Mamico project. For conditions of distribution
       3              : // and use, please see the copyright notice in Mamico's main folder, or at
       4              : // www5.in.tum.de/mamico
       5              : #ifndef _MOLECULARDYNAMICS_COUPLING_TRANSFERSTRATEGIES_TRANSFERSTRATEGY4SCHWARZCOUPLING_H_
       6              : #define _MOLECULARDYNAMICS_COUPLING_TRANSFERSTRATEGIES_TRANSFERSTRATEGY4SCHWARZCOUPLING_H_
       7              : 
       8              : #include "coupling/cell-mappings/ComputeMassMapping.h"
       9              : #include "coupling/cell-mappings/ComputeMomentumMapping.h"
      10              : #include "coupling/transferstrategies/TransferStrategy.h"
      11              : 
      12              : namespace coupling {
      13              : namespace transferstrategies {
      14              : template <class LinkedCell, unsigned int dim> class TransferStrategy4SchwarzCoupling;
      15              : }
      16              : } // namespace coupling
      17              : 
      18              : /** transfer strategy for Schwarz coupling algorithm, adopted from Dupuis et al.
      19              :  *  We currently sample over the last 20% of the coupling interval, i.e. of the
      20              :  * numberMDsteps time steps in MD. The other 80% are used for equilibration.
      21              :  *  @author Philipp Neumann
      22              :  *  @tparam LinkedCell the LinkedCell class is given by the implementation of
      23              :  * linked cells in the molecular dynamics simulation
      24              :  *  @tparam dim  refers to the spacial dimension of the simulation, can be 1, 2,
      25              :  * or 3*/
      26              : template <class LinkedCell, unsigned int dim>
      27              : class coupling::transferstrategies::TransferStrategy4SchwarzCoupling : public coupling::transferstrategies::TransferStrategy<LinkedCell, dim> {
      28              : public:
      29              :   /** @brief a simple
      30              :    *  @param mdSolverInterface interface for the md solver
      31              :    *  @param numberMDSteps number of md time steps within one coupling time step
      32              :    */
      33            0 :   TransferStrategy4SchwarzCoupling(coupling::interface::MDSolverInterface<LinkedCell, dim>* const mdSolverInterface, unsigned int numberMDSteps)
      34            0 :       : coupling::transferstrategies::TransferStrategy<LinkedCell, dim>(mdSolverInterface), _massMapping(mdSolverInterface),
      35            0 :         _momentumMapping(mdSolverInterface), _timestepCounter(0), _sampleCounter(0), _numberMDSteps(numberMDSteps), _sampleEveryTimestep(1) {}
      36              : 
      37              :   /** @brief a dummy destructor*/
      38            0 :   virtual ~TransferStrategy4SchwarzCoupling() {}
      39              : 
      40              :   /** @brief the sample counter is reseted (0)*/
      41              :   void beginProcessInnerCouplingCellsBeforeReceivingMacroscopicSolverData() override;
      42              : 
      43              :   /** the momentum is converted to velocity (velocity = momentum/mass) and
      44              :    * stored in the microscopicMomentum the mass is not applied, therefore the
      45              :    * macroscopicMass is set to 0 the macroscopic quantities are reseted (0)
      46              :    *  @brief the data received from the macro solver is processed
      47              :    *  @param cell the coupling cell to be processed
      48              :    *  @param index the index of the coupling cell */
      49              :   void processInnerCouplingCellAfterReceivingMacroscopicSolverData(coupling::datastructures::CouplingCellWithLinkedCells<LinkedCell, dim>& cell,
      50              :                                                                    I02 index) override;
      51              : 
      52              :   /** @brief the momentum is converted to velocity (velocity = momentum/mass)
      53              :    * and stored in the microscopicMomentum the mass is not applied, therefore
      54              :    * the macroscopicMass is set to 0 the macroscopic quantities are reseted (0)
      55              :    *  @brief the data received from the macro solver is processed
      56              :    *  @param cell the coupling cell to be processed
      57              :    *  @param index the index of the coupling cell */
      58              :   void processOuterCouplingCellAfterReceivingMacroscopicSolverData(coupling::datastructures::CouplingCellWithLinkedCells<LinkedCell, dim>& cell,
      59              :                                                                    I02 index) override;
      60              : 
      61              :   /** @brief the data collected during the md time steps is averaged
      62              :    * (/numberMDSteps)
      63              :    *  @param cell the coupling cell to be processed
      64              :    *  @param index the index of the coupling cell */
      65              :   void processInnerCouplingCellBeforeSendingMDSolverData(coupling::datastructures::CouplingCellWithLinkedCells<LinkedCell, dim>& cell, I02 index) override;
      66              : 
      67              :   /** @brief the macroscopic quantities are reseted (0)
      68              :    *  @param cell the coupling cell to be processed
      69              :    *  @param index the index of the coupling cell */
      70              :   void processOuterCouplingCellBeforeSendingMDSolverData(coupling::datastructures::CouplingCellWithLinkedCells<LinkedCell, dim>& cell, I02 index) override;
      71              : 
      72              :   /** @brief the _timestepCounter is incremented and if sample()==true the
      73              :    * _sampleCounter too */
      74              :   void beginProcessInnerCouplingCellsAfterMDTimestep() override;
      75              : 
      76              :   /** @brief the mass and momentum are evaluated in the cell and stored in the
      77              :    * macroscopic quantities
      78              :    *  @param cell the coupling cell to be processed
      79              :    *  @param index the index of the coupling cell */
      80              :   void processInnerCouplingCellAfterMDTimestep(coupling::datastructures::CouplingCellWithLinkedCells<LinkedCell, dim>& cell, I02 index) override;
      81              : 
      82              : protected:
      83              :   /** @brief depending on the sampling interval (_sampleEveryTimestep) true is
      84              :    *  returned if sampling has to be done in the current time step */
      85              :   virtual bool sample() const;
      86              : 
      87              : private:
      88              :   /** computes the mass in every single cell */
      89              :   coupling::cellmappings::ComputeMassMapping<LinkedCell, dim> _massMapping;
      90              :   /** computes the momentum in every single cell */
      91              :   coupling::cellmappings::ComputeMomentumMapping<LinkedCell, dim> _momentumMapping;
      92              :   /** counter for the time steps */
      93              :   unsigned int _timestepCounter;
      94              :   /** counter for the samples */
      95              :   unsigned int _sampleCounter;
      96              :   /** number of md time steps within one coupling time step */
      97              :   const unsigned int _numberMDSteps;
      98              :   /** the interval of sample point; 1 means every md time step is sampled; 10
      99              :    * means every 10th is used */
     100              :   const int _sampleEveryTimestep;
     101              : };
     102              : #include "coupling/transferstrategies/TransferStrategy4SchwarzCoupling.cpph"
     103              : 
     104              : #endif // _MOLECULARDYNAMICS_COUPLING_TRANSFERSTRATEGIES_TRANSFERSTRATEGY4SCHWARZCOUPLING_H_
        

Generated by: LCOV version 2.0-1