Simbody  3.7
Force_Thermostat.h
Go to the documentation of this file.
1 #ifndef SimTK_SIMBODY_FORCE_THERMOSTAT_H_
2 #define SimTK_SIMBODY_FORCE_THERMOSTAT_H_
3 
4 /* -------------------------------------------------------------------------- *
5  * Simbody(tm) *
6  * -------------------------------------------------------------------------- *
7  * This is part of the SimTK biosimulation toolkit originating from *
8  * Simbios, the NIH National Center for Physics-Based Simulation of *
9  * Biological Structures at Stanford, funded under the NIH Roadmap for *
10  * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody. *
11  * *
12  * Portions copyright (c) 2009-12 Stanford University and the Authors. *
13  * Authors: Michael Sherman *
14  * Contributors: Christopher Bruns *
15  * *
16  * Licensed under the Apache License, Version 2.0 (the "License"); you may *
17  * not use this file except in compliance with the License. You may obtain a *
18  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
19  * *
20  * Unless required by applicable law or agreed to in writing, software *
21  * distributed under the License is distributed on an "AS IS" BASIS, *
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
23  * See the License for the specific language governing permissions and *
24  * limitations under the License. *
25  * -------------------------------------------------------------------------- */
26 
33 #include "SimTKcommon.h"
34 #include "simbody/internal/Force.h"
35 
36 namespace SimTK {
37 
132 public:
137  const SimbodyMatterSubsystem& matter,
138  Real boltzmannsConstant,
139  Real bathTemperature,
140  Real relaxationTime,
141  int numExcludedDofs = 6);
142 
143 
146 
152 
156 
161 
164 
169  Thermostat& setDefaultNumExcludedDofs(int numExcludedDofs);
170 
174  int getDefaultNumChains() const;
187 
191 
195  const Thermostat& setNumChains(State&, int numChains) const;
211  const Thermostat& setNumExcludedDofs(State&, int numExcludedDofs) const;
212 
216  int getNumChains(const State&) const;
224  Real getRelaxationTime(const State&) const;
229  int getNumExcludedDofs(const State&) const;
230 
235  int getNumThermalDofs(const State&) const;
236 
241 
247  void setChainState(State&, const Vector&) const;
248 
252  Vector getChainState(const State&) const;
253 
257  Real calcBathEnergy(const State& state) const;
258 
261  Real getExternalPower(const State& state) const;
262 
265  Real getExternalWork(const State& state) const;
266 
269  void setExternalWork(State& state, Real work) const;
270 
275 
282 
283  // Don't show this in Doxygen.
287 };
288 
289 } // namespace SimTK
290 
291 
292 #endif // SimTK_SIMBODY_FORCE_THERMOSTAT_H_
SimTK::State
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
MobilizedBodyIndex
SimTK::Force::Thermostat::getExternalPower
Real getExternalPower(const State &state) const
Get the amount of power being applied by the thermostat to the system; sign is positive when energy i...
SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS
#define SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DERIVED, DERIVED_IMPL, PARENT)
Definition: PrivateImplementation.h:343
SimTK::Force::Thermostat::getNumThermalDofs
int getNumThermalDofs(const State &) const
Return the number of thermal degrees of freedom being used in the definition of temperature for this ...
SimTK::Force::Thermostat::setDefaultNumChains
Thermostat & setDefaultNumChains(int numChains)
Set the default (state independent) number of Nose'-Hoover chains.
SimTK::Force::Thermostat::setDefaultNumExcludedDofs
Thermostat & setDefaultNumExcludedDofs(int numExcludedDofs)
Set the default number of system rigid body degrees of freedom (0-6) to be excluded from the calculat...
SimTK::Force::Thermostat::setNumChains
const Thermostat & setNumChains(State &, int numChains) const
Set the actual number of Nose'-Hoover chains to be used.
SimTK::Force::Thermostat::getDefaultNumExcludedDofs
int getDefaultNumExcludedDofs() const
Get the initial value for the number of system rigid body degrees of freedom (0-6) to be excluded fro...
SimTK
This is a System that represents the dynamics of a particle moving along a smooth surface.
Definition: Assembler.h:37
SimTK::Force::Thermostat
This is a feedback-controlled force that uses Nose'-Hoover chains to maintain a particular temperatur...
Definition: Force_Thermostat.h:131
SimTK::Force::Thermostat::setExternalWork
void setExternalWork(State &state, Real work) const
Set the current value of the work done by the bath to an arbitrary value; normally zero for initializ...
SimTK::Force::Thermostat::getNumChains
int getNumChains(const State &) const
Obtain the current number of Nose'-Hoover chains in use.
SimTK::Force::Thermostat::setChainState
void setChainState(State &, const Vector &) const
Set the thermostat state variables to particular values.
SimTK::Force::Thermostat::Thermostat
Thermostat()
Default constructor creates an empty handle.
Definition: Force_Thermostat.h:145
SimTK::Force::Thermostat::initializeChainState
void initializeChainState(State &) const
This is a solver that initializes thermostat state variables to zero.
SimTK::Force::Thermostat::initializeSystemToBathTemperature
void initializeSystemToBathTemperature(State &) const
Set the controlled system to a set of randomized velocities which yields the bath temperature.
SimTKcommon.h
SimTK::Force::Thermostat::excludeMobilizedBody
Thermostat & excludeMobilizedBody(MobilizedBodyIndex)
TODO: not implemented yet.
SimTK::SimbodyMatterSubsystem
This subsystem contains the bodies ("matter") in the multibody system, the mobilizers (joints) that d...
Definition: SimbodyMatterSubsystem.h:133
SimTK::Force
This is the base class from which all Force element handle classes derive.
Definition: Force.h:50
SimTK::Force::Thermostat::getCurrentTemperature
Real getCurrentTemperature(const State &) const
Return the temperature of the controlled degrees of freedom via the definition T = 2*ke / (N*Kb) wher...
SimTK::Force::Thermostat::getChainState
Vector getChainState(const State &) const
Return the current values of the thermostat chain variables.
SimTK::GeneralForceSubsystem
This is a concrete subsystem which can apply arbitrary forces to a MultibodySystem.
Definition: GeneralForceSubsystem.h:47
SimTK::Force::Thermostat::getDefaultBathTemperature
Real getDefaultBathTemperature() const
Get the initial value for the bath temperature that will be use for the "bath temperature" State vari...
SimTK::Force::Thermostat::getDefaultNumChains
int getDefaultNumChains() const
Get the initial value for the number of chains that will be used for the "number of chains" State var...
SimTK::Force::Thermostat::setSystemToTemperature
void setSystemToTemperature(State &, Real T) const
Set the controlled system to a set of randomized velocities which yields a particular temperature.
SimTK::Force::Thermostat::getBoltzmannsConstant
Real getBoltzmannsConstant() const
Can't change the value of Boltzmann's constant after construction; this is the value being used.
SimTK::Force::Thermostat::getDefaultRelaxationTime
Real getDefaultRelaxationTime() const
Get the initial value for the bath temperature that will be use for the "bath temperature" State vari...
SimTK::Force::Thermostat::setBathTemperature
const Thermostat & setBathTemperature(State &, Real Tb) const
Set the bath temperature which serves as the target temperature for the thermostat.
SimTK::Force::Thermostat::getBathTemperature
Real getBathTemperature(const State &) const
Obtain the current bath temperature, in units which are determined by the value of Boltzmann's consta...
SimTK::Force::Thermostat::Thermostat
Thermostat(GeneralForceSubsystem &forces, const SimbodyMatterSubsystem &matter, Real boltzmannsConstant, Real bathTemperature, Real relaxationTime, int numExcludedDofs=6)
Define a global thermostat (one that affects all degrees of freedom) at a given default temperature a...
SimTK::Force::Thermostat::setNumExcludedDofs
const Thermostat & setNumExcludedDofs(State &, int numExcludedDofs) const
Set the actual number of system rigid body degrees of freedom (0-6) to be excluded from the calculati...
SimTK::Force::Thermostat::setDefaultBathTemperature
Thermostat & setDefaultBathTemperature(Real bathTemperature)
Set the default (state independent) bath temperature.
SimTK_SIMBODY_EXPORT
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
SimTK::Real
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:606
SimTK::Force::Thermostat::getNumExcludedDofs
int getNumExcludedDofs(const State &) const
Get the current value for the number of system rigid body degrees of freedom (0-6) to be excluded fro...
SimTK::Vector_< Real >
SimTK::Force::Thermostat::setRelaxationTime
const Thermostat & setRelaxationTime(State &, Real t) const
Set the relaxation time which determines how long the system will take to equilibrate to the bath tem...
SimTK::Force::Thermostat::getExternalWork
Real getExternalWork(const State &state) const
Get the amount of work that has been done by the bath on the system since an arbitrary start time.
Force.h
SimTK::Force::Thermostat::setDefaultRelaxationTime
Thermostat & setDefaultRelaxationTime(Real relaxationTime)
Set the default (state independent) relaxation time.
SimTK::Force::Thermostat::getRelaxationTime
Real getRelaxationTime(const State &) const
Obtain the current relaxation time.
SimTK::Force::Thermostat::calcBathEnergy
Real calcBathEnergy(const State &state) const
Calculate the total "bath energy" which, when added to the system energy, should yield a conserved qu...