MaMiCo 1.2
Loading...
Searching...
No Matches
VelocityGradientRelaxation.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_VELOCITYGRADIENTRELAXATION_H_
6#define _MOLECULARDYNAMICS_COUPLING_VELOCITYGRADIENTRELAXATION_H_
7
8#include "coupling/MomentumInsertion.h"
9#include "coupling/cell-mappings/ComputeMomentumMapping.h"
10#include "coupling/cell-mappings/VelocityGradientRelaxationMapping.h"
11#include "coupling/interface/MDSolverInterface.h"
12
13namespace coupling {
14template <class LinkedCell, unsigned int dim> class VelocityGradientRelaxation;
15template <class LinkedCell, unsigned int dim> class VelocityGradientRelaxationTopOnly;
16} // namespace coupling
17
37template <class LinkedCell, unsigned int dim> class coupling::VelocityGradientRelaxation : public coupling::MomentumInsertion<LinkedCell, dim> {
38public:
48 : coupling::MomentumInsertion<LinkedCell, dim>(mdSolverInterface), _couplingCells(couplingCells), _relaxationParam(relaxationParam) {}
49
51
55 unsigned int getTimeIntervalPerMomentumInsertion() const override { return 1; }
56
66 tarch::la::Vector<dim, double> oldVelocity(0.0);
67 cell.iterateConstCells(momentumMapping);
68 // set current average velocity within this cell
69 oldVelocity = momentumMapping.getMeanVelocity();
70 // set new momentum (based on velocity stored in microscopic
71 // momentum-buffer)
74 cell.iterateCells(velocityGradientRelaxation);
75 }
76
77protected:
84 const double _relaxationParam;
85};
86
106template <class LinkedCell, unsigned int dim> class coupling::VelocityGradientRelaxationTopOnly : public coupling::VelocityGradientRelaxation<LinkedCell, dim> {
107public:
111 : coupling::VelocityGradientRelaxation<LinkedCell, dim>(relaxationParam, mdSolverInterface, couplingCells) {}
112
115
125 tarch::la::Vector<dim, double> oldVelocity(0.0);
126 cell.iterateConstCells(momentumMapping);
127 // set current average velocity within this cell
128 oldVelocity = momentumMapping.getMeanVelocity();
129
130 // set new momentum (based on velocity stored in microscopic
131 // momentum-buffer)
135 cell.iterateCells(velocityGradientRelaxation);
136 }
137};
138#endif // _MOLECULARDYNAMICS_COUPLING_VELOCITYGRADIENTRELAXATION_H_
used to manipulate the momentum/ velocity of the molecules contained in a coupling cell.
Definition MomentumInsertion.h:23
coupling::interface::MDSolverInterface< LinkedCell, dim > *const _mdSolverInterface
Definition MomentumInsertion.h:47
MomentumInsertion(coupling::interface::MDSolverInterface< LinkedCell, dim > *const mdSolverInterface)
a simple constructor
Definition MomentumInsertion.h:27
carries out velocity relaxation (similar to the SetMomentumMapping procedure).
Definition VelocityGradientRelaxation.h:106
virtual ~VelocityGradientRelaxationTopOnly()
a dummy destructor
Definition VelocityGradientRelaxation.h:114
VelocityGradientRelaxationTopOnly(double relaxationParam, coupling::interface::MDSolverInterface< LinkedCell, dim > *const mdSolverInterface, const coupling::datastructures::CouplingCellWithLinkedCells< LinkedCell, dim > *const couplingCells)
a simple constructor
Definition VelocityGradientRelaxation.h:109
void insertMomentum(coupling::datastructures::CouplingCellWithLinkedCells< LinkedCell, dim > &cell, I02 idx) const override
insertes the momentum to the cells according to the params and velocity gradient relaxation method
Definition VelocityGradientRelaxation.h:123
carries out velocity relaxation (similar to the SetMomentumMapping procedure).
Definition VelocityGradientRelaxation.h:37
void insertMomentum(coupling::datastructures::CouplingCellWithLinkedCells< LinkedCell, dim > &cell, I02 idx) const override
insertes the momentum to the cells according to the params and velocity gradient relaxation method
Definition VelocityGradientRelaxation.h:64
const coupling::datastructures::CouplingCellWithLinkedCells< LinkedCell, dim > *const _couplingCells
Definition VelocityGradientRelaxation.h:79
unsigned int getTimeIntervalPerMomentumInsertion() const override
returns the time step interval for the momentum insertion, always one for this method
Definition VelocityGradientRelaxation.h:55
const double _relaxationParam
Definition VelocityGradientRelaxation.h:84
VelocityGradientRelaxation(double relaxationParam, coupling::interface::MDSolverInterface< LinkedCell, dim > *const mdSolverInterface, const coupling::datastructures::CouplingCellWithLinkedCells< LinkedCell, dim > *const couplingCells)
a simple constructor
Definition VelocityGradientRelaxation.h:46
virtual ~VelocityGradientRelaxation()
a dummy destructor
Definition VelocityGradientRelaxation.h:50
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 relaxes velocities of molecules towards an interpolated avergaged velocity value.
Definition VelocityGradientRelaxationMapping.h:38
This is the same as the class coupling::cellmappings::VelocityGradientRelaxationMapping,...
Definition VelocityGradientRelaxationMapping.h:406
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