MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ThermalSpecies.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef THERMALSPECIES_H
27 #define THERMALSPECIES_H
29 class BaseInteraction;
30 
31 template<class NormalForceSpecies>
33 {
34 public:
35 
38 
41 
44 
46  virtual ~ThermalSpecies();
47 
49  void write(std::ostream& os) const;
50 
52  void read(std::istream& is);
53 
55  std::string getBaseName() const;
56 
58  Mdouble getHeatCapacity() const;
59 
61  void setHeatCapacity(Mdouble heatCapacity);
62 
65 
67  void setThermalConductivity(Mdouble thermalConductivity);
68 
69 private:
74 
79 };
80 
81 template<class NormalForceSpecies>
84 {
85  heatCapacity_ = 0.0;
87 }
88 
89 template<class NormalForceSpecies>
92 {
95 }
96 
97 template<class NormalForceSpecies>
99 {}
100 
101 template<class NormalForceSpecies>
102 void ThermalSpecies<NormalForceSpecies>::write(std::ostream& os) const
103 {
104  NormalForceSpecies::write(os);
105  os << " heatCapacity " << heatCapacity_;
106  os << " thermalConductivity " << thermalConductivity_;
107 }
108 
109 template<class NormalForceSpecies>
111 {
112  std::string dummy;
113  NormalForceSpecies::read(is);
114  is >> dummy >> heatCapacity_;
115  is >> dummy >> thermalConductivity_;
116 }
117 
118 template<class NormalForceSpecies>
120 {
121  return "Thermal" + NormalForceSpecies::getBaseName();
122 }
123 
124 
125 template<class NormalForceSpecies>
127 {
128  return heatCapacity_;
129 }
130 
131 template<class NormalForceSpecies>
133 {
134  logger.assert_always(heatCapacity>0,
135  "[ThermalSpecies<>::setHeatCapacity(%)] value has to be positive",
136  heatCapacity);
137  heatCapacity_ = heatCapacity;
138 }
139 
140 template<class NormalForceSpecies>
142 {
143  return thermalConductivity_;
144 }
145 
146 template<class NormalForceSpecies>
148 {
149  logger.assert_always(thermalConductivity>=0,
150  "[ThermalSpecies<>::setThermalConductivity(%)] value has to be positive",
151  thermalConductivity);
152  thermalConductivity_ = thermalConductivity;
153 }
154 #endif
void write(std::ostream &os) const
Writes the species properties to an output stream.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Defines a contact force parallel to the contact normal.
double Mdouble
Mdouble thermalConductivity_
The thermal conductivity.
Stores information about interactions between two interactable objects; often particles but could be ...
void setThermalConductivity(Mdouble thermalConductivity)
Allows heatCapacity_ to be changed.
void read(std::istream &is)
Reads the species properties from an input stream.
void setHeatCapacity(Mdouble heatCapacity)
Allows heatCapacity_ to be changed.
ThermalInteraction< typename NormalForceSpecies::InteractionType > InteractionType
The correct Interaction type for this FrictionForceSpecies.
Mdouble getHeatCapacity() const
Allows heatCapacity_ to be accessed.
virtual ~ThermalSpecies()
The default destructor.
std::string getBaseName() const
Used in Species::getName to obtain a unique name for each Species.
Mdouble getThermalConductivity() const
Allows heatCapacity_ to be accessed.
ThermalSpecies()
The default constructor.
Mdouble heatCapacity_
The heat capacity.