84 std::string gradient_mode = responseSettings[
"gradient_mode"].
GetString();
85 if (gradient_mode.compare(
"finite_differencing") == 0)
91 KRATOS_ERROR <<
"Specified gradient_mode '" << gradient_mode <<
"' not recognized. The only option is: finite_differencing" << std::endl;
117 double total_mass = 0.0;
121 for (
auto& elem_i : mrModelPart.
Elements()){
122 const bool element_is_active = elem_i.
IsDefined(ACTIVE) ? elem_i.Is(ACTIVE) :
true;
123 if(element_is_active)
149 for(
auto& node_i : mrModelPart.
Nodes())
155 double mass_before_fd = 0.0;
156 for(std::size_t
i = 0;
i < ng_elem.
size();
i++)
159 const bool element_is_active = ng_elem_i.
IsDefined(ACTIVE) ? ng_elem_i.
Is(ACTIVE) :
true;
162 if(element_is_active)
170 double mass_after_fd = 0.0;
171 node_i.X() += mDelta;
172 node_i.X0() += mDelta;
173 for(std::size_t
i = 0;
i < ng_elem.
size();
i++)
176 const bool element_is_active = ng_elem_i.
IsDefined(ACTIVE) ? ng_elem_i.
Is(ACTIVE) :
true;
179 if(element_is_active)
182 gradient[0] = (mass_after_fd - mass_before_fd) / mDelta;
183 node_i.X() -= mDelta;
184 node_i.X0() -= mDelta;
188 node_i.Y() += mDelta;
189 node_i.Y0() += mDelta;
190 for(std::size_t
i = 0;
i < ng_elem.
size();
i++)
193 const bool element_is_active = ng_elem_i.
IsDefined(ACTIVE) ? ng_elem_i.
Is(ACTIVE) :
true;
196 if(element_is_active)
199 gradient[1] = (mass_after_fd - mass_before_fd) / mDelta;
200 node_i.Y() -= mDelta;
201 node_i.Y0() -= mDelta;
205 node_i.Z() += mDelta;
206 node_i.Z0() += mDelta;
207 for(std::size_t
i = 0;
i < ng_elem.
size();
i++)
210 const bool element_is_active = ng_elem_i.
IsDefined(ACTIVE) ? ng_elem_i.
Is(ACTIVE) :
true;
213 if(element_is_active)
216 gradient[2] = (mass_after_fd - mass_before_fd) / mDelta;
217 node_i.Z() -= mDelta;
218 node_i.Z0() -= mDelta;
221 noalias(node_i.FastGetSolutionStepValue(SHAPE_SENSITIVITY)) = gradient;
245 return "MassResponseFunctionUtility";
251 rOStream <<
"MassResponseFunctionUtility";
Base class for all Elements.
Definition: element.h:60
This method allows to look for neighbours in a triangular or tetrahedral mesh.
Definition: find_nodal_neighbours_process.h:59
void Execute() override
This method esxecutes the neighbour search.
Definition: find_nodal_neighbours_process.cpp:49
bool IsDefined(Flags const &rOther) const
Definition: flags.h:279
bool Is(Flags const &rOther) const
Definition: flags.h:274
size_type size() const
Definition: global_pointers_vector.h:307
Short class definition.
Definition: mass_response_function_utility.h:66
std::string Info() const
Turn back information as a string.
Definition: mass_response_function_utility.h:243
void CalculateGradient()
Definition: mass_response_function_utility.h:133
void Initialize()
Definition: mass_response_function_utility.h:108
array_1d< double, 3 > array_3d
Definition: mass_response_function_utility.h:71
double CalculateValue()
Definition: mass_response_function_utility.h:112
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: mass_response_function_utility.h:255
KRATOS_CLASS_POINTER_DEFINITION(MassResponseFunctionUtility)
Pointer definition of MassResponseFunctionUtility.
virtual ~MassResponseFunctionUtility()
Destructor.
Definition: mass_response_function_utility.h:95
MassResponseFunctionUtility(ModelPart &model_part, Parameters responseSettings)
Default constructor.
Definition: mass_response_function_utility.h:81
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: mass_response_function_utility.h:249
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
double GetDouble() const
This method returns the double contained in the current Parameter.
Definition: kratos_parameters.cpp:657
std::string GetString() const
This method returns the string contained in the current Parameter.
Definition: kratos_parameters.cpp:684
static double CalculateElementMass(Element &rElement, const std::size_t DomainSize)
Definition: total_structural_mass_process.cpp:34
This class implements a set of auxiliar, already parallelized, methods to perform some common tasks r...
Definition: variable_utils.h:63
void SetHistoricalVariableToZero(const Variable< TType > &rVariable, NodesContainerType &rNodes)
Sets the nodal value of any variable to zero.
Definition: variable_utils.h:757
#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
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
int domain_size
Definition: face_heat.py:4
model_part
Definition: face_heat.py:14
integer i
Definition: TensorModule.f:17
double precision, dimension(3, 3), public delta
Definition: TensorModule.f:16