10 #if !defined(KRATOS_CUSTOM_FUNCTIONS)
11 #define KRATOS_CUSTOM_FUNCTIONS
32 #include "custom_utilities/AuxiliaryFunctions.h"
35 #include "utilities/geometry_utilities.h"
39 template <std::
size_t TDim>
50 CustomFunctionsCalculator(): mPressuresFilled(false), mFirstGradientRecovery(true), mFirstLaplacianRecovery(true), mSomeCloudsDontWork(false), mCalculatingTheGradient(false), mCalculatingTheLaplacian(false), mFirstTimeAppending(true){}
80 for (
unsigned int i = 0;
i < TDim + 1; ++
i){
81 elemental_pressures[
i] = geom[
i].FastGetSolutionStepValue(PRESSURE);
87 for (
unsigned int i = 0;
i < TDim; ++
i){
91 double nodal_area = Volume /
static_cast<double>(TDim + 1);
94 for (
unsigned int i = 0;
i < TDim + 1; ++
i){
95 geom[
i].FastGetSolutionStepValue(PRESSURE_GRADIENT) +=
grad;
100 inode->FastGetSolutionStepValue(PRESSURE_GRADIENT) /= inode->FastGetSolutionStepValue(NODAL_AREA);
111 if (!mPressuresFilled){
112 PerformFirstStepComputations(r_model_part);
118 double max_pressure_change_rate = 0.0;
119 double mean_celerity = 0.0;
129 const double new_pressure = inode->FastGetSolutionStepValue(PRESSURE);
130 double& old_pressure = mPressures[
i];
131 const double delta_p = std::abs(new_pressure - old_pressure);
132 max_pressure_change_rate =
std::max(delta_p, max_pressure_change_rate);
133 old_pressure = new_pressure;
142 max_pressure_change_rate /=
delta_t;
147 const double pressure_spatial_variation = GetRangeWithinVector(mPressures);
148 mLastPressureVariation = pressure_spatial_variation;
149 const double characteristic_pressure_variation = 0.5 * (pressure_spatial_variation + mLastPressureVariation);
151 if (std::abs(characteristic_pressure_variation) == 0.0 || std::abs(reciprocal_of_characteristic_time) == 0.0){
152 std::cout <<
"Uniform problem: stationarity check being performed with dimensional values...! " <<
"\n";
154 if (max_pressure_change_rate <=
tol){
159 max_pressure_change_rate /= reciprocal_of_characteristic_time * characteristic_pressure_variation ;
163 KRATOS_ERROR <<
"Trying to calculate pressure variations between two coincident time steps! (null time variation since last recorded time)" << std::endl;
166 std::cout <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" <<
"\n";
167 std::cout <<
"The stationarity condition tolerance is " <<
"\n";
169 std::cout <<
"The stationarity residual is now " <<
"\n";
170 KRATOS_INFO(
"SwimmingDEM") << max_pressure_change_rate << std::endl;
171 std::cout <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" <<
"\n";
173 return max_pressure_change_rate <=
tol;
183 double added_volume = 0.0;
185 #pragma omp parallel for reduction(+ : added_volume)
188 for (
ElementIterator it = GetElementPartitionBegin(r_fluid_model_part,
k); it != GetElementPartitionEnd(r_fluid_model_part,
k); ++it){
189 added_volume += it->GetGeometry().DomainSize();
204 std::vector<array_1d <double, 3> > added_force_vect;
207 for (
unsigned int k = 0;
k < added_force_vect.size(); ++
k){
211 #pragma omp parallel for
214 for (
ElementIterator it = GetElementPartitionBegin(r_dem_model_part,
k); it != GetElementPartitionEnd(r_dem_model_part,
k); ++it){
218 if (geom[0].SolutionStepsDataHas(HYDRODYNAMIC_FORCE)){
219 element_force = geom[0].FastGetSolutionStepValue(HYDRODYNAMIC_FORCE);
226 added_force_vect[
k] += element_force;
230 force = added_force_vect[0];
232 for (
unsigned int k = 1;
k < added_force_vect.size(); ++
k){
233 force += added_force_vect[
k];
245 std::vector<array_1d <double, 3> > added_force_vect;
247 std::vector<array_1d <double, 3> > added_mean_force_vect;
250 for (
unsigned int k = 0;
k < added_force_vect.size(); ++
k){
255 #pragma omp parallel for
258 for (
ElementIterator it = GetElementPartitionBegin(r_fluid_model_part,
k); it != GetElementPartitionEnd(r_fluid_model_part,
k); ++it){
260 double element_volume;
264 if (geom[0].SolutionStepsDataHas(HYDRODYNAMIC_REACTION) && geom[0].SolutionStepsDataHas(FLUID_FRACTION)){
265 element_force = CalculateVectorIntegralOfLinearInterpolationPerUnitFluidMass(geom, HYDRODYNAMIC_REACTION, element_volume);
272 if (geom[0].SolutionStepsDataHas(MEAN_HYDRODYNAMIC_REACTION) && geom[0].SolutionStepsDataHas(FLUID_FRACTION)){
273 element_mean_force = CalculateVectorIntegralOfLinearInterpolationPerUnitFluidMass(geom, MEAN_HYDRODYNAMIC_REACTION, element_volume);
280 added_force_vect[
k] += element_force;
281 added_mean_force_vect[
k] += element_mean_force;
285 instantaneous_force = added_force_vect[0];
286 mean_force = added_force_vect[0];
288 for (
unsigned int k = 1;
k < added_force_vect.size(); ++
k){
289 instantaneous_force += added_force_vect[
k];
290 mean_force += added_mean_force_vect[
k];
302 double added_fluid_volume = 0.0;
304 #pragma omp parallel for reduction(+ : added_fluid_volume)
307 for (
ElementIterator it = GetElementPartitionBegin(r_fluid_model_part,
k); it != GetElementPartitionEnd(r_fluid_model_part,
k); ++it){
309 double element_volume;
310 double element_fluid_volume;
312 if (geom[0].SolutionStepsDataHas(FLUID_FRACTION)){
313 element_fluid_volume = CalculateScalarIntegralOfLinearInterpolation(geom, FLUID_FRACTION, element_volume);
320 added_fluid_volume += element_fluid_volume;
324 return added_fluid_volume;
329 template<
class matrix_T>
330 double determinant(boost::numeric::ublas::matrix_expression<matrix_T>
const& mat_r)
334 matrix_T mLu(mat_r() );
335 boost::numeric::ublas::permutation_matrix<std::size_t> pivots(mat_r().size1() );
337 int is_singular = lu_factorize(mLu, pivots);
341 for (std::size_t
i=0;
i < pivots.size(); ++
i)
359 assert(
m.size1() ==
m.size2() &&
"Can only calculate the inverse of square matrices");
365 assert(
m.size1() == 1 &&
m.size2() == 1 &&
"Only for 1x1 matrices");
368 assert(
m(0,0) != 0.0 &&
"Cannot take the inverse of matrix [0]");
375 assert(
m.size1() == 2 &&
m.size2() == 2 &&
"Only for 2x2 matrices");
378 const double a =
m(0,0);
379 const double b =
m(0,1);
380 const double c =
m(1,0);
381 const double d =
m(1,1);
391 assert(
m.size1() == 3 &&
m.size2() == 3 &&
"Only for 3x3 matrices");
394 const double a =
m(0,0);
395 const double b =
m(0,1);
396 const double c =
m(0,2);
397 const double d =
m(1,0);
398 const double e =
m(1,1);
399 const double f =
m(1,2);
400 const double g =
m(2,0);
401 const double h =
m(2,1);
402 const double k =
m(2,2);
430 const std::vector<DenseMatrix<double> >
v = Chop(
m);
432 assert(
a.size1() ==
a.size2());
473 std::vector<DenseMatrix<double> >
w;
488 #pragma omp parallel for
489 for (
int i = 0;
i < (
int)r_model_part.
Nodes().size(); ++
i){
490 ModelPart::NodesContainerType::iterator i_particle = r_model_part.
NodesBegin() +
i;
491 Node::Pointer p_node = *(i_particle.base());
492 double& destination_value = p_node->FastGetSolutionStepValue(destination_variable);
493 const double& origin_value = p_node->FastGetSolutionStepValue(origin_variable);
494 destination_value = origin_value;
501 #pragma omp parallel for
502 for (
int i = 0;
i < (
int)r_model_part.
Nodes().size(); ++
i){
503 ModelPart::NodesContainerType::iterator i_particle = r_model_part.
NodesBegin() +
i;
504 Node::Pointer p_node = *(i_particle.base());
505 array_1d<double, 3>& destination_value = p_node->FastGetSolutionStepValue(destination_variable);
506 const array_1d<double, 3>& origin_value = p_node->FastGetSolutionStepValue(origin_variable);
507 noalias(destination_value) = origin_value;
514 #pragma omp parallel for
515 for (
int i = 0;
i < (
int)r_model_part.
Nodes().size(); ++
i){
516 ModelPart::NodesContainerType::iterator i_particle = r_model_part.
NodesBegin() +
i;
517 Node::Pointer p_node = *(i_particle.base());
518 double& destination_value = p_node->FastGetSolutionStepValue(destination_variable);
519 destination_value = value;
526 #pragma omp parallel for
527 for (
int i = 0;
i < (
int)r_model_part.
Nodes().size(); ++
i){
528 ModelPart::NodesContainerType::iterator i_particle = r_model_part.
NodesBegin() +
i;
529 Node::Pointer p_node = *(i_particle.base());
530 array_1d<double, 3>& destination_value = p_node->FastGetSolutionStepValue(destination_variable);
531 noalias(destination_value) = value;
539 bool mPressuresFilled;
540 bool mFirstGradientRecovery;
541 bool mFirstLaplacianRecovery;
542 bool mSomeCloudsDontWork;
543 bool mCalculatingTheGradient;
544 bool mCalculatingTheLaplacian;
545 bool mFirstTimeAppending;
546 double mLastMeasurementTime;
547 double mLastPressureVariation;
548 double mTotalDomainVolume;
549 std::vector<double> mPressures;
550 std::vector<DenseVector<double> > mFirstRowsOfB;
555 inline double CalculateArea(
const double x0,
const double y0,
556 const double x1,
const double y1,
557 const double x2,
const double y2)
559 const double x10 =
x1 - x0;
560 const double y10 = y1 - y0;
562 const double x20 =
x2 - x0;
563 const double y20 = y2 - y0;
565 const double area = 0.5 * std::abs(x10 * y20 - x20 * y10);
572 inline double CalculateVol(
const double x0,
const double y0,
const double z0,
573 const double x1,
const double y1,
const double z1,
574 const double x2,
const double y2,
const double z2,
575 const double x3,
const double y3,
const double z3)
577 double x10 =
x1 - x0;
578 double y10 = y1 - y0;
579 double z10 = z1 - z0;
581 double x20 =
x2 - x0;
582 double y20 = y2 - y0;
583 double z20 = z2 - z0;
585 double x30 = x3 - x0;
586 double y30 = y3 - y0;
587 double z30 = z3 - z0;
589 double detJ = x10 * y20 * z30 - x10 * y30 * z20 +
590 y10 * z20 * x30 - y10 * x20 * z30 +
591 z10 * x20 * y30 - z10 * y20 * x30;
593 return detJ * 0.1666666666666666666666667;
598 double CalculateElementalVolume(
const Geometry<Node >& geom)
602 if constexpr (TDim == 2){
603 double x0 = geom[0].X();
604 double y0 = geom[0].Y();
605 double x1 = geom[1].X();
606 double y1 = geom[1].Y();
607 double x2 = geom[2].X();
608 double y2 = geom[2].Y();
610 vol = CalculateArea(x0, y0,
x1, y1,
x2, y2);
611 h = CalculateDiameter(x0, y0,
x1, y1,
x2, y2);
615 double x0 = geom[0].X();
616 double y0 = geom[0].Y();
617 double z0 = geom[0].Z();
618 double x1 = geom[1].X();
619 double y1 = geom[1].Y();
620 double z1 = geom[1].Z();
621 double x2 = geom[2].X();
622 double y2 = geom[2].Y();
623 double z2 = geom[2].Z();
624 double x3 = geom[3].X();
625 double y3 = geom[3].Y();
626 double z3 = geom[3].Z();
628 vol = CalculateVol(x0, y0, z0,
x1, y1, z1,
x2, y2, z2, x3, y3, z3);
629 h = CalculateDiameter(x0, y0, z0,
x1, y1, z1,
x2, y2, z2, x3, y3, z3);
631 if (std::abs(vol)/std::pow(
h, 3) < std::numeric_limits<double>::epsilon()){
632 KRATOS_ERROR <<
"Element with zero area found with the current geometry "<< geom << std::endl;
641 double CalculateDiameter(
const double x0,
const double y0,
642 const double x1,
const double y1,
643 const double x2,
const double y2)
645 double x10 =
x1 - x0;
646 double y10 = y1 - y0;
648 double x12 =
x1 - x0;
649 double y12 = y1 - y0;
651 double x20 =
x2 - x0;
652 double y20 = y2 - y0;
654 double dist_10 = std::sqrt(std::pow(x10,2) + std::pow(y10,2));
655 double dist_12 = std::sqrt(std::pow(x12,2) + std::pow(y12,2));
656 double dist_20 = std::sqrt(std::pow(x20,2) + std::pow(y20,2));
658 double arr[] = {dist_10, dist_12, dist_20};
660 double *
max = std::max_element(std::begin(arr),
std::end(arr));
668 double CalculateDiameter(
const double x0,
const double y0,
const double z0,
669 const double x1,
const double y1,
const double z1,
670 const double x2,
const double y2,
const double z2,
671 const double x3,
const double y3,
const double z3)
673 double x10 =
x1 - x0;
674 double y10 = y1 - y0;
675 double z10 = z1 - z0;
677 double x12 =
x1 - x0;
678 double y12 = y1 - y0;
679 double z12 = z1 - z0;
681 double x13 =
x1 - x3;
682 double y13 = y1 - y3;
683 double z13 = z1 - z3;
685 double x20 =
x2 - x0;
686 double y20 = y2 - y0;
687 double z20 = z2 - z0;
689 double x23 =
x2 - x3;
690 double y23 = y2 - y3;
691 double z23 = z2 - z3;
693 double x30 = x3 - x0;
694 double y30 = y3 - y0;
695 double z30 = z3 - z0;
697 double dist_10 = std::sqrt(std::pow(x10,2) + std::pow(y10,2) + std::pow(z10,2));
698 double dist_12 = std::sqrt(std::pow(x12,2) + std::pow(y12,2) + std::pow(z12,2));
699 double dist_13 = std::sqrt(std::pow(x13,2) + std::pow(y13,2) + std::pow(z13,2));
700 double dist_20 = std::sqrt(std::pow(x20,2) + std::pow(y20,2) + std::pow(z20,2));
701 double dist_23 = std::sqrt(std::pow(x23,2) + std::pow(y23,2) + std::pow(z23,2));
702 double dist_30 = std::sqrt(std::pow(x30,2) + std::pow(y30,2) + std::pow(z30,2));
704 double arr[] = {dist_10, dist_12, dist_13, dist_20, dist_23, dist_30};
706 double *
max = std::max_element(std::begin(arr),
std::end(arr));
714 double CalculateScalarIntegralOfLinearInterpolation(
const Geometry<Node >& geom,
const Variable<double>& r_var,
double& vol)
717 vol = geom.DomainSize();
719 KRATOS_ERROR_IF(std::abs(vol) == 0.0) <<
"Element with zero area found. Its geometry is given by "<< geom << std::endl;
721 const std::size_t
n_nodes = geom.PointsNumber();
723 const IndexType number_of_gauss_points = integration_points.size();
728 for (
IndexType g = 0; g < number_of_gauss_points; ++g) {
729 N =
row(N_container, g);
732 double value_at_gauss_point = 0.0;
734 for (
unsigned int i_node = 0; i_node <
n_nodes; ++i_node){
735 value_at_gauss_point +=
N[i_node] * geom[i_node].FastGetSolutionStepValue(r_var, 0);
738 return value_at_gauss_point;
744 array_1d <double, 3> CalculateVectorIntegralOfLinearInterpolation(
const Geometry<Node >& geom,
const Variable<array_1d <double, 3> >& r_var,
double& vol)
747 vol = geom.DomainSize();
749 KRATOS_ERROR_IF(std::abs(vol) == 0.0) <<
"Element with zero area found. Its geometry is given by " << geom << std::endl;
751 const std::size_t
n_nodes = geom.PointsNumber();
753 const IndexType number_of_gauss_points = integration_points.size();
758 for (
IndexType g = 0; g < number_of_gauss_points; ++g) {
759 N =
row(N_container, g);
762 array_1d <double, 3> value_at_gauss_point =
N[0] * geom[0].FastGetSolutionStepValue(r_var);
764 for (
unsigned int i_node = 1; i_node <
n_nodes; ++i_node){
765 value_at_gauss_point +=
N[i_node] * geom[i_node].FastGetSolutionStepValue(r_var);
768 return value_at_gauss_point;
774 array_1d <double, 3> CalculateVectorIntegralOfLinearInterpolationPerUnitFluidMass(
const Geometry<Node >& geom,
const Variable<array_1d <double, 3> >& r_var,
double& vol)
777 vol = geom.DomainSize();
779 KRATOS_ERROR_IF(std::abs(vol) == 0.0) <<
"Element with zero area found. Its geometry is given by " << geom << std::endl;
781 const std::size_t
n_nodes = geom.PointsNumber();
783 const IndexType number_of_gauss_points = integration_points.size();
787 Vector detJ_vector(number_of_gauss_points);
791 double integration_weight;
793 array_1d <double, 3> value_at_gauss_point = {};
795 for (
IndexType g = 0; g < number_of_gauss_points; ++g) {
796 N =
row(N_container, g);
797 integration_weight = integration_points[g].Weight() * detJ_vector[g];
800 for (
unsigned int i_node = 0; i_node <
n_nodes; ++i_node){
801 value_at_gauss_point += integration_weight *
N[i_node] * geom[i_node].FastGetSolutionStepValue(r_var) * geom[i_node].FastGetSolutionStepValue(DENSITY) * geom[i_node].FastGetSolutionStepValue(FLUID_FRACTION);
805 return value_at_gauss_point;
811 void PerformFirstStepComputations(ModelPart& r_model_part)
814 mPressures.resize(r_model_part.Nodes().size());
815 mLastMeasurementTime = r_model_part.GetProcessInfo()[TIME];
819 for (
NodeIterator inode = r_model_part.NodesBegin(); inode != r_model_part.NodesEnd(); ++inode) {
820 mPressures[
i] = inode->FastGetSolutionStepValue(PRESSURE);
824 mPressuresFilled =
true;
825 mLastPressureVariation = GetRangeWithinVector(mPressures);
832 bool operator()(std::pair<unsigned int, double>
const& first_pair, std::pair<unsigned int, double>
const& second_pair)
834 return(first_pair.second < second_pair.second || (first_pair.second == second_pair.second && first_pair.first < second_pair.first));
841 inline int Factorial(
const unsigned int n){
849 for (
unsigned int i =
n - 1;
i > 0; --
i){
859 double CalculateTheMaximumEdgeLength(ModelPart& r_model_part)
861 double max_distance_yet = 0.0;
864 Geometry<Node >& geom = ielem->GetGeometry();
865 unsigned int n_nodes =
static_cast<unsigned int>(TDim + 1);
867 for (
unsigned int k = 1;
k <
n_nodes - 1; ++
k){
869 array_1d <double, 3> delta_i = geom[
k - 1] - geom[
i];
876 return(std::sqrt(max_distance_yet));
882 double CalculateTheMinumumEdgeLength(ModelPart& r_model_part)
884 double min_distance_yet = 0.0;
886 bool first_node =
true;
889 Geometry<Node >& geom = ielem->GetGeometry();
892 array_1d <double, 3>
delta = geom[0] - geom[1];
897 unsigned int n_nodes =
static_cast<unsigned int>(TDim + 1);
899 for (
unsigned int k = 1;
k <
n_nodes - 1; ++
k){
901 array_1d <double, 3> delta_i = geom[
k - 1] - geom[
i];
909 return(std::sqrt(min_distance_yet));
919 double CalcDeterminant(
const DenseMatrix<double>&
m)
921 assert(
m.size1() ==
m.size2() &&
"Can only calculate the determinant of square matrices");
930 const double a =
m(0,0);
931 const double b =
m(0,1);
932 const double c =
m(1,0);
933 const double d =
m(1,1);
939 assert(
m.size1() == 3 &&
m.size2() == 3 &&
"Only for 3x3 matrices");
940 const double a =
m(0,0);
941 const double b =
m(0,1);
942 const double c =
m(0,2);
943 const double d =
m(1,0);
944 const double e =
m(1,1);
945 const double f =
m(1,2);
946 const double g =
m(2,0);
947 const double h =
m(2,1);
948 const double k =
m(2,2);
950 = (
a * ((
e*
k) - (
f*
h)))
951 - (
b * ((
k*
d) - (
f*g)))
952 + (
c * ((
d*
h) - (
e*g)));
956 assert(!
"Should not get here: unsupported matrix size");
957 throw std::runtime_error(
"Unsupported matrix size");
964 const std::vector<DenseMatrix<double> > Chop(
965 const DenseMatrix<double>&
m)
967 using boost::numeric::ublas::range;
968 using boost::numeric::ublas::matrix_range;
969 std::vector<matrix<double> >
v;
971 const int midy =
m.size1() / 2;
972 const int midx =
m.size2() / 2;
973 const matrix_range<const matrix<double> > top_left(
m,range(0 ,midy ),range(0 ,midx ));
974 const matrix_range<const matrix<double> > bottom_left(
m,range(midy,
m.size1()),range(0 ,midx ));
975 const matrix_range<const matrix<double> > top_right(
m,range(0 ,midy ),range(midx,
m.size2()));
976 const matrix_range<const matrix<double> > bottom_right(
m,range(midy,
m.size1()),range(midx,
m.size2()));
977 v.push_back(matrix<double>(top_left));
978 v.push_back(matrix<double>(top_right));
979 v.push_back(matrix<double>(bottom_left));
980 v.push_back(matrix<double>(bottom_right));
985 const DenseMatrix<double> Unchop(
986 const std::vector<DenseMatrix<double> >&
v)
991 using boost::numeric::ublas::range;
992 using boost::numeric::ublas::matrix_range;
993 assert(
v.size() == 4);
994 assert(
v[0].size1() ==
v[1].size1());
995 assert(
v[2].size1() ==
v[3].size1());
996 assert(
v[0].size2() ==
v[2].size2());
997 assert(
v[1].size2() ==
v[3].size2());
998 DenseMatrix<double>
m(
v[0].size1() +
v[2].size1(),
v[0].size2() +
v[1].size2());
999 for (
int quadrant=0; quadrant!=4; ++quadrant)
1001 const DenseMatrix<double>&
w =
v[quadrant];
1002 const std::size_t n_rows =
v[quadrant].size1();
1003 const std::size_t n_cols =
v[quadrant].size2();
1004 const int offset_x = quadrant % 2 ?
v[0].size2() : 0;
1005 const int offset_y = quadrant / 2 ?
v[0].size1() : 0;
1006 for (std::size_t
row=0;
row!=n_rows; ++
row)
1008 for (std::size_t col=0; col!=n_cols; ++col)
1010 m(offset_y +
row, offset_x + col) =
w(
row,col);
1015 assert(
v[0].size1() +
v[2].size1() ==
m.size1());
1016 assert(
v[1].size1() +
v[3].size1() ==
m.size1());
1017 assert(
v[0].size2() +
v[1].size2() ==
m.size2());
1018 assert(
v[2].size2() +
v[3].size2() ==
m.size2());
1029 DenseVector<unsigned int> mElementsPartition;
1035 double GetRangeWithinVector(
const std::vector<double>& vector)
1037 double min = vector[0];
1038 double max = vector[0];
1040 for (
unsigned int i = 0;
i != vector.size(); ++
i){
1048 DenseVector<unsigned int>& GetElementPartition()
1050 return mElementsPartition;
1053 ElementIterator GetElementPartitionBegin(ModelPart& r_model_part,
unsigned int k)
1055 return r_model_part.GetCommunicator().LocalMesh().Elements().ptr_begin() + mElementsPartition[
k];
1058 ElementIterator GetElementPartitionEnd(ModelPart& r_model_part,
unsigned int k)
1060 return r_model_part.GetCommunicator().LocalMesh().Elements().ptr_begin() + mElementsPartition[
k + 1];
#define DEM_INNER_PRODUCT_3(a, b)
Definition: DEM_application_variables.h:31
MeshType & LocalMesh()
Returns the reference to the mesh storing all local entities.
Definition: communicator.cpp:245
Definition: custom_functions.h:41
void CalculateTotalHydrodynamicForceOnParticles(ModelPart &r_dem_model_part, array_1d< double, 3 > &force)
Definition: custom_functions.h:200
ModelPart::NodesContainerType NodesArrayType
Definition: custom_functions.h:46
const DenseMatrix< double > Inverse(const DenseMatrix< double > &m)
Definition: custom_functions.h:356
double determinant(boost::numeric::ublas::matrix_expression< matrix_T > const &mat_r)
Definition: custom_functions.h:330
void CopyValuesFromFirstToSecond(ModelPart &r_model_part, const Variable< array_1d< double, 3 >> &origin_variable, const Variable< array_1d< double, 3 >> &destination_variable)
Definition: custom_functions.h:499
double CalculateDomainVolume(ModelPart &r_fluid_model_part)
Definition: custom_functions.h:179
CustomFunctionsCalculator()
Definition: custom_functions.h:50
void CalculatePressureGradient(ModelPart &r_model_part)
Default calculator.
Definition: custom_functions.h:60
ModelPart::ElementsContainerType::iterator ElementIterator
Definition: custom_functions.h:44
void SetValueOfAllNotes(ModelPart &r_model_part, const array_1d< double, 3 > &value, const Variable< array_1d< double, 3 >> &destination_variable)
Definition: custom_functions.h:524
ModelPart::NodesContainerType::iterator NodeIterator
Definition: custom_functions.h:45
bool AssessStationarity(ModelPart &r_model_part, const double &tol)
Definition: custom_functions.h:109
KRATOS_CLASS_POINTER_DEFINITION(CustomFunctionsCalculator)
void SetValueOfAllNotes(ModelPart &r_model_part, const double &value, const Variable< double > &destination_variable)
Definition: custom_functions.h:512
void CopyValuesFromFirstToSecond(ModelPart &r_model_part, const Variable< double > &origin_variable, const Variable< double > &destination_variable)
Definition: custom_functions.h:486
virtual ~CustomFunctionsCalculator()
Calculator.
Definition: custom_functions.h:53
double CalculateGlobalFluidVolume(ModelPart &r_fluid_model_part)
Definition: custom_functions.h:298
void CalculateTotalHydrodynamicForceOnFluid(ModelPart &r_fluid_model_part, array_1d< double, 3 > &instantaneous_force, array_1d< double, 3 > &mean_force)
Definition: custom_functions.h:241
Geometry base class.
Definition: geometry.h:71
virtual double DomainSize() const
This method calculate and return length, area or volume of this geometry depending to it's dimension.
Definition: geometry.h:1371
static void CalculateGeometryData(const GeometryType &rGeometry, BoundedMatrix< double, 4, 3 > &rDN_DX, array_1d< double, 4 > &rN, double &rVolume)
This function is designed to compute the shape function derivatives, shape functions and volume in 3D...
Definition: geometry_utilities.h:176
Definition: amatrix_interface.h:41
ElementsContainerType & Elements()
Definition: mesh.h:568
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
Communicator & GetCommunicator()
Definition: model_part.h:1821
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
ElementIterator ElementsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1179
MeshType::ElementIterator ElementIterator
Definition: model_part.h:174
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
static int GetNumThreads()
Returns the current number of threads.
Definition: parallel_utilities.cpp:34
size_type size() const
Returns the number of elements in the container.
Definition: pointer_vector_set.h:502
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_INFO(label)
Definition: logger.h:250
end
Definition: DEM_benchmarks.py:180
static double max(double a, double b)
Definition: GeometryFunctions.h:79
static double min(double a, double b)
Definition: GeometryFunctions.h:71
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
AMatrix::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
float velocity
Definition: PecletTest.py:54
v
Definition: generate_convection_diffusion_explicit_element.py:114
w
Definition: generate_convection_diffusion_explicit_element.py:108
f
Definition: generate_convection_diffusion_explicit_element.py:112
h
Definition: generate_droplet_dynamics.py:91
x2
Definition: generate_frictional_mortar_condition.py:122
x1
Definition: generate_frictional_mortar_condition.py:121
a
Definition: generate_stokes_twofluid_element.py:77
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
int n_nodes
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:15
c
Definition: generate_weakly_compressible_navier_stokes_element.py:108
grad
Definition: hinsberg_optimization.py:148
int tol
Definition: hinsberg_optimization.py:138
characteristic_length
Definition: isotropic_damage_automatic_differentiation.py:135
int d
Definition: ode_solve.py:397
int n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
int k
Definition: quadrature.py:595
float delta_t
Definition: rotatingcone_PureConvectionBenchmarking.py:129
int m
Definition: run_marine_rain_substepping.py:8
N
Definition: sensitivityMatrix.py:29
distance_2
Definition: sp_statistics.py:71
integer i
Definition: TensorModule.f:17
double precision, dimension(3, 3), public delta
Definition: TensorModule.f:16
e
Definition: run_cpp_mpi_tests.py:31
#define SWIMMING_MODULUS_3(a)
Definition: swimming_DEM_application.h:53