MolSim
Loading...
Searching...
No Matches
Thermostat.h
Go to the documentation of this file.
1
9#pragma once
10#include "ParticleContainer.h"
11#include <cmath>
12
15 private:
17 int dimension{2};
18
20 double kineticEnergy{0.0};
21
23 double temperature{0.0};
24
26 double scalingFactor{1.0};
27
33 double T_init{0.0};
34
40 double T_target{0.0};
41
47 int n_thermostat{1000};
48
56 double delta_T{INFINITY};
57
60 bool limitScaling{false};
61
64
66 bool nanoFlow{false};
67
69 std::array<double, 3> avg_velocity{0, 0, 0};
70
73
74 public:
81
95 double delta_T, bool initBrownianMotion, bool nanoFlow = false);
96
99
112 void initialize(int dimension, double T_init, int n_thermostat, double T_target, double delta_T,
113 bool initBrownianMotion, bool nanoFlow = false, bool limitScaling = false);
114
123
131
141
151
160
170 void updateSystemTemp(int currentStep);
171
173 double getKineticEnergy() const;
174
176 double getTemp() const;
177
179 double getInitTemp() const;
180
182 double getTargetTemp() const;
183
185 double getDeltaT() const;
186
188 double getScalingFactor() const;
189
191 bool doScalingLimit() const;
192
194 int getTimestep() const;
195
197 bool getNanoflow() const;
198
201
211 bool operator==(const Thermostat &other) const;
212};
Class for encapsulating and iterating over multiple Particle objects.
Class for encapsulating multiple Particle objects..
Definition ParticleContainer.h:17
Class modeling a thermostat which regulates the temperature of a Particle system.
Definition Thermostat.h:14
void initialize(int dimension, double T_init, int n_thermostat, double T_target, double delta_T, bool initBrownianMotion, bool nanoFlow=false, bool limitScaling=false)
Initialize the current Thermostat's parameters.
double getScalingFactor() const
Gets the scaling factor by which to scale the Particle velocities.
double getDeltaT() const
Gets the maximum temperature difference in one Thermostat application.
double delta_T
The maximum temperature difference in one Thermostat application (default: ).
Definition Thermostat.h:56
Thermostat(ParticleContainer &particles, int dimension, double T_init, int n_thermostat, double T_target, double delta_T, bool initBrownianMotion, bool nanoFlow=false)
Construct a complete Thermostat object with all parameters.
~Thermostat()
Destroys the current Thermostat object.
bool operator==(const Thermostat &other) const
Overload of the equality operator. Checks if two Thermostat objects have the same values.
void calculateKineticEnergy()
Calculates the kinetic energy for all Particle objects in the system.
void calculateThermalMotions()
Calculates the thermal motion of each Particle in the system.
ParticleContainer & getParticles() const
Gets a reference to the Particle system.
double getKineticEnergy() const
Gets the kinetic energy of the active simulation particles.
double kineticEnergy
The kinetic energy of the active simulation particles (default: 0).
Definition Thermostat.h:20
double temperature
The Temperature of the system (default: 0).
Definition Thermostat.h:23
int dimension
The dimensions for which the Thermostat temperature regulation should be applied (default: 2).
Definition Thermostat.h:17
double T_target
The target temperature of the system (default: ).
Definition Thermostat.h:40
double T_init
The starting temperature of the system (default: 0).
Definition Thermostat.h:33
bool getNanoflow() const
Determines whether the thermostat is used for the nano-scale flow simulation.
double getTemp() const
Gets the current temperature of the system.
double getInitTemp() const
Gets the starting temperature of the system.
ParticleContainer & particles
A reference to the Particle system.
Definition Thermostat.h:72
void calculateTemp()
Calculates the current temperature of the system.
std::array< double, 3 > avg_velocity
Average velocity of the system.
Definition Thermostat.h:69
bool nanoFlow
Determines whether the thermostat is used for the nano-scale flow simulation.
Definition Thermostat.h:66
double scalingFactor
The scaling factor by which to scale the Particle velocities (default: 1).
Definition Thermostat.h:26
bool limitScaling
Determines if the Thermostat should apply gradual velocity scaling or direct velocity scaling (defaul...
Definition Thermostat.h:60
bool doScalingLimit() const
Checks if the Thermostat should apply gradual or direct velocity scaling.
int getTimestep() const
Gets the number of simulation iterations after which to apply the Thermostat functionality.
void updateSystemTemp(int currentStep)
Updates the system temperature after the number of iterations specified inside the Thermostat object.
double getTargetTemp() const
Gets the target temperature of the system.
Thermostat(ParticleContainer &particles)
Construct a new Thermostat with default-initialized values.
void calculateScalingFactor()
Calculates the scaling factor .
int n_thermostat
The number of simulation iterations after which to apply the Thermostat functionality (default: 1000)...
Definition Thermostat.h:47
void initializeBrownianMotion()
Initialize the Particle velocities with Brownian Motion.
bool initBrownianMotion
Determines whether or not to initialize the velocities with Brownian Motion (default: on).
Definition Thermostat.h:63