9 #ifndef KRATOS_NODAL_TWO_STEP_V_P_STRATEGY_H
10 #define KRATOS_NODAL_TWO_STEP_V_P_STRATEGY_H
23 #include "utilities/geometry_utilities.h"
29 #include "custom_utilities/solver_settings.h"
66 template <
class TSparseSpace,
119 typename TLinearSolver::Pointer pVelocityLinearSolver,
120 typename TLinearSolver::Pointer pPressureLinearSolver,
121 bool ReformDofSet =
true,
122 double VelTol = 0.0001,
123 double PresTol = 0.0001,
124 int MaxPressureIterations = 1,
125 unsigned int TimeOrder = 2,
126 unsigned int DomainSize = 2) :
BaseType(rModelPart),
141 bool CalculateNormDxFlag =
true;
151 typename SchemeType::Pointer pScheme;
163 vel_build->SetCalculateReactionsFlag(
false);
171 pressure_build->SetCalculateReactionsFlag(
false);
188 if (DELTA_TIME.Key() == 0)
189 KRATOS_THROW_ERROR(std::runtime_error,
"DELTA_TIME Key is 0. Check that the application was correctly registered.",
"");
194 for (
const auto &r_element : rModelPart.
Elements())
196 ierr = r_element.Check(r_current_process_info);
215 double Dt = rCurrentProcessInfo[DELTA_TIME];
218 double Rho = OldDt /
Dt;
219 double TimeCoeff = 1.0 / (
Dt * Rho * Rho +
Dt * Rho);
221 Vector &BDFcoeffs = rCurrentProcessInfo[BDF_COEFFICIENTS];
222 BDFcoeffs.
resize(3,
false);
224 BDFcoeffs[0] = TimeCoeff * (Rho * Rho + 2.0 * Rho);
225 BDFcoeffs[1] = -TimeCoeff * (Rho * Rho + 2.0 * Rho + 1.0);
226 BDFcoeffs[2] = TimeCoeff;
230 double Dt = rCurrentProcessInfo[DELTA_TIME];
231 double TimeCoeff = 1.0 /
Dt;
233 Vector &BDFcoeffs = rCurrentProcessInfo[BDF_COEFFICIENTS];
234 BDFcoeffs.
resize(2,
false);
236 BDFcoeffs[0] = TimeCoeff;
237 BDFcoeffs[1] = -TimeCoeff;
248 double currentTime = rCurrentProcessInfo[TIME];
249 double timeInterval = rCurrentProcessInfo[DELTA_TIME];
250 bool timeIntervalChanged = rCurrentProcessInfo[TIME_INTERVAL_CHANGED];
251 bool converged =
false;
255 KRATOS_INFO(
"\n Solve with nodally_integrated_two_step_vp strategy at t=") << currentTime <<
"s" << std::endl;
257 if (timeIntervalChanged ==
true && currentTime > 10 * timeInterval)
259 maxNonLinearIterations *= 2;
261 if (currentTime < 10 * timeInterval)
264 std::cout <<
"within the first 10 time steps, I consider the given iteration number x3" << std::endl;
265 maxNonLinearIterations *= 3;
267 if (currentTime < 20 * timeInterval && currentTime >= 10 * timeInterval)
270 std::cout <<
"within the second 10 time steps, I consider the given iteration number x2" << std::endl;
271 maxNonLinearIterations *= 2;
274 bool momentumConverged =
true;
275 bool continuityConverged =
false;
276 bool fixedTimeStep =
false;
277 double pressureNorm = 0;
278 double velocityNorm = 0;
280 this->FillNodalSFDVector();
281 for (
unsigned int it = 0; it < maxNonLinearIterations; ++it)
284 std::cout <<
"----- > iteration: " << it << std::endl;
295 momentumConverged = this->
SolveMomentumIteration(it, maxNonLinearIterations, fixedTimeStep, velocityNorm);
302 if (fixedTimeStep ==
false)
322 if (it == maxNonLinearIterations - 1 || ((continuityConverged && momentumConverged) && it > 1))
332 if ((continuityConverged && momentumConverged) && it > 1)
334 rCurrentProcessInfo.
SetValue(BAD_VELOCITY_CONVERGENCE,
false);
335 rCurrentProcessInfo.
SetValue(BAD_PRESSURE_CONVERGENCE,
false);
337 std::cout <<
"nodal V-P strategy converged in " << it + 1 <<
" iterations." << std::endl;
343 std::cout <<
"Convergence tolerance not reached." << std::endl;
361 unsigned int sizeStrains = 3 * (
dimension - 1);
372 unsigned int neighbourNodes = neighb_nodes.
size();
373 unsigned int sizeSDFNeigh = neighbourNodes *
dimension;
375 if (itNode->SolutionStepsDataHas(NODAL_CAUCHY_STRESS))
377 Vector &rNodalStress = itNode->FastGetSolutionStepValue(NODAL_CAUCHY_STRESS);
378 if (rNodalStress.size() != sizeStrains)
380 rNodalStress.
resize(sizeStrains,
false);
386 std::cout <<
"THIS node does not have NODAL_CAUCHY_STRESS... " << itNode->X() <<
" " << itNode->Y() << std::endl;
389 if (itNode->SolutionStepsDataHas(NODAL_DEVIATORIC_CAUCHY_STRESS))
391 Vector &rNodalStress = itNode->FastGetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS);
392 if (rNodalStress.size() != sizeStrains)
394 rNodalStress.
resize(sizeStrains,
false);
400 std::cout <<
"THIS node does not have NODAL_DEVIATORIC_CAUCHY_STRESS... " << itNode->X() <<
" " << itNode->Y() << std::endl;
403 if (itNode->SolutionStepsDataHas(NODAL_VOLUME))
405 itNode->FastGetSolutionStepValue(NODAL_VOLUME) = 0;
409 std::cout <<
"THIS node does not have NODAL_VOLUME... " << itNode->X() <<
" " << itNode->Y() << std::endl;
412 if (itNode->SolutionStepsDataHas(NODAL_MEAN_MESH_SIZE))
414 itNode->FastGetSolutionStepValue(NODAL_MEAN_MESH_SIZE) = 0;
418 std::cout <<
"THIS node does not have NODAL_MEAN_MESH_SIZE... " << itNode->X() <<
" " << itNode->Y() << std::endl;
421 if (itNode->SolutionStepsDataHas(NODAL_FREESURFACE_AREA))
423 itNode->FastGetSolutionStepValue(NODAL_FREESURFACE_AREA) = 0;
427 std::cout <<
"THIS node does not have NODAL_FREESURFACE_AREA... " << itNode->X() <<
" " << itNode->Y() << std::endl;
430 if (itNode->SolutionStepsDataHas(NODAL_SFD_NEIGHBOURS))
432 Vector &rNodalSFDneighbours = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS);
433 if (rNodalSFDneighbours.size() != sizeSDFNeigh)
435 rNodalSFDneighbours.
resize(sizeSDFNeigh,
false);
441 std::cout <<
"THIS node does not have NODAL_SFD_NEIGHBOURS... " << itNode->X() <<
" " << itNode->Y() << std::endl;
444 if (itNode->SolutionStepsDataHas(NODAL_SPATIAL_DEF_RATE))
446 Vector &rSpatialDefRate = itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE);
447 if (rSpatialDefRate.size() != sizeStrains)
449 rSpatialDefRate.
resize(sizeStrains,
false);
455 std::cout <<
"THIS node does not have NODAL_SPATIAL_DEF_RATE... " << itNode->X() <<
" " << itNode->Y() << std::endl;
458 if (itNode->SolutionStepsDataHas(NODAL_DEFORMATION_GRAD))
460 Matrix &rFgrad = itNode->FastGetSolutionStepValue(NODAL_DEFORMATION_GRAD);
469 std::cout <<
"THIS node does not have NODAL_DEFORMATION_GRAD... " << itNode->X() <<
" " << itNode->Y() << std::endl;
472 if (itNode->SolutionStepsDataHas(NODAL_DEFORMATION_GRAD_VEL))
474 Matrix &rFgradVel = itNode->FastGetSolutionStepValue(NODAL_DEFORMATION_GRAD_VEL);
483 std::cout <<
"THIS node does not have NODAL_DEFORMATION_GRAD_VEL... " << itNode->X() <<
" " << itNode->Y() << std::endl;
496 const double timeInterval = rCurrentProcessInfo[DELTA_TIME];
498 double deviatoricCoeff = 0;
501 deviatoricCoeff = itNode->FastGetSolutionStepValue(DYNAMIC_VISCOSITY);
504 double volumetricCoeff = timeInterval * itNode->FastGetSolutionStepValue(BULK_MODULUS);
505 double currFirstLame = volumetricCoeff - 2.0 * deviatoricCoeff / 3.0;
507 itNode->FastGetSolutionStepValue(VOLUMETRIC_COEFFICIENT) = currFirstLame;
508 itNode->FastGetSolutionStepValue(DEVIATORIC_COEFFICIENT) = deviatoricCoeff;
518 int number_of_threads = omp_get_max_threads();
520 int number_of_threads = 1;
523 vector<unsigned int> element_partition;
524 OpenMPUtils::CreatePartition(number_of_threads, pElements.size(), element_partition);
529 typename ElementsArrayType::iterator ElemBegin = pElements.begin() + element_partition[
k];
530 typename ElementsArrayType::iterator ElemEnd = pElements.begin() + element_partition[
k + 1];
532 for (
typename ElementsArrayType::iterator itElem = ElemBegin; itElem != ElemEnd; itElem++)
535 double elementalVolume = 0;
539 elementalVolume = geometry.
Area() / 3.0;
543 elementalVolume = geometry.
Volume() * 0.25;
546 unsigned int numNodes = geometry.
size();
547 for (
unsigned int i = 0;
i < numNodes;
i++)
549 double &nodalVolume = geometry(
i)->FastGetSolutionStepValue(NODAL_VOLUME);
550 nodalVolume += elementalVolume;
559 unsigned int neighbourNodes = neighb_nodes.
size() + 1;
560 Vector &rNodeOrderedNeighbours = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS_ORDER);
562 if (rNodeOrderedNeighbours.size() != neighbourNodes)
563 rNodeOrderedNeighbours.
resize(neighbourNodes,
false);
567 rNodeOrderedNeighbours[0] = itNode->Id();
569 if (neighbourNodes > 1)
571 for (
unsigned int k = 0;
k < neighbourNodes - 1;
k++)
573 rNodeOrderedNeighbours[
k + 1] = neighb_nodes[
k].Id();
583 unsigned int sizeStrains = 3 * (
dimension - 1);
585 unsigned int neighbourNodes = neighb_nodes.
size() + 1;
586 unsigned int sizeSDFNeigh = neighbourNodes *
dimension;
588 if (itNode->SolutionStepsDataHas(NODAL_CAUCHY_STRESS))
590 Vector &rNodalStress = itNode->FastGetSolutionStepValue(NODAL_CAUCHY_STRESS);
591 if (rNodalStress.size() != sizeStrains)
592 rNodalStress.
resize(sizeStrains,
false);
595 if (itNode->SolutionStepsDataHas(NODAL_DEVIATORIC_CAUCHY_STRESS))
597 Vector &rNodalDevStress = itNode->FastGetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS);
598 if (rNodalDevStress.size() != sizeStrains)
599 rNodalDevStress.
resize(sizeStrains,
false);
602 if (itNode->SolutionStepsDataHas(NODAL_SFD_NEIGHBOURS_ORDER))
604 Vector &rNodalSFDneighboursOrder = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS_ORDER);
605 if (rNodalSFDneighboursOrder.size() != neighbourNodes)
606 rNodalSFDneighboursOrder.
resize(neighbourNodes,
false);
609 if (itNode->SolutionStepsDataHas(NODAL_SFD_NEIGHBOURS))
611 Vector &rNodalSFDneighbours = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS);
612 if (rNodalSFDneighbours.size() != sizeSDFNeigh)
613 rNodalSFDneighbours.
resize(sizeSDFNeigh,
false);
616 if (itNode->SolutionStepsDataHas(NODAL_SPATIAL_DEF_RATE))
618 Vector &rSpatialDefRate = itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE);
619 if (rSpatialDefRate.size() != sizeStrains)
620 rSpatialDefRate.
resize(sizeStrains,
false);
623 if (itNode->SolutionStepsDataHas(NODAL_DEFORMATION_GRAD))
625 Matrix &rFgrad = itNode->FastGetSolutionStepValue(NODAL_DEFORMATION_GRAD);
630 if (itNode->SolutionStepsDataHas(NODAL_DEFORMATION_GRAD_VEL))
632 Matrix &rFgradVel = itNode->FastGetSolutionStepValue(NODAL_DEFORMATION_GRAD_VEL);
637 if (itNode->SolutionStepsDataHas(NODAL_VOLUME))
639 itNode->FastGetSolutionStepValue(NODAL_VOLUME) = 0;
641 if (itNode->SolutionStepsDataHas(NODAL_MEAN_MESH_SIZE))
643 itNode->FastGetSolutionStepValue(NODAL_MEAN_MESH_SIZE) = 0;
645 if (itNode->SolutionStepsDataHas(NODAL_FREESURFACE_AREA))
647 itNode->FastGetSolutionStepValue(NODAL_FREESURFACE_AREA) = 0;
649 if (itNode->SolutionStepsDataHas(NODAL_VOLUMETRIC_DEF_RATE))
651 itNode->FastGetSolutionStepValue(NODAL_VOLUMETRIC_DEF_RATE) = 0;
653 if (itNode->SolutionStepsDataHas(NODAL_EQUIVALENT_STRAIN_RATE))
655 itNode->FastGetSolutionStepValue(NODAL_EQUIVALENT_STRAIN_RATE) = 0;
667 int number_of_threads = omp_get_max_threads();
669 int number_of_threads = 1;
672 vector<unsigned int> element_partition;
673 OpenMPUtils::CreatePartition(number_of_threads, pElements.size(), element_partition);
678 typename ElementsArrayType::iterator ElemBegin = pElements.begin() + element_partition[
k];
679 typename ElementsArrayType::iterator ElemEnd = pElements.begin() + element_partition[
k + 1];
681 for (
typename ElementsArrayType::iterator itElem = ElemBegin; itElem != ElemEnd; itElem++)
683 itElem->InitializeNonLinearIteration(rCurrentProcessInfo);
701 double nodalVolume = itNode->FastGetSolutionStepValue(NODAL_VOLUME);
723 double currFirstLame = itNode->FastGetSolutionStepValue(VOLUMETRIC_COEFFICIENT);
724 double deviatoricCoeff = 0;
726 Matrix Fgrad = itNode->FastGetSolutionStepValue(NODAL_DEFORMATION_GRAD);
727 Matrix FgradVel = itNode->FastGetSolutionStepValue(NODAL_DEFORMATION_GRAD_VEL);
728 double detFgrad = 1.0;
742 SpatialVelocityGrad =
prod(FgradVel, InvFgrad);
746 auto &r_stain_tensor2D = itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE);
747 r_stain_tensor2D[0] = SpatialVelocityGrad(0, 0);
748 r_stain_tensor2D[1] = SpatialVelocityGrad(1, 1);
749 r_stain_tensor2D[2] = 0.5 * (SpatialVelocityGrad(1, 0) + SpatialVelocityGrad(0, 1));
753 double DefVol = itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] + itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1];
755 itNode->GetSolutionStepValue(NODAL_VOLUMETRIC_DEF_RATE) = DefVol;
757 double nodalSigmaTot_xx = currFirstLame * DefVol + 2.0 * deviatoricCoeff * itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0];
758 double nodalSigmaTot_yy = currFirstLame * DefVol + 2.0 * deviatoricCoeff * itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1];
759 double nodalSigmaTot_xy = 2.0 * deviatoricCoeff * itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2];
761 double nodalSigmaDev_xx = 2.0 * deviatoricCoeff * (itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] - DefVol / 3.0);
762 double nodalSigmaDev_yy = 2.0 * deviatoricCoeff * (itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] - DefVol / 3.0);
763 double nodalSigmaDev_xy = 2.0 * deviatoricCoeff * itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2];
765 auto &r_stress_tensor2D = itNode->GetSolutionStepValue(NODAL_CAUCHY_STRESS, 0);
766 r_stress_tensor2D[0] = nodalSigmaTot_xx;
767 r_stress_tensor2D[1] = nodalSigmaTot_yy;
768 r_stress_tensor2D[2] = nodalSigmaTot_xy;
770 auto &r_dev_stress_tensor2D = itNode->GetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS, 0);
771 r_dev_stress_tensor2D[0] = nodalSigmaDev_xx;
772 r_dev_stress_tensor2D[1] = nodalSigmaDev_yy;
773 r_dev_stress_tensor2D[2] = nodalSigmaDev_xy;
777 auto &r_stain_tensor3D = itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE);
778 r_stain_tensor3D[0] = SpatialVelocityGrad(0, 0);
779 r_stain_tensor3D[1] = SpatialVelocityGrad(1, 1);
780 r_stain_tensor3D[2] = SpatialVelocityGrad(2, 2);
781 r_stain_tensor3D[3] = 0.5 * (SpatialVelocityGrad(1, 0) + SpatialVelocityGrad(0, 1));
782 r_stain_tensor3D[4] = 0.5 * (SpatialVelocityGrad(2, 0) + SpatialVelocityGrad(0, 2));
783 r_stain_tensor3D[5] = 0.5 * (SpatialVelocityGrad(2, 1) + SpatialVelocityGrad(1, 2));
787 double DefVol = itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] + itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] + itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2];
788 itNode->GetSolutionStepValue(NODAL_VOLUMETRIC_DEF_RATE) = DefVol;
790 double nodalSigmaTot_xx = currFirstLame * DefVol + 2.0 * deviatoricCoeff * itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0];
791 double nodalSigmaTot_yy = currFirstLame * DefVol + 2.0 * deviatoricCoeff * itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1];
792 double nodalSigmaTot_zz = currFirstLame * DefVol + 2.0 * deviatoricCoeff * itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2];
793 double nodalSigmaTot_xy = 2.0 * deviatoricCoeff * itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[3];
794 double nodalSigmaTot_xz = 2.0 * deviatoricCoeff * itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[4];
795 double nodalSigmaTot_yz = 2.0 * deviatoricCoeff * itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[5];
797 double nodalSigmaDev_xx = 2.0 * deviatoricCoeff * (itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] - DefVol / 3.0);
798 double nodalSigmaDev_yy = 2.0 * deviatoricCoeff * (itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] - DefVol / 3.0);
799 double nodalSigmaDev_zz = 2.0 * deviatoricCoeff * (itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] - DefVol / 3.0);
800 double nodalSigmaDev_xy = 2.0 * deviatoricCoeff * itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[3];
801 double nodalSigmaDev_xz = 2.0 * deviatoricCoeff * itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[4];
802 double nodalSigmaDev_yz = 2.0 * deviatoricCoeff * itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[5];
804 auto &r_stress_tensor3D = itNode->GetSolutionStepValue(NODAL_CAUCHY_STRESS, 0);
805 r_stress_tensor3D[0] = nodalSigmaTot_xx;
806 r_stress_tensor3D[1] = nodalSigmaTot_yy;
807 r_stress_tensor3D[2] = nodalSigmaTot_zz;
808 r_stress_tensor3D[3] = nodalSigmaTot_xy;
809 r_stress_tensor3D[4] = nodalSigmaTot_xz;
810 r_stress_tensor3D[5] = nodalSigmaTot_yz;
812 auto &r_dev_stress_tensor3D = itNode->GetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS, 0);
813 r_dev_stress_tensor3D[0] = nodalSigmaDev_xx;
814 r_dev_stress_tensor3D[1] = nodalSigmaDev_yy;
815 r_dev_stress_tensor3D[2] = nodalSigmaDev_zz;
816 r_dev_stress_tensor3D[3] = nodalSigmaDev_xy;
817 r_dev_stress_tensor3D[4] = nodalSigmaDev_xz;
818 r_dev_stress_tensor3D[5] = nodalSigmaDev_yz;
825 const double tolerance = 1
e-12;
829 const double static_friction = itNode->FastGetSolutionStepValue(STATIC_FRICTION);
830 const double dynamic_friction = itNode->FastGetSolutionStepValue(DYNAMIC_FRICTION);
831 const double delta_friction = dynamic_friction - static_friction;
832 const double inertial_number_zero = itNode->FastGetSolutionStepValue(INERTIAL_NUMBER_ZERO);
833 const double grain_diameter = itNode->FastGetSolutionStepValue(GRAIN_DIAMETER);
834 const double grain_density = itNode->FastGetSolutionStepValue(GRAIN_DENSITY);
835 const double regularization_coeff = itNode->FastGetSolutionStepValue(REGULARIZATION_COEFFICIENT);
837 const double theta = 0.5;
838 double mean_pressure = itNode->FastGetSolutionStepValue(PRESSURE, 0) * theta + itNode->FastGetSolutionStepValue(PRESSURE, 1) * (1 - theta);
840 double pressure_tolerance = -1.0e-07;
841 if (mean_pressure > pressure_tolerance)
843 mean_pressure = pressure_tolerance;
848 itNode->FastGetSolutionStepValue(NODAL_EQUIVALENT_STRAIN_RATE) = sqrt((2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] +
849 2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] +
850 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2]));
854 itNode->FastGetSolutionStepValue(NODAL_EQUIVALENT_STRAIN_RATE) = sqrt(2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] +
855 2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] +
856 2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] +
857 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[3] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[3] +
858 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[4] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[4] +
859 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[5] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[5]);
861 const double equivalent_strain_rate = itNode->FastGetSolutionStepValue(NODAL_EQUIVALENT_STRAIN_RATE);
862 const double exponent = -equivalent_strain_rate / regularization_coeff;
863 const double second_viscous_term = delta_friction * grain_diameter / (inertial_number_zero * std::sqrt(std::fabs(mean_pressure) / grain_density) + equivalent_strain_rate * grain_diameter);
865 if (std::fabs(equivalent_strain_rate) > tolerance)
867 const double first_viscous_term = static_friction * (1 - std::exp(exponent)) / equivalent_strain_rate;
868 deviatoricCoefficient = (first_viscous_term + second_viscous_term) * std::fabs(mean_pressure);
872 deviatoricCoefficient = 1.0;
877 const double dynamic_viscosity = itNode->FastGetSolutionStepValue(DYNAMIC_VISCOSITY);
878 const double friction_angle = itNode->FastGetSolutionStepValue(INTERNAL_FRICTION_ANGLE);
879 const double cohesion = itNode->FastGetSolutionStepValue(COHESION);
880 const double adaptive_exponent = itNode->FastGetSolutionStepValue(ADAPTIVE_EXPONENT);
882 const double theta = 0.5;
883 double mean_pressure = itNode->FastGetSolutionStepValue(PRESSURE, 0) * theta + itNode->FastGetSolutionStepValue(PRESSURE, 1) * (1 - theta);
885 double pressure_tolerance = -1.0e-07;
886 if (mean_pressure > pressure_tolerance)
888 mean_pressure = pressure_tolerance;
893 itNode->FastGetSolutionStepValue(NODAL_EQUIVALENT_STRAIN_RATE) = sqrt((2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] +
894 2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] +
895 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2]));
899 itNode->FastGetSolutionStepValue(NODAL_EQUIVALENT_STRAIN_RATE) = sqrt(2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] +
900 2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] +
901 2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] +
902 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[3] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[3] +
903 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[4] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[4] +
904 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[5] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[5]);
907 const double equivalent_strain_rate = itNode->FastGetSolutionStepValue(NODAL_EQUIVALENT_STRAIN_RATE);
910 if (std::fabs(equivalent_strain_rate) > tolerance)
912 const double friction_angle_rad = friction_angle *
Globals::Pi / 180.0;
913 const double tanFi = std::tan(friction_angle_rad);
914 double regularization = 1.0 - std::exp(-adaptive_exponent * equivalent_strain_rate);
915 deviatoricCoefficient = dynamic_viscosity + regularization * ((cohesion + tanFi * fabs(mean_pressure)) / equivalent_strain_rate);
919 deviatoricCoefficient = dynamic_viscosity;
926 itNode->FastGetSolutionStepValue(NODAL_EQUIVALENT_STRAIN_RATE) = sqrt((2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] +
927 2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] +
928 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2]));
932 itNode->FastGetSolutionStepValue(NODAL_EQUIVALENT_STRAIN_RATE) = sqrt(2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] +
933 2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] +
934 2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] +
935 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[3] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[3] +
936 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[4] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[4] +
937 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[5] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[5]);
940 const double yieldShear = itNode->FastGetSolutionStepValue(YIELD_SHEAR);
941 const double equivalentStrainRate = itNode->FastGetSolutionStepValue(NODAL_EQUIVALENT_STRAIN_RATE);
942 const double adaptiveExponent = itNode->FastGetSolutionStepValue(ADAPTIVE_EXPONENT);
943 const double exponent = -adaptiveExponent * equivalentStrainRate;
944 deviatoricCoefficient = itNode->FastGetSolutionStepValue(DYNAMIC_VISCOSITY);
945 if (equivalentStrainRate > tolerance)
947 deviatoricCoefficient += (yieldShear / equivalentStrainRate) * (1 - exp(exponent));
952 deviatoricCoefficient = itNode->FastGetSolutionStepValue(DYNAMIC_VISCOSITY);
954 itNode->FastGetSolutionStepValue(DEVIATORIC_COEFFICIENT) = deviatoricCoefficient;
963 double detFgrad = 1.0;
969 nodalFgrad = itNode->FastGetSolutionStepValue(NODAL_DEFORMATION_GRAD);
970 FgradVel = itNode->FastGetSolutionStepValue(NODAL_DEFORMATION_GRAD_VEL);
984 SpatialVelocityGrad =
prod(FgradVel, InvFgrad);
989 itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] = SpatialVelocityGrad(0, 0);
990 itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] = SpatialVelocityGrad(1, 1);
991 itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] = 0.5 * (SpatialVelocityGrad(1, 0) + SpatialVelocityGrad(0, 1));
993 itNode->FastGetSolutionStepValue(NODAL_EQUIVALENT_STRAIN_RATE) = sqrt((2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] +
994 2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] +
995 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2]));
997 double DefX = itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0];
998 double DefY = itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1];
1000 double DefVol = DefX + DefY;
1002 itNode->GetSolutionStepValue(NODAL_VOLUMETRIC_DEF_RATE) = DefVol;
1007 itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] = SpatialVelocityGrad(0, 0);
1008 itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] = SpatialVelocityGrad(1, 1);
1009 itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] = SpatialVelocityGrad(2, 2);
1010 itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[3] = 0.5 * (SpatialVelocityGrad(1, 0) + SpatialVelocityGrad(0, 1));
1011 itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[4] = 0.5 * (SpatialVelocityGrad(2, 0) + SpatialVelocityGrad(0, 2));
1012 itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[5] = 0.5 * (SpatialVelocityGrad(2, 1) + SpatialVelocityGrad(1, 2));
1014 itNode->FastGetSolutionStepValue(NODAL_EQUIVALENT_STRAIN_RATE) = sqrt(2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0] +
1015 2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1] +
1016 2.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2] +
1017 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[3] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[3] +
1018 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[4] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[4] +
1019 4.0 * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[5] * itNode->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[5]);
1021 double DefX = itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[0];
1022 double DefY = itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[1];
1023 double DefZ = itNode->GetSolutionStepValue(NODAL_SPATIAL_DEF_RATE)[2];
1025 double DefVol = DefX + DefY + DefZ;
1027 itNode->GetSolutionStepValue(NODAL_VOLUMETRIC_DEF_RATE) = DefVol;
1045 double nodalVolume = itNode->FastGetSolutionStepValue(NODAL_VOLUME);
1049 if (nodalVolume > 0)
1069 Vector nodalSFDneighboursId = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS_ORDER);
1070 Vector rNodalSFDneigh = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS);
1071 const unsigned int neighSize = nodalSFDneighboursId.size();
1079 double dNdXi = rNodalSFDneigh[0];
1080 double dNdYi = rNodalSFDneigh[1];
1082 Fgrad(0, 0) += dNdXi * itNode->X();
1083 Fgrad(0, 1) += dNdYi * itNode->X();
1084 Fgrad(1, 0) += dNdXi * itNode->Y();
1085 Fgrad(1, 1) += dNdYi * itNode->Y();
1087 double VelocityX = itNode->FastGetSolutionStepValue(VELOCITY_X, 0) * theta + itNode->FastGetSolutionStepValue(VELOCITY_X, 1) * (1 - theta);
1088 double VelocityY = itNode->FastGetSolutionStepValue(VELOCITY_Y, 0) * theta + itNode->FastGetSolutionStepValue(VELOCITY_Y, 1) * (1 - theta);
1090 FgradVel(0, 0) += dNdXi * VelocityX;
1091 FgradVel(0, 1) += dNdYi * VelocityX;
1092 FgradVel(1, 0) += dNdXi * VelocityY;
1093 FgradVel(1, 1) += dNdYi * VelocityY;
1095 unsigned int firstRow = 2;
1099 for (
unsigned int i = 0;
i < neighSize - 1;
i++)
1101 dNdXi = rNodalSFDneigh[firstRow];
1102 dNdYi = rNodalSFDneigh[firstRow + 1];
1103 unsigned int neigh_nodes_id = neighb_nodes[
i].Id();
1104 unsigned int other_neigh_nodes_id = nodalSFDneighboursId[
i + 1];
1105 if (neigh_nodes_id != other_neigh_nodes_id)
1107 std::cout <<
"node (x,y)=(" << itNode->X() <<
"," << itNode->Y() <<
") with neigh_nodes_id " << neigh_nodes_id <<
" different than other_neigh_nodes_id " << other_neigh_nodes_id << std::endl;
1109 Fgrad(0, 0) += dNdXi * neighb_nodes[
i].X();
1110 Fgrad(0, 1) += dNdYi * neighb_nodes[
i].X();
1111 Fgrad(1, 0) += dNdXi * neighb_nodes[
i].Y();
1112 Fgrad(1, 1) += dNdYi * neighb_nodes[
i].Y();
1114 VelocityX = neighb_nodes[
i].FastGetSolutionStepValue(VELOCITY_X, 0) * theta + neighb_nodes[
i].FastGetSolutionStepValue(VELOCITY_X, 1) * (1 - theta);
1115 VelocityY = neighb_nodes[
i].FastGetSolutionStepValue(VELOCITY_Y, 0) * theta + neighb_nodes[
i].FastGetSolutionStepValue(VELOCITY_Y, 1) * (1 - theta);
1117 FgradVel(0, 0) += dNdXi * VelocityX;
1118 FgradVel(0, 1) += dNdYi * VelocityX;
1119 FgradVel(1, 0) += dNdXi * VelocityY;
1120 FgradVel(1, 1) += dNdYi * VelocityY;
1129 double dNdXi = rNodalSFDneigh[0];
1130 double dNdYi = rNodalSFDneigh[1];
1131 double dNdZi = rNodalSFDneigh[2];
1133 double VelocityX = itNode->FastGetSolutionStepValue(VELOCITY_X, 0) * theta + itNode->FastGetSolutionStepValue(VELOCITY_X, 1) * (1 - theta);
1134 double VelocityY = itNode->FastGetSolutionStepValue(VELOCITY_Y, 0) * theta + itNode->FastGetSolutionStepValue(VELOCITY_Y, 1) * (1 - theta);
1135 double VelocityZ = itNode->FastGetSolutionStepValue(VELOCITY_Z, 0) * theta + itNode->FastGetSolutionStepValue(VELOCITY_Z, 1) * (1 - theta);
1137 Fgrad(0, 0) += dNdXi * itNode->X();
1138 Fgrad(0, 1) += dNdYi * itNode->X();
1139 Fgrad(0, 2) += dNdZi * itNode->X();
1141 Fgrad(1, 0) += dNdXi * itNode->Y();
1142 Fgrad(1, 1) += dNdYi * itNode->Y();
1143 Fgrad(1, 2) += dNdZi * itNode->Y();
1145 Fgrad(2, 0) += dNdXi * itNode->Z();
1146 Fgrad(2, 1) += dNdYi * itNode->Z();
1147 Fgrad(2, 2) += dNdZi * itNode->Z();
1149 FgradVel(0, 0) += dNdXi * VelocityX;
1150 FgradVel(0, 1) += dNdYi * VelocityX;
1151 FgradVel(0, 2) += dNdZi * VelocityX;
1153 FgradVel(1, 0) += dNdXi * VelocityY;
1154 FgradVel(1, 1) += dNdYi * VelocityY;
1155 FgradVel(1, 2) += dNdZi * VelocityY;
1157 FgradVel(2, 0) += dNdXi * VelocityZ;
1158 FgradVel(2, 1) += dNdYi * VelocityZ;
1159 FgradVel(2, 2) += dNdZi * VelocityZ;
1161 unsigned int firstRow = 3;
1165 for (
unsigned int i = 0;
i < neighSize - 1;
i++)
1168 dNdXi = rNodalSFDneigh[firstRow];
1169 dNdYi = rNodalSFDneigh[firstRow + 1];
1170 dNdZi = rNodalSFDneigh[firstRow + 2];
1172 VelocityX = neighb_nodes[
i].FastGetSolutionStepValue(VELOCITY_X, 0) * theta + neighb_nodes[
i].FastGetSolutionStepValue(VELOCITY_X, 1) * (1 - theta);
1173 VelocityY = neighb_nodes[
i].FastGetSolutionStepValue(VELOCITY_Y, 0) * theta + neighb_nodes[
i].FastGetSolutionStepValue(VELOCITY_Y, 1) * (1 - theta);
1174 VelocityZ = neighb_nodes[
i].FastGetSolutionStepValue(VELOCITY_Z, 0) * theta + neighb_nodes[
i].FastGetSolutionStepValue(VELOCITY_Z, 1) * (1 - theta);
1176 Fgrad(0, 0) += dNdXi * neighb_nodes[
i].X();
1177 Fgrad(0, 1) += dNdYi * neighb_nodes[
i].X();
1178 Fgrad(0, 2) += dNdZi * neighb_nodes[
i].X();
1180 Fgrad(1, 0) += dNdXi * neighb_nodes[
i].Y();
1181 Fgrad(1, 1) += dNdYi * neighb_nodes[
i].Y();
1182 Fgrad(1, 2) += dNdZi * neighb_nodes[
i].Y();
1184 Fgrad(2, 0) += dNdXi * neighb_nodes[
i].Z();
1185 Fgrad(2, 1) += dNdYi * neighb_nodes[
i].Z();
1186 Fgrad(2, 2) += dNdZi * neighb_nodes[
i].Z();
1188 FgradVel(0, 0) += dNdXi * VelocityX;
1189 FgradVel(0, 1) += dNdYi * VelocityX;
1190 FgradVel(0, 2) += dNdZi * VelocityX;
1192 FgradVel(1, 0) += dNdXi * VelocityY;
1193 FgradVel(1, 1) += dNdYi * VelocityY;
1194 FgradVel(1, 2) += dNdZi * VelocityY;
1196 FgradVel(2, 0) += dNdXi * VelocityZ;
1197 FgradVel(2, 1) += dNdYi * VelocityZ;
1198 FgradVel(2, 2) += dNdZi * VelocityZ;
1205 itNode->FastGetSolutionStepValue(NODAL_DEFORMATION_GRAD) = Fgrad;
1206 itNode->FastGetSolutionStepValue(NODAL_DEFORMATION_GRAD_VEL) = FgradVel;
1226 const double timeInterval = rCurrentProcessInfo[DELTA_TIME];
1227 unsigned int timeStep = rCurrentProcessInfo[STEP];
1234 (
i)->FastGetSolutionStepValue(PRESSURE_VELOCITY, 0) = 0;
1235 (
i)->FastGetSolutionStepValue(PRESSURE_VELOCITY, 1) = 0;
1239 double &CurrentPressure = (
i)->FastGetSolutionStepValue(PRESSURE, 0);
1240 double &PreviousPressure = (
i)->FastGetSolutionStepValue(PRESSURE, 1);
1241 double &CurrentPressureVelocity = (
i)->FastGetSolutionStepValue(PRESSURE_VELOCITY, 0);
1242 CurrentPressureVelocity = (CurrentPressure - PreviousPressure) / timeInterval;
1251 const double timeInterval = rCurrentProcessInfo[DELTA_TIME];
1252 unsigned int timeStep = rCurrentProcessInfo[STEP];
1258 (
i)->FastGetSolutionStepValue(PRESSURE_ACCELERATION, 0) = 0;
1259 (
i)->FastGetSolutionStepValue(PRESSURE_ACCELERATION, 1) = 0;
1263 double &CurrentPressureVelocity = (
i)->FastGetSolutionStepValue(PRESSURE_VELOCITY, 0);
1264 double &PreviousPressureVelocity = (
i)->FastGetSolutionStepValue(PRESSURE_VELOCITY, 1);
1265 double &CurrentPressureAcceleration = (
i)->FastGetSolutionStepValue(PRESSURE_ACCELERATION, 0);
1266 CurrentPressureAcceleration = (CurrentPressureVelocity - PreviousPressureVelocity) / timeInterval;
1285 if ((
i)->IsNot(ISOLATED) && ((
i)->IsNot(RIGID) || (
i)->Is(SOLID)))
1287 UpdateAccelerations(CurrentAcceleration, CurrentVelocity, PreviousAcceleration, PreviousVelocity);
1289 else if ((
i)->Is(RIGID))
1292 (
i)->FastGetSolutionStepValue(ACCELERATION, 0) = Zeros;
1293 (
i)->FastGetSolutionStepValue(ACCELERATION, 1) = Zeros;
1297 (
i)->FastGetSolutionStepValue(NODAL_VOLUME) = 0.0;
1298 (
i)->FastGetSolutionStepValue(NODAL_VOLUMETRIC_DEF_RATE) = 0.0;
1299 (
i)->FastGetSolutionStepValue(NODAL_EQUIVALENT_STRAIN_RATE) = 0;
1300 (
i)->FastGetSolutionStepValue(NODAL_MEAN_MESH_SIZE) = 0.0;
1301 (
i)->FastGetSolutionStepValue(NODAL_FREESURFACE_AREA) = 0.0;
1302 (
i)->FastGetSolutionStepValue(PRESSURE, 0) = 0.0;
1303 (
i)->FastGetSolutionStepValue(PRESSURE, 1) = 0.0;
1304 (
i)->FastGetSolutionStepValue(PRESSURE_VELOCITY, 0) = 0.0;
1305 (
i)->FastGetSolutionStepValue(PRESSURE_VELOCITY, 1) = 0.0;
1306 (
i)->FastGetSolutionStepValue(PRESSURE_ACCELERATION, 0) = 0.0;
1307 (
i)->FastGetSolutionStepValue(PRESSURE_ACCELERATION, 1) = 0.0;
1308 if ((
i)->SolutionStepsDataHas(VOLUME_ACCELERATION))
1311 (
i)->FastGetSolutionStepValue(ACCELERATION, 0) = VolumeAcceleration;
1312 (
i)->FastGetSolutionStepValue(VELOCITY, 0) += VolumeAcceleration * rCurrentProcessInfo[DELTA_TIME];
1325 double Dt = rCurrentProcessInfo[DELTA_TIME];
1326 noalias(CurrentAcceleration) = 2.0 * (CurrentVelocity - PreviousVelocity) /
Dt - PreviousAcceleration;
1333 const double TimeStep = rCurrentProcessInfo[DELTA_TIME];
1344 CurrentDisplacement[0] = 0.5 * TimeStep * (CurrentVelocity[0] + PreviousVelocity[0]) + PreviousDisplacement[0];
1345 CurrentDisplacement[1] = 0.5 * TimeStep * (CurrentVelocity[1] + PreviousVelocity[1]) + PreviousDisplacement[1];
1346 CurrentDisplacement[2] = 0.5 * TimeStep * (CurrentVelocity[2] + PreviousVelocity[2]) + PreviousDisplacement[2];
1354 const double TimeStep = rCurrentProcessInfo[DELTA_TIME];
1356 unsigned int sizeStrains = 3 * (
dimension - 1);
1372 CurrentDisplacement[0] = 0.5 * TimeStep * (CurrentVelocity[0] + PreviousVelocity[0]) + PreviousDisplacement[0];
1373 CurrentDisplacement[1] = 0.5 * TimeStep * (CurrentVelocity[1] + PreviousVelocity[1]) + PreviousDisplacement[1];
1376 CurrentDisplacement[2] = 0.5 * TimeStep * (CurrentVelocity[2] + PreviousVelocity[2]) + PreviousDisplacement[2];
1380 Vector &rNodalSFDneighbours =
i->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS);
1381 unsigned int sizeSDFNeigh = rNodalSFDneighbours.size();
1383 i->FastGetSolutionStepValue(NODAL_VOLUME) = 0;
1384 i->FastGetSolutionStepValue(NODAL_MEAN_MESH_SIZE) = 0;
1385 i->FastGetSolutionStepValue(NODAL_FREESURFACE_AREA) = 0;
1386 i->FastGetSolutionStepValue(NODAL_VOLUMETRIC_DEF_RATE) = 0;
1387 i->FastGetSolutionStepValue(NODAL_EQUIVALENT_STRAIN_RATE) = 0;
1391 Vector &rSpatialDefRate =
i->FastGetSolutionStepValue(NODAL_SPATIAL_DEF_RATE);
1394 Matrix &rFgrad =
i->FastGetSolutionStepValue(NODAL_DEFORMATION_GRAD);
1397 Matrix &rFgradVel =
i->FastGetSolutionStepValue(NODAL_DEFORMATION_GRAD_VEL);
1423 int StrategyLevel = Level > 0 ? Level - 1 : 0;
1439 std::stringstream buffer;
1440 buffer <<
"NodalTwoStepVPStrategy";
1441 return buffer.str();
1447 rOStream <<
"NodalTwoStepVPStrategy";
1490 bool ConvergedMomentum =
false;
1492 fixedTimeStep =
false;
1504 std::cout <<
"-------------- s o l v e d ! ------------------" << std::endl;
1510 double DvErrorNorm = NormDv / velocityNorm;
1512 unsigned int iterationForCheck = 3;
1513 KRATOS_INFO(
"TwoStepVPStrategy") <<
"iteration(" << it <<
") Velocity error: " << DvErrorNorm << std::endl;
1516 if (it == maxIt - 1)
1518 KRATOS_INFO(
"Iteration") << it <<
" Final Velocity error: " << DvErrorNorm << std::endl;
1521 else if (it > iterationForCheck)
1554 std::cout <<
"Momentum equations did not reach the convergence tolerance." << std::endl;
1556 return ConvergedMomentum;
1563 bool ConvergedContinuity =
false;
1575 std::cout <<
"The norm of pressure is: " << NormDp << std::endl;
1582 double DpErrorNorm = NormDp / (NormP);
1587 if (it == maxIt - 1)
1589 KRATOS_INFO(
"Iteration") << it <<
" Final Pressure error: " << DpErrorNorm << std::endl;
1594 KRATOS_INFO(
"Iteration") << it <<
" Pressure error: " << DpErrorNorm << std::endl;
1626 std::cout <<
"Continuity equation did not reach the convergence tolerance." << std::endl;
1628 return ConvergedContinuity;
1635 double NormV = 0.00;
1638 #pragma omp parallel reduction(+ : NormV)
1647 double NormVelNode = 0;
1649 for (
unsigned int d = 0;
d < 3; ++
d)
1651 NormVelNode += Vel[
d] * Vel[
d];
1652 NormV += Vel[
d] * Vel[
d];
1658 NormV = sqrt(NormV);
1663 errorNormDv = NormDv / NormV;
1667 std::cout <<
"The norm of velocity increment is: " << NormDv << std::endl;
1668 std::cout <<
"The norm of velocity is: " << NormV << std::endl;
1669 std::cout <<
"Velocity error: " << errorNormDv <<
"mVelocityTolerance: " <<
mVelocityTolerance << std::endl;
1686 double NormV = 0.00;
1688 #pragma omp parallel reduction(+ : NormV)
1697 double NormVelNode = 0;
1699 for (
unsigned int d = 0;
d < 3; ++
d)
1701 NormVelNode += Vel[
d] * Vel[
d];
1702 NormV += Vel[
d] * Vel[
d];
1709 NormV = sqrt(NormV);
1721 double NormP = 0.00;
1723 #pragma omp parallel reduction(+ : NormP)
1730 const double Pr = itNode->FastGetSolutionStepValue(PRESSURE);
1737 NormP = sqrt(NormP);
1750 const double currentTime = rCurrentProcessInfo[TIME];
1752 double sumErrorL2Velocity = 0;
1753 double sumErrorL2VelocityX = 0;
1754 double sumErrorL2VelocityY = 0;
1755 double sumErrorL2Pressure = 0;
1756 double sumErrorL2TauXX = 0;
1757 double sumErrorL2TauYY = 0;
1758 double sumErrorL2TauXY = 0;
1760 #pragma omp parallel
1767 const double posX = itNode->X();
1768 const double posY = itNode->Y();
1769 const double nodalArea = itNode->FastGetSolutionStepValue(NODAL_VOLUME);
1770 const double velX = itNode->FastGetSolutionStepValue(VELOCITY_X);
1771 const double velY = itNode->FastGetSolutionStepValue(VELOCITY_Y);
1772 const double pressure = itNode->FastGetSolutionStepValue(PRESSURE);
1773 const double tauXX = itNode->FastGetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS)[0];
1774 const double tauYY = itNode->FastGetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS)[1];
1775 const double tauXY = itNode->FastGetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS)[2];
1777 double expectedVelocityX = pow(posX, 2) * (1.0 - posX) * (1.0 - posX) * (2.0 * posY - 6.0 * pow(posY, 2) + 4.0 * pow(posY, 3));
1778 double expectedVelocityY = -pow(posY, 2) * (1.0 - posY) * (1.0 - posY) * (2.0 * posX - 6.0 * pow(posX, 2) + 4.0 * pow(posX, 3));
1779 double expectedPressure = -posX * (1.0 - posX);
1781 double expectedTauXX = 2.0 * (-4.0 * (1 - posX) * posX * (-1.0 + 2.0 * posX) * posY * (1.0 - 3.0 * posY + 2.0 * pow(posY, 2)));
1782 double expectedTauYY = 2.0 * (4.0 * posX * (1.0 - 3.0 * posX + 2.0 * pow(posX, 2)) * (1 - posY) * posY * (-1.0 + 2.0 * posY));
1783 double expectedTauXY = (2.0 * (1.0 - 6.0 * posY + 6.0 * pow(posY, 2)) * (1 - posX) * (1 - posX) * pow(posX, 2) - 2.0 * (1.0 - 6.0 * posX + 6.0 * pow(posX, 2)) * (1 - posY) * (1 - posY) * pow(posY, 2));
1785 double nodalErrorVelocityX = velX - expectedVelocityX;
1786 double nodalErrorVelocityY = velY - expectedVelocityY;
1787 double nodalErrorPressure =
pressure - expectedPressure;
1788 double nodalErrorTauXX = tauXX - expectedTauXX;
1789 double nodalErrorTauYY = tauYY - expectedTauYY;
1790 double nodalErrorTauXY = tauXY - expectedTauXY;
1792 sumErrorL2Velocity += (pow(nodalErrorVelocityX, 2) + pow(nodalErrorVelocityY, 2)) * nodalArea;
1793 sumErrorL2VelocityX += pow(nodalErrorVelocityX, 2) * nodalArea;
1794 sumErrorL2VelocityY += pow(nodalErrorVelocityY, 2) * nodalArea;
1795 sumErrorL2Pressure += pow(nodalErrorPressure, 2) * nodalArea;
1796 sumErrorL2TauXX += pow(nodalErrorTauXX, 2) * nodalArea;
1797 sumErrorL2TauYY += pow(nodalErrorTauYY, 2) * nodalArea;
1798 sumErrorL2TauXY += pow(nodalErrorTauXY, 2) * nodalArea;
1804 double errorL2Velocity = sqrt(sumErrorL2Velocity);
1805 double errorL2VelocityX = sqrt(sumErrorL2VelocityX);
1806 double errorL2VelocityY = sqrt(sumErrorL2VelocityY);
1807 double errorL2Pressure = sqrt(sumErrorL2Pressure);
1808 double errorL2TauXX = sqrt(sumErrorL2TauXX);
1809 double errorL2TauYY = sqrt(sumErrorL2TauYY);
1810 double errorL2TauXY = sqrt(sumErrorL2TauXY);
1812 std::ofstream myfileVelocity;
1813 myfileVelocity.open(
"errorL2VelocityFile.txt", std::ios::app);
1814 myfileVelocity << currentTime <<
"\t" << errorL2Velocity <<
"\n";
1815 myfileVelocity.close();
1817 std::ofstream myfileVelocityX;
1818 myfileVelocityX.open(
"errorL2VelocityXFile.txt", std::ios::app);
1819 myfileVelocityX << currentTime <<
"\t" << errorL2VelocityX <<
"\n";
1820 myfileVelocityX.close();
1822 std::ofstream myfileVelocityY;
1823 myfileVelocityY.open(
"errorL2VelocityYFile.txt", std::ios::app);
1824 myfileVelocityY << currentTime <<
"\t" << errorL2VelocityY <<
"\n";
1825 myfileVelocityY.close();
1827 std::ofstream myfilePressure;
1828 myfilePressure.open(
"errorL2PressureFile.txt", std::ios::app);
1829 myfilePressure << currentTime <<
"\t" << errorL2Pressure <<
"\n";
1830 myfilePressure.close();
1832 std::ofstream myfileTauXX;
1833 myfileTauXX.open(
"errorL2TauXXFile.txt", std::ios::app);
1834 myfileTauXX << currentTime <<
"\t" << errorL2TauXX <<
"\n";
1835 myfileTauXX.close();
1837 std::ofstream myfileTauYY;
1838 myfileTauYY.open(
"errorL2TauYYFile.txt", std::ios::app);
1839 myfileTauYY << currentTime <<
"\t" << errorL2TauYY <<
"\n";
1840 myfileTauYY.close();
1842 std::ofstream myfileTauXY;
1843 myfileTauXY.open(
"errorL2TauXYFile.txt", std::ios::app);
1844 myfileTauXY << currentTime <<
"\t" << errorL2TauXY <<
"\n";
1845 myfileTauXY.close();
1853 const double currentTime = rCurrentProcessInfo[TIME];
1855 double sumErrorL2VelocityTheta = 0;
1856 double sumErrorL2TauTheta = 0;
1860 double kappa = r_in / R_out;
1864 #pragma omp parallel
1871 const double posX = itNode->X();
1872 const double posY = itNode->Y();
1873 const double rPos = sqrt(pow(posX, 2) + pow(posY, 2));
1874 const double cosalfa = posX / rPos;
1875 const double sinalfa = posY / rPos;
1876 const double sin2alfa = 2.0 * cosalfa * sinalfa;
1877 const double cos2alfa = 1.0 - 2.0 * pow(sinalfa, 2);
1878 const double nodalArea = itNode->FastGetSolutionStepValue(NODAL_VOLUME);
1879 const double velX = itNode->FastGetSolutionStepValue(VELOCITY_X);
1880 const double velY = itNode->FastGetSolutionStepValue(VELOCITY_Y);
1881 const double tauXX = itNode->FastGetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS)[0];
1882 const double tauYY = itNode->FastGetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS)[1];
1883 const double tauXY = itNode->FastGetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS)[2];
1885 double expectedVelocityTheta = pow(
kappa, 2) * omega * R_out / (1.0 - pow(
kappa, 2)) * (R_out / rPos - rPos / R_out);
1886 double computedVelocityTheta = sqrt(pow(velX, 2) + pow(velY, 2));
1887 double nodalErrorVelocityTheta = computedVelocityTheta - expectedVelocityTheta;
1889 double expectedTauTheta = (2.0 *
viscosity * pow(
kappa, 2) * omega * pow(R_out, 2)) / (1.0 - pow(
kappa, 2)) / pow(rPos, 2);
1890 double computedTauTheta = +(tauXX - tauYY) * sin2alfa / 2.0 - tauXY * cos2alfa;
1891 double nodalErrorTauTheta = computedTauTheta - expectedTauTheta;
1892 itNode->FastGetSolutionStepValue(NODAL_ERROR_XX) = computedVelocityTheta;
1894 sumErrorL2VelocityTheta += pow(nodalErrorVelocityTheta, 2) * nodalArea;
1895 sumErrorL2TauTheta += pow(nodalErrorTauTheta, 2) * nodalArea;
1899 double errorL2VelocityTheta = sqrt(sumErrorL2VelocityTheta);
1900 double errorL2TauTheta = sqrt(sumErrorL2TauTheta);
1902 std::ofstream myfileVelocity;
1903 myfileVelocity.open(
"errorL2Poiseuille.txt", std::ios::app);
1904 myfileVelocity << currentTime <<
"\t" << errorL2VelocityTheta <<
"\t" << errorL2TauTheta <<
"\n";
1905 myfileVelocity.close();
1912 double NormP = 0.00;
1922 const double Pr = itNode->FastGetSolutionStepValue(PRESSURE);
1929 NormP = sqrt(NormP);
1934 errorNormDp = NormDp / NormP;
1938 std::cout <<
" The norm of pressure increment is: " << NormDp << std::endl;
1939 std::cout <<
" The norm of pressure is: " << NormP << std::endl;
1940 std::cout <<
" Pressure error: " << errorNormDp << std::endl;
1955 double currentTime = rCurrentProcessInfo[TIME];
1956 double timeInterval = rCurrentProcessInfo[DELTA_TIME];
1957 double minTolerance = 0.005;
1958 bool fixedTimeStep =
false;
1959 if (currentTime < 3 * timeInterval)
1964 if ((DvErrorNorm > minTolerance || (DvErrorNorm < 0 && DvErrorNorm > 0) || (DvErrorNorm != DvErrorNorm)) &&
1966 (DvErrorNorm != 1 || currentTime > timeInterval))
1968 rCurrentProcessInfo.
SetValue(BAD_VELOCITY_CONVERGENCE,
true);
1969 std::cout <<
"NOT GOOD CONVERGENCE!!! I'll reduce the next time interval" << DvErrorNorm << std::endl;
1970 minTolerance = 0.05;
1971 if (DvErrorNorm > minTolerance)
1973 std::cout <<
"BAD CONVERGENCE!!! I GO AHEAD WITH THE PREVIOUS VELOCITY AND PRESSURE FIELDS" << DvErrorNorm << std::endl;
1974 fixedTimeStep =
true;
1982 itNode->FastGetSolutionStepValue(VELOCITY, 0) = itNode->FastGetSolutionStepValue(VELOCITY, 1);
1983 itNode->FastGetSolutionStepValue(PRESSURE, 0) = itNode->FastGetSolutionStepValue(PRESSURE, 1);
1984 itNode->FastGetSolutionStepValue(ACCELERATION, 0) = itNode->FastGetSolutionStepValue(ACCELERATION, 1);
1991 rCurrentProcessInfo.
SetValue(BAD_VELOCITY_CONVERGENCE,
false);
1993 return fixedTimeStep;
2000 double currentTime = rCurrentProcessInfo[TIME];
2001 double timeInterval = rCurrentProcessInfo[DELTA_TIME];
2002 double minTolerance = 0.99999;
2003 bool fixedTimeStep =
false;
2005 if ((DvErrorNorm > minTolerance || (DvErrorNorm < 0 && DvErrorNorm > 0) || (DvErrorNorm != DvErrorNorm)) &&
2007 (DvErrorNorm != 1 || currentTime > timeInterval))
2009 rCurrentProcessInfo.
SetValue(BAD_VELOCITY_CONVERGENCE,
true);
2010 std::cout <<
" BAD CONVERGENCE DETECTED DURING THE ITERATIVE LOOP!!! error: " << DvErrorNorm <<
" higher than 0.9999" << std::endl;
2011 std::cout <<
" I GO AHEAD WITH THE PREVIOUS VELOCITY AND PRESSURE FIELDS" << std::endl;
2012 fixedTimeStep =
true;
2013 #pragma omp parallel
2020 itNode->FastGetSolutionStepValue(VELOCITY, 0) = itNode->FastGetSolutionStepValue(VELOCITY, 1);
2021 itNode->FastGetSolutionStepValue(PRESSURE, 0) = itNode->FastGetSolutionStepValue(PRESSURE, 1);
2022 itNode->FastGetSolutionStepValue(ACCELERATION, 0) = itNode->FastGetSolutionStepValue(ACCELERATION, 1);
2028 rCurrentProcessInfo.
SetValue(BAD_VELOCITY_CONVERGENCE,
false);
2030 return fixedTimeStep;
2037 double currentTime = rCurrentProcessInfo[TIME];
2038 double timeInterval = rCurrentProcessInfo[DELTA_TIME];
2039 double minTolerance = 0.01;
2040 bool fixedTimeStep =
false;
2041 if (currentTime < 3 * timeInterval)
2046 if ((DvErrorNorm > minTolerance || (DvErrorNorm < 0 && DvErrorNorm > 0) || (DvErrorNorm != DvErrorNorm)) &&
2048 (DvErrorNorm != 1 || currentTime > timeInterval))
2050 fixedTimeStep =
true;
2051 rCurrentProcessInfo.
SetValue(BAD_PRESSURE_CONVERGENCE,
true);
2055 rCurrentProcessInfo.
SetValue(BAD_PRESSURE_CONVERGENCE,
false);
2057 return fixedTimeStep;
2135 if (HaveVelStrategy)
2141 KRATOS_THROW_ERROR(std::runtime_error,
"NodalTwoStepVPStrategy error: No Velocity strategy defined in FractionalStepSettings",
"");
2146 if (HavePressStrategy)
2153 KRATOS_THROW_ERROR(std::runtime_error,
"NodalTwoStepVPStrategy error: No Pressure strategy defined in FractionalStepSettings",
"");
2163 void FillNodalSFDVector()
Definition: boundary_normals_calculation_utilities.hpp:48
void CalculateUnitBoundaryNormals(ModelPart &rModelPart, int EchoLevel=0)
Calculates the area normal (vector oriented as the normal with a dimension proportional to the area).
Definition: boundary_normals_calculation_utilities.hpp:83
Current class provides an implementation for the base builder and solving operations.
Definition: builder_and_solver.h:64
virtual const DataCommunicator & GetDataCommunicator() const
Definition: communicator.cpp:340
virtual int MyPID() const
Definition: communicator.cpp:91
void SetValue(const Variable< TDataType > &rThisVariable, TDataType const &rValue)
Sets the value for a given variable.
Definition: data_value_container.h:320
Short class definition.
Definition: gauss_seidel_linear_strategy.h:83
Geometry base class.
Definition: geometry.h:71
SizeType size() const
Definition: geometry.h:518
virtual double Volume() const
This method calculate and return volume of this geometry.
Definition: geometry.h:1358
virtual double Area() const
This method calculate and return area or surface area of this geometry depending to it's dimension.
Definition: geometry.h:1345
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
size_type size() const
Definition: global_pointers_vector.h:307
Implicit solving strategy base class This is the base class from which we will derive all the implici...
Definition: implicit_solving_strategy.h:61
BaseType::ElementsArrayType ElementsArrayType
Definition: implicit_solving_strategy.h:94
Definition: amatrix_interface.h:41
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
static void InvertMatrix3(const TMatrix1 &rInputMatrix, TMatrix2 &rInvertedMatrix, double &rInputMatrixDet)
It inverts matrices of order 3.
Definition: math_utils.h:449
static void InvertMatrix2(const TMatrix1 &rInputMatrix, TMatrix2 &rInvertedMatrix, double &rInputMatrixDet)
It inverts matrices of order 2.
Definition: math_utils.h:416
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::NodeIterator NodeIterator
Definition: model_part.h:134
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
VariablesList & GetNodalSolutionStepVariablesList()
Definition: model_part.h:549
Current class provides an implementation for standard builder and solving operations.
Definition: nodal_residualbased_elimination_builder_and_solver_continuity.h:80
Current class provides an implementation for standard builder and solving operations.
Definition: nodal_residualbased_elimination_builder_and_solver.h:80
Definition: nodal_two_step_v_p_strategy.h:70
void InitializeNonLinearIterations()
Definition: nodal_two_step_v_p_strategy.h:659
void SetTimeCoefficients(ProcessInfo &rCurrentProcessInfo)
Definition: nodal_two_step_v_p_strategy.h:208
void ComputeErrorL2NormCasePoiseuille()
Definition: nodal_two_step_v_p_strategy.h:1848
void ComputeNodalVolume()
Definition: nodal_two_step_v_p_strategy.h:511
double mPressureTolerance
Definition: nodal_two_step_v_p_strategy.h:2084
void ComputeAndStoreNodalDeformationGradient(ModelPart::NodeIterator itNode, double theta)
Definition: nodal_two_step_v_p_strategy.h:1062
void CalculatePressureVelocity()
Definition: nodal_two_step_v_p_strategy.h:1222
void CalculatePressureAcceleration()
Definition: nodal_two_step_v_p_strategy.h:1247
void CalculateAccelerations()
Definition: nodal_two_step_v_p_strategy.h:1271
void CalcNodalStrainsForNode(ModelPart::NodeIterator itNode)
Definition: nodal_two_step_v_p_strategy.h:957
BaseType::TSystemVectorType TSystemVectorType
Definition: nodal_two_step_v_p_strategy.h:93
NodalTwoStepVPStrategy(ModelPart &rModelPart, typename TLinearSolver::Pointer pVelocityLinearSolver, typename TLinearSolver::Pointer pPressureLinearSolver, bool ReformDofSet=true, double VelTol=0.0001, double PresTol=0.0001, int MaxPressureIterations=1, unsigned int TimeOrder=2, unsigned int DomainSize=2)
Definition: nodal_two_step_v_p_strategy.h:118
bool CheckMomentumConvergence(const double DvErrorNorm)
Definition: nodal_two_step_v_p_strategy.h:1996
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: nodal_two_step_v_p_strategy.h:97
TwoStepVPSolverSettings< TSparseSpace, TDenseSpace, TLinearSolver > SolverSettingsType
Definition: nodal_two_step_v_p_strategy.h:103
bool CheckVelocityConvergence(const double NormDv, double &errorNormDv)
Definition: nodal_two_step_v_p_strategy.h:1631
void Clear() override
Clears the internal storage.
Definition: nodal_two_step_v_p_strategy.h:1410
void Initialize() override
Initialization of member variables and prior operations.
Definition: nodal_two_step_v_p_strategy.h:356
void FinalizeSolutionStep() override
Performs all the required operations that should be done (for each step) after solving the solution s...
Definition: nodal_two_step_v_p_strategy.h:351
double ComputeVelocityNorm()
Definition: nodal_two_step_v_p_strategy.h:1682
StrategyPointerType mpMomentumStrategy
Scheme for the solution of the momentum equation.
Definition: nodal_two_step_v_p_strategy.h:2104
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: nodal_two_step_v_p_strategy.h:1445
NodalTwoStepVPStrategy(ModelPart &rModelPart, SolverSettingsType &rSolverConfig)
Definition: nodal_two_step_v_p_strategy.h:112
unsigned int mMaxPressureIter
Definition: nodal_two_step_v_p_strategy.h:2086
void CalcNodalStrainsAndStresses()
Definition: nodal_two_step_v_p_strategy.h:688
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: nodal_two_step_v_p_strategy.h:95
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Counted pointer of NodalTwoStepVPStrategy.
Definition: nodal_two_step_v_p_strategy.h:77
void UpdateTopology(ModelPart &rModelPart, unsigned int echoLevel)
Definition: nodal_two_step_v_p_strategy.h:1210
bool SolveSolutionStep() override
Solves the current step. This function returns true if a solution has been found, false otherwise.
Definition: nodal_two_step_v_p_strategy.h:243
void SetNeighboursOrderToNode(ModelPart::NodeIterator itNode)
Definition: nodal_two_step_v_p_strategy.h:556
bool SolveMomentumIteration(unsigned int it, unsigned int maxIt, bool &fixedTimeStep, double &velocityNorm)
Calculate the coefficients for time iteration.
Definition: nodal_two_step_v_p_strategy.h:1486
void InitializeStrategy(SolverSettingsType &rSolverConfig)
Definition: nodal_two_step_v_p_strategy.h:2117
void UpdatePressureAccelerations()
Definition: nodal_two_step_v_p_strategy.h:1403
bool FixTimeStepContinuity(const double DvErrorNorm)
Definition: nodal_two_step_v_p_strategy.h:2033
bool FixTimeStepMomentum(const double DvErrorNorm)
Definition: nodal_two_step_v_p_strategy.h:1951
void UpdateAccelerations(array_1d< double, 3 > &CurrentAcceleration, const array_1d< double, 3 > &CurrentVelocity, array_1d< double, 3 > &PreviousAcceleration, const array_1d< double, 3 > &PreviousVelocity)
Definition: nodal_two_step_v_p_strategy.h:1318
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver >::Pointer StrategyPointerType
Definition: nodal_two_step_v_p_strategy.h:101
void ComputeErrorL2NormCaseImposedG()
Definition: nodal_two_step_v_p_strategy.h:1745
KRATOS_CLASS_POINTER_DEFINITION(NodalTwoStepVPStrategy)
Geometry< NodeType > GeometryType
Geometry type (using with given NodeType)
Definition: nodal_two_step_v_p_strategy.h:85
std::string Info() const override
Turn back information as a string.
Definition: nodal_two_step_v_p_strategy.h:1437
void CalcNodalStrainsAndStressesForNode(ModelPart::NodeIterator itNode)
Definition: nodal_two_step_v_p_strategy.h:718
unsigned int mTimeOrder
Definition: nodal_two_step_v_p_strategy.h:2090
void InitializeNodalVariablesForRemeshedDomain(ModelPart::NodeIterator itNode)
Definition: nodal_two_step_v_p_strategy.h:578
void InitialAssignFluidMaterialToEachNode(ModelPart::NodeIterator itNode)
Definition: nodal_two_step_v_p_strategy.h:492
std::size_t SizeType
Definition: nodal_two_step_v_p_strategy.h:87
int Check() override
Function to perform expensive checks.
Definition: nodal_two_step_v_p_strategy.h:179
GeometryType::ShapeFunctionsGradientsType ShapeFunctionDerivativesArrayType
Definition: nodal_two_step_v_p_strategy.h:105
void ComputeDeviatoricCoefficientForFluid(ModelPart::NodeIterator itNode, const unsigned int dimension, double &deviatoricCoefficient)
Definition: nodal_two_step_v_p_strategy.h:822
bool CheckPressureConvergence(const double NormDp, double &errorNormDp)
Definition: nodal_two_step_v_p_strategy.h:1908
BaseType::TDataType TDataType
Definition: nodal_two_step_v_p_strategy.h:79
BaseType::TSystemMatrixType TSystemMatrixType
Definition: nodal_two_step_v_p_strategy.h:91
StrategyPointerType mpPressureStrategy
Scheme for the solution of the mass equation.
Definition: nodal_two_step_v_p_strategy.h:2107
BaseType::DofsArrayType DofsArrayType
Definition: nodal_two_step_v_p_strategy.h:89
void CalcNodalStrains()
Definition: nodal_two_step_v_p_strategy.h:1031
unsigned int mDomainSize
Definition: nodal_two_step_v_p_strategy.h:2088
BaseType::ElementsArrayType ElementsArrayType
Definition: nodal_two_step_v_p_strategy.h:99
void CalculateDisplacements()
Definition: nodal_two_step_v_p_strategy.h:1329
virtual ~NodalTwoStepVPStrategy()
Destructor.
Definition: nodal_two_step_v_p_strategy.h:177
bool SolveContinuityIteration(unsigned int it, unsigned int maxIt, double &NormP)
Definition: nodal_two_step_v_p_strategy.h:1559
double ComputePressureNorm()
Definition: nodal_two_step_v_p_strategy.h:1717
double mVelocityTolerance
Definition: nodal_two_step_v_p_strategy.h:2082
bool mReformDofSet
Definition: nodal_two_step_v_p_strategy.h:2092
Node NodeType
Node type (default is: Node)
Definition: nodal_two_step_v_p_strategy.h:82
void CalculateDisplacementsAndResetNodalVariables()
Definition: nodal_two_step_v_p_strategy.h:1350
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: nodal_two_step_v_p_strategy.h:1451
GlobalPointersVector< Node > NodeWeakPtrVectorType
Definition: nodal_two_step_v_p_strategy.h:107
void SetEchoLevel(int Level) override
This sets the level of echo for the solving strategy.
Definition: nodal_two_step_v_p_strategy.h:1420
This class defines the node.
Definition: node.h:65
static int ThisThread()
Wrapper for omp_get_thread_num().
Definition: openmp_utils.h:108
static void PartitionedIterators(TVector &rVector, typename TVector::iterator &rBegin, typename TVector::iterator &rEnd)
Generate a partition for an std::vector-like array, providing iterators to the begin and end position...
Definition: openmp_utils.h:179
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
ProcessInfo & GetPreviousTimeStepInfo(IndexType StepsBefore=1)
Definition: process_info.h:187
This class provides the implementation of a static scheme.
Definition: residualbased_incrementalupdate_static_scheme.h:57
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
Solving strategy base class This is the base class from which we will derive all the strategies (impl...
Definition: solving_strategy.h:64
TDenseSpace::MatrixType LocalSystemMatrixType
Definition: solving_strategy.h:79
TSparseSpace::DataType TDataType
Definition: solving_strategy.h:69
virtual void SetEchoLevel(const int Level)
This sets the level of echo for the solving strategy.
Definition: solving_strategy.h:255
ModelPart & GetModelPart()
Operations to get the pointer to the model.
Definition: solving_strategy.h:350
ModelPart::ElementsContainerType ElementsArrayType
Definition: solving_strategy.h:91
int GetEchoLevel()
This returns the level of echo for the solving strategy.
Definition: solving_strategy.h:271
TSparseSpace::MatrixType TSystemMatrixType
Definition: solving_strategy.h:71
virtual int Check()
Function to perform expensive checks.
Definition: solving_strategy.h:377
TSparseSpace::VectorType TSystemVectorType
Definition: solving_strategy.h:73
virtual void MoveMesh()
This function is designed to move the mesh.
Definition: solving_strategy.h:330
TDenseSpace::VectorType LocalSystemVectorType
Definition: solving_strategy.h:81
Helper class to define solution strategies for TwoStepVPStrategy.
Definition: solver_settings.h:57
virtual bool FindTolerance(StrategyLabel const &rStrategyLabel, double &rTolerance)
Definition: solver_settings.h:143
@ Velocity
Definition: solver_settings.h:71
@ Pressure
Definition: solver_settings.h:72
virtual bool FindMaxIter(StrategyLabel const &rStrategyLabel, unsigned int &rMaxIter)
Definition: solver_settings.h:156
virtual unsigned int GetDomainSize() const
Definition: solver_settings.h:124
virtual unsigned int GetEchoLevel()
Definition: solver_settings.h:176
virtual bool FindStrategy(StrategyLabel const &rStrategyLabel, StrategyPointerType &pThisStrategy)
Definition: solver_settings.h:129
bool GetReformDofSet()
Definition: solver_settings.h:181
bool Has(const VariableData &rThisVariable) const
Definition: variables_list.h:372
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_INFO(label)
Definition: logger.h:250
constexpr double Pi
Definition: global_variables.h:25
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
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
Temp
Definition: PecletTest.py:105
float viscosity
Definition: edgebased_var.py:8
Dt
Definition: face_heat.py:78
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
kappa
Definition: ode_solve.py:416
int d
Definition: ode_solve.py:397
int k
Definition: quadrature.py:595
integer i
Definition: TensorModule.f:17
float pressure
Definition: test_pureconvectionsolver_benchmarking.py:101
ReformDofAtEachIteration
Definition: test_pureconvectionsolver_benchmarking.py:131
e
Definition: run_cpp_mpi_tests.py:31