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.
residualbased_incrementalupdate_static_simp_scheme.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Baumgärtner Daniel, https://github.com/dbaumgaertner
11 // Octaviano Malfavón Farías
12 // Eric Gonzales
13 // Philipp Hofer
14 // Erich Wehrle
15 #if !defined(KRATOS_RESIDUALBASED_INCREMENTALUPDATE_STATIC_SIMP_SCHEME_H)
16 #define KRATOS_RESIDUALBASED_INCREMENTALUPDATE_STATIC_SIMP_SCHEME_H
17 
18 
19 // External includes
20 
21 
22 // Project includes
24 #include "includes/variables.h"
25 
27 
28 // Application includes
30 
31 
32 namespace Kratos
33 {
34 
59 template<class TSparseSpace,class TDenseSpace >
61 {
62 
63 public:
68 
70 
71  typedef typename BaseType::TDataType TDataType;
72 
74 
76 
78 
81 
82 
85 
94  : ResidualBasedIncrementalUpdateStaticScheme<TSparseSpace,TDenseSpace>()
95  {}
96 
100 
101 
107  // UPDATE LHS AND RHS
110 
112  Element& rCurrentElement,
113  LocalSystemMatrixType& rLHSContribution,
114  LocalSystemVectorType& rRHSContribution,
115  EquationIdVectorType& rEquationId,
116  const ProcessInfo& rCurrentProcessInfo
117  ) override
118  {
119  KRATOS_TRY
120  //Initializing the non linear iteration for the current element
121  rCurrentElement.InitializeNonLinearIteration(rCurrentProcessInfo);
122 
123  //basic operations for the element considered
124  rCurrentElement.CalculateLocalSystem(rLHSContribution,rRHSContribution,rCurrentProcessInfo);
125 
126  //Determine the new Youngs Modulus based on the assigned new density (X_PHYS)
127  const double E_min = rCurrentElement.GetProperties()[YOUNGS_MODULUS_MIN];
128  const double E_initial = rCurrentElement.GetProperties()[YOUNGS_MODULUS_0];
129  //const std::string mat_interp = rCurrentElement.GetProperties()[MAT_INTERP];
130  const std::string mat_interp = rCurrentElement.GetValue(MAT_INTERP);
131  const double E_current = rCurrentElement.GetValue(YOUNG_MODULUS);
132  const double penalty = rCurrentElement.GetValue(PENAL);
133  const double x_phys = rCurrentElement.GetValue(X_PHYS);
134 
135  double E_new = 0;
136  if (mat_interp == "simp")
137  {
138  E_new += E_initial*pow(x_phys, penalty);
139  }
140  else if (mat_interp == "simp_modified")
141  {
142  E_new += (E_min + pow(x_phys, penalty) * (E_initial - E_min));
143  }
144  else if (mat_interp == "ramp")
145  {
146  E_new += E_min + x_phys/(1+penalty*(1-x_phys)) * (E_initial - E_min);
147  }
148  else
149  {
150  KRATOS_ERROR << "Material interpolation option incorrectly chosen \nAvailable methods are: 'simp', 'simp_modified', 'ramp'." << std::endl;
151  }
152 
153  //Calculate the factor that needs to be multiplied on the RHS and LHS
154  const double factor = E_new/E_current;
155 
156  // Factorize LHS and RHS according SIMP approach
157  // Note that when this function is called, all the contributions from the force conditions are missing.
158  // I.e. RHS = -K*u_init. Hence we can directly factorize LHS and RHS to obtained the modified stiffnesses
159  rLHSContribution *= factor;
160  rRHSContribution *= factor;
161  //Continuation of the basic operations
162  rCurrentElement.EquationIdVector(rEquationId,rCurrentProcessInfo);
163 
164  KRATOS_CATCH( "" )
165  }
166 
167 
190 protected:
226 private:
262 }; /* Class Scheme */
263 
272 } /* namespace Kratos.*/
273 
274 #endif /* KRATOS_RESIDUAL_BASED_STATIC_SIMP_SCHEME defined */
275 
Base class for all Elements.
Definition: element.h:60
PropertiesType & GetProperties()
Definition: element.h:1024
virtual void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const
Definition: element.h:258
virtual void InitializeNonLinearIteration(const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:372
virtual void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:405
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: geometrical_object.h:248
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
Definition: residualbased_incrementalupdate_static_simp_scheme.h:61
~ResidualBasedIncrementalUpdateStaticSIMPScheme() override
Definition: residualbased_incrementalupdate_static_simp_scheme.h:99
BaseType::TSystemVectorType TSystemVectorType
Definition: residualbased_incrementalupdate_static_simp_scheme.h:77
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: residualbased_incrementalupdate_static_simp_scheme.h:79
BaseType::DofsArrayType DofsArrayType
Definition: residualbased_incrementalupdate_static_simp_scheme.h:73
BaseType::TDataType TDataType
Definition: residualbased_incrementalupdate_static_simp_scheme.h:71
ResidualBasedIncrementalUpdateStaticScheme< TSparseSpace, TDenseSpace > BaseType
Definition: residualbased_incrementalupdate_static_simp_scheme.h:69
void CalculateSystemContributions(Element &rCurrentElement, LocalSystemMatrixType &rLHSContribution, LocalSystemVectorType &rRHSContribution, EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo) override
Definition: residualbased_incrementalupdate_static_simp_scheme.h:111
KRATOS_CLASS_POINTER_DEFINITION(ResidualBasedIncrementalUpdateStaticSIMPScheme)
Element::EquationIdVectorType EquationIdVectorType
The definition of the vector containing the equation ids.
Definition: residualbased_incrementalupdate_static_simp_scheme.h:84
BaseType::TSystemMatrixType TSystemMatrixType
Definition: residualbased_incrementalupdate_static_simp_scheme.h:75
ResidualBasedIncrementalUpdateStaticSIMPScheme()
Definition: residualbased_incrementalupdate_static_simp_scheme.h:93
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: residualbased_incrementalupdate_static_simp_scheme.h:80
This class provides the implementation of a static scheme.
Definition: residualbased_incrementalupdate_static_scheme.h:57
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Local system vector type definition.
Definition: residualbased_incrementalupdate_static_scheme.h:84
Element::EquationIdVectorType EquationIdVectorType
The definition of the vector containing the equation ids.
Definition: residualbased_incrementalupdate_static_scheme.h:92
BaseType::LocalSystemVectorType LocalSystemVectorType
Local system matrix type definition.
Definition: residualbased_incrementalupdate_static_scheme.h:82
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
typename TSparseSpace::DataType TDataType
Data type definition.
Definition: scheme.h:68
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
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
float factor
for node in (self.combined_model_part).Nodes: pold = node.GetSolutionStepValue(PRESSURE,...
Definition: ulf_PGLASS.py:254