14 #if !defined(KRATOS_CONTROL_MODULE_PROCESS )
15 #define KRATOS_CONTROL_MODULE_PROCESS
49 "model_part_name":"MODEL_PART_NAME",
50 "imposed_direction" : 0,
51 "alternate_axis_loading": false,
52 "target_stress_table_id" : 0,
53 "initial_velocity" : 0.0,
54 "limit_velocity" : 1.0,
55 "velocity_factor" : 1.0,
56 "compression_length" : 1.0,
57 "young_modulus" : 1.0e7,
58 "stress_increment_tolerance": 100.0,
59 "update_stiffness": true,
61 "stress_averaging_time": 1.0e-5
91 #pragma omp parallel for
92 for(
int i = 0;
i<NNodes;
i++) {
93 ModelPart::NodesContainerType::iterator it = it_begin +
i;
94 it->SetValue(TARGET_STRESS,zero_vector);
95 it->SetValue(REACTION_STRESS,zero_vector);
96 it->SetValue(LOADING_VELOCITY,zero_vector);
125 #pragma omp parallel for
126 for(
int i = 0;
i<NNodes;
i++) {
127 ModelPart::NodesContainerType::iterator it = it_begin +
i;
128 it->Fix(DISPLACEMENT_X);
129 it->FastGetSolutionStepValue(DISPLACEMENT_X) = 0.0;
133 #pragma omp parallel for
134 for(
int i = 0;
i<NNodes;
i++) {
135 ModelPart::NodesContainerType::iterator it = it_begin +
i;
136 it->Fix(DISPLACEMENT_Y);
137 it->FastGetSolutionStepValue(DISPLACEMENT_Y) = 0.0;
141 #pragma omp parallel for
142 for(
int i = 0;
i<NNodes;
i++) {
143 ModelPart::NodesContainerType::iterator it = it_begin +
i;
144 it->Fix(DISPLACEMENT_Z);
145 it->FastGetSolutionStepValue(DISPLACEMENT_Z) = 0.0;
149 #pragma omp parallel for
150 for(
int i = 0;
i<NNodes;
i++) {
151 ModelPart::NodesContainerType::iterator it = it_begin +
i;
152 it->Fix(DISPLACEMENT_X);
153 it->FastGetSolutionStepValue(DISPLACEMENT_X) = 0.0;
154 it->Fix(DISPLACEMENT_Y);
155 it->FastGetSolutionStepValue(DISPLACEMENT_Y) = 0.0;
172 double ReactionStress = CalculateReactionStress();
173 ReactionStress = UpdateVectorOfHistoricalStressesAndComputeNewAverage(ReactionStress);
184 mStiffness = EstimateStiffness(ReactionStress,DeltaTime);
190 const double NextTargetStress = pTargetStressTable->GetValue(CurrentTime+DeltaTime);
191 const double df_target = NextTargetStress - ReactionStress;
210 #pragma omp parallel for
211 for(
int i = 0;
i<NNodes;
i++) {
212 ModelPart::NodesContainerType::iterator it = it_begin +
i;
213 it->FastGetSolutionStepValue(DISPLACEMENT_X) +=
mVelocity * DeltaTime;
215 it->GetValue(TARGET_STRESS_X) = pTargetStressTable->GetValue(CurrentTime);
216 it->GetValue(REACTION_STRESS_X) = ReactionStress;
217 it->GetValue(LOADING_VELOCITY_X) =
mVelocity;
220 #pragma omp parallel for
221 for(
int i = 0;
i<NNodes;
i++) {
222 ModelPart::NodesContainerType::iterator it = it_begin +
i;
223 it->FastGetSolutionStepValue(DISPLACEMENT_Y) +=
mVelocity * DeltaTime;
225 it->GetValue(TARGET_STRESS_Y) = pTargetStressTable->GetValue(CurrentTime);
226 it->GetValue(REACTION_STRESS_Y) = ReactionStress;
227 it->GetValue(LOADING_VELOCITY_Y) =
mVelocity;
230 #pragma omp parallel for
231 for(
int i = 0;
i<NNodes;
i++) {
232 ModelPart::NodesContainerType::iterator it = it_begin +
i;
233 it->FastGetSolutionStepValue(DISPLACEMENT_Z) +=
mVelocity * DeltaTime;
235 it->GetValue(TARGET_STRESS_Z) = pTargetStressTable->GetValue(CurrentTime);
236 it->GetValue(REACTION_STRESS_Z) = ReactionStress;
237 it->GetValue(LOADING_VELOCITY_Z) =
mVelocity;
240 #pragma omp parallel for
241 for(
int i = 0;
i<NNodes;
i++) {
242 ModelPart::NodesContainerType::iterator it = it_begin +
i;
246 it->FastGetSolutionStepValue(DISPLACEMENT_X) +=
mVelocity * cos_theta * DeltaTime;
247 it->FastGetSolutionStepValue(DISPLACEMENT_Y) +=
mVelocity * sin_theta * DeltaTime;
249 it->GetValue(TARGET_STRESS_X) = pTargetStressTable->GetValue(CurrentTime) * cos_theta;
250 it->GetValue(TARGET_STRESS_Y) = pTargetStressTable->GetValue(CurrentTime) * sin_theta;
251 it->GetValue(REACTION_STRESS_X) = ReactionStress * cos_theta;
252 it->GetValue(REACTION_STRESS_Y) = ReactionStress * sin_theta;
253 it->GetValue(LOADING_VELOCITY_X) =
mVelocity * cos_theta;
254 it->GetValue(LOADING_VELOCITY_Y) =
mVelocity * sin_theta;
260 #pragma omp parallel for
261 for(
int i = 0;
i<NNodes;
i++) {
262 ModelPart::NodesContainerType::iterator it = it_begin +
i;
263 it->GetValue(TARGET_STRESS_X) = pTargetStressTable->GetValue(CurrentTime);
264 it->GetValue(REACTION_STRESS_X) = ReactionStress;
265 it->GetValue(LOADING_VELOCITY_X) = 0.0;
268 #pragma omp parallel for
269 for(
int i = 0;
i<NNodes;
i++) {
270 ModelPart::NodesContainerType::iterator it = it_begin +
i;
271 it->GetValue(TARGET_STRESS_Y) = pTargetStressTable->GetValue(CurrentTime);
272 it->GetValue(REACTION_STRESS_Y) = ReactionStress;
273 it->GetValue(LOADING_VELOCITY_Y) = 0.0;
276 #pragma omp parallel for
277 for(
int i = 0;
i<NNodes;
i++) {
278 ModelPart::NodesContainerType::iterator it = it_begin +
i;
279 it->GetValue(TARGET_STRESS_Z) = pTargetStressTable->GetValue(CurrentTime);
280 it->GetValue(REACTION_STRESS_Z) = ReactionStress;
281 it->GetValue(LOADING_VELOCITY_Z) = 0.0;
284 #pragma omp parallel for
285 for(
int i = 0;
i<NNodes;
i++) {
286 ModelPart::NodesContainerType::iterator it = it_begin +
i;
290 it->GetValue(TARGET_STRESS_X) = pTargetStressTable->GetValue(CurrentTime) * cos_theta;
291 it->GetValue(TARGET_STRESS_Y) = pTargetStressTable->GetValue(CurrentTime) * sin_theta;
292 it->GetValue(REACTION_STRESS_X) = ReactionStress * cos_theta;
293 it->GetValue(REACTION_STRESS_Y) = ReactionStress * sin_theta;
294 it->GetValue(LOADING_VELOCITY_X) = 0.0;
295 it->GetValue(LOADING_VELOCITY_Y) = 0.0;
313 double ReactionStress = CalculateReactionStress();
322 std::string
Info()
const override
324 return "ControlModuleProcess";
330 rOStream <<
"ControlModuleProcess";
373 double UpdateVectorOfHistoricalStressesAndComputeNewAverage(
const double& last_reaction) {
376 if (length_of_vector == 0) {
378 if(number_of_steps_for_stress_averaging < 1) number_of_steps_for_stress_averaging = 1;
380 KRATOS_INFO(
"DEM") <<
" 'number_of_steps_for_stress_averaging' is "<< number_of_steps_for_stress_averaging << std::endl;
385 if(length_of_vector > 1) {
386 for(
int i=1;
i<length_of_vector;
i++) {
392 double average = 0.0;
393 for(
int i=0;
i<length_of_vector;
i++) {
396 average /= (
double) length_of_vector;
402 void IsTimeToApplyCM(){
433 double CalculateReactionStress() {
440 double FaceArea = 0.0;
441 #pragma omp parallel for reduction(+:FaceArea)
442 for(
int i = 0;
i < NCons;
i++)
444 ModelPart::ConditionsContainerType::iterator itCond = con_begin +
i;
445 FaceArea += itCond->GetGeometry().Area();
449 double FaceReaction = 0.0;
451 #pragma omp parallel for reduction(+:FaceReaction)
452 for(
int i = 0;
i<NNodes;
i++){
453 ModelPart::NodesContainerType::iterator it = it_begin +
i;
454 FaceReaction += it->FastGetSolutionStepValue(REACTION_X);
457 #pragma omp parallel for reduction(+:FaceReaction)
458 for(
int i = 0;
i<NNodes;
i++){
459 ModelPart::NodesContainerType::iterator it = it_begin +
i;
460 FaceReaction += it->FastGetSolutionStepValue(REACTION_Y);
463 #pragma omp parallel for reduction(+:FaceReaction)
464 for(
int i = 0;
i<NNodes;
i++){
465 ModelPart::NodesContainerType::iterator it = it_begin +
i;
466 FaceReaction += it->FastGetSolutionStepValue(REACTION_Z);
469 #pragma omp parallel for reduction(+:FaceReaction)
470 for(
int i = 0;
i<NNodes;
i++){
471 ModelPart::NodesContainerType::iterator it = it_begin +
i;
473 array_1d<double,2>
n;
476 double inv_norm = 1.0/
norm_2(
n);
480 double n_dot_r =
n[0] * it->FastGetSolutionStepValue(REACTION_X) +
481 n[1] * it->FastGetSolutionStepValue(REACTION_Y);
482 FaceReaction += n_dot_r;
486 double ReactionStress;
487 if (std::abs(FaceArea) > 1.0e-12) {
488 ReactionStress = FaceReaction/FaceArea;
490 ReactionStress = 0.0;
493 return ReactionStress;
496 double EstimateStiffness(
const double& rReactionStress,
const double& rDeltaTime) {
515 rOStream << std::endl;
Definition: control_module_process.hpp:27
std::string Info() const override
Turn back information as a string.
Definition: control_module_process.hpp:322
double mVelocity
Definition: control_module_process.hpp:347
double mStartTime
Definition: control_module_process.hpp:350
bool mUpdateStiffness
Definition: control_module_process.hpp:354
ModelPart & mrModelPart
Member Variables.
Definition: control_module_process.hpp:344
void ExecuteFinalizeSolutionStep() override
This function will be executed at every time step AFTER performing the solve phase.
Definition: control_module_process.hpp:307
double mStressIncrementTolerance
Definition: control_module_process.hpp:352
unsigned int mYCounter
Definition: control_module_process.hpp:359
bool mAlternateAxisLoading
Definition: control_module_process.hpp:357
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: control_module_process.hpp:334
unsigned int mImposedDirection
Definition: control_module_process.hpp:345
~ControlModuleProcess() override
Destructor.
Definition: control_module_process.hpp:105
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: control_module_process.hpp:328
unsigned int mZCounter
Definition: control_module_process.hpp:360
unsigned int mTargetStressTableId
Definition: control_module_process.hpp:346
double mLimitVelocity
Definition: control_module_process.hpp:348
double mStiffness
Definition: control_module_process.hpp:353
double mReactionStressOld
Definition: control_module_process.hpp:351
unsigned int mXCounter
Definition: control_module_process.hpp:358
void ExecuteInitialize() override
Definition: control_module_process.hpp:116
void Execute() override
Execute method is used to execute the ControlModuleProcess algorithms.
Definition: control_module_process.hpp:110
double mVelocityFactor
Definition: control_module_process.hpp:349
ControlModuleProcess(ModelPart &rModelPart, Parameters rParameters)
Constructor.
Definition: control_module_process.hpp:39
Table< double, double > TableType
Defining a table with double argument and result type as table type.
Definition: control_module_process.hpp:34
bool mApplyCM
Definition: control_module_process.hpp:361
void ExecuteInitializeSolutionStep() override
this function will be executed at every time step BEFORE performing the solve phase
Definition: control_module_process.hpp:163
std::vector< double > mVectorOfLastStresses
Definition: control_module_process.hpp:355
double mStressAveragingTime
Definition: control_module_process.hpp:356
KRATOS_CLASS_POINTER_DEFINITION(ControlModuleProcess)
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ConditionIterator ConditionsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1361
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
TableType::Pointer pGetTable(IndexType TableId)
Definition: model_part.h:595
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
int GetInt() const
This method returns the integer contained in the current Parameter.
Definition: kratos_parameters.cpp:666
void ValidateAndAssignDefaults(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing match the form prescribed by th...
Definition: kratos_parameters.cpp:1306
bool GetBool() const
This method returns the boolean contained in the current Parameter.
Definition: kratos_parameters.cpp:675
The base class for all processes in Kratos.
Definition: process.h:49
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_INFO(label)
Definition: logger.h:250
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
int step
Definition: face_heat.py:88
delta_time
Definition: generate_frictional_mortar_condition.py:130
float external_radius
Definition: mesh_to_mdpa_converter.py:24
int n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
integer i
Definition: TensorModule.f:17