MaMiCo 1.2
Loading...
Searching...
No Matches
KineticEnergyController.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_KINETICENERGYCONTROLLER_H_
6#define _MOLECULARDYNAMICS_COUPLING_KINETICENERGYCONTROLLER_H_
7
8#include "coupling/cell-mappings/ComputeKineticEnergyMapping.h"
9#include "coupling/cell-mappings/ComputeMassMapping.h"
10#include "coupling/cell-mappings/ComputeMomentumMapping.h"
11#include "coupling/cell-mappings/ComputeTemperatureMapping.h"
12#include "coupling/cell-mappings/SetKineticEnergyMapping.h"
13#include "coupling/cell-mappings/SetTemperatureMapping.h"
14#include "coupling/datastructures/CouplingCell.h"
15#include "coupling/datastructures/CouplingCellWithLinkedCells.h"
16
17namespace coupling {
18template <class LinkedCell, unsigned int dim> class KineticEnergyController;
19}
20
27template <class LinkedCell, unsigned int dim> class coupling::KineticEnergyController {
28public:
34
40 cell.iterateConstCells(computeKineticEnergyMapping);
41 return computeKineticEnergyMapping.getKineticEnergy();
42 }
43
49 cell.iterateConstCells(computeMomentumMapping);
50 tarch::la::Vector<dim, double> meanVelocity = computeMomentumMapping.getMeanVelocity();
51
53 cell.iterateConstCells(computeTemperatureMapping);
54 return computeTemperatureMapping.getTemperature();
55 }
56
64 // determine mass, momentum and old kinetic energy
66 cell.iterateConstCells(computeMassMapping);
68 cell.iterateConstCells(computeMomentumMapping);
70 cell.iterateConstCells(computeKineticEnergyMapping);
71 // set new kinetic energy
72 unsigned int numberParticles = computeMassMapping.getNumberOfParticles();
73 tarch::la::Vector<dim, double> meanVelocity = computeMomentumMapping.getMeanVelocity();
74 double oldKineticEnergy = computeKineticEnergyMapping.getKineticEnergy();
75 coupling::cellmappings::SetKineticEnergyMapping<LinkedCell, dim> setKineticEnergyMapping(oldKineticEnergy, kineticEnergy, numberParticles, meanVelocity);
76 cell.iterateCells(setKineticEnergyMapping);
77 }
78
87 cell.iterateConstCells(computeMomentumMapping);
88 tarch::la::Vector<dim, double> meanVelocity = computeMomentumMapping.getMeanVelocity();
89
91 cell.iterateConstCells(computeTemperatureMapping);
92 double currentTemperature = computeTemperatureMapping.getTemperature();
93
94 coupling::cellmappings::SetTemperatureMapping<LinkedCell, dim> setTemperatureMapping(currentTemperature, temperature, meanVelocity, _mdSolverInterface);
95 cell.iterateCells(setTemperatureMapping);
96 }
97
98private:
101};
102#endif // _MOLECULARDYNAMICS_COUPLING_KINETICENERGYCONTROLLER_H_
controles and regulates the kinetic energy of the MD system.
Definition KineticEnergyController.h:27
double computeKineticEnergy(coupling::datastructures::CouplingCellWithLinkedCells< LinkedCell, dim > &cell) const
computes and returns the kinetic energy within a coupling cell
Definition KineticEnergyController.h:38
double computeTemperature(coupling::datastructures::CouplingCellWithLinkedCells< LinkedCell, dim > &cell) const
computes and returns the temperature within a coupling cell
Definition KineticEnergyController.h:47
coupling::interface::MDSolverInterface< LinkedCell, dim > *const _mdSolverInterface
Definition KineticEnergyController.h:100
KineticEnergyController(coupling::interface::MDSolverInterface< LinkedCell, dim > *const mdSolverInterface)
a simple constructor
Definition KineticEnergyController.h:31
~KineticEnergyController()
a simple destructor
Definition KineticEnergyController.h:33
void setTemperature(coupling::datastructures::CouplingCellWithLinkedCells< LinkedCell, dim > &cell, const double &temperature) const
sets the temperature within the cell to 'temperature'.
Definition KineticEnergyController.h:85
void setKineticEnergy(coupling::datastructures::CouplingCellWithLinkedCells< LinkedCell, dim > &cell, const double &kineticEnergy) const
sets the kinetic energy within a coupling cell to the input value.
Definition KineticEnergyController.h:63
This class computes the kinetic energy. inside a linked cell.
Definition ComputeKineticEnergyMapping.h:25
double getKineticEnergy() const
Definition ComputeKineticEnergyMapping.h:64
This class computes the mass over certain linked cells.
Definition ComputeMassMapping.h:23
unsigned int getNumberOfParticles() const
Definition ComputeMassMapping.h:67
This class computes the momentum over certain linked cells.
Definition ComputeMomentumMapping.h:24
tarch::la::Vector< dim, double > getMeanVelocity() const
Definition ComputeMomentumMapping.h:81
This class computes the temperature in a certain (coupling) cell.
Definition ComputeTemperatureMapping.h:25
double getTemperature() const
Definition ComputeTemperatureMapping.h:76
This class sets kinetic energy over several linked cells.
Definition SetKineticEnergyMapping.h:25
This class sets a certain temperature over several linked cells.
Definition SetTemperatureMapping.h:25
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