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_BOUNDARYFORCECONTROLLER_H_
6 : #define _MOLECULARDYNAMICS_COUPLING_BOUNDARYFORCECONTROLLER_H_
7 :
8 : #include "coupling/datastructures/CouplingCellWithLinkedCells.h"
9 : #include "coupling/interface/MDSolverInterface.h"
10 :
11 : namespace coupling {
12 : template <class LinkedCell, unsigned int dim> class BoundaryForceController;
13 : }
14 :
15 : /** There is an interface method applyBoundaryForce which triggers potential
16 : * boundary forcing in each coupling cell that is located at the very outer
17 : * MD boundary (first layer of non-ghost coupling cells).
18 : * @brief controller for forces acting at open MD boundaries
19 : * @tparam LinkedCell the LinkedCell class is given by the implementation of
20 : * linked cells in the molecular dynamics simulation
21 : * @tparam dim the integer dim refers to the spacial dimension of the
22 : * simulation, can be 1, 2, or 3
23 : * @author Philipp Neumann
24 : */
25 : template <class LinkedCell, unsigned int dim> class coupling::BoundaryForceController {
26 : public:
27 : /**@brief A simple constructor
28 : * @param mdSolverInterface interface to the molecular dynamics solver*/
29 4 : BoundaryForceController(coupling::interface::MDSolverInterface<LinkedCell, dim>* const mdSolverInterface) : _mdSolverInterface(mdSolverInterface) {}
30 : /**@brief A simple destructor*/
31 0 : virtual ~BoundaryForceController() {}
32 :
33 : /** iterates over all linked cells of the given coupling cell and applies
34 : * the cellmapping for the boundary force
35 : * @brief applies the boundary force on a boundary cell
36 : * @param cell the boundary coupling cell to apply the boundary force
37 : */
38 : virtual void applyBoundaryForce(coupling::datastructures::CouplingCellWithLinkedCells<LinkedCell, dim>& cell) = 0;
39 :
40 : /** @brief calculates the potential energy for a given position
41 : * @param position the position for which the potential energy will be
42 : * calculated
43 : * @returns the potential energy for the given position */
44 0 : virtual double getPotentialEnergy(const tarch::la::Vector<dim, double>& position) const { return 0; }
45 :
46 : /** @brief calculates the boundary force for the given particle position
47 : * @param position particle position for the force calculation
48 : * @returns the force for the given position */
49 0 : virtual tarch::la::Vector<dim, double> getForce(const tarch::la::Vector<dim, double>& position) const { return tarch::la::Vector<dim, double>(0.0); }
50 :
51 : protected:
52 : coupling::interface::MDSolverInterface<LinkedCell, dim>* const _mdSolverInterface; ///< interface of the molecular dynamics solver
53 : };
54 : #endif // _MOLECULARDYNAMICS_COUPLING_BOUNDARYFORCECONTROLLER_H_
|