Simbody  3.4 (development)
Force_Thermostat.h
Go to the documentation of this file.
00001 #ifndef SimTK_SIMBODY_FORCE_THERMOSTAT_H_
00002 #define SimTK_SIMBODY_FORCE_THERMOSTAT_H_
00003 
00004 /* -------------------------------------------------------------------------- *
00005  *                               Simbody(tm)                                  *
00006  * -------------------------------------------------------------------------- *
00007  * This is part of the SimTK biosimulation toolkit originating from           *
00008  * Simbios, the NIH National Center for Physics-Based Simulation of           *
00009  * Biological Structures at Stanford, funded under the NIH Roadmap for        *
00010  * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody.  *
00011  *                                                                            *
00012  * Portions copyright (c) 2009-12 Stanford University and the Authors.        *
00013  * Authors: Michael Sherman                                                   *
00014  * Contributors: Christopher Bruns                                            *
00015  *                                                                            *
00016  * Licensed under the Apache License, Version 2.0 (the "License"); you may    *
00017  * not use this file except in compliance with the License. You may obtain a  *
00018  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *
00019  *                                                                            *
00020  * Unless required by applicable law or agreed to in writing, software        *
00021  * distributed under the License is distributed on an "AS IS" BASIS,          *
00022  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *
00023  * See the License for the specific language governing permissions and        *
00024  * limitations under the License.                                             *
00025  * -------------------------------------------------------------------------- */
00026 
00033 #include "SimTKcommon.h"
00034 #include "simbody/internal/Force.h"
00035 
00036 namespace SimTK {
00037 
00131 class SimTK_SIMBODY_EXPORT Force::Thermostat : public Force {
00132 public:
00136     Thermostat(GeneralForceSubsystem&        forces, 
00137                const SimbodyMatterSubsystem& matter, 
00138                Real                          boltzmannsConstant, 
00139                Real                          bathTemperature, 
00140                Real                          relaxationTime,
00141                int                           numExcludedDofs = 6);
00142 
00143     
00145     Thermostat() {}
00146 
00151     Thermostat& excludeMobilizedBody(MobilizedBodyIndex);
00152 
00155     Thermostat& setDefaultNumChains(int numChains);
00156 
00160     Thermostat& setDefaultBathTemperature(Real bathTemperature);
00161 
00163     Thermostat& setDefaultRelaxationTime(Real relaxationTime);
00164 
00169     Thermostat& setDefaultNumExcludedDofs(int numExcludedDofs);
00170 
00174     int getDefaultNumChains() const;
00178     Real getDefaultBathTemperature() const;
00181     Real getDefaultRelaxationTime() const;
00186     int getDefaultNumExcludedDofs() const;
00187 
00190     Real getBoltzmannsConstant() const;
00191 
00195     const Thermostat& setNumChains(State&, int numChains) const;
00201     const Thermostat& setBathTemperature(State&, Real Tb) const;
00206     const Thermostat& setRelaxationTime(State&, Real t) const;
00211     const Thermostat& setNumExcludedDofs(State&, int numExcludedDofs) const;
00212 
00216     int getNumChains(const State&) const;
00221     Real getBathTemperature(const State&) const;
00224     Real getRelaxationTime(const State&) const;
00229     int getNumExcludedDofs(const State&) const;
00230 
00235     int getNumThermalDofs(const State&) const;
00236 
00240     Real getCurrentTemperature(const State&) const;
00241 
00243     void initializeChainState(State&) const;
00247     void setChainState(State&, const Vector&) const;
00248 
00252     Vector getChainState(const State&) const;
00253 
00257     Real calcBathEnergy(const State& state) const;
00258 
00261     Real getExternalPower(const State& state) const;
00262 
00265     Real getExternalWork(const State& state) const;
00266 
00269     void setExternalWork(State& state, Real work) const;
00270 
00274     void initializeSystemToBathTemperature(State&) const;
00275 
00281     void setSystemToTemperature(State&, Real T) const;
00282 
00283     // Don't show this in Doxygen.
00285     SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(Thermostat, ThermostatImpl, Force);
00287 };
00288 
00289 } // namespace SimTK
00290 
00291 
00292 #endif // SimTK_SIMBODY_FORCE_THERMOSTAT_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines