MaMiCo 1.2
Loading...
Searching...
No Matches
MomentumController.h
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_MOMENTUMCONTROLLER_H_
6#define _MOLECULARDYNAMICS_COUPLING_MOMENTUMCONTROLLER_H_
7
8#include "coupling/cell-mappings/ComputeMassMapping.h"
9#include "coupling/cell-mappings/ComputeMomentumMapping.h"
10#include "coupling/cell-mappings/SetMomentumMapping.h"
11#include "coupling/datastructures/CouplingCell.h"
12#include "tarch/la/Vector.h"
13
14namespace coupling {
15template <class LinkedCell, unsigned int dim> class MomentumController;
16}
17
26template <class LinkedCell, unsigned int dim> class coupling::MomentumController {
27public:
31 : _computeMassMapping(mdSolverInterface), _computeMomentumMapping(mdSolverInterface), _mdSolverInterface(mdSolverInterface) {}
32
35
49
58
67
79 tarch::la::Vector<dim, double> currentMomentum(0.0);
80 computeMomentum(cell, currentMomentum);
82 unsigned int numberParticles = _computeMassMapping.getNumberOfParticles();
83 coupling::cellmappings::SetMomentumMapping<LinkedCell, dim> setMomentumMapping(currentMomentum, newMomentum, numberParticles, _mdSolverInterface);
84 cell.iterateCells(setMomentumMapping);
85 }
86
87private:
94};
95#endif // _MOLECULARDYNAMICS_COUPLING_MOMENTUMCONTROLLER_H_
controls the momentum in a coupling cell.
Definition MomentumController.h:26
void setMomentum(coupling::datastructures::CouplingCellWithLinkedCells< LinkedCell, dim > &cell, const tarch::la::Vector< dim, double > &newMomentum)
sets the momentum of a coupling cell to the input value.
Definition MomentumController.h:78
void computeMomentum(coupling::datastructures::CouplingCellWithLinkedCells< LinkedCell, dim > &cell, tarch::la::Vector< dim, double > &momentum)
computes and returns the momentum of a coupling cell
Definition MomentumController.h:54
MomentumController(coupling::interface::MDSolverInterface< LinkedCell, dim > *const mdSolverInterface)
a simple constructor
Definition MomentumController.h:30
coupling::cellmappings::ComputeMassMapping< LinkedCell, dim > _computeMassMapping
Definition MomentumController.h:89
coupling::interface::MDSolverInterface< LinkedCell, dim > *const _mdSolverInterface
Definition MomentumController.h:93
void computeMomentumAndMeanVelocity(coupling::datastructures::CouplingCellWithLinkedCells< LinkedCell, dim > &cell, tarch::la::Vector< dim, double > &momentum, tarch::la::Vector< dim, double > &meanVelocity)
computes and returns the momentum and mean velocity of a coupling cell
Definition MomentumController.h:43
coupling::cellmappings::ComputeMomentumMapping< LinkedCell, dim > _computeMomentumMapping
Definition MomentumController.h:91
~MomentumController()
Definition MomentumController.h:34
void computeMeanVelocity(coupling::datastructures::CouplingCellWithLinkedCells< LinkedCell, dim > &cell, tarch::la::Vector< dim, double > &meanVelocity)
Definition MomentumController.h:63
This class computes the mass over certain linked cells.
Definition ComputeMassMapping.h:23
This class computes the momentum over certain linked cells.
Definition ComputeMomentumMapping.h:24
This class sets a certain momentum over several linked cells.
Definition SetMomentumMapping.h:24
defines the cell type with cell-averaged quantities. Derived from the class coupling::datastructures:...
Definition CouplingCellWithLinkedCells.h:26
void iterateConstCells(A &a) const
Definition CouplingCellWithLinkedCells.h:90
void iterateCells(A &a)
Definition CouplingCellWithLinkedCells.h:74
interface to the MD simulation
Definition MDSolverInterface.h:25
Definition Vector.h:24
everything necessary for coupling operations, is defined in here
Definition AdditiveMomentumInsertion.h:15