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.
set_absorbing_boundary_parameters_process.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: Aron Noordam
11 //
12 
13 #pragma once
14 
15 #include "includes/kratos_flags.h"
17 #include "processes/process.h"
18 
20 
21 namespace Kratos
22 {
23 
25 {
26 
27 public:
28 
30 
32  Parameters rParameters
33  ) : Process(Flags()) , mrModelPart(model_part)
34  {
36 
37  //only include validation with c++11 since raw_literals do not exist in c++03
38  Parameters default_parameters( R"(
39  {
40  "model_part_name":"PLEASE_CHOOSE_MODEL_PART_NAME",
41  "absorbing_factors": [1.0,1.0],
42  "virtual_thickness": 1e10
43  } )" );
44 
45  // Some values need to be mandatory prescribed since no meaningful default value exist. For this reason try accessing to them
46  // So that an error is thrown if they don't exist
47  rParameters["model_part_name"];
48 
49  // Now validate against defaults -- this also ensures no type mismatch
50  rParameters.ValidateAndAssignDefaults(default_parameters);
51 
52  // get absorbing factors
53  mAbsorbingFactors.resize(2, false);
54  mAbsorbingFactors(0) = rParameters["absorbing_factors"][0].GetDouble();
55  mAbsorbingFactors(1) = rParameters["absorbing_factors"][1].GetDouble();
56 
57  // get virtual thickness
58  mVirtualThickness = rParameters["virtual_thickness"].GetDouble();
59 
60  KRATOS_CATCH("")
61  }
62 
66 
69  void ExecuteInitialize() override
70  {
72 
73  block_for_each(mrModelPart.Conditions(), [&](Condition& rCondition) {
74  rCondition.SetValue(ABSORBING_FACTORS, mAbsorbingFactors);
75  rCondition.SetValue(VIRTUAL_THICKNESS, mVirtualThickness);
76  });
77 
78  KRATOS_CATCH("")
79  }
80 
81  std::string Info() const override
82  {
83  return "SetAbsorbingBoundaryParametersProcess";
84  }
85 
86 private:
88  ModelPart& mrModelPart;
89  Vector mAbsorbingFactors;
90  double mVirtualThickness;
91 };
92 
93 }
Base class for all Conditions.
Definition: condition.h:59
Definition: flags.h:58
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
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
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
The base class for all processes in Kratos.
Definition: process.h:49
Definition: set_absorbing_boundary_parameters_process.hpp:25
void ExecuteInitialize() override
Definition: set_absorbing_boundary_parameters_process.hpp:69
std::string Info() const override
Turn back information as a string.
Definition: set_absorbing_boundary_parameters_process.hpp:81
SetAbsorbingBoundaryParametersProcess(const SetAbsorbingBoundaryParametersProcess &)=delete
KRATOS_CLASS_POINTER_DEFINITION(SetAbsorbingBoundaryParametersProcess)
~SetAbsorbingBoundaryParametersProcess() override=default
SetAbsorbingBoundaryParametersProcess(ModelPart &model_part, Parameters rParameters)
Definition: set_absorbing_boundary_parameters_process.hpp:31
SetAbsorbingBoundaryParametersProcess & operator=(const SetAbsorbingBoundaryParametersProcess &)=delete
#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
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
model_part
Definition: face_heat.py:14