Simbody  3.8
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_
#define SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DERIVED, DERIVED_IMPL, PARENT)
Definition: PrivateImplementation.h:343
Includes internal headers providing declarations for the basic SimTK Core classes,...
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
This is a feedback-controlled force that uses Nose'-Hoover chains to maintain a particular temperatur...
Definition: Force_Thermostat.h:131
Thermostat()
Default constructor creates an empty handle.
Definition: Force_Thermostat.h:145
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...
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.
Thermostat & setDefaultBathTemperature(Real bathTemperature)
Set the default (state independent) bath temperature.
const Thermostat & setBathTemperature(State &, Real Tb) const
Set the bath temperature which serves as the target temperature for the thermostat.
const Thermostat & setNumChains(State &, int numChains) const
Set the actual number of Nose'-Hoover chains to be used.
Real getDefaultRelaxationTime() const
Get the initial value for the bath temperature that will be use for the "bath temperature" State vari...
Real getBoltzmannsConstant() const
Can't change the value of Boltzmann's constant after construction; this is the value being used.
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...
void setSystemToTemperature(State &, Real T) const
Set the controlled system to a set of randomized velocities which yields a particular temperature.
int getNumChains(const State &) const
Obtain the current number of Nose'-Hoover chains in use.
Real calcBathEnergy(const State &state) const
Calculate the total "bath energy" which, when added to the system energy, should yield a conserved qu...
void setChainState(State &, const Vector &) const
Set the thermostat state variables to particular values.
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...
Real getRelaxationTime(const State &) const
Obtain the current relaxation time.
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...
Thermostat & setDefaultNumExcludedDofs(int numExcludedDofs)
Set the default number of system rigid body degrees of freedom (0-6) to be excluded from the calculat...
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...
int getNumThermalDofs(const State &) const
Return the number of thermal degrees of freedom being used in the definition of temperature for this ...
Vector getChainState(const State &) const
Return the current values of the thermostat chain variables.
Real getDefaultBathTemperature() const
Get the initial value for the bath temperature that will be use for the "bath temperature" State vari...
Thermostat & setDefaultNumChains(int numChains)
Set the default (state independent) number of Nose'-Hoover chains.
Real getBathTemperature(const State &) const
Obtain the current bath temperature, in units which are determined by the value of Boltzmann's consta...
void initializeChainState(State &) const
This is a solver that initializes thermostat state variables to zero.
Thermostat & excludeMobilizedBody(MobilizedBodyIndex)
TODO: not implemented yet.
int getDefaultNumExcludedDofs() const
Get the initial value for the number of system rigid body degrees of freedom (0-6) to be excluded fro...
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...
Thermostat & setDefaultRelaxationTime(Real relaxationTime)
Set the default (state independent) relaxation time.
Real getCurrentTemperature(const State &) const
Return the temperature of the controlled degrees of freedom via the definition T = 2*ke / (N*Kb) wher...
int getDefaultNumChains() const
Get the initial value for the number of chains that will be used for the "number of chains" State var...
void initializeSystemToBathTemperature(State &) const
Set the controlled system to a set of randomized velocities which yields the bath temperature.
This is the base class from which all Force element handle classes derive.
Definition: Force.h:50
This is a concrete subsystem which can apply arbitrary forces to a MultibodySystem.
Definition: GeneralForceSubsystem.h:47
This is for arrays indexed by mobilized body number within a subsystem (typically the SimbodyMatterSu...
This subsystem contains the bodies ("matter") in the multibody system, the mobilizers (joints) that d...
Definition: SimbodyMatterSubsystem.h:133
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
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:607