KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
calculate_global_physical_properties.h
Go to the documentation of this file.
1 #ifndef CALCULATE_GLOBAL_PHYSICAL_PROPERTIES_H
2 #define CALCULATE_GLOBAL_PHYSICAL_PROPERTIES_H
3 
4 // /* External includes */
5 
6 // System includes
7 
8 // Project includes
9 #include "utilities/timer.h"
12 #include "includes/variables.h"
13 
14 /* System includes */
15 #include <limits>
16 #include <iostream>
17 #include <iomanip>
18 
19 /* External includes */
20 #ifdef _OPENMP
21 #include <omp.h>
22 #endif
23 
24 /* Project includes */
25 #include "includes/define.h"
26 #include "utilities/openmp_utils.h"
27 
28 namespace Kratos
29 {
30 
32  {
33  public:
34 
36 
38 
40 
42  {
43  mInitialCenterOfMassAndMass = CalculateCenterOfMass(r_model_part);
44  mInitialMass = CalculateTotalMass(r_model_part);
45  }
46 
48 
50 
51 
52  //***************************************************************************************************************
53  //***************************************************************************************************************
54 
55  double CalculateTotalVolume(ModelPart& r_model_part)
56  {
57  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(), r_model_part.GetCommunicator().LocalMesh().Elements().size(), mElementsPartition);
58  double added_volume = 0.0;
59 
60  #pragma omp parallel for reduction(+ : added_volume)
61  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
62 
63  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
64  if (it->GetGeometry()[0].Is(BLOCKED)) { // we exclude blocked elements from the volume calculation (e.g., inlet injectors)
65  continue;
66  }
67  if ((it)->IsNot(DEMFlags::BELONGS_TO_A_CLUSTER)) {
68  SphericParticle& r_spheric_particle = dynamic_cast<Kratos::SphericParticle&> (*it);
69  const double particle_radius = r_spheric_particle.GetRadius();
70  added_volume += 4.0 / 3.0 * Globals::Pi * particle_radius * particle_radius * particle_radius;
71  }
72  }
73  }
74 
75  return added_volume;
76  }
77 
78  //***************************************************************************************************************
79  //***************************************************************************************************************
80  // Returns the minimum value of a double variable in the model part.
81 
82  double CalculateMaxNodalVariable(ModelPart& r_model_part, const Variable<double>& r_variable) {
83  ElementsArrayType& pElements = r_model_part.GetCommunicator().LocalMesh().Elements();
84 
85  KRATOS_ERROR_IF(pElements.size() == 0) << "Cannot compute maximum of the required nodal variable. Empty model part. Could not compute the maximum of the required variable " << r_variable << std::endl;
86 
87  ElementsArrayType::iterator it_begin = pElements.ptr_begin();
88 
89  KRATOS_ERROR_IF_NOT(it_begin->GetGeometry()[0].SolutionStepsDataHas(r_variable)) << "Cannot compute maximum of the required nodal variable. Missing nodal variable " << r_variable << std::endl;
90 
91  std::vector<double> max_values;
92  double max_val = - std::numeric_limits<double>::max();
93  max_values.resize(ParallelUtilities::GetNumThreads());
94 
95  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
96  max_values[k] = max_val;
97  }
98 
99  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(), pElements.size(), mElementsPartition);
100 
101  unsigned int elem_counter;
102 
103  #pragma omp parallel for private(elem_counter)
104  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
105  elem_counter = mElementsPartition[k];
106 
107  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
108  max_values[k] = std::max(max_values[k], (it)->GetGeometry()[0].FastGetSolutionStepValue(r_variable));
109  elem_counter++;
110  }
111  }
112 
113  // getting the maximum between threads:
114  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
115  max_val = std::max(max_val, max_values[k]);
116  }
117 
118  return max_val;
119  }
120 
121  //***************************************************************************************************************
122  //***************************************************************************************************************
123 
124  double CalculateMinNodalVariable(ModelPart& r_model_part, const Variable<double>& r_variable) {
125  ElementsArrayType& pElements = r_model_part.GetCommunicator().LocalMesh().Elements();
126 
127  KRATOS_ERROR_IF(pElements.size() == 0) << "Cannot compute minimum of the required nodal variable. Empty model part. Could not compute the maximum of the required variable " << r_variable << std::endl;
128 
129  ElementsArrayType::iterator it_begin = pElements.ptr_begin();
130 
131  KRATOS_ERROR_IF_NOT(it_begin->GetGeometry()[0].SolutionStepsDataHas(r_variable)) << "Cannot compute minimum of the required nodal variable. Missing variable " << r_variable << std::endl;
132 
133  std::vector<double> min_values;
134  double min_val = std::numeric_limits<double>::max();
135  min_values.resize(ParallelUtilities::GetNumThreads());
136 
137  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
138  min_values[k] = min_val;
139  }
140 
141  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(), pElements.size(), mElementsPartition);
142 
143  unsigned int elem_counter;
144 
145  #pragma omp parallel for private(elem_counter)
146  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
147  elem_counter = mElementsPartition[k];
148 
149  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
150  min_values[k] = std::min(min_values[k], (it)->GetGeometry()[0].FastGetSolutionStepValue(r_variable));
151  elem_counter++;
152  }
153  }
154 
155  // getting the minimum between threads:
156  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
157  min_val = std::min(min_val, min_values[k]);
158  }
159 
160  return min_val;
161  }
162 
163  //***************************************************************************************************************
164  //***************************************************************************************************************
165 
166  double CalculateD50(ModelPart& r_model_part)
167  {
168  const unsigned int size = r_model_part.GetCommunicator().LocalMesh().Elements().size();
169  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(), size, mElementsPartition);
170 
171  std::vector<double> radii;
172  radii.resize(size);
173  unsigned int particle_counter = 0;
174 
175  #pragma omp parallel for private(particle_counter)
176  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
177  particle_counter = mElementsPartition[k];
178 
179  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
180  SphericParticle& r_spheric_particle = dynamic_cast<Kratos::SphericParticle&> (*it);
181  radii[particle_counter] = r_spheric_particle.GetRadius();
182  particle_counter++;
183  }
184 
185  }
186  if (particle_counter) {
187  std::sort(radii.begin(), radii.end());
188  int half = div(size, 2).quot;
189  bool even = (size%2 == 0);
190  double d50 = even ? 2 * radii[half] : radii[half] + radii[half + 1];
191 
192  return d50;
193  }
194  else {
195  return 0.00;
196  }
197  }
198 
199  //***************************************************************************************************************
200  //***************************************************************************************************************
201 
202  double CalculateTotalMass(ModelPart& r_model_part)
203  {
204  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(),r_model_part.GetCommunicator().LocalMesh().Elements().size(), mElementsPartition);
205 
206  double added_mass = 0.0;
207 
208  #pragma omp parallel for reduction(+ : added_mass)
209  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
210 
211  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
212  if ((it)->IsNot(DEMFlags::BELONGS_TO_A_CLUSTER)) {
213  double particle_mass = (it)->GetGeometry()[0].FastGetSolutionStepValue(NODAL_MASS);
214  added_mass += particle_mass;
215  }
216  }
217  }
218 
219  return added_mass;
220  }
221 
222  //***************************************************************************************************************
223  //***************************************************************************************************************
224 
226  {
227  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(), r_model_part.GetCommunicator().LocalMesh().Elements().size(), mElementsPartition);
228 
229  const double total_mass_inv = 1 / CalculateTotalMass(r_model_part);
230  double cm_x = 0.0;
231  double cm_y = 0.0;
232  double cm_z = 0.0;
233 
234  #pragma omp parallel for reduction(+ : cm_x, cm_y, cm_z)
235  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
236 
237  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
238  if ((it)->IsNot(DEMFlags::BELONGS_TO_A_CLUSTER)) {
239  double particle_mass = (it)->GetGeometry()[0].FastGetSolutionStepValue(NODAL_MASS);
240  cm_x += particle_mass * (it)->GetGeometry()[0].Coordinates()[0];
241  cm_y += particle_mass * (it)->GetGeometry()[0].Coordinates()[1];
242  cm_z += particle_mass * (it)->GetGeometry()[0].Coordinates()[2];
243  }
244  }
245  }
246 
247  array_1d<double, 3> center_of_mass;
248  center_of_mass[0] = total_mass_inv * cm_x;
249  center_of_mass[1] = total_mass_inv * cm_y;
250  center_of_mass[2] = total_mass_inv * cm_z;
251 
252  return center_of_mass;
253  }
254 
255  //***************************************************************************************************************
256  //***************************************************************************************************************
257 
258  double CalculateGravitationalPotentialEnergy(ModelPart& r_model_part, const array_1d<double, 3> reference_point)
259  {
260  double gravitational_energy;
261  const double total_mass = CalculateTotalMass(r_model_part);
262  if (total_mass == 0) gravitational_energy = 0.0;
263  else {
264  const array_1d<double, 3>& gravity = r_model_part.GetProcessInfo()[GRAVITY];
265  const array_1d<double, 3> center_of_mass = CalculateCenterOfMass(r_model_part);
266  const array_1d<double, 3> center_of_mass_to_reference = reference_point - center_of_mass;
267  gravitational_energy = total_mass * (center_of_mass_to_reference[0] * gravity[0] + center_of_mass_to_reference[1] * gravity[1] + center_of_mass_to_reference[2] * gravity[2]);
268  }
269  return gravitational_energy;
270  }
271 
272  //***************************************************************************************************************
273  //***************************************************************************************************************
274 
276  {
277  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(), r_model_part.GetCommunicator().LocalMesh().Elements().size(), mElementsPartition);
278 
279  double kinematic_energy = 0.0;
280 
281  #pragma omp parallel for reduction(+ : kinematic_energy)
282  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
283 
284  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
285  if ((it)->IsNot(DEMFlags::BELONGS_TO_A_CLUSTER)) {
286  double particle_translational_kinematic_energy = 0.0;
287 
288  (it)->Calculate(PARTICLE_TRANSLATIONAL_KINEMATIC_ENERGY, particle_translational_kinematic_energy, r_model_part.GetProcessInfo());
289 
290  kinematic_energy += particle_translational_kinematic_energy;
291  }
292  }
293 
294  }
295 
296  return kinematic_energy;
297  }
298 
299  //***************************************************************************************************************
300  //***************************************************************************************************************
301 
303  {
304  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(), r_model_part.GetCommunicator().LocalMesh().Elements().size(), mElementsPartition);
305 
306  double rotational_kinematic_energy = 0.0;
307 
308  #pragma omp parallel for reduction(+ : rotational_kinematic_energy)
309  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
310 
311  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
312  if ((it)->IsNot(DEMFlags::BELONGS_TO_A_CLUSTER)) {
313  double particle_rotational_kinematic_energy = 0.0;
314 
315  (it)->Calculate(PARTICLE_ROTATIONAL_KINEMATIC_ENERGY, particle_rotational_kinematic_energy, r_model_part.GetProcessInfo());
316 
317  rotational_kinematic_energy += particle_rotational_kinematic_energy;
318  }
319  }
320 
321  }
322 
323  return rotational_kinematic_energy;
324  }
325 
326  //***************************************************************************************************************
327  //***************************************************************************************************************
328 
329  double CalculateElasticEnergy(ModelPart& r_model_part)
330  {
331  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(), r_model_part.GetCommunicator().LocalMesh().Elements().size(), mElementsPartition);
332 
333  double elastic_energy = 0.0;
334 
335  #pragma omp parallel for reduction(+ : elastic_energy)
336  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
337 
338  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
339  if ((it)->IsNot(DEMFlags::BELONGS_TO_A_CLUSTER)) {
340  double particle_elastic_energy = 0.0;
341 
342  (it)->Calculate(PARTICLE_ELASTIC_ENERGY, particle_elastic_energy, r_model_part.GetProcessInfo());
343 
344  elastic_energy += particle_elastic_energy;
345  }
346  }
347 
348  }
349 
350  return elastic_energy;
351  }
352 
353  //***************************************************************************************************************
354  //***************************************************************************************************************
355 
357  {
358  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(), r_model_part.GetCommunicator().LocalMesh().Elements().size(), mElementsPartition);
359 
360  double frictional_energy = 0.0;
361 
362  #pragma omp parallel for reduction(+ : frictional_energy)
363  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
364 
365  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
366  if ((it)->IsNot(DEMFlags::BELONGS_TO_A_CLUSTER)) {
367  double particle_frictional_energy = 0.0;
368 
369  (it)->Calculate(PARTICLE_INELASTIC_FRICTIONAL_ENERGY, particle_frictional_energy, r_model_part.GetProcessInfo());
370 
371  frictional_energy += particle_frictional_energy;
372  }
373  }
374 
375  }
376 
377  return frictional_energy;
378  }
379 
381  {
382  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(), r_model_part.GetCommunicator().LocalMesh().Elements().size(), mElementsPartition);
383 
384  double viscodamping_energy = 0.0;
385 
386  #pragma omp parallel for reduction(+ : viscodamping_energy)
387  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
388 
389  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
390  if ((it)->IsNot(DEMFlags::BELONGS_TO_A_CLUSTER)) {
391  double particle_viscodamping_energy = 0.0;
392 
393  (it)->Calculate(PARTICLE_INELASTIC_VISCODAMPING_ENERGY, particle_viscodamping_energy, r_model_part.GetProcessInfo());
394 
395  viscodamping_energy += particle_viscodamping_energy;
396  }
397  }
398 
399  }
400 
401  return viscodamping_energy;
402  }
403 
405  {
406  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(), r_model_part.GetCommunicator().LocalMesh().Elements().size(), mElementsPartition);
407 
408  double rollingresistance_energy = 0.0;
409 
410  #pragma omp parallel for reduction(+ : rollingresistance_energy)
411  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
412 
413  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
414  if ((it)->IsNot(DEMFlags::BELONGS_TO_A_CLUSTER)) {
415  double particle_rollingresistance_energy = 0.0;
416 
417  (it)->Calculate(PARTICLE_INELASTIC_ROLLING_RESISTANCE_ENERGY, particle_rollingresistance_energy, r_model_part.GetProcessInfo());
418 
419  rollingresistance_energy += particle_rollingresistance_energy;
420  }
421  }
422 
423  }
424 
425  return rollingresistance_energy;
426  }
427 
428  //***************************************************************************************************************
429  //***************************************************************************************************************
430 
432  {
433  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(), r_model_part.GetCommunicator().LocalMesh().Elements().size(), mElementsPartition);
434 
435  double m_x = 0.0;
436  double m_y = 0.0;
437  double m_z = 0.0;
438 
439  #pragma omp parallel for reduction(+ : m_x, m_y, m_z)
440  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
441 
442  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
443  if ((it)->IsNot(DEMFlags::BELONGS_TO_A_CLUSTER)) {
444  array_1d<double, 3> particle_momentum;
445  (it)->Calculate(MOMENTUM, particle_momentum, r_model_part.GetProcessInfo());
446  m_x += particle_momentum[0];
447  m_y += particle_momentum[1];
448  m_z += particle_momentum[2];
449  }
450  }
451 
452  }
453 
454  array_1d<double, 3> momentum;
455  momentum[0] = m_x;
456  momentum[1] = m_y;
457  momentum[2] = m_z;
458 
459  return momentum;
460  }
461 
462  //***************************************************************************************************************
463  //***************************************************************************************************************
464 
466  {
467  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(), r_model_part.GetCommunicator().LocalMesh().Elements().size(), mElementsPartition);
468 
469  const array_1d<double, 3> center_of_mass = CalculateCenterOfMass(r_model_part);
470  double am_x = 0.0;
471  double am_y = 0.0;
472  double am_z = 0.0;
473 
474  #pragma omp parallel for reduction(+ : am_x, am_y, am_z)
475  for (int k = 0; k < ParallelUtilities::GetNumThreads(); k++){
476 
477  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
478  if ((it)->IsNot(DEMFlags::BELONGS_TO_A_CLUSTER)) {
479  array_1d<double, 3> particle_momentum;
480  array_1d<double, 3> particle_local_angular_momentum;
481  array_1d<double, 3> center_of_mass_to_particle = (it)->GetGeometry()[0].Coordinates() - center_of_mass;
482 
483  (it)->Calculate(MOMENTUM, particle_momentum, r_model_part.GetProcessInfo());
484  (it)->Calculate(ANGULAR_MOMENTUM, particle_local_angular_momentum, r_model_part.GetProcessInfo());
485 
487  Kratos::MathUtils<double>::CrossProduct(aux, particle_momentum, center_of_mass_to_particle);
488 
489  am_x += particle_local_angular_momentum[0] + aux[0];
490  am_y += particle_local_angular_momentum[1] + aux[1];
491  am_z += particle_local_angular_momentum[2] + aux[2];
492  }
493  }
494  }
495 
496  array_1d<double, 3> angular_momentum;
497  angular_momentum[0] = am_x;
498  angular_momentum[1] = am_y;
499  angular_momentum[2] = am_z;
500 
501  return angular_momentum;
502  }
503 
504  //***************************************************************************************************************
505  //***************************************************************************************************************
506  // Check by how much Newton's Third Law is violated
508  {
509  OpenMPUtils::CreatePartition(ParallelUtilities::GetNumThreads(),r_model_part.GetCommunicator().LocalMesh().Elements().size(), mElementsPartition);
510  double sum_of_contact_forces_x = 0.0;
511  double sum_of_contact_forces_y = 0.0;
512  double sum_of_contact_forces_z = 0.0;
513 
514  #pragma omp parallel for reduction(+ : sum_of_contact_forces_x, sum_of_contact_forces_y, sum_of_contact_forces_z)
515  for (int k = 0; k < ParallelUtilities::GetNumThreads(); ++k){
516 
517  for (ElementsArrayType::iterator it = GetElementPartitionBegin(r_model_part, k); it != GetElementPartitionEnd(r_model_part, k); ++it){
518  if ((it)->IsNot(DEMFlags::BELONGS_TO_A_CLUSTER)){
519  const array_1d<double, 3>& contact_force = (it)->GetGeometry()[0].FastGetSolutionStepValue(CONTACT_FORCES);
520  sum_of_contact_forces_x += contact_force[0];
521  sum_of_contact_forces_y += contact_force[1];
522  sum_of_contact_forces_z += contact_force[2];
523  }
524  }
525  }
526 
527  array_1d<double, 3> sum_of_contact_forces;
528  sum_of_contact_forces[0] = sum_of_contact_forces_x;
529  sum_of_contact_forces[1] = sum_of_contact_forces_y;
530  sum_of_contact_forces[2] = sum_of_contact_forces_z;
531  return sum_of_contact_forces;
532  }
533  //***************************************************************************************************************
534  //***************************************************************************************************************
538 
540  {
541  return mInitialCenterOfMassAndMass;
542  }
543 
547 
548 
552 
554 
555  virtual std::string Info() const
556  {
557  return "";
558  }
559 
561 
562  virtual void PrintInfo(std::ostream& rOStream) const
563  {
564  }
565 
567 
568  virtual void PrintData(std::ostream& rOStream) const
569  {
570  }
571 
572 
576 
577  std::vector<unsigned int>& GetElementPartition()
578  {
579  return (mElementsPartition);
580  }
581 
582  ElementsArrayType::iterator GetElementPartitionBegin(ModelPart& r_model_part, unsigned int k)
583  {
584  ElementsArrayType& pElements = r_model_part.GetCommunicator().LocalMesh().Elements();
585  return (pElements.ptr_begin() + mElementsPartition[k]);
586  }
587 
588  ElementsArrayType::iterator GetElementPartitionEnd(ModelPart& r_model_part, unsigned int k)
589  {
590  ElementsArrayType& pElements = r_model_part.GetCommunicator().LocalMesh().Elements();
591  return (pElements.ptr_begin() + mElementsPartition[k + 1]);
592  }
593 
595 
596  protected:
599 
600 
604 
605 
609 
610 
614 
615 
619  std::vector<unsigned int> mElementsPartition;
620 
624 
625 
629 
630 
632 
633  private:
634 
635 
638 
639 
643 
644  array_1d<double, 3> mInitialCenterOfMassAndMass;
645  double mInitialMass;
646 
647 
651 
655 
656 
660 
661 
665 
666 
670 
673 
674 
676 
677  }; // Class SphericElementGlobalPhysicsCalculator
678 
680 
683 
684 
688 
689 } // namespace Kratos.
690 
691 #endif // CALCULATE_GLOBAL_PHYSICAL_PROPERTIES_H
MeshType & LocalMesh()
Returns the reference to the mesh storing all local entities.
Definition: communicator.cpp:245
static T CrossProduct(const T &a, const T &b)
Performs the vector product of the two input vectors a,b.
Definition: math_utils.h:762
ElementsContainerType & Elements()
Definition: mesh.h:568
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
Communicator & GetCommunicator()
Definition: model_part.h:1821
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
static int GetNumThreads()
Returns the current number of threads.
Definition: parallel_utilities.cpp:34
size_type size() const
Returns the number of elements in the container.
Definition: pointer_vector_set.h:502
Definition: calculate_global_physical_properties.h:32
ModelPart::ElementsContainerType ElementsArrayType
Definition: calculate_global_physical_properties.h:35
virtual std::string Info() const
Turn back information as a stemplate<class T, std::size_t dim> tring.
Definition: calculate_global_physical_properties.h:555
double CalculateTotalMass(ModelPart &r_model_part)
Definition: calculate_global_physical_properties.h:202
double CalculateD50(ModelPart &r_model_part)
Definition: calculate_global_physical_properties.h:166
SphericElementGlobalPhysicsCalculator(ModelPart &r_model_part)
Default constructor.
Definition: calculate_global_physical_properties.h:41
std::vector< unsigned int > & GetElementPartition()
Definition: calculate_global_physical_properties.h:577
array_1d< double, 3 > GetInitialCenterOfMass()
Definition: calculate_global_physical_properties.h:539
double CalculateMaxNodalVariable(ModelPart &r_model_part, const Variable< double > &r_variable)
Definition: calculate_global_physical_properties.h:82
double CalculateInelasticViscodampingEnergy(ModelPart &r_model_part)
Definition: calculate_global_physical_properties.h:380
array_1d< double, 3 > CalculateSumOfInternalForces(ModelPart &r_model_part)
Definition: calculate_global_physical_properties.h:507
ElementsArrayType::iterator GetElementPartitionEnd(ModelPart &r_model_part, unsigned int k)
Definition: calculate_global_physical_properties.h:588
array_1d< double, 3 > CalulateTotalAngularMomentum(ModelPart &r_model_part)
Definition: calculate_global_physical_properties.h:465
double CalculateInelasticFrictionalEnergy(ModelPart &r_model_part)
Definition: calculate_global_physical_properties.h:356
double CalculateElasticEnergy(ModelPart &r_model_part)
Definition: calculate_global_physical_properties.h:329
double CalculateMinNodalVariable(ModelPart &r_model_part, const Variable< double > &r_variable)
Definition: calculate_global_physical_properties.h:124
ElementsArrayType::iterator GetElementPartitionBegin(ModelPart &r_model_part, unsigned int k)
Definition: calculate_global_physical_properties.h:582
double CalculateTranslationalKinematicEnergy(ModelPart &r_model_part)
Definition: calculate_global_physical_properties.h:275
KRATOS_CLASS_POINTER_DEFINITION(SphericElementGlobalPhysicsCalculator)
array_1d< double, 3 > CalculateCenterOfMass(ModelPart &r_model_part)
Definition: calculate_global_physical_properties.h:225
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: calculate_global_physical_properties.h:562
array_1d< double, 3 > CalculateTotalMomentum(ModelPart &r_model_part)
Definition: calculate_global_physical_properties.h:431
double CalculateRotationalKinematicEnergy(ModelPart &r_model_part)
Definition: calculate_global_physical_properties.h:302
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: calculate_global_physical_properties.h:568
double CalculateTotalVolume(ModelPart &r_model_part)
Definition: calculate_global_physical_properties.h:55
double CalculateInelasticRollingResistanceEnergy(ModelPart &r_model_part)
Definition: calculate_global_physical_properties.h:404
std::vector< unsigned int > mElementsPartition
Definition: calculate_global_physical_properties.h:619
virtual ~SphericElementGlobalPhysicsCalculator()
Destructor.
Definition: calculate_global_physical_properties.h:49
double CalculateGravitationalPotentialEnergy(ModelPart &r_model_part, const array_1d< double, 3 > reference_point)
Definition: calculate_global_physical_properties.h:258
Definition: spheric_particle.h:31
virtual double GetRadius()
Definition: spheric_particle.cpp:2195
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
static double max(double a, double b)
Definition: GeometryFunctions.h:79
static double min(double a, double b)
Definition: GeometryFunctions.h:71
constexpr double Pi
Definition: global_variables.h:25
TDataType Calculate(GeometryType &dummy, const Variable< TDataType > &rVariable)
Definition: add_geometries_to_python.cpp:103
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
int k
Definition: quadrature.py:595
def div(DN, x)
This method defines the divergence.
Definition: sympy_fe_utilities.py:291