GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
Electrical.hpp
Go to the documentation of this file.
1 // This file is part of GranOO, a workbench for DEM simulation.
2 //
3 // Author(s) : - Damien Andre IRCER/UNILIM, Limoges France
4 // <damien.andre@unilim.fr>
5 // - Jean-luc Charles Arts et Metiers ParisTech, CNRS, I2M, Bordeaux France
6 // <jean-luc.charles@ensam.eu>
7 // - Jeremie Girardot Arts et Metiers ParisTech, CNRS, I2M, Bordeaux France
8 // <jeremie.girardot@ensam.eu>
9 // - Cedric Hubert LAMIH/UPHF, Valenciennes France
10 // <cedric.hubert@uphf.fr>
11 // - Ivan Iordanoff Arts et Metiers ParisTech, CNRS, I2M, Bordeaux France
12 // <ivan.iordanoff@ensam.eu>
13 //
14 // Copyright (C) 2008-2019 D. Andre, JL. Charles, J. Girardot, C. Hubert, I. Iordanoff
15 //
16 // This program is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 // This program is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU General Public License for more details.
25 //
26 // You should have received a copy of the GNU General Public License
27 // along with this program. If not, see <http://www.gnu.org/licenses/>.
28 
29 
30 #ifndef _LibDEM_Prop_Electrical_HPP
31 #define _LibDEM_Prop_Electrical_HPP
32 
33 
35 #include "GranOO3/Core/Prop.hpp"
36 
37 namespace GranOO3
38 {
39  namespace DEM
40  {
41 
42  class Electrical : public Core::Prop<Element>,
43  public Core::Register<Electrical>
44  {
45  GRANOO_CLASS(DEM::Electrical, Core::Prop<Element>);
46 
47  public:
48  // Constructors and destructor
49  Electrical();
50  virtual ~Electrical();
51  virtual std::string info() const;
52 
53  // Accessors and mutators
54  GRANOO_ACCESS_POS(conductivity , double, _electrical_conductivity);
55  GRANOO_ACCESS (potential , double, _potential );
56  GRANOO_ACCESS_SET(boundary_condition, bool , _boundary_condition );
57 
58  GRANOO_ACCESS(entering_power, double, _entering_power );
59  GRANOO_ACCESS(leaving_power, double, _leaving_power );
60  GRANOO_ACCESS(total_power, double, _leaving_power );
61  GRANOO_ACCESS(joule_power, double, _joule_power );
62  GRANOO_ACCESS(entering_current, double, _entering_current);
63  GRANOO_ACCESS(leaving_current, double, _leaving_current );
64 
65  void set_as_positive(bool activate);
66  void set_as_ground(bool activate);
67  void add_current(double current);
68  void add_power(double current, double conductance);
69  void clear_all_power();
70  void clear_all_current();
71 
72  void compute_power();
73 
74  const bool is_boundary_condition() const;
75  const bool is_positive() const;
76  const bool is_ground() const;
77 
78  private:
80  template<class Archive> void serialize(Archive& ar, const unsigned int );
81 
82  private:
84  double _potential;
87  double _total_power;
88  double _joule_power;
91 
93  bool _is_ground;
95  };
96 
97  template<class Archive> void
98  Electrical::serialize(Archive& ar, const unsigned int version) {
99  ar & boost::serialization::base_object< Core::Prop<Element> >(*this);
101  ar & _potential;
102  ar & _entering_current;
103  ar & _leaving_current;
104  ar & _entering_power;
105  ar & _leaving_power;
106  ar & _total_power;
107  if (version >= 1) {
108  ar & _joule_power;
109  }
110  }
111 
112  }
113 }
114 
115 
116 #include <boost/serialization/version.hpp>
118 
119 namespace GranOO3 {
120  GRANOO_CLASS_DECLARE_TPL(DEM::Electrical);
121 }
122 
123 
124 
125 #endif
126 
BOOST_CLASS_VERSION(GranOO3::DEM::Electrical, 1) namespace GranOO3
Definition: Electrical.hpp:117
Definition: Prop.hpp:48
Definition: SetOf.hpp:346
a property for adding electrical physics to DEM::Element
Definition: Electrical.hpp:44
bool _boundary_condition
A flag that tells whether the node is part of the boundary conditions.
Definition: Electrical.hpp:92
void serialize(Archive &ar, const unsigned int)
complete serializing of the instance in the *.gdd format
Definition: Electrical.hpp:98
double _potential
The electrical potential in the node.
Definition: Electrical.hpp:84
const bool is_boundary_condition() const
Definition: Electrical.cpp:103
bool _is_ground
A flag that tells whether the node is part of the ground terminal of the current source.
Definition: Electrical.hpp:93
double _leaving_current
The sum of all currents leaving the node.
Definition: Electrical.hpp:90
double _entering_current
The sum of all currents enterring the node.
Definition: Electrical.hpp:89
void clear_all_power()
Sets all powers to 0, namely the enterring and leaving powers.
Definition: Electrical.cpp:93
void add_current(double current)
Adds the contribution of a branch to the total current crossing the node, which is represented by a d...
Definition: Electrical.cpp:79
double _joule_power
Definition: Electrical.hpp:88
Electrical()
constructor
Definition: Electrical.cpp:48
void set_as_positive(bool activate)
Defines the attached discrete element as connected to the positive terminal of the voltage source.
Definition: Electrical.cpp:71
void add_power(double current, double conductance)
Adds the contribution of a branch to the electrical power crossing the node, given a current and cond...
Definition: Electrical.cpp:86
virtual ~Electrical()
destructor
Definition: Electrical.cpp:63
friend class boost::serialization::access
Definition: Electrical.hpp:79
double _total_power
The total power in the node computed as the average of the enterring and leaving powers.
Definition: Electrical.hpp:87
void clear_all_current()
Sets all currents to 0, namely the enterring and leaving currents.
Definition: Electrical.cpp:98
void compute_power()
Computes the total power in the node by averaging the enterring and leaving powers.
Definition: Electrical.cpp:66
double _leaving_power
The sum of all current powers leaving the node.
Definition: Electrical.hpp:86
const bool is_ground() const
Definition: Electrical.cpp:111
virtual std::string info() const
Definition: Electrical.cpp:115
double _electrical_conductivity
The electrical conductivity of the material.
Definition: Electrical.hpp:83
void set_as_ground(bool activate)
Defines the attached discrete element as connected to the ground terminal of the voltage source.
Definition: Electrical.cpp:75
double _entering_power
The sum of all current powers enterring the node.
Definition: Electrical.hpp:85
bool _is_positive
A flag that tells whether the node is part of the positive terminal of the current source.
Definition: Electrical.hpp:94
const bool is_positive() const
Definition: Electrical.cpp:107
Definition: Common.hpp:198
static char_cptr version
Definition: Exprtk.hpp:44221