15 #if !defined(KRATOS_APPLY_CONSTANT_VECTORVALUE_PROCESS_H_INCLUDED )
16 #define KRATOS_APPLY_CONSTANT_VECTORVALUE_PROCESS_H_INCLUDED
70 "model_part_name":"PLEASE_CHOOSE_MODEL_PART_NAME",
72 "variable_name": "PLEASE_PRESCRIBE_VARIABLE_NAME",
77 "direction": [1.0, 0.0, 0.0]
84 KRATOS_THROW_ERROR(std::runtime_error,
"direction vector is not a vector or it does not have size 3. Direction vector currently passed",
parameters.PrettyPrintJsonString());
88 KRATOS_THROW_ERROR(std::runtime_error,
"modulus shall be a number. Parameter list in which is included is :",
parameters.PrettyPrintJsonString());
90 if(
parameters[
"variable_name"].IsString() ==
false)
92 KRATOS_THROW_ERROR(std::runtime_error,
"vairbale_name shall be a String. Parameter list in which is included is :",
parameters.PrettyPrintJsonString());
94 if(
parameters[
"model_part_name"].IsString() ==
false)
96 KRATOS_THROW_ERROR(std::runtime_error,
"model_part_name shall be a String. Parameter list in which is included is :",
parameters.PrettyPrintJsonString());
100 parameters.ValidateAndAssignDefaults(default_parameters);
105 this->
Set(X_COMPONENT_FIXED,
parameters[
"is_fixed_x"].GetBool());
106 this->
Set(Y_COMPONENT_FIXED,
parameters[
"is_fixed_y"].GetBool());
107 this->
Set(Z_COMPONENT_FIXED,
parameters[
"is_fixed_z"].GetBool());
122 KRATOS_THROW_ERROR(std::runtime_error,
" Norm of direction given is approximately zero. Please give a direction vector with a non zero norm : current value of direction vector = ",
mdirection);
140 if(
model_part.GetNodalSolutionStepVariablesList().Has(rVariable) ==
false )
142 std::string
err_msg = std::string(
"Trying to fix a variable that is not in the model_part - variable: ")+
mvariable_name;
171 const double modulus,
181 KRATOS_THROW_ERROR(std::runtime_error,
"Mesh does not exist in model_part: mesh id is --> ",mesh_id);
184 if(this->
IsDefined(X_COMPONENT_FIXED) ==
false )
186 KRATOS_THROW_ERROR(std::runtime_error,
"Please specify if component x is to be fixed or not (flag X_COMPONENT_FIXED)",
"");
188 if(this->
IsDefined(Y_COMPONENT_FIXED) ==
false )
190 KRATOS_THROW_ERROR(std::runtime_error,
"Please specify if component y is to be fixed or not (flag Y_COMPONENT_FIXED)",
"");
192 if(this->
IsDefined(Z_COMPONENT_FIXED) ==
false )
194 KRATOS_THROW_ERROR(std::runtime_error,
"Please specify if the variable is to be fixed or not (flag Z_COMPONENT_FIXED)",
"");
199 if(
model_part.GetNodalSolutionStepVariablesList().Has(rVariable) ==
false )
201 std::string
err_msg = std::string(
"Trying to fix a variable that is not in the model_part - variable: ")+
mvariable_name;
205 if(direction.size() != 3)
264 InternalApplyValue<component_type >(varx, this->
Is(X_COMPONENT_FIXED), value[0]);
265 InternalApplyValue<component_type >(vary, this->
Is(Y_COMPONENT_FIXED), value[1]);
266 InternalApplyValue<component_type >(varz, this->
Is(Z_COMPONENT_FIXED), value[2]);
321 std::string
Info()
const override
323 return "ApplyConstantVectorValueProcess";
329 rOStream <<
"ApplyConstantVectorValueProcess";
356 template<
class TVarType >
357 void InternalApplyValue(
const TVarType& rVar,
const bool to_be_fixed,
const double value)
367 if(to_be_fixed && (it_begin->HasDofFor(rVar) ==
false) )
369 KRATOS_THROW_ERROR(std::runtime_error,
" Trying to fix a dofs which was not allocated. Variable is --> ",rVar.Name() );
387 ApplyConstantVectorValueProcess&
operator=(ApplyConstantVectorValueProcess
const& rOther);
422 rOStream << std::endl;
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
The base class for all processes in Kratos.
Definition: apply_constant_vectorvalue_process.h:45
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: apply_constant_vectorvalue_process.h:333
void ExecuteAfterOutputStep() override
this function will be executed at every time step AFTER writing the output
Definition: apply_constant_vectorvalue_process.h:294
std::string Info() const override
Turn back information as a string.
Definition: apply_constant_vectorvalue_process.h:321
KRATOS_DEFINE_LOCAL_FLAG(Y_COMPONENT_FIXED)
ApplyConstantVectorValueProcess(ModelPart &model_part, const Variable< array_1d< double, 3 > > &rVariable, const double modulus, const Vector &direction, std::size_t mesh_id, const Flags options)
Definition: apply_constant_vectorvalue_process.h:169
void ExecuteFinalizeSolutionStep() override
this function will be executed at every time step AFTER performing the solve phase
Definition: apply_constant_vectorvalue_process.h:282
KRATOS_CLASS_POINTER_DEFINITION(ApplyConstantVectorValueProcess)
Pointer definition of ApplyConstantVectorValueProcess.
void ExecuteInitialize() override
Definition: apply_constant_vectorvalue_process.h:254
double mmodulus
Definition: apply_constant_vectorvalue_process.h:348
std::size_t mmesh_id
Definition: apply_constant_vectorvalue_process.h:350
KRATOS_DEFINE_LOCAL_FLAG(Z_COMPONENT_FIXED)
void ExecuteBeforeOutputStep() override
this function will be executed at every time step BEFORE writing the output
Definition: apply_constant_vectorvalue_process.h:288
ApplyConstantVectorValueProcess(ModelPart &model_part, Parameters parameters)
Default constructor.
Definition: apply_constant_vectorvalue_process.h:61
KRATOS_DEFINE_LOCAL_FLAG(X_COMPONENT_FIXED)
void operator()()
This operator is provided to call the process as a function and simply calls the Execute method.
Definition: apply_constant_vectorvalue_process.h:238
~ApplyConstantVectorValueProcess() override
Destructor.
Definition: apply_constant_vectorvalue_process.h:230
void ExecuteInitializeSolutionStep() override
this function will be executed at every time step BEFORE performing the solve phase
Definition: apply_constant_vectorvalue_process.h:277
void ExecuteFinalize() override
Definition: apply_constant_vectorvalue_process.h:301
void Execute() override
Execute method is used to execute the ApplyConstantVectorValueProcess algorithms.
Definition: apply_constant_vectorvalue_process.h:250
ModelPart & mr_model_part
Definition: apply_constant_vectorvalue_process.h:346
Vector mdirection
Definition: apply_constant_vectorvalue_process.h:349
std::string mvariable_name
Definition: apply_constant_vectorvalue_process.h:347
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: apply_constant_vectorvalue_process.h:327
void ExecuteBeforeSolutionLoop() override
Definition: apply_constant_vectorvalue_process.h:271
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
bool IsDefined(Flags const &rOther) const
Definition: flags.h:279
bool Is(Flags const &rOther) const
Definition: flags.h:274
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
KratosComponents class encapsulates a lookup table for a family of classes in a generic way.
Definition: kratos_components.h:49
static const TComponentType & Get(const std::string &rName)
Retrieves a component with the specified name.
Definition: kratos_components.h:114
NodesContainerType & Nodes()
Definition: mesh.h:346
NodeIterator NodesBegin()
Definition: mesh.h:326
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType & GetMesh(IndexType ThisIndex=0)
Definition: model_part.h:1791
This class defines the node.
Definition: node.h:65
TVariableType::Type & FastGetSolutionStepValue(const TVariableType &rThisVariable)
Definition: node.h:435
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
size_type size() const
Returns the number of elements in the container.
Definition: pointer_vector_set.h:502
The base class for all processes in Kratos.
Definition: process.h:49
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_CREATE_LOCAL_FLAG(class_name, name, position)
Definition: define.h:685
std::istream & operator>>(std::istream &rIStream, ApplyConstantVectorValueProcess &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const ApplyConstantVectorValueProcess &rThis)
output stream function
Definition: apply_constant_vectorvalue_process.h:418
bool Has(const std::string &ModelerName)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:24
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
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
parameters
Definition: fluid_chimera_analysis.py:35
string err_msg
Definition: fluid_chimera_analysis.py:21
int nnodes
Definition: sensitivityMatrix.py:24
e
Definition: run_cpp_mpi_tests.py:31