KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
newmark_quasistatic_U_Pw_scheme.hpp
Go to the documentation of this file.
1 // KRATOS___
2 // // ) )
3 // // ___ ___
4 // // ____ //___) ) // ) )
5 // // / / // // / /
6 // ((____/ / ((____ ((___/ / MECHANICS
7 //
8 // License: geo_mechanics_application/license.txt
9 //
10 // Main authors: Ignasi de Pouplana,
11 // Vahid Galavi
12 //
13 
14 #pragma once
15 
16 #include "includes/define.h"
17 #include "includes/model_part.h"
19 
21 
22 namespace Kratos
23 {
24 
25 template <class TSparseSpace, class TDenseSpace>
26 class NewmarkQuasistaticUPwScheme : public GeneralizedNewmarkScheme<TSparseSpace, TDenseSpace>
27 {
28 public:
30 
37 
38  NewmarkQuasistaticUPwScheme(double beta, double gamma, double theta)
39  : GeneralizedNewmarkScheme<TSparseSpace, TDenseSpace>(
40  {FirstOrderScalarVariable(WATER_PRESSURE, DT_WATER_PRESSURE, DT_PRESSURE_COEFFICIENT)},
41  {SecondOrderVectorVariable(DISPLACEMENT), SecondOrderVectorVariable(ROTATION)},
42  theta,
43  beta,
44  gamma)
45  {
46  }
47 
49  {
51 
52  if (rModelPart.GetProcessInfo()[NODAL_SMOOTHING]) {
53  const unsigned int dim = rModelPart.GetProcessInfo()[DOMAIN_SIZE];
54  const auto stress_tensor_size = dim == N_DIM_3D ? STRESS_TENSOR_SIZE_3D : STRESS_TENSOR_SIZE_2D;
55 
56  // Clear nodal variables
57  block_for_each(rModelPart.Nodes(), [&stress_tensor_size](Node& rNode) {
58  rNode.FastGetSolutionStepValue(NODAL_AREA) = 0.0;
59  Matrix& r_nodal_stress = rNode.FastGetSolutionStepValue(NODAL_CAUCHY_STRESS_TENSOR);
60  if (r_nodal_stress.size1() != stress_tensor_size)
61  r_nodal_stress.resize(stress_tensor_size, stress_tensor_size, false);
62  noalias(r_nodal_stress) = ZeroMatrix(stress_tensor_size, stress_tensor_size);
63  rNode.FastGetSolutionStepValue(NODAL_DAMAGE_VARIABLE) = 0.0;
64  rNode.FastGetSolutionStepValue(NODAL_JOINT_AREA) = 0.0;
65  rNode.FastGetSolutionStepValue(NODAL_JOINT_WIDTH) = 0.0;
66  rNode.FastGetSolutionStepValue(NODAL_JOINT_DAMAGE) = 0.0;
67  });
68 
69  this->FinalizeSolutionStepActiveEntities(rModelPart, A, Dx, b);
70 
71  // Compute smoothed nodal variables
72  block_for_each(rModelPart.Nodes(), [](Node& rNode) {
73  if (const double& nodal_area = rNode.FastGetSolutionStepValue(NODAL_AREA); nodal_area > 1.0e-20) {
74  const double inv_nodal_area = 1.0 / nodal_area;
75  rNode.FastGetSolutionStepValue(NODAL_CAUCHY_STRESS_TENSOR) *= inv_nodal_area;
76  rNode.FastGetSolutionStepValue(NODAL_DAMAGE_VARIABLE) *= inv_nodal_area;
77  }
78 
79  if (const double& nodal_joint_area = rNode.FastGetSolutionStepValue(NODAL_JOINT_AREA);
80  nodal_joint_area > 1.0e-20) {
81  const double inv_nodal_joint_area = 1.0 / nodal_joint_area;
82  rNode.FastGetSolutionStepValue(NODAL_JOINT_WIDTH) *= inv_nodal_joint_area;
83  rNode.FastGetSolutionStepValue(NODAL_JOINT_DAMAGE) *= inv_nodal_joint_area;
84  }
85  });
86  } else {
87  this->FinalizeSolutionStepActiveEntities(rModelPart, A, Dx, b);
88  }
89 
90  KRATOS_CATCH("")
91  }
92 }; // Class NewmarkQuasistaticUPwScheme
93 
94 } // namespace Kratos
Definition: generalized_newmark_scheme.hpp:22
void FinalizeSolutionStepActiveEntities(ModelPart &rModelPart, TSystemMatrixType &, TSystemVectorType &, TSystemVectorType &)
Definition: geomechanics_time_integration_scheme.hpp:165
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
Definition: newmark_quasistatic_U_Pw_scheme.hpp:27
void FinalizeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Function called once at the end of a solution step, after convergence is reached if an iterative proc...
Definition: newmark_quasistatic_U_Pw_scheme.hpp:48
NewmarkQuasistaticUPwScheme(double beta, double gamma, double theta)
Definition: newmark_quasistatic_U_Pw_scheme.hpp:38
KRATOS_CLASS_POINTER_DEFINITION(NewmarkQuasistaticUPwScheme)
This class defines the node.
Definition: node.h:65
TVariableType::Type & FastGetSolutionStepValue(const TVariableType &rThisVariable)
Definition: node.h:435
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
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
typename TSparseSpace::MatrixType TSystemMatrixType
Matrix type definition.
Definition: scheme.h:71
typename TSparseSpace::VectorType TSystemVectorType
Vector type definition.
Definition: scheme.h:74
typename TDenseSpace::VectorType LocalSystemVectorType
Local system vector type definition.
Definition: scheme.h:80
ModelPart::DofsArrayType DofsArrayType
DoF array type definition.
Definition: scheme.h:86
typename TDenseSpace::MatrixType LocalSystemMatrixType
Local system matrix type definition.
Definition: scheme.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
constexpr SizeType STRESS_TENSOR_SIZE_3D
Definition: geo_mechanics_application_constants.h:38
constexpr SizeType N_DIM_3D
Definition: geo_mechanics_application_constants.h:25
void block_for_each(TIterator itBegin, TIterator itEnd, TFunction &&rFunction)
Execute a functor on all items of a range in parallel.
Definition: parallel_utilities.h:299
constexpr SizeType STRESS_TENSOR_SIZE_2D
Definition: geo_mechanics_application_constants.h:37
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
float gamma
Definition: generate_two_fluid_navier_stokes.py:131
A
Definition: sensitivityMatrix.py:70
int dim
Definition: sensitivityMatrix.py:25
Definition: geomechanics_time_integration_scheme.hpp:20
Definition: geomechanics_time_integration_scheme.hpp:35