diff --git a/applications/ThermalDEMApplication/CMakeLists.txt b/applications/ThermalDEMApplication/CMakeLists.txt index 51f62b7288b1..4e46ece25d4c 100644 --- a/applications/ThermalDEMApplication/CMakeLists.txt +++ b/applications/ThermalDEMApplication/CMakeLists.txt @@ -69,8 +69,11 @@ set( KRATOS_THERMAL_DEM_APPLICATION_CORE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/radiation/radiation_continuum_zhou.cpp ${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/real_contact/real_contact_model.cpp ${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/real_contact/real_contact_lu.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/real_contact/real_contact_morris.cpp ${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/real_contact/real_contact_zhou.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/real_contact/real_contact_morris_area.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/real_contact/real_contact_morris_area_time.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/real_contact/real_contact_rangel_area.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/real_contact/real_contact_rangel_area_time.cpp ${CMAKE_CURRENT_SOURCE_DIR}/custom_elements/thermal_spheric_particle.cpp ${CMAKE_CURRENT_SOURCE_DIR}/custom_elements/thermal_spheric_continuum_particle.cpp ${CMAKE_CURRENT_SOURCE_DIR}/custom_elements/sintering_spheric_continuum_particle.cpp diff --git a/applications/ThermalDEMApplication/README.md b/applications/ThermalDEMApplication/README.md index a2acb9478013..ecac4c715d49 100644 --- a/applications/ThermalDEMApplication/README.md +++ b/applications/ThermalDEMApplication/README.md @@ -2,14 +2,14 @@ This application is an extension of the [DEM Application](https://github.com/KratosMultiphysics/Kratos/tree/master/applications/DEMApplication) to include **thermal effects** such as: -- Heat transfer between particle-particle, particle-rigid wall, and particle-surrounding fluid. +- Heat transfer between particle-particle, particle-wall, and particle-surrounding fluid. - Heat transfer mechanisms by conduction, convection, and radiation. - Heat generation by energy dissipation and internal sources. - Temperature dependent material properties. -Theoretical information on thermal DEM analysis can be found [here](./ThermalDEMTheory.pdf). +Theoretical information on thermal DEM analysis can be found [here](https://doi.org/10.5281/zenodo.13846126). -A [Matlab version](https://gitlab.com/rafaelrangel/demlab) of this application is also available. +A [Matlab version](https://github.com/rlrangel/DEMLab) of this application is also available. ## Table of Contents - [Authorship](#authorship) @@ -124,17 +124,20 @@ Add **thermal settings** with desired options: Add **post options** with desired options: - "PostTemperature" : true or false, - "PostHeatFlux" : true or false, - "PostGraphParticleTempMin" : true or false, - "PostGraphParticleTempMax" : true or false, - "PostGraphParticleTempAvg" : true or false, - "PostGraphParticleTempDev" : true or false, - "PostGraphModelTempAvg" : true or false, - "PostGraphHeatFluxContributions" : true or false, - "PostGraphHeatGenContributions" : true or false, - "PostGraphEnergyContributions" : true or false, - "PostMapHeatGeneration" : true or false + "PostTemperature" : true or false, + "PostHeatFlux" : true or false, + "PostGraphParticleTempMin" : true or false, + "PostGraphParticleTempMax" : true or false, + "PostGraphParticleTempAvg" : true or false, + "PostGraphParticleTempAvgVol" : true or false, + "PostGraphParticleTempDev" : true or false, + "PostGraphMechanicalEnergy" : true or false, + "PostGraphDissipatedEnergy" : true or false, + "PostGraphThermalEnergy" : true or false, + "PostGraphHeatFluxContributions" : true or false, + "PostGraphHeatGenerationValues" : true or false, + "PostGraphHeatGenerationContributions" : true or false, + "PostHeatMapGeneration" : true or false ### Materials (json file) @@ -209,19 +212,19 @@ Add **SubModelPartData** to sub model parts with desired options: - *"thermal_integration_scheme"*:\ Selected scheme for time integration of thermal problem.\ Default: "forward_euler" - + - *"numerical_integration_method"*:\ Selected metohd for solving integration expressions numerically.\ Default: "adaptive_simpson" - + - *"thermal_solve_frequency"*:\ Number of steps in which thermal problem is solved.\ Default: 1 - + - *"voronoi_tesselation_frequency"*:\ Number of steps in which Voronoi diagram is built, in case it is required.\ Default: 1000 - + - *"porosity_update_frequency"*:\ Number of steps in which porosity is computed, in case it is required.\ Default: 1000 @@ -229,7 +232,7 @@ Add **SubModelPartData** to sub model parts with desired options: - *"automatic_solve_frequency"*:\ Boolean for automatically setting the thermal solve frequency based on the maximum allowed time step (it overrides the value set for thermal_solve_frequency).\ Default: false - + - *"compute_motion"*:\ Boolean for solving mechanical problem.\ Default: true @@ -237,7 +240,7 @@ Add **SubModelPartData** to sub model parts with desired options: - *"compute_direct_conduction"*:\ Boolean for computing heat transfer between elements by direct conduction.\ Default: true - + - *"compute_indirect_conduction"*:\ Boolean for computing heat transfer between elements by indirect conduction.\ Default: false @@ -277,7 +280,7 @@ Add **SubModelPartData** to sub model parts with desired options: - *"heat_generation_model"*:\ List of selected models for simulating heat generation by energy dissipation.\ Default: ["sliding_friction"] - + - *"adjusted_contact_model"*:\ Selected model for adjusting contact geometry.\ Default: "zhou" @@ -301,7 +304,7 @@ Add **SubModelPartData** to sub model parts with desired options: - *"conduction_radius"*:\ Radius of cylindrical conductive region (ratio of particles radii) required for conduction model "batchelor_obrien_complete" and "batchelor_obrien_modified".\ Default: 1.0 - + - *"fluid_layer_thickness"*:\ Thickness of particle fluid layer (ratio of particles radii) required for conduction model "surrounding_layer".\ Default: 0.4 @@ -337,7 +340,7 @@ Add **SubModelPartData** to sub model parts with desired options: - *"heat_map_subdivisions"*:\ Number of subdivisions in X,Y,Z directions to defined the grid of the heat map.\ Default: [10,10,10] - + - *"global_fluid_properties"*:\ Prescribed values for the properties of the interstitial fluid, assumed as constant throughout all the analysis (fluid behavior does not change as it is not simulated). @@ -377,47 +380,59 @@ Add **SubModelPartData** to sub model parts with desired options: - *"PostTemperature"*:\ Boolean for showing elements temperature in post processing.\ Default: false - + - *"PostHeatFlux"*:\ Boolean for showing elements heat flux in post processing.\ Default: false - + - *"PostGraphParticleTempMin"*:\ Boolean for writing a graph with the minimum particle temperature.\ Default: false - + - *"PostGraphParticleTempMax"*:\ Boolean for writing a graph with the maximum particle temperature.\ Default: false - + - *"PostGraphParticleTempAvg"*:\ Boolean for writing a graph with the average temperature of all particles.\ Default: false - + +- *"PostGraphParticleTempAvgVol"*:\ + Boolean for writing a graph with the volume-weighted average temperature of all particles.\ + Default: false + - *"PostGraphParticleTempDev"*:\ Boolean for writing a graph with the standard deviation of the temperature of all particles.\ Default: false - -- *"PostGraphModelTempAvg"*:\ - Boolean for writing a graph with the weighted average of the temperature of all particles (taking the particles volume into account).\ + +- *"PostGraphMechanicalEnergy"*:\ + Boolean for writing a graph with the mechanical energy components of all partilces.\ Default: false - + +- *"PostGraphDissipatedEnergy"*:\ + Boolean for writing a graph with the accumulated energy dissipation of all partilces.\ + Default: false + +- *"PostGraphThermalEnergy"*:\ + Boolean for writing a graph with the accumulated thermal energy (from heat generation by energy dissipation) of all partilces.\ + Default: false + - *"PostGraphHeatFluxContributions"*:\ Boolean for writing a graph with the contribution of each heat transfer mechanism to the total heat transfer.\ Default: false -- *"PostGraphHeatGenContributions"*:\ - Boolean for writing a graph with the contribution of each heat generation mechanism to the total heat generation.\ +- *"PostGraphHeatGenerationValues"*:\ + Boolean for writing a graph with the total values of each heat generation mechanism.\ Default: false - -- *"PostGraphEnergyContributions"*:\ - Boolean for writing a graph with the energy composition (conservative and accumulated dissipative components) of all partilces.\ + +- *"PostGraphHeatGenerationContributions"*:\ + Boolean for writing a graph with the contribution of each heat generation mechanism to the total heat generation.\ Default: false -- *"PostMapHeatGeneration"*:\ - Boolean for assemblying and writing the density map of heat generation.\ +- *"PostHeatMapGeneration"*:\ + Boolean for assemblying and writing the heat map of heat generation.\ Default: false - + **Material properties** - *"materials.Variables.THERMAL_CONDUCTIVITY"*:\ Thermal conductivity of material (always required). diff --git a/applications/ThermalDEMApplication/ThermalDEMTheory.pdf b/applications/ThermalDEMApplication/ThermalDEMTheory.pdf deleted file mode 100644 index 53fcd986a4f5..000000000000 Binary files a/applications/ThermalDEMApplication/ThermalDEMTheory.pdf and /dev/null differ diff --git a/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_bob_complete.h b/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_bob_complete.h index 49be776d1707..0b0abdcb9760 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_bob_complete.h +++ b/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_bob_complete.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(DIRECT_CONDUCTION_MODEL_BOB_COMPLETE_H_INCLUDED) -#define DIRECT_CONDUCTION_MODEL_BOB_COMPLETE_H_INCLUDED +#pragma once // System includes @@ -92,5 +91,3 @@ namespace Kratos } } // namespace Kratos - -#endif // DIRECT_CONDUCTION_MODEL_BOB_COMPLETE_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_bob_modified.h b/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_bob_modified.h index 90a29fd59876..2e6625b94a0d 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_bob_modified.h +++ b/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_bob_modified.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(DIRECT_CONDUCTION_MODEL_BOB_MODIFIED_H_INCLUDED) -#define DIRECT_CONDUCTION_MODEL_BOB_MODIFIED_H_INCLUDED +#pragma once // System includes @@ -81,5 +80,3 @@ namespace Kratos } } // namespace Kratos - -#endif // DIRECT_CONDUCTION_MODEL_BOB_MODIFIED_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_bob_simple.h b/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_bob_simple.h index b225998e53db..fdbe22d71127 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_bob_simple.h +++ b/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_bob_simple.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(DIRECT_CONDUCTION_MODEL_BOB_SIMPLE_H_INCLUDED) -#define DIRECT_CONDUCTION_MODEL_BOB_SIMPLE_H_INCLUDED +#pragma once // System includes @@ -78,5 +77,3 @@ namespace Kratos } } // namespace Kratos - -#endif // DIRECT_CONDUCTION_MODEL_BOB_SIMPLE_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_collision.cpp b/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_collision.cpp index bcbca52df230..6e368bae5cea 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_collision.cpp +++ b/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_collision.cpp @@ -29,7 +29,7 @@ namespace Kratos { // Get collision time and impact normal velocity typename ThermalSphericParticle::ContactParams contact_params = particle->GetContactParameters(); const double col_time = r_process_info[TIME] - contact_params.impact_time; - const double impact_normal_velocity = fabs(contact_params.impact_velocity[0]); + const double impact_normal_velocity = std::abs(contact_params.impact_velocity[0]); // Compute max collision time double col_time_max = 0.0; diff --git a/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_collision.h b/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_collision.h index 44c9330ecdc1..fce96e2c8474 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_collision.h +++ b/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_collision.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(DIRECT_CONDUCTION_MODEL_COLLISION_H_INCLUDED) -#define DIRECT_CONDUCTION_MODEL_COLLISION_H_INCLUDED +#pragma once // System includes @@ -78,5 +77,3 @@ namespace Kratos } } // namespace Kratos - -#endif // DIRECT_CONDUCTION_MODEL_COLLISION_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_model.h b/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_model.h index 77c566e5b3b5..6793cdf24718 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_model.h +++ b/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_model.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(DIRECT_CONDUCTION_MODEL_H_INCLUDED) -#define DIRECT_CONDUCTION_MODEL_H_INCLUDED +#pragma once // System includes @@ -81,5 +80,3 @@ namespace Kratos } } // namespace Kratos - -#endif // DIRECT_CONDUCTION_MODEL_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_pipe.h b/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_pipe.h index b3c32787befd..a472c5ae45d7 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_pipe.h +++ b/applications/ThermalDEMApplication/custom_constitutive/conduction/direct_conduction_pipe.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(DIRECT_CONDUCTION_MODEL_PIPE_H_INCLUDED) -#define DIRECT_CONDUCTION_MODEL_PIPE_H_INCLUDED +#pragma once // System includes @@ -78,5 +77,3 @@ namespace Kratos } } // namespace Kratos - -#endif // DIRECT_CONDUCTION_MODEL_PIPE_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_model.h b/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_model.h index 7c9d5dc538de..9aed161afa13 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_model.h +++ b/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_model.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(INDIRECT_CONDUCTION_MODEL_H_INCLUDED) -#define INDIRECT_CONDUCTION_MODEL_H_INCLUDED +#pragma once // System includes @@ -81,5 +80,3 @@ namespace Kratos } } // namespace Kratos - -#endif // INDIRECT_CONDUCTION_MODEL_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_surround_layer.cpp b/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_surround_layer.cpp index d0780e133dbc..23cc2a7fcfc2 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_surround_layer.cpp +++ b/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_surround_layer.cpp @@ -74,7 +74,7 @@ namespace Kratos { c = sqrt(1.0 - r_in * r_in); // Heat transfer coefficient from analytical solution of the integral expression - return 2.0 * Globals::Pi * fluid_conductivity * particle_radius * ((a + 1.0) * log(fabs(b - a - 1.0) / fabs(a - c + 1.0)) + b - c); + return 2.0 * Globals::Pi * fluid_conductivity * particle_radius * ((a + 1.0) * log(std::abs(b - a - 1.0) / std::abs(a - c + 1.0)) + b - c); KRATOS_CATCH("") } diff --git a/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_surround_layer.h b/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_surround_layer.h index 6af900ea72c3..2e09ff15b2f4 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_surround_layer.h +++ b/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_surround_layer.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(INDIRECT_CONDUCTION_MODEL_SURROUNDING_LAYER_H_INCLUDED) -#define INDIRECT_CONDUCTION_MODEL_SURROUNDING_LAYER_H_INCLUDED +#pragma once // System includes @@ -83,5 +82,3 @@ namespace Kratos } } // namespace Kratos - -#endif // INDIRECT_CONDUCTION_MODEL_SURROUNDING_LAYER_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_vargas.h b/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_vargas.h index 7eb5d4e2e0b4..6eec5474271e 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_vargas.h +++ b/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_vargas.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(INDIRECT_CONDUCTION_MODEL_VARGAS_H_INCLUDED) -#define INDIRECT_CONDUCTION_MODEL_VARGAS_H_INCLUDED +#pragma once // System includes @@ -78,5 +77,3 @@ namespace Kratos } } // namespace Kratos - -#endif // INDIRECT_CONDUCTION_MODEL_VARGAS_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_voronoi_a.h b/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_voronoi_a.h index feb3421b4bd6..0b06e8b4449c 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_voronoi_a.h +++ b/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_voronoi_a.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(INDIRECT_CONDUCTION_MODEL_VORONOI_A_H_INCLUDED) -#define INDIRECT_CONDUCTION_MODEL_VORONOI_A_H_INCLUDED +#pragma once // System includes @@ -86,5 +85,3 @@ namespace Kratos } } // namespace Kratos - -#endif // INDIRECT_CONDUCTION_MODEL_VORONOI_A_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_voronoi_b.cpp b/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_voronoi_b.cpp index 04c8395749ed..cc25988c3857 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_voronoi_b.cpp +++ b/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_voronoi_b.cpp @@ -145,17 +145,17 @@ namespace Kratos { const double delmax = 0.5 * (sqrt((4.0 * An) / (Globals::Pi * distance * distance * (1.0 - dgamma * dgamma)) + 1.0) - dgamma); const double delmin = 0.5 * (sqrt((4.0 * contact_radius * contact_radius) / (distance * distance * (1.0 - dgamma * dgamma)) + 1.0) - dgamma); - const double Xmax = ((A + B) * delmax + dgamma * B - 1.0) / sqrt(fabs(lambda)); - const double Xmin = ((A + B) * delmin + dgamma * B - 1.0) / sqrt(fabs(lambda)); + const double Xmax = ((A + B) * delmax + dgamma * B - 1.0) / sqrt(std::abs(lambda)); + const double Xmin = ((A + B) * delmin + dgamma * B - 1.0) / sqrt(std::abs(lambda)); const double Y1 = (Xmax - Xmin) / (1.0 - Xmax * Xmin); const double Y2 = (Xmax - Xmin) / (1.0 + Xmax * Xmin); // Heat transfer coefficient if (lambda > 0.0) - return Globals::Pi * fluid_conductivity * distance * (1.0 - dgamma * dgamma) * log(fabs((1.0 - Y1) / (1.0 + Y1))) / (2.0 * sqrt(fabs(lambda))); + return Globals::Pi * fluid_conductivity * distance * (1.0 - dgamma * dgamma) * log(std::abs((1.0 - Y1) / (1.0 + Y1))) / (2.0 * sqrt(std::abs(lambda))); else if (lambda < 0.0) - return Globals::Pi * fluid_conductivity * distance * (1.0 - dgamma * dgamma) * atan(Y2) / (2.0 * sqrt(fabs(lambda))); + return Globals::Pi * fluid_conductivity * distance * (1.0 - dgamma * dgamma) * atan(Y2) / (2.0 * sqrt(std::abs(lambda))); else return Globals::Pi * fluid_conductivity * distance * (1.0 - dgamma * dgamma) * (1.0 / delmin - 1.0 / delmax) / (A + B); diff --git a/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_voronoi_b.h b/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_voronoi_b.h index 077534b93bef..0ba600cc4ef3 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_voronoi_b.h +++ b/applications/ThermalDEMApplication/custom_constitutive/conduction/indirect_conduction_voronoi_b.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(INDIRECT_CONDUCTION_MODEL_VORONOI_B_H_INCLUDED) -#define INDIRECT_CONDUCTION_MODEL_VORONOI_B_H_INCLUDED +#pragma once // System includes @@ -82,5 +81,3 @@ namespace Kratos } } // namespace Kratos - -#endif // INDIRECT_CONDUCTION_MODEL_VORONOI_B_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/convection/convection_model.h b/applications/ThermalDEMApplication/custom_constitutive/convection/convection_model.h index 814af9d1d8d0..39542998636e 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/convection/convection_model.h +++ b/applications/ThermalDEMApplication/custom_constitutive/convection/convection_model.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(CONVECTION_MODEL_H_INCLUDED) -#define CONVECTION_MODEL_H_INCLUDED +#pragma once // System includes @@ -81,5 +80,3 @@ namespace Kratos } } // namespace Kratos - -#endif // CONVECTION_MODEL_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_gunn.h b/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_gunn.h index 7f38c34a252c..f79bfd92e419 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_gunn.h +++ b/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_gunn.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(NUSSELT_NUMBER_GUNN_H_INCLUDED) -#define NUSSELT_NUMBER_GUNN_H_INCLUDED +#pragma once // System includes @@ -78,5 +77,3 @@ namespace Kratos } } // namespace Kratos - -#endif // NUSSELT_NUMBER_GUNN_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_hanz_marshall.h b/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_hanz_marshall.h index 8c872b979fdb..b47fbd8e1644 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_hanz_marshall.h +++ b/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_hanz_marshall.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(NUSSELT_NUMBER_HANZ_MARSHALL_H_INCLUDED) -#define NUSSELT_NUMBER_HANZ_MARSHALL_H_INCLUDED +#pragma once // System includes @@ -78,5 +77,3 @@ namespace Kratos } } // namespace Kratos - -#endif // NUSSELT_NUMBER_HANZ_MARSHALL_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_li_mason.h b/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_li_mason.h index 37102bf36cbf..baf967139f71 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_li_mason.h +++ b/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_li_mason.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(NUSSELT_NUMBER_LI_MASON_H_INCLUDED) -#define NUSSELT_NUMBER_LI_MASON_H_INCLUDED +#pragma once // System includes @@ -78,5 +77,3 @@ namespace Kratos } } // namespace Kratos - -#endif // NUSSELT_NUMBER_LI_MASON_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_whitaker.h b/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_whitaker.h index 0d5b76a9bcce..206275d1f350 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_whitaker.h +++ b/applications/ThermalDEMApplication/custom_constitutive/convection/nusselt_whitaker.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(NUSSELT_NUMBER_WHITAKER_H_INCLUDED) -#define NUSSELT_NUMBER_WHITAKER_H_INCLUDED +#pragma once // System includes @@ -78,5 +77,3 @@ namespace Kratos } } // namespace Kratos - -#endif // NUSSELT_NUMBER_WHITAKER_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/generation/generation_dissipation.cpp b/applications/ThermalDEMApplication/custom_constitutive/generation/generation_dissipation.cpp index f3fe7db693fb..43d90efe9ddf 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/generation/generation_dissipation.cpp +++ b/applications/ThermalDEMApplication/custom_constitutive/generation/generation_dissipation.cpp @@ -38,6 +38,7 @@ namespace Kratos { const double coeff = conversion * partition; // Initialize contribution from different sources of heat generation + double thermal_energy; double heat_gen; double heat_gen_damping_pp = 0.0; double heat_gen_damping_pw = 0.0; @@ -48,49 +49,58 @@ namespace Kratos { // Damping thermal power if (r_process_info[GENERATION_DAMPING_OPTION]) { - heat_gen = coeff * contact_params.viscodamping_energy / time; + thermal_energy = coeff * contact_params.viscodamping_energy; + heat_gen = thermal_energy / time; if (particle->mNeighborType & PARTICLE_NEIGHBOR) { + particle->mGenerationThermalEnergy_damp_particle += thermal_energy; + particle->mGenerationHeatFlux_damp_particle += heat_gen; heat_gen_damping_pp = heat_gen; - particle->mGenerationHeatFlux_damp_particle += heat_gen; } else if (particle->mNeighborType & WALL_NEIGHBOR) { + particle->mGenerationThermalEnergy_damp_wall += thermal_energy; + particle->mGenerationHeatFlux_damp_wall += heat_gen; heat_gen_damping_pw = heat_gen; - particle->mGenerationHeatFlux_damp_wall += heat_gen; } } // Sliding friction thermal power if (r_process_info[GENERATION_SLIDING_OPTION]) { - heat_gen = coeff * contact_params.frictional_energy / time; + thermal_energy = coeff * contact_params.frictional_energy; + heat_gen = thermal_energy / time; if (particle->mNeighborType & PARTICLE_NEIGHBOR) { + particle->mGenerationThermalEnergy_slid_particle += thermal_energy; + particle->mGenerationHeatFlux_slid_particle += heat_gen; heat_gen_sliding_pp = heat_gen; - particle->mGenerationHeatFlux_slid_particle += heat_gen; } else if (particle->mNeighborType & WALL_NEIGHBOR) { + particle->mGenerationThermalEnergy_slid_wall += thermal_energy; + particle->mGenerationHeatFlux_slid_wall += heat_gen; heat_gen_sliding_pw = heat_gen; - particle->mGenerationHeatFlux_slid_wall += heat_gen; } } // Rolling friction thermal power if (r_process_info[GENERATION_ROLLING_OPTION] && particle->Is(DEMFlags::HAS_ROTATION) && particle->Is(DEMFlags::HAS_ROLLING_FRICTION)) { - heat_gen = coeff * contact_params.rollresist_energy / time; + thermal_energy = coeff * contact_params.rollresist_energy; + heat_gen = thermal_energy / time; if (particle->mNeighborType & PARTICLE_NEIGHBOR) { + particle->mGenerationThermalEnergy_roll_particle += thermal_energy; + particle->mGenerationHeatFlux_roll_particle += heat_gen; heat_gen_rolling_pp = heat_gen; - particle->mGenerationHeatFlux_roll_particle += heat_gen; } else if (particle->mNeighborType & WALL_NEIGHBOR) { + particle->mGenerationThermalEnergy_roll_wall += thermal_energy; + particle->mGenerationHeatFlux_roll_wall += heat_gen; heat_gen_rolling_pw = heat_gen; - particle->mGenerationHeatFlux_roll_wall += heat_gen; } } // Fill heat map if (r_process_info[HEAT_MAP_GENERATION_OPTION]) - FillDensityMap(r_process_info, particle, time, heat_gen_damping_pp, heat_gen_damping_pw, heat_gen_sliding_pp, heat_gen_sliding_pw, heat_gen_rolling_pp, heat_gen_rolling_pw); + FillHeatMap(r_process_info, particle, time, heat_gen_damping_pp, heat_gen_damping_pw, heat_gen_sliding_pp, heat_gen_sliding_pw, heat_gen_rolling_pp, heat_gen_rolling_pw); return heat_gen_damping_pp + heat_gen_damping_pw + heat_gen_sliding_pp + heat_gen_sliding_pw + heat_gen_rolling_pp + heat_gen_rolling_pw; @@ -109,7 +119,7 @@ namespace Kratos { } //------------------------------------------------------------------------------------------------------------ - void GenerationDissipation::FillDensityMap(const ProcessInfo& r_process_info, + void GenerationDissipation::FillHeatMap(const ProcessInfo& r_process_info, ThermalSphericParticle* particle, const double time, const double heat_gen_damping_pp, diff --git a/applications/ThermalDEMApplication/custom_constitutive/generation/generation_dissipation.h b/applications/ThermalDEMApplication/custom_constitutive/generation/generation_dissipation.h index 513615042d8b..aef04944fbcb 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/generation/generation_dissipation.h +++ b/applications/ThermalDEMApplication/custom_constitutive/generation/generation_dissipation.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(GENERATION_MODEL_DISSIPATION_H_INCLUDED) -#define GENERATION_MODEL_DISSIPATION_H_INCLUDED +#pragma once // System includes @@ -32,15 +31,15 @@ namespace Kratos // Public methods double ComputeHeatGeneration (const ProcessInfo& r_process_info, ThermalSphericParticle* particle) override; double ComputePartitionCoeff (ThermalSphericParticle* particle); - void FillDensityMap (const ProcessInfo& r_process_info, - ThermalSphericParticle* particle, - const double time, - const double heat_gen_damping_pp, - const double heat_gen_damping_pw, - const double heat_gen_sliding_pp, - const double heat_gen_sliding_pw, - const double heat_gen_rolling_pp, - const double heat_gen_rolling_pw); + void FillHeatMap (const ProcessInfo& r_process_info, + ThermalSphericParticle* particle, + const double time, + const double heat_gen_damping_pp, + const double heat_gen_damping_pw, + const double heat_gen_sliding_pp, + const double heat_gen_sliding_pw, + const double heat_gen_rolling_pp, + const double heat_gen_rolling_pw); // Clone HeatGenerationMechanism* CloneRaw() const override { @@ -88,5 +87,3 @@ namespace Kratos } } // namespace Kratos - -#endif // GENERATION_MODEL_DISSIPATION_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/generation/generation_model.h b/applications/ThermalDEMApplication/custom_constitutive/generation/generation_model.h index 2f7b58feb0b0..6ed8ca494b10 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/generation/generation_model.h +++ b/applications/ThermalDEMApplication/custom_constitutive/generation/generation_model.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(GENERATION_MODEL_H_INCLUDED) -#define GENERATION_MODEL_H_INCLUDED +#pragma once // System includes @@ -80,5 +79,3 @@ namespace Kratos } } // namespace Kratos - -#endif // GENERATION_MODEL_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/heat_exchange_mechanism.h b/applications/ThermalDEMApplication/custom_constitutive/heat_exchange_mechanism.h index b245e5d025c7..c53da0a8d3a5 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/heat_exchange_mechanism.h +++ b/applications/ThermalDEMApplication/custom_constitutive/heat_exchange_mechanism.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(HEAT_EXCHANGE_MECHANISM_H_INCLUDED) -#define HEAT_EXCHANGE_MECHANISM_H_INCLUDED +#pragma once // System includes #include @@ -96,5 +95,3 @@ namespace Kratos } } // namespace Kratos - -#endif // HEAT_EXCHANGE_MECHANISM_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/heat_generation_mechanism.h b/applications/ThermalDEMApplication/custom_constitutive/heat_generation_mechanism.h index dcc08e04782d..d4e07f74aa28 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/heat_generation_mechanism.h +++ b/applications/ThermalDEMApplication/custom_constitutive/heat_generation_mechanism.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(HEAT_GENERATION_MECHANISM_H_INCLUDED) -#define HEAT_GENERATION_MECHANISM_H_INCLUDED +#pragma once // System includes #include @@ -95,5 +94,3 @@ namespace Kratos } } // namespace Kratos - -#endif // HEAT_GENERATION_MECHANISM_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/radiation/radiation_continuum_krause.h b/applications/ThermalDEMApplication/custom_constitutive/radiation/radiation_continuum_krause.h index d8d23d9b7817..1afa7230f1c5 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/radiation/radiation_continuum_krause.h +++ b/applications/ThermalDEMApplication/custom_constitutive/radiation/radiation_continuum_krause.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(RADIATION_MODEL_CONTINUUM_KRAUSE_H_INCLUDED) -#define RADIATION_MODEL_CONTINUUM_KRAUSE_H_INCLUDED +#pragma once // System includes @@ -80,5 +79,3 @@ namespace Kratos } } // namespace Kratos - -#endif // RADIATION_MODEL_CONTINUUM_KRAUSE_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/radiation/radiation_continuum_zhou.h b/applications/ThermalDEMApplication/custom_constitutive/radiation/radiation_continuum_zhou.h index fb818795d6ae..719a901dc9d4 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/radiation/radiation_continuum_zhou.h +++ b/applications/ThermalDEMApplication/custom_constitutive/radiation/radiation_continuum_zhou.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(RADIATION_MODEL_CONTINUUM_ZHOU_H_INCLUDED) -#define RADIATION_MODEL_CONTINUUM_ZHOU_H_INCLUDED +#pragma once // System includes @@ -80,5 +79,3 @@ namespace Kratos } } // namespace Kratos - -#endif // RADIATION_MODEL_CONTINUUM_ZHOU_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/radiation/radiation_model.h b/applications/ThermalDEMApplication/custom_constitutive/radiation/radiation_model.h index 5372dc854b99..bb7b76aa1795 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/radiation/radiation_model.h +++ b/applications/ThermalDEMApplication/custom_constitutive/radiation/radiation_model.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(RADIATION_MODEL_H_INCLUDED) -#define RADIATION_MODEL_H_INCLUDED +#pragma once // System includes @@ -86,5 +85,3 @@ namespace Kratos } } // namespace Kratos - -#endif // RADIATION_MODEL_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_lu.h b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_lu.h index b8fedfcd549c..4e9e93f59c23 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_lu.h +++ b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_lu.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(REAL_CONTACT_MODEL_LU_H_INCLUDED) -#define REAL_CONTACT_MODEL_LU_H_INCLUDED +#pragma once // System includes @@ -79,5 +78,3 @@ namespace Kratos } } // namespace Kratos - -#endif // REAL_CONTACT_MODEL_LU_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_model.h b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_model.h index b9ebc242aae9..5917fd37fe44 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_model.h +++ b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_model.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(REAL_CONTACT_MODEL_H_INCLUDED) -#define REAL_CONTACT_MODEL_H_INCLUDED +#pragma once // System includes #include @@ -94,5 +93,3 @@ namespace Kratos } } // namespace Kratos - -#endif // REAL_CONTACT_MODEL_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris.cpp b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris_area.cpp similarity index 83% rename from applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris.cpp rename to applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris_area.cpp index 625e507d209d..999bd037c140 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris.cpp +++ b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris_area.cpp @@ -11,15 +11,15 @@ // External includes // Project includes -#include "real_contact_morris.h" +#include "real_contact_morris_area.h" namespace Kratos { //----------------------------------------------------------------------------------------------------------------------- - RealContactMorris::RealContactMorris() {} - RealContactMorris::~RealContactMorris() {} + RealContactMorrisArea::RealContactMorrisArea() {} + RealContactMorrisArea::~RealContactMorrisArea() {} //------------------------------------------------------------------------------------------------------------ - void RealContactMorris::AdjustContact(const ProcessInfo& r_process_info, ThermalSphericParticle* particle) { + void RealContactMorrisArea::AdjustContact(const ProcessInfo& r_process_info, ThermalSphericParticle* particle) { KRATOS_TRY // Parameters @@ -35,7 +35,7 @@ namespace Kratos { const double correction_area = pow(hertz_force * eff_radius / eff_young_real, 1.0 / 3.0); // Time correction - double correction_time = 1.0; // TODO: Compute time correction from collision time + double correction_time = 1.0; // Adjusted value of contact radius particle->mContactRadiusAdjusted = correction_area * correction_time; diff --git a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris.h b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris_area.h similarity index 67% rename from applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris.h rename to applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris_area.h index 93d0de523c42..677b59fdb929 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris.h +++ b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris_area.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(REAL_CONTACT_MODEL_MORRIS_H_INCLUDED) -#define REAL_CONTACT_MODEL_MORRIS_H_INCLUDED +#pragma once // System includes @@ -19,59 +18,59 @@ namespace Kratos { - class KRATOS_API(THERMAL_DEM_APPLICATION) RealContactMorris : public RealContactModel + class KRATOS_API(THERMAL_DEM_APPLICATION) RealContactMorrisArea : public RealContactModel { public: // Pointer definition - KRATOS_CLASS_POINTER_DEFINITION(RealContactMorris); + KRATOS_CLASS_POINTER_DEFINITION(RealContactMorrisArea); // Constructor / Destructor - RealContactMorris(); - virtual ~RealContactMorris(); + RealContactMorrisArea(); + virtual ~RealContactMorrisArea(); // Public methods void AdjustContact(const ProcessInfo& r_process_info, ThermalSphericParticle* particle) override; // Clone RealContactModel* CloneRaw() const override { - RealContactModel* cloned_model(new RealContactMorris(*this)); + RealContactModel* cloned_model(new RealContactMorrisArea(*this)); return cloned_model; } RealContactModel::Pointer CloneShared() const override { - RealContactModel::Pointer cloned_model(new RealContactMorris(*this)); + RealContactModel::Pointer cloned_model(new RealContactMorrisArea(*this)); return cloned_model; } // Turn back information as a string virtual std::string Info() const override { std::stringstream buffer; - buffer << "RealContactMorris"; + buffer << "RealContactMorrisArea"; return buffer.str(); } // Print object information - virtual void PrintInfo(std::ostream& rOStream) const override { rOStream << "RealContactMorris"; } + virtual void PrintInfo(std::ostream& rOStream) const override { rOStream << "RealContactMorrisArea"; } virtual void PrintData(std::ostream& rOStream) const override {} private: // Assignment operator / Copy constructor - RealContactMorris& operator=(RealContactMorris const& rOther) {return *this;} - RealContactMorris(RealContactMorris const& rOther) {*this = rOther;} + RealContactMorrisArea& operator=(RealContactMorrisArea const& rOther) {return *this;} + RealContactMorrisArea(RealContactMorrisArea const& rOther) {*this = rOther;} - }; // Class RealContactMorris + }; // Class RealContactMorrisArea // input stream function inline std::istream& operator>>(std::istream& rIStream, - RealContactMorris& rThis) { + RealContactMorrisArea& rThis) { return rIStream; } // output stream function inline std::ostream& operator<<(std::ostream& rOStream, - const RealContactMorris& rThis) { + const RealContactMorrisArea& rThis) { rThis.PrintInfo(rOStream); rOStream << std::endl; rThis.PrintData(rOStream); @@ -79,5 +78,3 @@ namespace Kratos } } // namespace Kratos - -#endif // REAL_CONTACT_MODEL_MORRIS_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris_area_time.cpp b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris_area_time.cpp new file mode 100644 index 000000000000..c5a7121e8f18 --- /dev/null +++ b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris_area_time.cpp @@ -0,0 +1,56 @@ +// Kratos Multi-Physics - ThermalDEM Application +// +// License: BSD License +// Kratos default license: kratos/license.txt +// +// Main authors: Rafael Rangel (rrangel@cimne.upc.edu) +// + +// System includes + +// External includes + +// Project includes +#include "real_contact_morris_area_time.h" + +namespace Kratos { + //----------------------------------------------------------------------------------------------------------------------- + RealContactMorrisAreaTime::RealContactMorrisAreaTime() {} + RealContactMorrisAreaTime::~RealContactMorrisAreaTime() {} + + //------------------------------------------------------------------------------------------------------------ + void RealContactMorrisAreaTime::AdjustContact(const ProcessInfo& r_process_info, ThermalSphericParticle* particle) { + KRATOS_TRY + + // Parameters + typename ThermalSphericParticle::ContactParams contact_params = particle->GetContactParameters(); + const double eff_young = particle->ComputeEffectiveYoung(); + const double eff_young_real = particle->ComputeEffectiveYoungReal(); + const double eff_radius = particle->ComputeEffectiveRadius(); + const double identation = std::max(-1.0 * particle->mNeighborSeparation, 0.0); + const double col_time_max = particle->ComputeMaxCollisionTime(); + const double col_time_max_real = particle->ComputeMaxCollisionTimeReal(); + const double col_time = r_process_info[TIME] - contact_params.impact_time; + + // Contact force with simulation parameters (using Hertz theory) + const double hertz_force = 4.0 * eff_young * sqrt(eff_radius) * pow(identation, 3.0 / 2.0) / 3.0; + + // Area correction + const double correction_area = pow(hertz_force * eff_radius / eff_young_real, 1.0 / 3.0); + + // Time correction + double correction_time = 1.0; + if (col_time < col_time_max) + correction_time = pow(col_time_max_real / col_time_max, 2.0 / 3.0); + + // Adjusted value of contact radius + particle->mContactRadiusAdjusted = correction_area * correction_time; + + // Compute adjusted distance/separation from adjusted contact radius + particle->mNeighborDistanceAdjusted = particle->ComputeDistanceToNeighborAdjusted(); + particle->mNeighborSeparationAdjusted = particle->ComputeSeparationToNeighborAdjusted(); + + KRATOS_CATCH("") + } + +} // namespace Kratos diff --git a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris_area_time.h b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris_area_time.h new file mode 100644 index 000000000000..6d0bf679f098 --- /dev/null +++ b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_morris_area_time.h @@ -0,0 +1,80 @@ +// Kratos Multi-Physics - ThermalDEM Application +// +// License: BSD License +// Kratos default license: kratos/license.txt +// +// Main authors: Rafael Rangel (rrangel@cimne.upc.edu) +// + +#pragma once + +// System includes + +// External includes + +// Project includes +#include "real_contact_model.h" +#include "custom_elements/thermal_spheric_particle.h" + +namespace Kratos +{ + class KRATOS_API(THERMAL_DEM_APPLICATION) RealContactMorrisAreaTime : public RealContactModel + { + public: + + // Pointer definition + KRATOS_CLASS_POINTER_DEFINITION(RealContactMorrisAreaTime); + + // Constructor / Destructor + RealContactMorrisAreaTime(); + virtual ~RealContactMorrisAreaTime(); + + // Public methods + void AdjustContact(const ProcessInfo& r_process_info, ThermalSphericParticle* particle) override; + + // Clone + RealContactModel* CloneRaw() const override { + RealContactModel* cloned_model(new RealContactMorrisAreaTime(*this)); + return cloned_model; + } + + RealContactModel::Pointer CloneShared() const override { + RealContactModel::Pointer cloned_model(new RealContactMorrisAreaTime(*this)); + return cloned_model; + } + + // Turn back information as a string + virtual std::string Info() const override { + std::stringstream buffer; + buffer << "RealContactMorrisAreaTime"; + return buffer.str(); + } + + // Print object information + virtual void PrintInfo(std::ostream& rOStream) const override { rOStream << "RealContactMorrisAreaTime"; } + virtual void PrintData(std::ostream& rOStream) const override {} + + private: + + // Assignment operator / Copy constructor + RealContactMorrisAreaTime& operator=(RealContactMorrisAreaTime const& rOther) {return *this;} + RealContactMorrisAreaTime(RealContactMorrisAreaTime const& rOther) {*this = rOther;} + + }; // Class RealContactMorrisAreaTime + + // input stream function + inline std::istream& operator>>(std::istream& rIStream, + RealContactMorrisAreaTime& rThis) { + return rIStream; + } + + // output stream function + inline std::ostream& operator<<(std::ostream& rOStream, + const RealContactMorrisAreaTime& rThis) { + rThis.PrintInfo(rOStream); + rOStream << std::endl; + rThis.PrintData(rOStream); + return rOStream; + } + +} // namespace Kratos diff --git a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_rangel_area.cpp b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_rangel_area.cpp new file mode 100644 index 000000000000..1da7b413f329 --- /dev/null +++ b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_rangel_area.cpp @@ -0,0 +1,55 @@ +// Kratos Multi-Physics - ThermalDEM Application +// +// License: BSD License +// Kratos default license: kratos/license.txt +// +// Main authors: Rafael Rangel (rrangel@cimne.upc.edu) +// + +// System includes + +// External includes + +// Project includes +#include "real_contact_rangel_area.h" + +namespace Kratos { + //----------------------------------------------------------------------------------------------------------------------- + RealContactRangelArea::RealContactRangelArea() {} + RealContactRangelArea::~RealContactRangelArea() {} + + //------------------------------------------------------------------------------------------------------------ + void RealContactRangelArea::AdjustContact(const ProcessInfo& r_process_info, ThermalSphericParticle* particle) { + KRATOS_TRY + + // Simulation and real values of effective Young modulus + const double eff_young = particle->ComputeEffectiveYoung(); + const double eff_young_real = particle->ComputeEffectiveYoungReal(); + + // Area correction + if (particle->mNeighborType & PARTICLE_NEIGHBOR) { + const double r1 = particle->GetParticleRadius(); + const double r2 = particle->GetNeighborRadius(); + const double d_sim = particle->mNeighborDistance; + const double overlap_sim = r1 + r2 - d_sim; + const double overlap_real = pow(eff_young/eff_young_real, 2.0/3.0) * overlap_sim; + const double d_real = r1 + r2 - overlap_real; + particle->mContactRadiusAdjusted = sqrt(std::abs(r1 * r1 - pow(((r1 * r1 - r2 * r2 + d_real * d_real) / (2.0 * d_real)), 2.0))); + } + else if (particle->mNeighborType & WALL_NEIGHBOR) { + const double r1 = particle->GetParticleRadius(); + const double d_sim = particle->mNeighborDistance; + const double overlap_sim = r1 - d_sim; + const double overlap_real = pow(eff_young/eff_young_real, 2.0/3.0) * overlap_sim; + const double d_real = r1 - overlap_real; + particle->mContactRadiusAdjusted = sqrt(r1 * r1 - d_real * d_real); + } + + // Compute adjusted distance/separation from adjusted contact radius + particle->mNeighborDistanceAdjusted = particle->ComputeDistanceToNeighborAdjusted(); + particle->mNeighborSeparationAdjusted = particle->ComputeSeparationToNeighborAdjusted(); + + KRATOS_CATCH("") + } + +} // namespace Kratos diff --git a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_rangel_area.h b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_rangel_area.h new file mode 100644 index 000000000000..03a37b2a3c28 --- /dev/null +++ b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_rangel_area.h @@ -0,0 +1,80 @@ +// Kratos Multi-Physics - ThermalDEM Application +// +// License: BSD License +// Kratos default license: kratos/license.txt +// +// Main authors: Rafael Rangel (rrangel@cimne.upc.edu) +// + +#pragma once + +// System includes + +// External includes + +// Project includes +#include "real_contact_model.h" +#include "custom_elements/thermal_spheric_particle.h" + +namespace Kratos +{ + class KRATOS_API(THERMAL_DEM_APPLICATION) RealContactRangelArea : public RealContactModel + { + public: + + // Pointer definition + KRATOS_CLASS_POINTER_DEFINITION(RealContactRangelArea); + + // Constructor / Destructor + RealContactRangelArea(); + virtual ~RealContactRangelArea(); + + // Public methods + void AdjustContact(const ProcessInfo& r_process_info, ThermalSphericParticle* particle) override; + + // Clone + RealContactModel* CloneRaw() const override { + RealContactModel* cloned_model(new RealContactRangelArea(*this)); + return cloned_model; + } + + RealContactModel::Pointer CloneShared() const override { + RealContactModel::Pointer cloned_model(new RealContactRangelArea(*this)); + return cloned_model; + } + + // Turn back information as a string + virtual std::string Info() const override { + std::stringstream buffer; + buffer << "RealContactRangelArea"; + return buffer.str(); + } + + // Print object information + virtual void PrintInfo(std::ostream& rOStream) const override { rOStream << "RealContactRangelArea"; } + virtual void PrintData(std::ostream& rOStream) const override {} + + private: + + // Assignment operator / Copy constructor + RealContactRangelArea& operator=(RealContactRangelArea const& rOther) {return *this;} + RealContactRangelArea(RealContactRangelArea const& rOther) {*this = rOther;} + + }; // Class RealContactRangelArea + + // input stream function + inline std::istream& operator>>(std::istream& rIStream, + RealContactRangelArea& rThis) { + return rIStream; + } + + // output stream function + inline std::ostream& operator<<(std::ostream& rOStream, + const RealContactRangelArea& rThis) { + rThis.PrintInfo(rOStream); + rOStream << std::endl; + rThis.PrintData(rOStream); + return rOStream; + } + +} // namespace Kratos diff --git a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_rangel_area_time.cpp b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_rangel_area_time.cpp new file mode 100644 index 000000000000..c04b8becce44 --- /dev/null +++ b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_rangel_area_time.cpp @@ -0,0 +1,68 @@ +// Kratos Multi-Physics - ThermalDEM Application +// +// License: BSD License +// Kratos default license: kratos/license.txt +// +// Main authors: Rafael Rangel (rrangel@cimne.upc.edu) +// + +// System includes + +// External includes + +// Project includes +#include "real_contact_rangel_area_time.h" + +namespace Kratos { + //----------------------------------------------------------------------------------------------------------------------- + RealContactRangelAreaTime::RealContactRangelAreaTime() {} + RealContactRangelAreaTime::~RealContactRangelAreaTime() {} + + //------------------------------------------------------------------------------------------------------------ + void RealContactRangelAreaTime::AdjustContact(const ProcessInfo& r_process_info, ThermalSphericParticle* particle) { + KRATOS_TRY + + // Simulation and real values of effective Young modulus + const double eff_young = particle->ComputeEffectiveYoung(); + const double eff_young_real = particle->ComputeEffectiveYoungReal(); + + // Get collision time + typename ThermalSphericParticle::ContactParams contact_params = particle->GetContactParameters(); + const double col_time = r_process_info[TIME] - contact_params.impact_time; + const double col_time_max = particle->ComputeMaxCollisionTime(); + const double col_time_max_real = particle->ComputeMaxCollisionTimeReal(); + + // Area correction + if (particle->mNeighborType & PARTICLE_NEIGHBOR) { + const double r1 = particle->GetParticleRadius(); + const double r2 = particle->GetNeighborRadius(); + const double d_sim = particle->mNeighborDistance; + const double overlap_sim = r1 + r2 - d_sim; + const double overlap_real = pow(eff_young/eff_young_real, 2.0/3.0) * overlap_sim; + const double d_real = r1 + r2 - overlap_real; + particle->mContactRadiusAdjusted = sqrt(std::abs(r1 * r1 - pow(((r1 * r1 - r2 * r2 + d_real * d_real) / (2.0 * d_real)), 2.0))); + } + else if (particle->mNeighborType & WALL_NEIGHBOR) { + const double r1 = particle->GetParticleRadius(); + const double d_sim = particle->mNeighborDistance; + const double overlap_sim = r1 - d_sim; + const double overlap_real = pow(eff_young/eff_young_real, 2.0/3.0) * overlap_sim; + const double d_real = r1 - overlap_real; + particle->mContactRadiusAdjusted = sqrt(r1 * r1 - d_real * d_real); + } + + // Time correction + double correction_time = 1.0; + if (col_time < col_time_max) { + correction_time = pow(col_time_max_real / col_time_max, 2.0 / 3.0); + particle->mContactRadiusAdjusted *= correction_time; + } + + // Compute adjusted distance/separation from adjusted contact radius + particle->mNeighborDistanceAdjusted = particle->ComputeDistanceToNeighborAdjusted(); + particle->mNeighborSeparationAdjusted = particle->ComputeSeparationToNeighborAdjusted(); + + KRATOS_CATCH("") + } + +} // namespace Kratos diff --git a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_rangel_area_time.h b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_rangel_area_time.h new file mode 100644 index 000000000000..62c22044ee72 --- /dev/null +++ b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_rangel_area_time.h @@ -0,0 +1,80 @@ +// Kratos Multi-Physics - ThermalDEM Application +// +// License: BSD License +// Kratos default license: kratos/license.txt +// +// Main authors: Rafael Rangel (rrangel@cimne.upc.edu) +// + +#pragma once + +// System includes + +// External includes + +// Project includes +#include "real_contact_model.h" +#include "custom_elements/thermal_spheric_particle.h" + +namespace Kratos +{ + class KRATOS_API(THERMAL_DEM_APPLICATION) RealContactRangelAreaTime : public RealContactModel + { + public: + + // Pointer definition + KRATOS_CLASS_POINTER_DEFINITION(RealContactRangelAreaTime); + + // Constructor / Destructor + RealContactRangelAreaTime(); + virtual ~RealContactRangelAreaTime(); + + // Public methods + void AdjustContact(const ProcessInfo& r_process_info, ThermalSphericParticle* particle) override; + + // Clone + RealContactModel* CloneRaw() const override { + RealContactModel* cloned_model(new RealContactRangelAreaTime(*this)); + return cloned_model; + } + + RealContactModel::Pointer CloneShared() const override { + RealContactModel::Pointer cloned_model(new RealContactRangelAreaTime(*this)); + return cloned_model; + } + + // Turn back information as a string + virtual std::string Info() const override { + std::stringstream buffer; + buffer << "RealContactRangelAreaTime"; + return buffer.str(); + } + + // Print object information + virtual void PrintInfo(std::ostream& rOStream) const override { rOStream << "RealContactRangelAreaTime"; } + virtual void PrintData(std::ostream& rOStream) const override {} + + private: + + // Assignment operator / Copy constructor + RealContactRangelAreaTime& operator=(RealContactRangelAreaTime const& rOther) {return *this;} + RealContactRangelAreaTime(RealContactRangelAreaTime const& rOther) {*this = rOther;} + + }; // Class RealContactRangelAreaTime + + // input stream function + inline std::istream& operator>>(std::istream& rIStream, + RealContactRangelAreaTime& rThis) { + return rIStream; + } + + // output stream function + inline std::ostream& operator<<(std::ostream& rOStream, + const RealContactRangelAreaTime& rThis) { + rThis.PrintInfo(rOStream); + rOStream << std::endl; + rThis.PrintData(rOStream); + return rOStream; + } + +} // namespace Kratos diff --git a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_zhou.h b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_zhou.h index 7dc9cdb9a871..5ea3f7870bc2 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_zhou.h +++ b/applications/ThermalDEMApplication/custom_constitutive/real_contact/real_contact_zhou.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(REAL_CONTACT_MODEL_ZHOU_H_INCLUDED) -#define REAL_CONTACT_MODEL_ZHOU_H_INCLUDED +#pragma once // System includes @@ -79,5 +78,3 @@ namespace Kratos } } // namespace Kratos - -#endif // REAL_CONTACT_MODEL_ZHOU_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_constitutive/sintering_continuum.cpp b/applications/ThermalDEMApplication/custom_constitutive/sintering_continuum.cpp index a5a80bbbc910..3ba02f3c56f8 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/sintering_continuum.cpp +++ b/applications/ThermalDEMApplication/custom_constitutive/sintering_continuum.cpp @@ -264,7 +264,7 @@ namespace Kratos else { // tension if (failure_type == 0) { LocalElasticContactForce[2] = -kn * (indentation - sintering_displ) * 0.666666666666666; - if (fabs(LocalElasticContactForce[2]) > limit_force) { + if (std::abs(LocalElasticContactForce[2]) > limit_force) { failure_type = 4; // tension failure LocalElasticContactForce[2] = 0.0; } diff --git a/applications/ThermalDEMApplication/custom_constitutive/sintering_continuum.h b/applications/ThermalDEMApplication/custom_constitutive/sintering_continuum.h index 7066b3e5fee1..1e65b37e99fa 100644 --- a/applications/ThermalDEMApplication/custom_constitutive/sintering_continuum.h +++ b/applications/ThermalDEMApplication/custom_constitutive/sintering_continuum.h @@ -12,8 +12,7 @@ It is intended to be used with the sintering continuun particle, which also came from the DEMApp. */ -#if !defined(SINTERING_CONTINUUM_H_INCLUDED) -#define SINTERING_CONTINUUM_H_INCLUDED +#pragma once // System includes #include @@ -159,5 +158,3 @@ namespace Kratos }; // class SinteringContinuum } // namespace Kratos - -#endif // SINTERING_CONTINUUM_H_INCLUDED defined diff --git a/applications/ThermalDEMApplication/custom_elements/sintering_spheric_continuum_particle.h b/applications/ThermalDEMApplication/custom_elements/sintering_spheric_continuum_particle.h index e70473449c97..d5831996aa93 100644 --- a/applications/ThermalDEMApplication/custom_elements/sintering_spheric_continuum_particle.h +++ b/applications/ThermalDEMApplication/custom_elements/sintering_spheric_continuum_particle.h @@ -15,8 +15,7 @@ template thermal_spheric_particle. */ -#if !defined(KRATOS_SINTERING_SPHERIC_CONTINUUM_PARTICLE_H_INCLUDED) -#define KRATOS_SINTERING_SPHERIC_CONTINUUM_PARTICLE_H_INCLUDED +#pragma once // System includes #include @@ -85,5 +84,3 @@ namespace Kratos }; // Class SinteringSphericContinuumParticle } // namespace Kratos - -#endif // KRATOS_SINTERING_SPHERIC_CONTINUUM_PARTICLE_H_INCLUDED defined diff --git a/applications/ThermalDEMApplication/custom_elements/thermal_spheric_continuum_particle.h b/applications/ThermalDEMApplication/custom_elements/thermal_spheric_continuum_particle.h index 8181fa1eba9c..dcf6a14757f5 100644 --- a/applications/ThermalDEMApplication/custom_elements/thermal_spheric_continuum_particle.h +++ b/applications/ThermalDEMApplication/custom_elements/thermal_spheric_continuum_particle.h @@ -17,8 +17,7 @@ HOWEVER, THE THERMAL BEHAVIOR IMPLEMENTED HERE CAN BE BETTER SIMULATED WITH THE NEW THERMAL SPHERIC PARTICLE. */ -#if !defined(KRATOS_THERMAL_SPHERIC_CONTINUUM_PARTICLE_H_INCLUDED) -#define KRATOS_THERMAL_SPHERIC_CONTINUUM_PARTICLE_H_INCLUDED +#pragma once // System includes #include @@ -116,5 +115,3 @@ namespace Kratos }; // Class ThermalSphericContinuumParticle }// namespace Kratos - -#endif // KRATOS_THERMAL_SPHERIC_CONTINUUM_PARTICLE_H_INCLUDED defined diff --git a/applications/ThermalDEMApplication/custom_elements/thermal_spheric_particle.cpp b/applications/ThermalDEMApplication/custom_elements/thermal_spheric_particle.cpp index 099635881ef4..ab299180a388 100644 --- a/applications/ThermalDEMApplication/custom_elements/thermal_spheric_particle.cpp +++ b/applications/ThermalDEMApplication/custom_elements/thermal_spheric_particle.cpp @@ -149,17 +149,25 @@ namespace Kratos r_properties.HasTable(TEMPERATURE, THERMAL_EXPANSION_COEFFICIENT); mStoreContactParam = mHasMotion && - (r_process_info[HEAT_GENERATION_OPTION] || - (r_process_info[DIRECT_CONDUCTION_OPTION] && r_process_info[DIRECT_CONDUCTION_MODEL_NAME].compare("collisional") == 0)); + (r_process_info[HEAT_GENERATION_OPTION] || + (r_process_info[DIRECT_CONDUCTION_OPTION] && r_process_info[DIRECT_CONDUCTION_MODEL_NAME].compare("collisional") == 0) || + (r_process_info[REAL_CONTACT_OPTION] && (r_process_info[REAL_CONTACT_MODEL_NAME].compare("morris_area_time") == 0 || + r_process_info[REAL_CONTACT_MODEL_NAME].compare("rangel_area_time") == 0))); // Clear maps mContactParamsParticle.clear(); mContactParamsWall.clear(); // Initialize accumulated energy dissipations - mPreviousViscodampingEnergy = 0.0; - mPreviousFrictionalEnergy = 0.0; - mPreviousRollResistEnergy = 0.0; + mPreviousViscodampingEnergy = 0.0; + mPreviousFrictionalEnergy = 0.0; + mPreviousRollResistEnergy = 0.0; + mGenerationThermalEnergy_damp_particle = 0.0; + mGenerationThermalEnergy_damp_wall = 0.0; + mGenerationThermalEnergy_slid_particle = 0.0; + mGenerationThermalEnergy_slid_wall = 0.0; + mGenerationThermalEnergy_roll_particle = 0.0; + mGenerationThermalEnergy_roll_wall = 0.0; KRATOS_CATCH("") } @@ -812,8 +820,9 @@ namespace Kratos double ThermalSphericParticle::ComputeFourierNumber(void) { KRATOS_TRY - const double col_time_max = ComputeMaxCollisionTime(); - const double Rc_max = ComputeMaxContactRadius(); + // ATTENTION: Assumption: Original model was not assumed real Young modulus for col_time_max and Rc_max! + const double col_time_max = ComputeMaxCollisionTimeReal(); + const double Rc_max = ComputeMaxContactRadiusReal(); if (Rc_max > 0.0) return GetParticleConductivity() * col_time_max / (GetParticleDensity() * GetParticleHeatCapacity() * Rc_max * Rc_max); @@ -829,13 +838,30 @@ namespace Kratos const double eff_radius = ComputeEffectiveRadius(); const double eff_mass = ComputeEffectiveMass(); - const double eff_young = ComputeEffectiveYoungReal(); // ATTENTION: Assumption: Original model was not assumed real Young modulus! - const double impact_normal_velocity = fabs(GetContactParameters().impact_velocity[0]); + const double eff_young = ComputeEffectiveYoung(); + const double impact_normal_velocity = std::abs(GetContactParameters().impact_velocity[0]); if (impact_normal_velocity != 0.0) return 2.87 * pow(eff_mass * eff_mass / (eff_radius * eff_young * eff_young * impact_normal_velocity), 0.2); else - return std::numeric_limits::max(); + return 0.0; + + KRATOS_CATCH("") + } + + //------------------------------------------------------------------------------------------------------------ + double ThermalSphericParticle::ComputeMaxCollisionTimeReal(void) { + KRATOS_TRY + + const double eff_radius = ComputeEffectiveRadius(); + const double eff_mass = ComputeEffectiveMass(); + const double eff_young = ComputeEffectiveYoungReal(); + const double impact_normal_velocity = std::abs(GetContactParameters().impact_velocity[0]); + + if (impact_normal_velocity != 0.0) + return 2.87 * pow(eff_mass * eff_mass / (eff_radius * eff_young * eff_young * impact_normal_velocity), 0.2); + else + return 0.0; KRATOS_CATCH("") } @@ -846,8 +872,22 @@ namespace Kratos const double eff_radius = ComputeEffectiveRadius(); const double eff_mass = ComputeEffectiveMass(); - const double eff_young = ComputeEffectiveYoungReal(); // ATTENTION: Assumption: Original model was not assumed real Young modulus! - const double impact_normal_velocity = fabs(GetContactParameters().impact_velocity[0]); + const double eff_young = ComputeEffectiveYoung(); + const double impact_normal_velocity = std::abs(GetContactParameters().impact_velocity[0]); + + return pow(15.0 * eff_mass * eff_radius * eff_radius * impact_normal_velocity * impact_normal_velocity / (16.0 * eff_young), 0.2); + + KRATOS_CATCH("") + } + + //------------------------------------------------------------------------------------------------------------ + double ThermalSphericParticle::ComputeMaxContactRadiusReal(void) { + KRATOS_TRY + + const double eff_radius = ComputeEffectiveRadius(); + const double eff_mass = ComputeEffectiveMass(); + const double eff_young = ComputeEffectiveYoungReal(); + const double impact_normal_velocity = std::abs(GetContactParameters().impact_velocity[0]); return pow(15.0 * eff_mass * eff_radius * eff_radius * impact_normal_velocity * impact_normal_velocity / (16.0 * eff_young), 0.2); @@ -864,7 +904,7 @@ namespace Kratos if (mNeighborType & PARTICLE_NEIGHBOR) { const double r1 = GetParticleRadius(); const double r2 = GetNeighborRadius(); - Rc = sqrt(fabs(r1 * r1 - pow(((r1 * r1 - r2 * r2 + mNeighborDistance * mNeighborDistance) / (2.0 * mNeighborDistance)), 2.0))); + Rc = sqrt(std::abs(r1 * r1 - pow(((r1 * r1 - r2 * r2 + mNeighborDistance * mNeighborDistance) / (2.0 * mNeighborDistance)), 2.0))); } else if (mNeighborType & WALL_NEIGHBOR) { const double r = GetParticleRadius(); diff --git a/applications/ThermalDEMApplication/custom_elements/thermal_spheric_particle.h b/applications/ThermalDEMApplication/custom_elements/thermal_spheric_particle.h index 31f148b66457..6b10e6e2a1f6 100644 --- a/applications/ThermalDEMApplication/custom_elements/thermal_spheric_particle.h +++ b/applications/ThermalDEMApplication/custom_elements/thermal_spheric_particle.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(KRATOS_THERMAL_SPHERIC_PARTICLE_H_INCLUDED) -#define KRATOS_THERMAL_SPHERIC_PARTICLE_H_INCLUDED +#pragma once // System includes #include @@ -105,7 +104,9 @@ namespace Kratos double ComputeSeparationToNeighborAdjusted (void); double ComputeFourierNumber (void); double ComputeMaxCollisionTime (void); + double ComputeMaxCollisionTimeReal (void); double ComputeMaxContactRadius (void); + double ComputeMaxContactRadiusReal (void); double ComputeContactRadius (void); double ComputeEffectiveRadius (void); double ComputeEffectiveMass (void); @@ -240,6 +241,12 @@ namespace Kratos double mPreviousViscodampingEnergy; // accumulated energy dissipation from previous interaction: viscodamping double mPreviousFrictionalEnergy; // accumulated energy dissipation from previous interaction: frictional double mPreviousRollResistEnergy; // accumulated energy dissipation from previous interaction: rolling resistance + double mGenerationThermalEnergy_damp_particle; + double mGenerationThermalEnergy_damp_wall; + double mGenerationThermalEnergy_slid_particle; + double mGenerationThermalEnergy_slid_wall; + double mGenerationThermalEnergy_roll_particle; + double mGenerationThermalEnergy_roll_wall; // Heat maps std::vector>> mHeatMapGenerationDampingPP; // Local heat map matrix for heat generaion by damping between particle-particle @@ -317,5 +324,3 @@ namespace Kratos } } // namespace Kratos - -#endif // KRATOS_THERMAL_SPHERIC_PARTICLE_H_INCLUDED defined diff --git a/applications/ThermalDEMApplication/custom_python/add_custom_constitutive_laws_to_python.cpp b/applications/ThermalDEMApplication/custom_python/add_custom_constitutive_laws_to_python.cpp index 72d5303c75a3..ab305df47343 100644 --- a/applications/ThermalDEMApplication/custom_python/add_custom_constitutive_laws_to_python.cpp +++ b/applications/ThermalDEMApplication/custom_python/add_custom_constitutive_laws_to_python.cpp @@ -37,8 +37,11 @@ #include "custom_constitutive/generation/generation_dissipation.h" #include "custom_constitutive/real_contact/real_contact_model.h" #include "custom_constitutive/real_contact/real_contact_lu.h" -#include "custom_constitutive/real_contact/real_contact_morris.h" #include "custom_constitutive/real_contact/real_contact_zhou.h" +#include "custom_constitutive/real_contact/real_contact_morris_area.h" +#include "custom_constitutive/real_contact/real_contact_morris_area_time.h" +#include "custom_constitutive/real_contact/real_contact_rangel_area.h" +#include "custom_constitutive/real_contact/real_contact_rangel_area_time.h" #include "custom_constitutive/sintering_continuum.h" #include "custom_constitutive/DEM_KDEM_CL.h" @@ -158,10 +161,19 @@ namespace Kratos py::class_(m, "RealContactLu") .def(py::init<>()); - py::class_(m, "RealContactMorris") + py::class_(m, "RealContactZhou") .def(py::init<>()); - py::class_(m, "RealContactZhou") + py::class_(m, "RealContactMorrisArea") + .def(py::init<>()); + + py::class_(m, "RealContactMorrisAreaTime") + .def(py::init<>()); + + py::class_(m, "RealContactRangelArea") + .def(py::init<>()); + + py::class_(m, "RealContactRangelAreaTime") .def(py::init<>()); // Sintering --------------------------------------------------------------------------------------------------------------- diff --git a/applications/ThermalDEMApplication/custom_python/add_custom_constitutive_laws_to_python.h b/applications/ThermalDEMApplication/custom_python/add_custom_constitutive_laws_to_python.h index 5022837063a9..578d2588fe83 100644 --- a/applications/ThermalDEMApplication/custom_python/add_custom_constitutive_laws_to_python.h +++ b/applications/ThermalDEMApplication/custom_python/add_custom_constitutive_laws_to_python.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(KRATOS_ADD_CUSTOM_CONSTITUTIVE_LAWS_TO_PYTHON_H_INCLUDED) -#define KRATOS_ADD_CUSTOM_CONSTITUTIVE_LAWS_TO_PYTHON_H_INCLUDED +#pragma once // System includes #include @@ -27,5 +26,3 @@ namespace Kratos } // namespace Python } // namespace Kratos - -#endif // KRATOS_ADD_CUSTOM_CONSTITUTIVE_LAWS_TO_PYTHON_H_INCLUDED defined diff --git a/applications/ThermalDEMApplication/custom_python/add_custom_processes_to_python.h b/applications/ThermalDEMApplication/custom_python/add_custom_processes_to_python.h index 511895a54b4c..699fd8dc48c9 100644 --- a/applications/ThermalDEMApplication/custom_python/add_custom_processes_to_python.h +++ b/applications/ThermalDEMApplication/custom_python/add_custom_processes_to_python.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(KRATOS_ADD_CUSTOM_PROCESSES_TO_PYTHON_H_INCLUDED) -#define KRATOS_ADD_CUSTOM_PROCESSES_TO_PYTHON_H_INCLUDED +#pragma once // System includes #include @@ -27,5 +26,3 @@ namespace Kratos } // namespace Python } // namespace Kratos - -#endif // KRATOS_ADD_CUSTOM_PROCESSES_TO_PYTHON_H_INCLUDED defined diff --git a/applications/ThermalDEMApplication/custom_python/add_custom_strategies_to_python.h b/applications/ThermalDEMApplication/custom_python/add_custom_strategies_to_python.h index 88c79508d372..594a64f7d2e7 100644 --- a/applications/ThermalDEMApplication/custom_python/add_custom_strategies_to_python.h +++ b/applications/ThermalDEMApplication/custom_python/add_custom_strategies_to_python.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(KRATOS_ADD_CUSTOM_STRATEGIES_TO_PYTHON_H_INCLUDED) -#define KRATOS_ADD_CUSTOM_STRATEGIES_TO_PYTHON_H_INCLUDED +#pragma once // System includes #include @@ -27,5 +26,3 @@ namespace Kratos } // namespace Python } // namespace Kratos - -#endif // KRATOS_ADD_CUSTOM_STRATEGIES_TO_PYTHON_H_INCLUDED defined diff --git a/applications/ThermalDEMApplication/custom_python/add_custom_utilities_to_python.h b/applications/ThermalDEMApplication/custom_python/add_custom_utilities_to_python.h index 45a9f8ee4094..d8eb2f696d51 100644 --- a/applications/ThermalDEMApplication/custom_python/add_custom_utilities_to_python.h +++ b/applications/ThermalDEMApplication/custom_python/add_custom_utilities_to_python.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(KRATOS_ADD_CUSTOM_UTILITIES_TO_PYTHON_H_INCLUDED) -#define KRATOS_ADD_CUSTOM_UTILITIES_TO_PYTHON_H_INCLUDED +#pragma once // System includes #include @@ -27,5 +26,3 @@ namespace Kratos } // namespace Python } // namespace Kratos - -#endif // KRATOS_ADD_CUSTOM_UTILITIES_TO_PYTHON_H_INCLUDED defined diff --git a/applications/ThermalDEMApplication/custom_strategies/schemes/thermal_dem_integration_scheme.h b/applications/ThermalDEMApplication/custom_strategies/schemes/thermal_dem_integration_scheme.h index 9e110f6e1ce9..2869466a8004 100644 --- a/applications/ThermalDEMApplication/custom_strategies/schemes/thermal_dem_integration_scheme.h +++ b/applications/ThermalDEMApplication/custom_strategies/schemes/thermal_dem_integration_scheme.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(KRATOS_THERMAL_DEM_INTEGRATION_SCHEME_H_INCLUDED) -#define KRATOS_THERMAL_DEM_INTEGRATION_SCHEME_H_INCLUDED +#pragma once // System includes #include @@ -91,5 +90,3 @@ namespace Kratos } } // namespace Kratos - -#endif // KRATOS_THERMAL_DEM_INTEGRATION_SCHEME_H_INCLUDED defined diff --git a/applications/ThermalDEMApplication/custom_strategies/schemes/thermal_forward_euler_scheme.h b/applications/ThermalDEMApplication/custom_strategies/schemes/thermal_forward_euler_scheme.h index 80739af16bbd..c1ee7888c0e9 100644 --- a/applications/ThermalDEMApplication/custom_strategies/schemes/thermal_forward_euler_scheme.h +++ b/applications/ThermalDEMApplication/custom_strategies/schemes/thermal_forward_euler_scheme.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(KRATOS_THERMAL_FORWARD_EULER_SCHEME_H_INCLUDED) -#define KRATOS_THERMAL_FORWARD_EULER_SCHEME_H_INCLUDED +#pragma once // System includes #include @@ -83,5 +82,3 @@ namespace Kratos } } // namespace Kratos - -#endif // KRATOS_THERMAL_FORWARD_EULER_SCHEME_H_INCLUDED defined diff --git a/applications/ThermalDEMApplication/custom_strategies/strategies/thermal_explicit_solver_strategy.h b/applications/ThermalDEMApplication/custom_strategies/strategies/thermal_explicit_solver_strategy.h index 185a393c4cbd..f4021a395751 100644 --- a/applications/ThermalDEMApplication/custom_strategies/strategies/thermal_explicit_solver_strategy.h +++ b/applications/ThermalDEMApplication/custom_strategies/strategies/thermal_explicit_solver_strategy.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(KRATOS_THERMAL_EXPLICIT_SOLVER_STRATEGY_H_INCLUDED) -#define KRATOS_THERMAL_EXPLICIT_SOLVER_STRATEGY_H_INCLUDED +#pragma once // System includes @@ -61,5 +60,3 @@ namespace Kratos }; // Class ThermalExplicitSolverStrategy } // namespace Kratos - -#endif // KRATOS_THERMAL_EXPLICIT_SOLVER_STRATEGY_H_INCLUDED defined diff --git a/applications/ThermalDEMApplication/custom_utilities/graph_utilities.cpp b/applications/ThermalDEMApplication/custom_utilities/graph_utilities.cpp index ff69245b5504..e11cb79fa62d 100644 --- a/applications/ThermalDEMApplication/custom_utilities/graph_utilities.cpp +++ b/applications/ThermalDEMApplication/custom_utilities/graph_utilities.cpp @@ -15,16 +15,18 @@ namespace Kratos { //----------------------------------------------------------------------------------------------------------------------- - GraphUtilities::GraphUtilities() - { - mGraph_ParticleTempMin = false; - mGraph_ParticleTempMax = false; - mGraph_ParticleTempAvg = false; - mGraph_ParticleTempDev = false; - mGraph_ModelTempAvg = false; - mGraph_ParticleHeatFluxContributions = false; - mGraph_ParticleHeatGenContributions = false; - mGraph_ParticleEnergyContributions = false; + GraphUtilities::GraphUtilities() { + mGraph_ParticleTempMin = false; + mGraph_ParticleTempMax = false; + mGraph_ParticleTempAvg = false; + mGraph_ParticleTempAvgVol = false; + mGraph_ParticleTempDev = false; + mGraph_EnergyMechanical = false; + mGraph_EnergyDissipated = false; + mGraph_EnergyThermal = false; + mGraph_HeatFluxContributions = false; + mGraph_HeatGenValues = false; + mGraph_HeatGenContributions = false; } GraphUtilities::~GraphUtilities() {} @@ -33,28 +35,60 @@ namespace Kratos { void GraphUtilities::ExecuteInitialize(bool ParticleTempMin, bool ParticleTempMax, bool ParticleTempAvg, + bool ParticleTempAvgVol, bool ParticleTempDev, - bool ModelTempAvg, - bool ParticleHeatFluxContributions, - bool ParticleHeatGenContributions, - bool ParticleEnergyContributions) + bool EnergyMechanical, + bool EnergyDissipated, + bool EnergyThermal, + bool HeatFluxContributions, + bool HeatGenValues, + bool HeatGenContributions) { KRATOS_TRY // Set member flags - mGraph_ParticleTempMin = ParticleTempMin; - mGraph_ParticleTempMax = ParticleTempMax; - mGraph_ParticleTempAvg = ParticleTempAvg; - mGraph_ParticleTempDev = ParticleTempDev; - mGraph_ModelTempAvg = ModelTempAvg; - mGraph_ParticleHeatFluxContributions = ParticleHeatFluxContributions; - mGraph_ParticleHeatGenContributions = ParticleHeatGenContributions; - mGraph_ParticleEnergyContributions = ParticleEnergyContributions; + mGraph_ParticleTempMin = ParticleTempMin; + mGraph_ParticleTempMax = ParticleTempMax; + mGraph_ParticleTempAvg = ParticleTempAvg; + mGraph_ParticleTempAvgVol = ParticleTempAvgVol; + mGraph_ParticleTempDev = ParticleTempDev; + mGraph_EnergyMechanical = EnergyMechanical; + mGraph_EnergyDissipated = EnergyDissipated; + mGraph_EnergyThermal = EnergyThermal; + mGraph_HeatFluxContributions = HeatFluxContributions; + mGraph_HeatGenValues = HeatGenValues; + mGraph_HeatGenContributions = HeatGenContributions; // Open files + OpenFiles(); + + KRATOS_CATCH("") + } + + //----------------------------------------------------------------------------------------------------------------------- + void GraphUtilities::ExecuteFinalizeSolutionStep(ModelPart& rModelPart) { + KRATOS_TRY + + if (rModelPart.GetProcessInfo()[IS_TIME_TO_PRINT]) + WriteGraphs(rModelPart); + + KRATOS_CATCH("") + } + + //----------------------------------------------------------------------------------------------------------------------- + void GraphUtilities::ExecuteFinalize(void) { + KRATOS_TRY + + CloseFiles(); + + KRATOS_CATCH("") + } + + //----------------------------------------------------------------------------------------------------------------------- + void GraphUtilities::OpenFiles(void) { if (mGraph_ParticleTempMin) { mFile_ParticleTempMin.open("graph_particle_temp_min.txt", std::ios::out); - KRATOS_ERROR_IF_NOT(mFile_ParticleTempMin) << "Could not open graph file for minimum particle temperature!" << std::endl; + KRATOS_ERROR_IF_NOT(mFile_ParticleTempMin) << "Could not open graph_particle_temp_min.txt!" << std::endl; mFile_ParticleTempMin << "1 - TIME STEP | "; mFile_ParticleTempMin << "2 - TIME | "; mFile_ParticleTempMin << "3 - MIN PARTICLE TEMPERATURE"; @@ -62,7 +96,7 @@ namespace Kratos { } if (mGraph_ParticleTempMax) { mFile_ParticleTempMax.open("graph_particle_temp_max.txt", std::ios::out); - KRATOS_ERROR_IF_NOT(mFile_ParticleTempMax) << "Could not open graph file for maximum particle temperature!" << std::endl; + KRATOS_ERROR_IF_NOT(mFile_ParticleTempMax) << "Could not open graph_particle_temp_max.txt!" << std::endl; mFile_ParticleTempMax << "1 - TIME STEP | "; mFile_ParticleTempMax << "2 - TIME | "; mFile_ParticleTempMax << "3 - MAX PARTICLE TEMPERATURE"; @@ -70,244 +104,320 @@ namespace Kratos { } if (mGraph_ParticleTempAvg) { mFile_ParticleTempAvg.open("graph_particle_temp_avg.txt", std::ios::out); - KRATOS_ERROR_IF_NOT(mFile_ParticleTempAvg) << "Could not open graph file for average particle temperature!" << std::endl; + KRATOS_ERROR_IF_NOT(mFile_ParticleTempAvg) << "Could not open graph_particle_temp_avg.txt!" << std::endl; mFile_ParticleTempAvg << "1 - TIME STEP | "; mFile_ParticleTempAvg << "2 - TIME | "; mFile_ParticleTempAvg << "3 - AVERAGE PARTICLE TEMPERATURE"; mFile_ParticleTempAvg << std::endl; } + if (mGraph_ParticleTempAvgVol) { + mFile_ParticleTempAvgVol.open("graph_particle_temp_avg_vol.txt", std::ios::out); + KRATOS_ERROR_IF_NOT(mFile_ParticleTempAvgVol) << "Could not open graph_particle_temp_avg_vol.txt!" << std::endl; + mFile_ParticleTempAvgVol << "1 - TIME STEP | "; + mFile_ParticleTempAvgVol << "2 - TIME | "; + mFile_ParticleTempAvgVol << "3 - AVERAGE PARTICLE TEMPERATURE (VOLUME WEIGHTED)"; + mFile_ParticleTempAvgVol << std::endl; + } if (mGraph_ParticleTempDev) { mFile_ParticleTempDev.open("graph_particle_temp_dev.txt", std::ios::out); - KRATOS_ERROR_IF_NOT(mFile_ParticleTempDev) << "Could not open graph file for deviation of particle temperature!" << std::endl; + KRATOS_ERROR_IF_NOT(mFile_ParticleTempDev) << "Could not open graph_particle_temp_dev.txt!" << std::endl; mFile_ParticleTempDev << "1 - TIME STEP | "; mFile_ParticleTempDev << "2 - TIME | "; mFile_ParticleTempDev << "3 - PARTICLE TEMPERATURE STANDARD DEVIATION"; mFile_ParticleTempDev << std::endl; } - if (mGraph_ModelTempAvg) { - mFile_ModelTempAvg.open("graph_model_temp_avg.txt", std::ios::out); - KRATOS_ERROR_IF_NOT(mFile_ModelTempAvg) << "Could not open graph file for average model temperature!" << std::endl; - mFile_ModelTempAvg << "1 - TIME STEP | "; - mFile_ModelTempAvg << "2 - TIME | "; - mFile_ModelTempAvg << "3 - AVERAGE MODEL TEMPERATURE"; - mFile_ModelTempAvg << std::endl; + if (mGraph_EnergyMechanical) { + mFile_EnergyMechanical.open("graph_energy_mechanical.txt", std::ios::out); + KRATOS_ERROR_IF_NOT(mFile_EnergyMechanical) << "Could not open graph_energy_mechanical.txt!" << std::endl; + mFile_EnergyMechanical << "1 - TIME STEP | "; + mFile_EnergyMechanical << "2 - TIME | "; + mFile_EnergyMechanical << "3 - GRAVITY | "; + mFile_EnergyMechanical << "4 - ELASTIC | "; + mFile_EnergyMechanical << "5 - KINETIC TRANSLATION | "; + mFile_EnergyMechanical << "6 - KINETIC ROTATION | "; + mFile_EnergyMechanical << "7 - TOTAL"; + mFile_EnergyMechanical << std::endl; } - if (mGraph_ParticleHeatFluxContributions) { - mFile_ParticleHeatFluxContributions.open("graph_flux_contributions.txt", std::ios::out); - KRATOS_ERROR_IF_NOT(mFile_ParticleHeatFluxContributions) << "Could not open graph file for heat flux contributions!" << std::endl; - mFile_ParticleHeatFluxContributions << "1 - TIME STEP | "; - mFile_ParticleHeatFluxContributions << "2 - TIME | "; - mFile_ParticleHeatFluxContributions << "3 - DIRECT CONDUCTION | "; - mFile_ParticleHeatFluxContributions << "4 - INDIRECT CONDUCTION | "; - mFile_ParticleHeatFluxContributions << "5 - RADIATION | "; - mFile_ParticleHeatFluxContributions << "6 - GENERATION | "; - mFile_ParticleHeatFluxContributions << "7 - CONVECTION | "; - mFile_ParticleHeatFluxContributions << "8 - SURFACE PRESCRIBED | "; - mFile_ParticleHeatFluxContributions << "9 - VOLUME PRESCRIBED"; - mFile_ParticleHeatFluxContributions << std::endl; + if (mGraph_EnergyDissipated) { + mFile_EnergyDissipated.open("graph_energy_dissipated.txt", std::ios::out); + KRATOS_ERROR_IF_NOT(mFile_EnergyDissipated) << "Could not open graph_energy_dissipated.txt!" << std::endl; + mFile_EnergyDissipated << "1 - TIME STEP | "; + mFile_EnergyDissipated << "2 - TIME | "; + mFile_EnergyDissipated << "3 - SLIDING | "; + mFile_EnergyDissipated << "4 - ROLLING | "; + mFile_EnergyDissipated << "5 - DAMPING | "; + mFile_EnergyDissipated << "6 - TOTAL (ACCUMULATED)"; + mFile_EnergyDissipated << std::endl; } - if (mGraph_ParticleHeatGenContributions) { - mFile_ParticleHeatGenContributions.open("graph_generation_contributions.txt", std::ios::out); - KRATOS_ERROR_IF_NOT(mFile_ParticleHeatGenContributions) << "Could not open graph file for heat generation contributions!" << std::endl; - mFile_ParticleHeatGenContributions << "1 - TIME STEP | "; - mFile_ParticleHeatGenContributions << "2 - TIME | "; - mFile_ParticleHeatGenContributions << "3 - SLIDING FRICTION PARTICLE-PARTICLE | "; - mFile_ParticleHeatGenContributions << "4 - SLIDING FRICTION PARTICLE-WALL | "; - mFile_ParticleHeatGenContributions << "5 - ROLLING FRICTION PARTICLE-PARTICLE | "; - mFile_ParticleHeatGenContributions << "6 - ROLLING FRICTION PARTICLE-WALL | "; - mFile_ParticleHeatGenContributions << "7 - DAMPING FORCE PARTICLE-PARTICLE | "; - mFile_ParticleHeatGenContributions << "8 - DAMPING FORCE PARTICLE-WALL"; - mFile_ParticleHeatGenContributions << std::endl; + if (mGraph_EnergyThermal) { + mFile_EnergyThermal.open("graph_energy_thermal.txt", std::ios::out); + KRATOS_ERROR_IF_NOT(mFile_EnergyThermal) << "Could not open graph file graph_energy_thermal.txt!" << std::endl; + mFile_EnergyThermal << "1 - TIME STEP | "; + mFile_EnergyThermal << "2 - TIME | "; + mFile_EnergyThermal << "3 - SLIDING PARTICLE-PARTICLE | "; + mFile_EnergyThermal << "4 - SLIDING PARTICLE-WALL | "; + mFile_EnergyThermal << "5 - ROLLING PARTICLE-PARTICLE | "; + mFile_EnergyThermal << "6 - ROLLING PARTICLE-WALL | "; + mFile_EnergyThermal << "7 - DAMPING PARTICLE-PARTICLE | "; + mFile_EnergyThermal << "8 - DAMPING PARTICLE-WALL | "; + mFile_EnergyThermal << "9 - TOTAL (ACCUMULATED)"; + mFile_EnergyThermal << std::endl; } - if (mGraph_ParticleEnergyContributions) { - mFile_ParticleEnergyContributions.open("graph_energy_contributions.txt", std::ios::out); - KRATOS_ERROR_IF_NOT(mFile_ParticleEnergyContributions) << "Could not open graph file for energy contributions!" << std::endl; - mFile_ParticleEnergyContributions << "1 - TIME STEP | "; - mFile_ParticleEnergyContributions << "2 - TIME | "; - mFile_ParticleEnergyContributions << "3 - GRAVITATIONAL | "; - mFile_ParticleEnergyContributions << "4 - ELASTIC | "; - mFile_ParticleEnergyContributions << "5 - KINETIC TRANSLATION | "; - mFile_ParticleEnergyContributions << "6 - KINETIC ROTATION | "; - mFile_ParticleEnergyContributions << "7 - TOTAL ENERGY | "; - mFile_ParticleEnergyContributions << "8 - ACCUMULATED DISSIP FRICTION | "; - mFile_ParticleEnergyContributions << "9 - ACCUMULATED DISSIP ROLL | "; - mFile_ParticleEnergyContributions << "10 - ACCUMULATED DISSIP DAMPING | "; - mFile_ParticleEnergyContributions << "11 - TOTAL ACCUMULATED DISSIP | "; - mFile_ParticleEnergyContributions << "12 - TOTAL ENERGY + ACCUMULATED DISSIP"; - mFile_ParticleEnergyContributions << std::endl; + if (mGraph_HeatFluxContributions) { + mFile_HeatFluxContributions.open("graph_heat_flux_contributions.txt", std::ios::out); + KRATOS_ERROR_IF_NOT(mFile_HeatFluxContributions) << "Could not open graph_heat_flux_contributions.txt!" << std::endl; + mFile_HeatFluxContributions << "1 - TIME STEP | "; + mFile_HeatFluxContributions << "2 - TIME | "; + mFile_HeatFluxContributions << "3 - CONDUCTION DIRECT | "; + mFile_HeatFluxContributions << "4 - CONDUCTION INDIRECT | "; + mFile_HeatFluxContributions << "5 - RADIATION | "; + mFile_HeatFluxContributions << "6 - GENERATION | "; + mFile_HeatFluxContributions << "7 - CONVECTION | "; + mFile_HeatFluxContributions << "8 - SURFACE PRESCRIBED | "; + mFile_HeatFluxContributions << "9 - VOLUME PRESCRIBED"; + mFile_HeatFluxContributions << std::endl; + } + if (mGraph_HeatGenValues) { + mFile_HeatGenValues.open("graph_heat_generation_values.txt", std::ios::out); + KRATOS_ERROR_IF_NOT(mFile_HeatGenValues) << "Could not open graph_heat_generation_values.txt!" << std::endl; + mFile_HeatGenValues << "1 - TIME STEP | "; + mFile_HeatGenValues << "2 - TIME | "; + mFile_HeatGenValues << "3 - SLIDING PARTICLE-PARTICLE | "; + mFile_HeatGenValues << "4 - SLIDING PARTICLE-WALL | "; + mFile_HeatGenValues << "5 - ROLLING PARTICLE-PARTICLE | "; + mFile_HeatGenValues << "6 - ROLLING PARTICLE-WALL | "; + mFile_HeatGenValues << "7 - DAMPING PARTICLE-PARTICLE | "; + mFile_HeatGenValues << "8 - DAMPING PARTICLE-WALL"; + mFile_HeatGenValues << "9 - TOTAL"; + mFile_HeatGenValues << std::endl; + } + if (mGraph_HeatGenContributions) { + mFile_HeatGenContributions.open("graph_heat_generation_contributions.txt", std::ios::out); + KRATOS_ERROR_IF_NOT(mFile_HeatGenContributions) << "Could not open graph_heat_generation_contributions.txt!" << std::endl; + mFile_HeatGenContributions << "1 - TIME STEP | "; + mFile_HeatGenContributions << "2 - TIME | "; + mFile_HeatGenContributions << "3 - SLIDING PARTICLE-PARTICLE | "; + mFile_HeatGenContributions << "4 - SLIDING PARTICLE-WALL | "; + mFile_HeatGenContributions << "5 - ROLLING PARTICLE-PARTICLE | "; + mFile_HeatGenContributions << "6 - ROLLING PARTICLE-WALL | "; + mFile_HeatGenContributions << "7 - DAMPING PARTICLE-PARTICLE | "; + mFile_HeatGenContributions << "8 - DAMPING PARTICLE-WALL"; + mFile_HeatGenContributions << std::endl; } - - KRATOS_CATCH("") } //----------------------------------------------------------------------------------------------------------------------- - void GraphUtilities::ExecuteFinalizeSolutionStep(ModelPart& rModelPart) - { + void GraphUtilities::WriteGraphs(ModelPart& rModelPart) { KRATOS_TRY + // Initialize results const ProcessInfo& r_process_info = rModelPart.GetProcessInfo(); - if (!r_process_info[IS_TIME_TO_PRINT]) - return; - // Initialize results - const int num_of_particles = rModelPart.NumberOfElements(); - int num_ratio_particles_flux = 0; - int num_ratio_particles_gen = 0; - double total_vol = 0.0; - - double particle_temp_min = DBL_MAX; - double particle_temp_max = -DBL_MAX; - double particle_temp_avg = 0.0; - double particle_temp_dev = 0.0; - double model_temp_avg = 0.0; - - double particle_flux_conducdir_ratio_avg = 0.0; - double particle_flux_conducindir_ratio_avg = 0.0; - double particle_flux_rad_ratio_avg = 0.0; - double particle_flux_gen_ratio_avg = 0.0; - double particle_flux_conv_ratio_avg = 0.0; - double particle_flux_prescsurf_ratio_avg = 0.0; - double particle_flux_prescvol_ratio_avg = 0.0; - - double particle_gen_slid_pp_ratio_avg = 0.0; - double particle_gen_slid_pw_ratio_avg = 0.0; - double particle_gen_roll_pp_ratio_avg = 0.0; - double particle_gen_roll_pw_ratio_avg = 0.0; - double particle_gen_damp_pp_ratio_avg = 0.0; - double particle_gen_damp_pw_ratio_avg = 0.0; - - double total_energy_potential_gravity = 0.0; - double total_energy_potential_elastic = 0.0; - double total_energy_kinetic_translation = 0.0; - double total_energy_kinetic_rotation = 0.0; - double total_energy = 0.0; - - double total_accum_energy_dissip_slid = 0.0; - double total_accum_energy_dissip_roll = 0.0; - double total_accum_energy_dissip_damp = 0.0; - double total_accum_energy_dissip = 0.0; + const int num_particles = rModelPart.NumberOfElements(); + int num_particles_flux_contrib = 0; + int num_particles_gen_contrib = 0; + double vol_total = 0.0; + + double particle_temp_min = DBL_MAX; + double particle_temp_max = -DBL_MAX; + double particle_temp_avg = 0.0; + double particle_temp_avg_vol = 0.0; + double particle_temp_dev = 0.0; + + double energy_mech_gravity_all = 0.0; + double energy_mech_elastic_all = 0.0; + double energy_mech_translation_all = 0.0; + double energy_mech_rotation_all = 0.0; + double energy_mech_all = 0.0; + + double energy_dissip_slid_all = 0.0; + double energy_dissip_roll_all = 0.0; + double energy_dissip_damp_all = 0.0; + double energy_dissip_all = 0.0; + + double energy_thermal_slid_pp_all = 0.0; + double energy_thermal_slid_pw_all = 0.0; + double energy_thermal_roll_pp_all = 0.0; + double energy_thermal_roll_pw_all = 0.0; + double energy_thermal_damp_pp_all = 0.0; + double energy_thermal_damp_pw_all = 0.0; + double energy_thermal_all = 0.0; + + double heat_flux_values_conducdir_all = 0.0; + double heat_flux_values_conducindir_all = 0.0; + double heat_flux_values_rad_all = 0.0; + double heat_flux_values_gen_all = 0.0; + double heat_flux_values_conv_all = 0.0; + double heat_flux_values_prescsurf_all = 0.0; + double heat_flux_values_prescvol_all = 0.0; + double heat_flux_values_all = 0.0; + + double heat_flux_contrib_conducdir = 0.0; + double heat_flux_contrib_conducindir = 0.0; + double heat_flux_contrib_rad = 0.0; + double heat_flux_contrib_gen = 0.0; + double heat_flux_contrib_conv = 0.0; + double heat_flux_contrib_prescsurf = 0.0; + double heat_flux_contrib_prescvol = 0.0; + + double heat_gen_values_slid_pp_all = 0.0; + double heat_gen_values_slid_pw_all = 0.0; + double heat_gen_values_roll_pp_all = 0.0; + double heat_gen_values_roll_pw_all = 0.0; + double heat_gen_values_damp_pp_all = 0.0; + double heat_gen_values_damp_pw_all = 0.0; + double heat_gen_values_all = 0.0; + + double heat_gen_contrib_slid_pp = 0.0; + double heat_gen_contrib_slid_pw = 0.0; + double heat_gen_contrib_roll_pp = 0.0; + double heat_gen_contrib_roll_pw = 0.0; + double heat_gen_contrib_damp_pp = 0.0; + double heat_gen_contrib_damp_pw = 0.0; ModelPart::ElementsContainerType::iterator it = rModelPart.GetCommunicator().LocalMesh().Elements().ptr_begin(); #pragma omp parallel for schedule(dynamic, 100) - for (int i = 0; i < num_of_particles; i++) { + for (int i = 0; i < num_particles; i++) { ThermalSphericParticle& particle = dynamic_cast (*(it+i)); - // Accumulate values - const double vol = particle.CalculateVolume(); - const double temp = particle.GetGeometry()[0].FastGetSolutionStepValue(TEMPERATURE); - double energy_potential_gravity = 0.0; - double energy_potential_elastic = 0.0; - double energy_kinetic_translation = 0.0; - double energy_kinetic_rotation = 0.0; - double accum_energy_dissip_slid = 0.0; - double accum_energy_dissip_roll = 0.0; - double accum_energy_dissip_damp = 0.0; - particle.Calculate(PARTICLE_GRAVITATIONAL_ENERGY, energy_potential_gravity, r_process_info); - particle.Calculate(PARTICLE_ELASTIC_ENERGY, energy_potential_elastic, r_process_info); - particle.Calculate(PARTICLE_TRANSLATIONAL_KINEMATIC_ENERGY, energy_kinetic_translation, r_process_info); - particle.Calculate(PARTICLE_ROTATIONAL_KINEMATIC_ENERGY, energy_kinetic_rotation, r_process_info); - particle.Calculate(PARTICLE_INELASTIC_FRICTIONAL_ENERGY, accum_energy_dissip_slid, r_process_info); - particle.Calculate(PARTICLE_INELASTIC_ROLLING_RESISTANCE_ENERGY, accum_energy_dissip_roll, r_process_info); - particle.Calculate(PARTICLE_INELASTIC_VISCODAMPING_ENERGY, accum_energy_dissip_damp, r_process_info); - + // Particle results + const double vol = particle.CalculateVolume(); + const double temp = particle.GetGeometry()[0].FastGetSolutionStepValue(TEMPERATURE); + + double energy_mech_gravity = 0.0; + double energy_mech_elastic = 0.0; + double energy_mech_translation = 0.0; + double energy_mech_rotation = 0.0; + + double energy_dissip_slid = 0.0; + double energy_dissip_roll = 0.0; + double energy_dissip_damp = 0.0; + + particle.Calculate(PARTICLE_GRAVITATIONAL_ENERGY, energy_mech_gravity, r_process_info); + particle.Calculate(PARTICLE_ELASTIC_ENERGY, energy_mech_elastic, r_process_info); + particle.Calculate(PARTICLE_TRANSLATIONAL_KINEMATIC_ENERGY, energy_mech_translation, r_process_info); + particle.Calculate(PARTICLE_ROTATIONAL_KINEMATIC_ENERGY, energy_mech_rotation, r_process_info); + particle.Calculate(PARTICLE_INELASTIC_FRICTIONAL_ENERGY, energy_dissip_slid, r_process_info); + particle.Calculate(PARTICLE_INELASTIC_ROLLING_RESISTANCE_ENERGY, energy_dissip_roll, r_process_info); + particle.Calculate(PARTICLE_INELASTIC_VISCODAMPING_ENERGY, energy_dissip_damp, r_process_info); + + const double energy_thermal_slid_pp = std::abs(particle.mGenerationThermalEnergy_slid_particle); + const double energy_thermal_slid_pw = std::abs(particle.mGenerationThermalEnergy_slid_wall); + const double energy_thermal_roll_pp = std::abs(particle.mGenerationThermalEnergy_roll_particle); + const double energy_thermal_roll_pw = std::abs(particle.mGenerationThermalEnergy_roll_wall); + const double energy_thermal_damp_pp = std::abs(particle.mGenerationThermalEnergy_damp_particle); + const double energy_thermal_damp_pw = std::abs(particle.mGenerationThermalEnergy_damp_wall); + + const double heat_flux_values_conducdir = std::abs(particle.mConductionDirectHeatFlux); + const double heat_flux_values_conducindir = std::abs(particle.mConductionIndirectHeatFlux); + const double heat_flux_values_rad = std::abs(particle.mRadiationHeatFlux); + const double heat_flux_values_gen = std::abs(particle.mGenerationHeatFlux); + const double heat_flux_values_conv = std::abs(particle.mConvectionHeatFlux); + const double heat_flux_values_prescsurf = std::abs(particle.mPrescribedHeatFluxSurface); + const double heat_flux_values_prescvol = std::abs(particle.mPrescribedHeatFluxVolume); + const double heat_flux_values = std::abs(particle.mTotalHeatFlux); + + const double heat_gen_values_slid_pp = std::abs(particle.mGenerationHeatFlux_slid_particle); + const double heat_gen_values_slid_pw = std::abs(particle.mGenerationHeatFlux_slid_wall); + const double heat_gen_values_roll_pp = std::abs(particle.mGenerationHeatFlux_roll_particle); + const double heat_gen_values_roll_pw = std::abs(particle.mGenerationHeatFlux_roll_wall); + const double heat_gen_values_damp_pp = std::abs(particle.mGenerationHeatFlux_damp_particle); + const double heat_gen_values_damp_pw = std::abs(particle.mGenerationHeatFlux_damp_wall); + const double heat_gen_values = std::abs(particle.mGenerationHeatFlux); + + // Accumulate particle results #pragma omp critical { - total_vol += vol; + vol_total += vol; if (temp < particle_temp_min) particle_temp_min = temp; if (temp > particle_temp_max) particle_temp_max = temp; - particle_temp_avg += temp; - particle_temp_dev += temp * temp; - model_temp_avg += temp * vol; - - total_energy_potential_gravity += energy_potential_gravity; - total_energy_potential_elastic += energy_potential_elastic; - total_energy_kinetic_translation += energy_kinetic_translation; - total_energy_kinetic_rotation += energy_kinetic_rotation; - total_energy += energy_potential_gravity + energy_potential_elastic + energy_kinetic_translation + energy_kinetic_rotation; + particle_temp_avg += temp; + particle_temp_avg_vol += temp * vol; + particle_temp_dev += temp * temp; + + energy_mech_gravity_all += energy_mech_gravity; + energy_mech_elastic_all += energy_mech_elastic; + energy_mech_translation_all += energy_mech_translation; + energy_mech_rotation_all += energy_mech_rotation; + energy_mech_all += energy_mech_gravity + energy_mech_elastic + energy_mech_translation + energy_mech_rotation; - total_accum_energy_dissip_slid += accum_energy_dissip_slid; - total_accum_energy_dissip_roll += accum_energy_dissip_roll; - total_accum_energy_dissip_damp += accum_energy_dissip_damp; - total_accum_energy_dissip += accum_energy_dissip_slid + accum_energy_dissip_roll + accum_energy_dissip_damp; - } - - if (mGraph_ParticleHeatFluxContributions) { - // Get absolute value of particle heat transfer mechanisms - const double flux_conducdir = fabs(particle.mConductionDirectHeatFlux); - const double flux_conducindir = fabs(particle.mConductionIndirectHeatFlux); - const double flux_rad = fabs(particle.mRadiationHeatFlux); - const double flux_gen = fabs(particle.mGenerationHeatFlux); - const double flux_conv = fabs(particle.mConvectionHeatFlux); - const double flux_prescsurf = fabs(particle.mPrescribedHeatFluxSurface); - const double flux_prescvol = fabs(particle.mPrescribedHeatFluxVolume); - const double flux_total = flux_conducdir + flux_conducindir + flux_rad + flux_gen + flux_conv + flux_prescsurf + flux_prescvol; - - // Compute relative contribution of each heat transfer mechanism for current particle - if (flux_total != 0.0) { - #pragma omp critical - { - num_ratio_particles_flux++; - particle_flux_conducdir_ratio_avg += flux_conducdir / flux_total; - particle_flux_conducindir_ratio_avg += flux_conducindir / flux_total; - particle_flux_rad_ratio_avg += flux_rad / flux_total; - particle_flux_gen_ratio_avg += flux_gen / flux_total; - particle_flux_conv_ratio_avg += flux_conv / flux_total; - particle_flux_prescsurf_ratio_avg += flux_prescsurf / flux_total; - particle_flux_prescvol_ratio_avg += flux_prescvol / flux_total; - } + energy_dissip_slid_all += energy_dissip_slid; + energy_dissip_roll_all += energy_dissip_roll; + energy_dissip_damp_all += energy_dissip_damp; + energy_dissip_all += energy_dissip_slid + energy_dissip_roll + energy_dissip_damp; + + energy_thermal_slid_pp_all += energy_thermal_slid_pp; + energy_thermal_slid_pw_all += energy_thermal_slid_pw; + energy_thermal_roll_pp_all += energy_thermal_roll_pp; + energy_thermal_roll_pw_all += energy_thermal_roll_pw; + energy_thermal_damp_pp_all += energy_thermal_damp_pp; + energy_thermal_damp_pw_all += energy_thermal_damp_pw; + energy_thermal_all += energy_thermal_slid_pp + energy_thermal_slid_pw + energy_thermal_roll_pp + energy_thermal_roll_pw + energy_thermal_damp_pp + energy_thermal_damp_pw; + + heat_flux_values_conducdir_all += heat_flux_values_conducdir; + heat_flux_values_conducindir_all += heat_flux_values_conducindir; + heat_flux_values_rad_all += heat_flux_values_rad; + heat_flux_values_gen_all += heat_flux_values_gen; + heat_flux_values_conv_all += heat_flux_values_conv; + heat_flux_values_prescsurf_all += heat_flux_values_prescsurf; + heat_flux_values_prescvol_all += heat_flux_values_prescvol; + heat_flux_values_all += heat_flux_values_conducdir + heat_flux_values_conducindir + heat_flux_values_rad + heat_flux_values_gen + heat_flux_values_conv + heat_flux_values_prescsurf + heat_flux_values_prescvol; + + if (heat_flux_values != 0.0) { + num_particles_flux_contrib++; + heat_flux_contrib_conducdir += heat_flux_values_conducdir / heat_flux_values; + heat_flux_contrib_conducindir += heat_flux_values_conducindir / heat_flux_values; + heat_flux_contrib_rad += heat_flux_values_rad / heat_flux_values; + heat_flux_contrib_gen += heat_flux_values_gen / heat_flux_values; + heat_flux_contrib_conv += heat_flux_values_conv / heat_flux_values; + heat_flux_contrib_prescsurf += heat_flux_values_prescsurf / heat_flux_values; + heat_flux_contrib_prescvol += heat_flux_values_prescvol / heat_flux_values; } - } - if (mGraph_ParticleHeatGenContributions) { - // Get absolute value of particle heat generation mechanisms - const double gen_slid_pp = fabs(particle.mGenerationHeatFlux_slid_particle); - const double gen_slid_pw = fabs(particle.mGenerationHeatFlux_slid_wall); - const double gen_roll_pp = fabs(particle.mGenerationHeatFlux_roll_particle); - const double gen_roll_pw = fabs(particle.mGenerationHeatFlux_roll_wall); - const double gen_damp_pp = fabs(particle.mGenerationHeatFlux_damp_particle); - const double gen_damp_pw = fabs(particle.mGenerationHeatFlux_damp_wall); - const double gen_total = fabs(particle.mGenerationHeatFlux); - - // Compute relative contribution of each heat generation mechanism for current particle - if (gen_total != 0.0) { - #pragma omp critical - { - num_ratio_particles_gen++; - particle_gen_slid_pp_ratio_avg += gen_slid_pp / gen_total; - particle_gen_slid_pw_ratio_avg += gen_slid_pw / gen_total; - particle_gen_roll_pp_ratio_avg += gen_roll_pp / gen_total; - particle_gen_roll_pw_ratio_avg += gen_roll_pw / gen_total; - particle_gen_damp_pp_ratio_avg += gen_damp_pp / gen_total; - particle_gen_damp_pw_ratio_avg += gen_damp_pw / gen_total; - } + heat_gen_values_slid_pp_all += heat_gen_values_slid_pp; + heat_gen_values_slid_pw_all += heat_gen_values_slid_pw; + heat_gen_values_roll_pp_all += heat_gen_values_roll_pp; + heat_gen_values_roll_pw_all += heat_gen_values_roll_pw; + heat_gen_values_damp_pp_all += heat_gen_values_damp_pp; + heat_gen_values_damp_pw_all += heat_gen_values_damp_pw; + heat_gen_values_all += heat_gen_values_slid_pp + heat_gen_values_slid_pw + heat_gen_values_roll_pp + heat_gen_values_roll_pw + heat_gen_values_damp_pp + heat_gen_values_damp_pw; + + if (heat_gen_values != 0.0) { + num_particles_gen_contrib++; + heat_gen_contrib_slid_pp += heat_gen_values_slid_pp / heat_gen_values; + heat_gen_contrib_slid_pw += heat_gen_values_slid_pw / heat_gen_values; + heat_gen_contrib_roll_pp += heat_gen_values_roll_pp / heat_gen_values; + heat_gen_contrib_roll_pw += heat_gen_values_roll_pw / heat_gen_values; + heat_gen_contrib_damp_pp += heat_gen_values_damp_pp / heat_gen_values; + heat_gen_contrib_damp_pw += heat_gen_values_damp_pw / heat_gen_values; } } } // Compute temperature results (avg, dev) - particle_temp_avg /= num_of_particles; - model_temp_avg /= total_vol; - particle_temp_dev = sqrt(std::max(0.0, particle_temp_dev / num_of_particles - particle_temp_avg * particle_temp_avg)); + particle_temp_avg /= num_particles; + particle_temp_avg_vol /= vol_total; + particle_temp_dev = sqrt(std::max(0.0, particle_temp_dev / num_particles - particle_temp_avg * particle_temp_avg)); // Compute average of relative contribution of each heat transfer mechanism - if (mGraph_ParticleHeatFluxContributions && num_ratio_particles_flux > 0) { - particle_flux_conducdir_ratio_avg /= num_ratio_particles_flux; - particle_flux_conducindir_ratio_avg /= num_ratio_particles_flux; - particle_flux_rad_ratio_avg /= num_ratio_particles_flux; - particle_flux_gen_ratio_avg /= num_ratio_particles_flux; - particle_flux_conv_ratio_avg /= num_ratio_particles_flux; - particle_flux_prescsurf_ratio_avg /= num_ratio_particles_flux; - particle_flux_prescvol_ratio_avg /= num_ratio_particles_flux; + if (num_particles_flux_contrib > 0) { + heat_flux_contrib_conducdir /= num_particles_flux_contrib; + heat_flux_contrib_conducindir /= num_particles_flux_contrib; + heat_flux_contrib_rad /= num_particles_flux_contrib; + heat_flux_contrib_gen /= num_particles_flux_contrib; + heat_flux_contrib_conv /= num_particles_flux_contrib; + heat_flux_contrib_prescsurf /= num_particles_flux_contrib; + heat_flux_contrib_prescvol /= num_particles_flux_contrib; } // Compute average of relative contribution of each heat generation mechanism - if (mGraph_ParticleHeatGenContributions && num_ratio_particles_gen > 0) { - particle_gen_slid_pp_ratio_avg /= num_ratio_particles_gen; - particle_gen_slid_pw_ratio_avg /= num_ratio_particles_gen; - particle_gen_roll_pp_ratio_avg /= num_ratio_particles_gen; - particle_gen_roll_pw_ratio_avg /= num_ratio_particles_gen; - particle_gen_damp_pp_ratio_avg /= num_ratio_particles_gen; - particle_gen_damp_pw_ratio_avg /= num_ratio_particles_gen; + if (num_particles_gen_contrib > 0) { + heat_gen_contrib_slid_pp /= num_particles_gen_contrib; + heat_gen_contrib_slid_pw /= num_particles_gen_contrib; + heat_gen_contrib_roll_pp /= num_particles_gen_contrib; + heat_gen_contrib_roll_pw /= num_particles_gen_contrib; + heat_gen_contrib_damp_pp /= num_particles_gen_contrib; + heat_gen_contrib_damp_pw /= num_particles_gen_contrib; } // Write results to files @@ -332,75 +442,100 @@ namespace Kratos { << particle_temp_avg << std::endl; + if (mFile_ParticleTempAvgVol.is_open()) + mFile_ParticleTempAvgVol << time_step << " " + << time << " " + << particle_temp_avg_vol + << std::endl; + if (mFile_ParticleTempDev.is_open()) mFile_ParticleTempDev << time_step << " " << time << " " << particle_temp_dev << std::endl; - if (mFile_ModelTempAvg.is_open()) - mFile_ModelTempAvg << time_step << " " - << time << " " - << model_temp_avg - << std::endl; - - if (mFile_ParticleHeatFluxContributions.is_open()) - mFile_ParticleHeatFluxContributions << time_step << " " - << time << " " - << particle_flux_conducdir_ratio_avg << " " - << particle_flux_conducindir_ratio_avg << " " - << particle_flux_rad_ratio_avg << " " - << particle_flux_gen_ratio_avg << " " - << particle_flux_conv_ratio_avg << " " - << particle_flux_prescsurf_ratio_avg << " " - << particle_flux_prescvol_ratio_avg - << std::endl; - - if (mFile_ParticleHeatGenContributions.is_open()) - mFile_ParticleHeatGenContributions << time_step << " " - << time << " " - << particle_gen_slid_pp_ratio_avg << " " - << particle_gen_slid_pw_ratio_avg << " " - << particle_gen_roll_pp_ratio_avg << " " - << particle_gen_roll_pw_ratio_avg << " " - << particle_gen_damp_pp_ratio_avg << " " - << particle_gen_damp_pw_ratio_avg - << std::endl; - - if (mFile_ParticleEnergyContributions.is_open()) - mFile_ParticleEnergyContributions << time_step << " " - << time << " " - << total_energy_potential_gravity << " " - << total_energy_potential_elastic << " " - << total_energy_kinetic_translation << " " - << total_energy_kinetic_rotation << " " - << total_energy << " " - << total_accum_energy_dissip_slid << " " - << total_accum_energy_dissip_roll << " " - << total_accum_energy_dissip_damp << " " - << total_accum_energy_dissip << " " - << total_energy+total_accum_energy_dissip - << std::endl; + if (mFile_EnergyMechanical.is_open()) + mFile_EnergyMechanical << time_step << " " + << time << " " + << energy_mech_gravity_all << " " + << energy_mech_elastic_all << " " + << energy_mech_translation_all << " " + << energy_mech_rotation_all << " " + << energy_mech_all + << std::endl; + + if (mFile_EnergyDissipated.is_open()) + mFile_EnergyDissipated << time_step << " " + << time << " " + << energy_dissip_slid_all << " " + << energy_dissip_roll_all << " " + << energy_dissip_damp_all << " " + << energy_dissip_all + << std::endl; + + if (mFile_EnergyThermal.is_open()) + mFile_EnergyThermal << time_step << " " + << time << " " + << energy_thermal_slid_pp_all << " " + << energy_thermal_slid_pw_all << " " + << energy_thermal_roll_pp_all << " " + << energy_thermal_roll_pw_all << " " + << energy_thermal_damp_pp_all << " " + << energy_thermal_damp_pw_all << " " + << energy_thermal_all + << std::endl; + + if (mFile_HeatFluxContributions.is_open()) + mFile_HeatFluxContributions << time_step << " " + << time << " " + << heat_flux_contrib_conducdir << " " + << heat_flux_contrib_conducindir << " " + << heat_flux_contrib_rad << " " + << heat_flux_contrib_gen << " " + << heat_flux_contrib_conv << " " + << heat_flux_contrib_prescsurf << " " + << heat_flux_contrib_prescvol + << std::endl; + + if (mFile_HeatGenValues.is_open()) + mFile_HeatGenValues << time_step << " " + << time << " " + << heat_gen_values_slid_pp_all << " " + << heat_gen_values_slid_pw_all << " " + << heat_gen_values_roll_pp_all << " " + << heat_gen_values_roll_pw_all << " " + << heat_gen_values_damp_pp_all << " " + << heat_gen_values_damp_pw_all << " " + << heat_gen_values_all + << std::endl; + + if (mFile_HeatGenContributions.is_open()) + mFile_HeatGenContributions << time_step << " " + << time << " " + << heat_gen_contrib_slid_pp << " " + << heat_gen_contrib_slid_pw << " " + << heat_gen_contrib_roll_pp << " " + << heat_gen_contrib_roll_pw << " " + << heat_gen_contrib_damp_pp << " " + << heat_gen_contrib_damp_pw + << std::endl; KRATOS_CATCH("") } //----------------------------------------------------------------------------------------------------------------------- - void GraphUtilities::ExecuteFinalize(void) - { - KRATOS_TRY - - // Close files - if (mFile_ParticleTempMin.is_open()) mFile_ParticleTempMin.close(); - if (mFile_ParticleTempMax.is_open()) mFile_ParticleTempMax.close(); - if (mFile_ParticleTempAvg.is_open()) mFile_ParticleTempAvg.close(); - if (mFile_ParticleTempDev.is_open()) mFile_ParticleTempDev.close(); - if (mFile_ModelTempAvg.is_open()) mFile_ModelTempAvg.close(); - if (mFile_ParticleHeatFluxContributions.is_open()) mFile_ParticleHeatFluxContributions.close(); - if (mFile_ParticleHeatGenContributions.is_open()) mFile_ParticleHeatGenContributions.close(); - if (mFile_ParticleEnergyContributions.is_open()) mFile_ParticleEnergyContributions.close(); - - KRATOS_CATCH("") + void GraphUtilities::CloseFiles(void) { + if (mFile_ParticleTempMin.is_open()) mFile_ParticleTempMin.close(); + if (mFile_ParticleTempMax.is_open()) mFile_ParticleTempMax.close(); + if (mFile_ParticleTempAvg.is_open()) mFile_ParticleTempAvg.close(); + if (mFile_ParticleTempAvgVol.is_open()) mFile_ParticleTempAvgVol.close(); + if (mFile_ParticleTempDev.is_open()) mFile_ParticleTempDev.close(); + if (mFile_EnergyMechanical.is_open()) mFile_EnergyMechanical.close(); + if (mFile_EnergyDissipated.is_open()) mFile_EnergyDissipated.close(); + if (mFile_EnergyThermal.is_open()) mFile_EnergyThermal.close(); + if (mFile_HeatFluxContributions.is_open()) mFile_HeatFluxContributions.close(); + if (mFile_HeatGenValues.is_open()) mFile_HeatGenValues.close(); + if (mFile_HeatGenContributions.is_open()) mFile_HeatGenContributions.close(); } - + } // namespace Kratos diff --git a/applications/ThermalDEMApplication/custom_utilities/graph_utilities.h b/applications/ThermalDEMApplication/custom_utilities/graph_utilities.h index 005eeca4cdc6..4bf6b7887312 100644 --- a/applications/ThermalDEMApplication/custom_utilities/graph_utilities.h +++ b/applications/ThermalDEMApplication/custom_utilities/graph_utilities.h @@ -35,11 +35,14 @@ namespace Kratos void ExecuteInitialize(bool ParticleTempMin, bool ParticleTempMax, bool ParticleTempAvg, + bool ParticleTempAvgVol, bool ParticleTempDev, - bool ModelTempAvg, - bool ParticleHeatFluxContributions, - bool ParticleHeatGenContributions, - bool ParticleEnergyContributions); + bool EnergyMechanical, + bool EnergyDissipated, + bool EnergyThermal, + bool HeatFluxContributions, + bool HeatGenValues, + bool HeatGenContributions); void ExecuteFinalizeSolutionStep(ModelPart& rModelPart); void ExecuteFinalize(void); @@ -49,23 +52,34 @@ namespace Kratos bool mGraph_ParticleTempMin; bool mGraph_ParticleTempMax; bool mGraph_ParticleTempAvg; + bool mGraph_ParticleTempAvgVol; bool mGraph_ParticleTempDev; - bool mGraph_ModelTempAvg; - bool mGraph_ParticleHeatFluxContributions; - bool mGraph_ParticleHeatGenContributions; - bool mGraph_ParticleEnergyContributions; - - std::ofstream mFile_ParticleTempMin; - std::ofstream mFile_ParticleTempMax; - std::ofstream mFile_ParticleTempAvg; - std::ofstream mFile_ParticleTempDev; - std::ofstream mFile_ModelTempAvg; - std::ofstream mFile_ParticleHeatFluxContributions; - std::ofstream mFile_ParticleHeatGenContributions; - std::ofstream mFile_ParticleEnergyContributions; + bool mGraph_EnergyMechanical; + bool mGraph_EnergyDissipated; + bool mGraph_EnergyThermal; + bool mGraph_HeatFluxContributions; + bool mGraph_HeatGenValues; + bool mGraph_HeatGenContributions; + + std::ofstream mFile_ParticleTempMin; // Minimum particle temperature + std::ofstream mFile_ParticleTempMax; // Maximum particle temperature + std::ofstream mFile_ParticleTempAvg; // Average particle temperature + std::ofstream mFile_ParticleTempAvgVol; // Volume-average particle temperature + std::ofstream mFile_ParticleTempDev; // Std dev particle temperature + std::ofstream mFile_EnergyMechanical; // Mechanical energy components (current) + std::ofstream mFile_EnergyDissipated; // Dissipated energy components (accumulated) + std::ofstream mFile_EnergyThermal; // Accumulated thermal energy generation components (U[J]=Q[W]*t[s]) + std::ofstream mFile_HeatFluxContributions; // Relative contributions of heat flux components + std::ofstream mFile_HeatGenValues; // Current values of heat generation components (Q[W]) + std::ofstream mFile_HeatGenContributions; // Relative contributions of current values heat generation components (%) private: + // Private methods + void OpenFiles(void); + void CloseFiles(void); + void WriteGraphs(ModelPart& rModelPart); + // Assignment operator GraphUtilities& operator=(GraphUtilities const& rOther); diff --git a/applications/ThermalDEMApplication/custom_utilities/heat_map_utilities.cpp b/applications/ThermalDEMApplication/custom_utilities/heat_map_utilities.cpp index 3089ac6487ee..3b8415a3d273 100644 --- a/applications/ThermalDEMApplication/custom_utilities/heat_map_utilities.cpp +++ b/applications/ThermalDEMApplication/custom_utilities/heat_map_utilities.cpp @@ -111,17 +111,17 @@ namespace Kratos { std::ofstream file_generation_rolling_pw; file_generation_damping_pp.open("map_generation_damping_pp.txt", std::ios::out); - KRATOS_ERROR_IF_NOT(file_generation_damping_pp) << "Could not open map file of heat generation due to particle-particle damping!" << std::endl; + KRATOS_ERROR_IF_NOT(file_generation_damping_pp) << "Could not open file map_generation_damping_pp.txt!" << std::endl; file_generation_damping_pw.open("map_generation_damping_pw.txt", std::ios::out); - KRATOS_ERROR_IF_NOT(file_generation_damping_pw) << "Could not open map file of heat generation due to particle-wall damping!" << std::endl; + KRATOS_ERROR_IF_NOT(file_generation_damping_pw) << "Could not open file map_generation_damping_pw.txt!" << std::endl; file_generation_sliding_pp.open("map_generation_sliding_pp.txt", std::ios::out); - KRATOS_ERROR_IF_NOT(file_generation_sliding_pp) << "Could not open map file of heat generation due to particle-particle sliding!" << std::endl; + KRATOS_ERROR_IF_NOT(file_generation_sliding_pp) << "Could not open file map_generation_sliding_pp.txt!" << std::endl; file_generation_sliding_pw.open("map_generation_sliding_pw.txt", std::ios::out); - KRATOS_ERROR_IF_NOT(file_generation_sliding_pw) << "Could not open map file of heat generation due to particle-wall sliding!" << std::endl; + KRATOS_ERROR_IF_NOT(file_generation_sliding_pw) << "Could not open file map_generation_sliding_pw.txt!" << std::endl; file_generation_rolling_pp.open("map_generation_rolling_pp.txt", std::ios::out); - KRATOS_ERROR_IF_NOT(file_generation_rolling_pp) << "Could not open map file of heat generation due to particle-particle rolling!" << std::endl; + KRATOS_ERROR_IF_NOT(file_generation_rolling_pp) << "Could not open file map_generation_rolling_pp.txt!" << std::endl; file_generation_rolling_pw.open("map_generation_rolling_pw.txt", std::ios::out); - KRATOS_ERROR_IF_NOT(file_generation_rolling_pw) << "Could not open map file of heat generation due to particle-wall rolling!" << std::endl; + KRATOS_ERROR_IF_NOT(file_generation_rolling_pw) << "Could not open file map_generation_rolling_pw.txt!" << std::endl; // Print headers file_generation_damping_pp << "MAP - HEAT GENERATION - DAMPING - PARTICLE-PARTICLE" << std::endl; diff --git a/applications/ThermalDEMApplication/custom_utilities/numerical_integration_adaptive_simpson.cpp b/applications/ThermalDEMApplication/custom_utilities/numerical_integration_adaptive_simpson.cpp index 2e1653f500f9..2b0a6d160bc8 100644 --- a/applications/ThermalDEMApplication/custom_utilities/numerical_integration_adaptive_simpson.cpp +++ b/applications/ThermalDEMApplication/custom_utilities/numerical_integration_adaptive_simpson.cpp @@ -68,7 +68,7 @@ namespace Kratos { double I1 = (b - a) / 6.0 * (fa + 4.0 * fc + fb); double I2 = (b - a) / 12.0 * (fa + 4.0 * fd + 2.0 * fc + 4.0 * fe + fb); - if (fabs(I2 - I1) <= mTol) { + if (std::abs(I2 - I1) <= mTol) { return I2 + (I2 - I1) / 15.0; } else { // sub-divide interval recursively diff --git a/applications/ThermalDEMApplication/custom_utilities/numerical_integration_adaptive_simpson.h b/applications/ThermalDEMApplication/custom_utilities/numerical_integration_adaptive_simpson.h index d3bf0f40771e..5e71d0cb1e24 100644 --- a/applications/ThermalDEMApplication/custom_utilities/numerical_integration_adaptive_simpson.h +++ b/applications/ThermalDEMApplication/custom_utilities/numerical_integration_adaptive_simpson.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(NUMERICAL_INTEGRATION_METHOD_ADAPTIVE_SIMPSON_H_INCLUDED) -#define NUMERICAL_INTEGRATION_METHOD_ADAPTIVE_SIMPSON_H_INCLUDED +#pragma once // System includes #include @@ -60,5 +59,3 @@ namespace Kratos }; // Class AdaptiveSimpsonQuadrature } // namespace Kratos - -#endif // NUMERICAL_INTEGRATION_METHOD_ADAPTIVE_SIMPSON_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_utilities/numerical_integration_method.h b/applications/ThermalDEMApplication/custom_utilities/numerical_integration_method.h index b30f56b85be1..d23e27bfe9b9 100644 --- a/applications/ThermalDEMApplication/custom_utilities/numerical_integration_method.h +++ b/applications/ThermalDEMApplication/custom_utilities/numerical_integration_method.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(NUMERICAL_INTEGRATION_METHOD_H_INCLUDED) -#define NUMERICAL_INTEGRATION_METHOD_H_INCLUDED +#pragma once // System includes @@ -79,5 +78,3 @@ namespace Kratos }; // Class NumericalIntegrationMethod } // namespace Kratos - -#endif // NUMERICAL_INTEGRATION_METHOD_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_2d.cpp b/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_2d.cpp index 77a12f1bce77..be049438675b 100644 --- a/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_2d.cpp +++ b/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_2d.cpp @@ -244,7 +244,7 @@ namespace Kratos { } // Add triangle area - total_area += fabs(0.5 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2))); + total_area += std::abs(0.5 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2))); // Add particles area AddParticleArea(rModelPart, addedParticle, particle_area, v1); diff --git a/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_2d.h b/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_2d.h index a5c00c8e5554..8cb016c0d290 100644 --- a/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_2d.h +++ b/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_2d.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#ifndef TESSELATION_UTILITIES_2D_H_INCLUDED -#define TESSELATION_UTILITIES_2D_H_INCLUDED +#pragma once // System includes @@ -78,5 +77,3 @@ namespace Kratos }; // Class TesselationUtilities2D } // namespace Kratos - -#endif // TESSELATION_UTILITIES_2D_H_INCLUDED diff --git a/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_3d.cpp b/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_3d.cpp index fc6763a4754c..269516fd9fef 100644 --- a/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_3d.cpp +++ b/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_3d.cpp @@ -266,7 +266,7 @@ namespace Kratos { c[1] = y4 - y1; c[2] = z4 - z1; GeometryFunctions::CrossProduct(b, c, bxc); - total_volume += fabs(GeometryFunctions::DotProduct(a, bxc)) / 6.0; + total_volume += std::abs(GeometryFunctions::DotProduct(a, bxc)) / 6.0; // Add particles volume AddParticleVolume(rModelPart, addedParticle, particle_volume, v1); diff --git a/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_3d.h b/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_3d.h index a8d0bbc544c8..6866397793cc 100644 --- a/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_3d.h +++ b/applications/ThermalDEMApplication/custom_utilities/tesselation_utilities_3d.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#ifndef TESSELATION_UTILITIES_3D_H_INCLUDED -#define TESSELATION_UTILITIES_3D_H_INCLUDED +#pragma once // System includes @@ -66,5 +65,3 @@ namespace Kratos }; // Class TesselationUtilities3D } // namespace Kratos - -#endif // TESSELATION_UTILITIES_3D_H_INCLUDED diff --git a/applications/ThermalDEMApplication/python_scripts/thermal_dem_analysis.py b/applications/ThermalDEMApplication/python_scripts/thermal_dem_analysis.py index c42097fde957..efef74cc9d49 100644 --- a/applications/ThermalDEMApplication/python_scripts/thermal_dem_analysis.py +++ b/applications/ThermalDEMApplication/python_scripts/thermal_dem_analysis.py @@ -33,12 +33,15 @@ def GetDefaultInputParameters(self): SetDefaultBoolParameterIfNotExists(dem_parameters, "PostGraphParticleTempMin") SetDefaultBoolParameterIfNotExists(dem_parameters, "PostGraphParticleTempMax") SetDefaultBoolParameterIfNotExists(dem_parameters, "PostGraphParticleTempAvg") + SetDefaultBoolParameterIfNotExists(dem_parameters, "PostGraphParticleTempAvgVol") SetDefaultBoolParameterIfNotExists(dem_parameters, "PostGraphParticleTempDev") - SetDefaultBoolParameterIfNotExists(dem_parameters, "PostGraphModelTempAvg") + SetDefaultBoolParameterIfNotExists(dem_parameters, "PostGraphMechanicalEnergy") + SetDefaultBoolParameterIfNotExists(dem_parameters, "PostGraphDissipatedEnergy") + SetDefaultBoolParameterIfNotExists(dem_parameters, "PostGraphThermalEnergy") SetDefaultBoolParameterIfNotExists(dem_parameters, "PostGraphHeatFluxContributions") - SetDefaultBoolParameterIfNotExists(dem_parameters, "PostGraphHeatGenContributions") - SetDefaultBoolParameterIfNotExists(dem_parameters, "PostGraphEnergyContributions") - SetDefaultBoolParameterIfNotExists(dem_parameters, "PostMapHeatGeneration") + SetDefaultBoolParameterIfNotExists(dem_parameters, "PostGraphHeatGenerationValues") + SetDefaultBoolParameterIfNotExists(dem_parameters, "PostGraphHeatGenerationContributions") + SetDefaultBoolParameterIfNotExists(dem_parameters, "PostHeatMapGeneration") return dem_parameters diff --git a/applications/ThermalDEMApplication/python_scripts/thermal_sphere_strategy.py b/applications/ThermalDEMApplication/python_scripts/thermal_sphere_strategy.py index f0e4a895c0ea..85969aff3eb9 100644 --- a/applications/ThermalDEMApplication/python_scripts/thermal_sphere_strategy.py +++ b/applications/ThermalDEMApplication/python_scripts/thermal_sphere_strategy.py @@ -112,7 +112,7 @@ def FinalizeSolutionStep(self): self.graph_utils.ExecuteFinalizeSolutionStep(self.spheres_model_part) # Merge particle heat maps to global heat maps - if (self.PostMapHeatGeneration): + if (self.PostHeatMapGeneration): self.heat_map_utils.ExecuteFinalizeSolutionStep(self.spheres_model_part) #---------------------------------------------------------------------------------------------- @@ -124,7 +124,7 @@ def Finalize(self): self.graph_utils.ExecuteFinalize() # Write global heat maps - if (self.PostMapHeatGeneration): + if (self.PostHeatMapGeneration): self.heat_map_utils.ExecuteFinalize(self.spheres_model_part) ####################################### PARTICULAR METHODS ####################################### @@ -199,15 +199,18 @@ def GetProjectParameters(self, DEM_parameters): self.fluid_velocity[2] = self.fluid_props["fluid_velocity_Z"].GetDouble() # Post options - self.PostGraphParticleTempMin = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphParticleTempMin") - self.PostGraphParticleTempMax = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphParticleTempMax") - self.PostGraphParticleTempAvg = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphParticleTempAvg") - self.PostGraphParticleTempDev = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphParticleTempDev") - self.PostGraphModelTempAvg = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphModelTempAvg") - self.PostGraphFluxContributions = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphHeatFluxContributions") - self.PostGraphGenContributions = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphHeatGenContributions") - self.PostGraphEnergyContributions = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphEnergyContributions") - self.PostMapHeatGeneration = GetBoolParameterIfItExists(self.DEM_parameters, "PostMapHeatGeneration") + self.PostGraphParticleTempMin = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphParticleTempMin") + self.PostGraphParticleTempMax = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphParticleTempMax") + self.PostGraphParticleTempAvg = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphParticleTempAvg") + self.PostGraphParticleTempAvgVol = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphParticleTempAvgVol") + self.PostGraphParticleTempDev = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphParticleTempDev") + self.PostGraphMechanicalEnergy = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphMechanicalEnergy") + self.PostGraphDissipatedEnergy = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphDissipatedEnergy") + self.PostGraphThermalEnergy = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphThermalEnergy") + self.PostGraphHeatFluxContributions = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphHeatFluxContributions") + self.PostGraphHeatGenerationValues = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphHeatGenerationValues") + self.PostGraphHeatGenerationContributions = GetBoolParameterIfItExists(self.DEM_parameters, "PostGraphHeatGenerationContributions") + self.PostHeatMapGeneration = GetBoolParameterIfItExists(self.DEM_parameters, "PostHeatMapGeneration") self.heat_map_corner1 = Vector(3) self.heat_map_corner1[0] = min(self.thermal_settings["heat_map_corners"][0][0].GetDouble(),self.thermal_settings["heat_map_corners"][1][0].GetDouble()) @@ -262,9 +265,12 @@ def CheckProjectParameters(self): model != "contact_damping"): raise Exception('ThermalDEM', 'Heat generation model \'' + model + '\' is not implemented.') - if (self.adjusted_contact_model != "zhou" and - self.adjusted_contact_model != "lu" and - self.adjusted_contact_model != "morris"): + if (self.adjusted_contact_model != "zhou" and + self.adjusted_contact_model != "lu" and + self.adjusted_contact_model != "morris_area" and + self.adjusted_contact_model != "morris_area_time" and + self.adjusted_contact_model != "rangel_area" and + self.adjusted_contact_model != "rangel_area_time"): raise Exception('ThermalDEM', 'Adjusted contact model \'' + self.adjusted_contact_model + '\' is not implemented.') # Other methods @@ -355,14 +361,17 @@ def SetVoronoiPorosityFlags(self): #---------------------------------------------------------------------------------------------- def SetGraphFlags(self): - if (self.PostGraphParticleTempMin or - self.PostGraphParticleTempMax or - self.PostGraphParticleTempAvg or - self.PostGraphParticleTempDev or - self.PostGraphModelTempAvg or - self.PostGraphFluxContributions or - self.PostGraphGenContributions or - self.PostGraphEnergyContributions): + if (self.PostGraphParticleTempMin or + self.PostGraphParticleTempMax or + self.PostGraphParticleTempAvg or + self.PostGraphParticleTempAvgVol or + self.PostGraphParticleTempDev or + self.PostGraphMechanicalEnergy or + self.PostGraphDissipatedEnergy or + self.PostGraphThermalEnergy or + self.PostGraphHeatFluxContributions or + self.PostGraphHeatGenerationValues or + self.PostGraphHeatGenerationContributions): self.write_graph = True else: self.write_graph = False @@ -380,7 +389,7 @@ def CreateCPlusPlusUtilities(self): if (self.write_graph): self.graph_utils = GraphUtilities() - if (self.PostMapHeatGeneration): + if (self.PostHeatMapGeneration): self.heat_map_utils = HeatMapUtilities() #---------------------------------------------------------------------------------------------- @@ -476,8 +485,14 @@ def SetConstitutiveLaw(self, properties): class_name = "RealContactZhou" elif self.adjusted_contact_model == "lu": class_name = "RealContactLu" - elif self.adjusted_contact_model == "morris": - class_name = "RealContactMorris" + elif self.adjusted_contact_model == "morris_area": + class_name = "RealContactMorrisArea" + elif self.adjusted_contact_model == "morris_area_time": + class_name = "RealContactMorrisAreaTime" + elif self.adjusted_contact_model == "rangel_area": + class_name = "RealContactRangelArea" + elif self.adjusted_contact_model == "rangel_area_time": + class_name = "RealContactRangelAreaTime" else: raise Exception('ThermalDEM', 'Real contact model \'' + self.adjusted_contact_model + '\' is not implemented.') try: @@ -572,7 +587,7 @@ def SetThermalVariablesAndOptions(self): self.spheres_model_part.ProcessInfo.SetValue(FLUID_VELOCITY, self.fluid_velocity) # Post options - self.SetOneOrZeroInProcessInfoAccordingToBoolValue(self.spheres_model_part, HEAT_MAP_GENERATION_OPTION, self.PostMapHeatGeneration) + self.SetOneOrZeroInProcessInfoAccordingToBoolValue(self.spheres_model_part, HEAT_MAP_GENERATION_OPTION, self.PostHeatMapGeneration) self.spheres_model_part.ProcessInfo.SetValue(HEAT_MAP_COORDINATES_1, self.heat_map_corner1) self.spheres_model_part.ProcessInfo.SetValue(HEAT_MAP_COORDINATES_2, self.heat_map_corner2) self.spheres_model_part.ProcessInfo.SetValue(HEAT_MAP_SUBDIVISIONS, self.heat_map_subdivisions) @@ -605,13 +620,16 @@ def InitializeCPlusPlusUtilities(self): self.graph_utils.ExecuteInitialize(self.PostGraphParticleTempMin, self.PostGraphParticleTempMax, self.PostGraphParticleTempAvg, + self.PostGraphParticleTempAvgVol, self.PostGraphParticleTempDev, - self.PostGraphModelTempAvg, - self.PostGraphFluxContributions, - self.PostGraphGenContributions, - self.PostGraphEnergyContributions) - - if (self.PostMapHeatGeneration): + self.PostGraphMechanicalEnergy, + self.PostGraphDissipatedEnergy, + self.PostGraphThermalEnergy, + self.PostGraphHeatFluxContributions, + self.PostGraphHeatGenerationValues, + self.PostGraphHeatGenerationContributions) + + if (self.PostHeatMapGeneration): self.heat_map_utils.ExecuteInitialize(self.spheres_model_part) #---------------------------------------------------------------------------------------------- diff --git a/applications/ThermalDEMApplication/thermal_dem_application.h b/applications/ThermalDEMApplication/thermal_dem_application.h index 3821260924cd..adadb3588218 100644 --- a/applications/ThermalDEMApplication/thermal_dem_application.h +++ b/applications/ThermalDEMApplication/thermal_dem_application.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(KRATOS_THERMAL_DEM_APPLICATION_H_INCLUDED) -#define KRATOS_THERMAL_DEM_APPLICATION_H_INCLUDED +#pragma once // System includes #include @@ -78,5 +77,3 @@ namespace Kratos }; // Class KratosThermalDEMApplication } // namespace Kratos - -#endif // KRATOS_THERMAL_DEM_APPLICATION_H_INCLUDED defined diff --git a/applications/ThermalDEMApplication/thermal_dem_application_variables.h b/applications/ThermalDEMApplication/thermal_dem_application_variables.h index 11e255a88e54..8340d4d9f80b 100644 --- a/applications/ThermalDEMApplication/thermal_dem_application_variables.h +++ b/applications/ThermalDEMApplication/thermal_dem_application_variables.h @@ -6,8 +6,7 @@ // Main authors: Rafael Rangel (rrangel@cimne.upc.edu) // -#if !defined(KRATOS_THERMAL_DEM_APPLICATION_VARIABLES_H_INCLUDED) -#define KRATOS_THERMAL_DEM_APPLICATION_VARIABLES_H_INCLUDED +#pragma once // System includes @@ -90,5 +89,3 @@ namespace Kratos KRATOS_DEFINE_LOCAL_APPLICATION_FLAG(THERMAL_DEM_APPLICATION, IS_SINTERING); }; } // namespace Kratos - -#endif // KRATOS_THERMAL_DEM_APPLICATION_VARIABLES_H_INCLUDED defined