14 #if !defined(KRATOS_DAM_UPLIFT_CONDITION_LOAD_PROCESS)
15 #define KRATOS_DAM_UPLIFT_CONDITION_LOAD_PROCESS
57 "model_part_name":"PLEASE_CHOOSE_MODEL_PART_NAME",
58 "variable_name": "PLEASE_PRESCRIBE_VARIABLE_NAME",
60 "joint_group_name" : "PLEASE_CHOOSE_JOINT_GROUP_NAME",
61 "Gravity_Direction" : "Y",
62 "Reservoir_Bottom_Coordinate_in_Gravity_Direction" : 0.0,
63 "Upstream_Coordinate" : [0.0,0.0,0.0],
64 "Downstream_Coordinate" : [0.0,0.0,0.0],
65 "Upstream_Longitudinal_Coordinate" : [0.0,0.0,0.0],
72 "Effectiveness" : 0.0,
81 rParameters[
"Reservoir_Bottom_Coordinate_in_Gravity_Direction"];
82 rParameters[
"Upstream_Coordinate"];
83 rParameters[
"variable_name"];
84 rParameters[
"model_part_name"];
96 mX0[0] = rParameters[
"Upstream_Coordinate"][0].
GetDouble();
97 mX0[1] = rParameters[
"Upstream_Coordinate"][1].
GetDouble();
98 mX0[2] = rParameters[
"Upstream_Coordinate"][2].
GetDouble();
101 mX1[0] = rParameters[
"Downstream_Coordinate"][0].
GetDouble();
102 mX1[1] = rParameters[
"Downstream_Coordinate"][1].
GetDouble();
103 mX1[2] = rParameters[
"Downstream_Coordinate"][2].
GetDouble();
106 mX2[0] = rParameters[
"Upstream_Longitudinal_Coordinate"][0].
GetDouble();
107 mX2[1] = rParameters[
"Upstream_Longitudinal_Coordinate"][1].
GetDouble();
108 mX2[2] = rParameters[
"Upstream_Longitudinal_Coordinate"][2].
GetDouble();
176 reference_vector =
prod(RotationMatrix,
mX0);
184 double JointPosition = 0.0;
191 for(
int j = 0;
j < nelems;
j++)
193 ModelPart::ElementsContainerType::iterator it_elem = el_begin +
j;
198 unsigned int NumGPoints = IntegrationPoints.size();
199 Vector detJContainer(NumGPoints);
201 std::vector<double> StateVariableVector(NumGPoints);
202 it_elem->CalculateOnIntegrationPoints(STATE_VARIABLE,StateVariableVector,CurrentProcessInfo);
205 for (
unsigned int GPoint = 0; GPoint < NumGPoints; GPoint++ )
208 AuxLocalCoordinates[0] = IntegrationPoints[GPoint][0];
209 AuxLocalCoordinates[1] = IntegrationPoints[GPoint][1];
210 AuxLocalCoordinates[2] = IntegrationPoints[GPoint][2];
214 if (StateVariableVector.empty()) MyGaussPoint.
StateVariable = 0.0;
215 else MyGaussPoint.
StateVariable = StateVariableVector[GPoint];
236 noalias(auxiliar_vector) = rNode.Coordinates();
238 newCoordinate = prod(RotationMatrix, auxiliar_vector);
240 double uplift_pressure = 0.0;
242 if (newCoordinate(0) < (reference_vector(0) + JointPosition))
244 uplift_pressure = mSpecific * (ref_water_level - (rNode.Coordinates()[direction]));
248 if (mDrain == true && JointPosition < (reference_vector(0) + mDistanceDrain))
250 if (newCoordinate(0) < (reference_vector(0) + mDistanceDrain))
252 uplift_pressure = mSpecific * (ref_water_level - (rNode.Coordinates()[direction])) * (1.0 - 0.8 * ((1.0 / ((reference_vector(0) + mDistanceDrain) - JointPosition)) * (fabs(newCoordinate(0) - JointPosition))));
256 uplift_pressure = 0.2 * mSpecific * (ref_water_level - (rNode.Coordinates()[direction])) * (1.0 - ((1.0 / (mBaseDam - mDistanceDrain)) * (fabs(newCoordinate(0) - (reference_vector(0) + mDistanceDrain)))));
261 uplift_pressure = mSpecific * (ref_water_level - (rNode.Coordinates()[direction])) * (1.0 - ((1.0 / (mBaseDam - (JointPosition - reference_vector(0)))) * (fabs(newCoordinate(0) - JointPosition))));
265 if (uplift_pressure < 0.0)
267 rNode.FastGetSolutionStepValue(var) = 0.0;
271 rNode.FastGetSolutionStepValue(var) = uplift_pressure;
288 const int nelems = mrJointModelPart.GetMesh(0).Elements().size();
289 const int nnodes = mrModelPart.GetMesh(0).Nodes().size();
295 double time = mrModelPart.GetProcessInfo()[TIME];
297 mWaterLevel = mpTable->GetValue(
time);
311 if (mGravityDirection ==
"X")
313 else if (mGravityDirection ==
"Y")
319 reference_vector =
prod(RotationMatrix, mX0);
324 const ProcessInfo& CurrentProcessInfo = mrModelPart.GetProcessInfo();
327 double JointPosition = 0.0;
328 double ref_water_level = mReferenceCoordinate + mWaterLevel;
332 ModelPart::ElementsContainerType::iterator el_begin = mrJointModelPart.ElementsBegin();
334 for(
int j = 0;
j < nelems;
j++)
336 ModelPart::ElementsContainerType::iterator it_elem = el_begin +
j;
339 MyIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_1;
341 unsigned int NumGPoints = IntegrationPoints.size();
342 Vector detJContainer(NumGPoints);
344 std::vector<double> StateVariableVector(NumGPoints);
345 it_elem->CalculateOnIntegrationPoints(STATE_VARIABLE,StateVariableVector,CurrentProcessInfo);
348 for (
unsigned int GPoint = 0; GPoint < NumGPoints; GPoint++ )
351 AuxLocalCoordinates[0] = IntegrationPoints[GPoint][0];
352 AuxLocalCoordinates[1] = IntegrationPoints[GPoint][1];
353 AuxLocalCoordinates[2] = IntegrationPoints[GPoint][2];
357 if (StateVariableVector.empty()) MyGaussPoint.
StateVariable = 0.0;
358 else MyGaussPoint.
StateVariable = StateVariableVector[GPoint];
379 noalias(auxiliar_vector) = rNode.Coordinates();
381 newCoordinate = prod(RotationMatrix, auxiliar_vector);
383 double uplift_pressure = 0.0;
385 if (newCoordinate(0) < (reference_vector(0) + JointPosition))
387 uplift_pressure = mSpecific * (ref_water_level - (rNode.Coordinates()[direction]));
391 if (mDrain == true && JointPosition < (reference_vector(0) + mDistanceDrain))
393 if (newCoordinate(0) < (reference_vector(0) + mDistanceDrain))
395 uplift_pressure = mSpecific * (ref_water_level - (rNode.Coordinates()[direction])) * (1.0 - 0.8 * ((1.0 / ((reference_vector(0) + mDistanceDrain) - JointPosition)) * (fabs(newCoordinate(0) - JointPosition))));
399 uplift_pressure = 0.2 * mSpecific * (ref_water_level - (rNode.Coordinates()[direction])) * (1.0 - ((1.0 / (mBaseDam - mDistanceDrain)) * (fabs(newCoordinate(0) - (reference_vector(0) + mDistanceDrain)))));
404 uplift_pressure = mSpecific * (ref_water_level - (rNode.Coordinates()[direction])) * (1.0 - ((1.0 / (mBaseDam - (JointPosition - reference_vector(0)))) * (fabs(newCoordinate(0) - JointPosition))));
408 if (uplift_pressure < 0.0)
410 rNode.FastGetSolutionStepValue(var) = 0.0;
414 rNode.FastGetSolutionStepValue(var) = uplift_pressure;
428 V_uplift = (mX1 - mX0);
429 mBaseDam =
norm_2(V_uplift);
430 double inv_norm_uplift = 1.0 /
norm_2(V_uplift);
431 V_uplift[0] *= inv_norm_uplift;
432 V_uplift[1] *= inv_norm_uplift;
433 V_uplift[2] *= inv_norm_uplift;
437 V_longitudinal = (mX2 - mX0);
438 double inv_norm_longitudinal = 1.0 /
norm_2(V_longitudinal);
439 V_longitudinal[0] *= inv_norm_longitudinal;
440 V_longitudinal[1] *= inv_norm_longitudinal;
441 V_longitudinal[2] *= inv_norm_longitudinal;
448 rRotationMatrix(0, 0) = V_uplift[0];
449 rRotationMatrix(0, 1) = V_uplift[1];
450 rRotationMatrix(0, 2) = V_uplift[2];
452 rRotationMatrix(1, 0) = V_longitudinal[0];
453 rRotationMatrix(1, 1) = V_longitudinal[1];
454 rRotationMatrix(1, 2) = V_longitudinal[2];
456 rRotationMatrix(2, 0) = V_normal[0];
457 rRotationMatrix(2, 1) = V_normal[1];
458 rRotationMatrix(2, 2) = V_normal[2];
464 std::string
Info()
const override
466 return "DamUpliftConditionLoadProcess";
472 rOStream <<
"DamUpliftConditionLoadProcess";
521 rOStream << std::endl;
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Definition: dam_uplift_condition_load_process.hpp:31
std::string mGravityDirection
Definition: dam_uplift_condition_load_process.hpp:488
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: dam_uplift_condition_load_process.hpp:470
double mDistanceDrain
Definition: dam_uplift_condition_load_process.hpp:495
Vector mX1
Definition: dam_uplift_condition_load_process.hpp:498
double mSpecific
Definition: dam_uplift_condition_load_process.hpp:490
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: dam_uplift_condition_load_process.hpp:132
void CalculateRotationMatrix(BoundedMatrix< double, 3, 3 > &rRotationMatrix)
Definition: dam_uplift_condition_load_process.hpp:422
double mEffectivenessDrain
Definition: dam_uplift_condition_load_process.hpp:496
bool mDrain
Definition: dam_uplift_condition_load_process.hpp:493
virtual ~DamUpliftConditionLoadProcess()
Destructor.
Definition: dam_uplift_condition_load_process.hpp:129
std::string Info() const override
Turn back information as a string.
Definition: dam_uplift_condition_load_process.hpp:464
ModelPart & mrJointModelPart
Definition: dam_uplift_condition_load_process.hpp:486
KRATOS_CLASS_POINTER_DEFINITION(DamUpliftConditionLoadProcess)
TableType::Pointer mpTable
Definition: dam_uplift_condition_load_process.hpp:501
int mTableId
Definition: dam_uplift_condition_load_process.hpp:502
void ExecuteInitialize() override
This function is designed for being called at the beginning of the computations right after reading t...
Definition: dam_uplift_condition_load_process.hpp:138
void ExecuteInitializeSolutionStep() override
This function will be executed at every time step BEFORE performing the solve phase.
Definition: dam_uplift_condition_load_process.hpp:281
Vector mX0
Definition: dam_uplift_condition_load_process.hpp:497
double mTimeUnitConverter
Definition: dam_uplift_condition_load_process.hpp:500
double mBaseDam
Definition: dam_uplift_condition_load_process.hpp:491
ModelPart & mrModelPart
Member Variables.
Definition: dam_uplift_condition_load_process.hpp:485
double mHeightDrain
Definition: dam_uplift_condition_load_process.hpp:494
double mReferenceCoordinate
Definition: dam_uplift_condition_load_process.hpp:489
Table< double, double > TableType
Definition: dam_uplift_condition_load_process.hpp:36
Vector mX2
Definition: dam_uplift_condition_load_process.hpp:499
DamUpliftConditionLoadProcess(ModelPart &rModelPart, ModelPart &rJointModelPart, Parameters &rParameters)
Constructor.
Definition: dam_uplift_condition_load_process.hpp:48
std::string mVariableName
Definition: dam_uplift_condition_load_process.hpp:487
double mWaterLevel
Definition: dam_uplift_condition_load_process.hpp:492
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: dam_uplift_condition_load_process.hpp:476
IntegrationMethod
Definition: geometry_data.h:76
Geometry base class.
Definition: geometry.h:71
virtual CoordinatesArrayType & GlobalCoordinates(CoordinatesArrayType &rResult, CoordinatesArrayType const &LocalCoordinates) const
Definition: geometry.h:2377
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
Vector & DeterminantOfJacobian(Vector &rResult) const
Definition: geometry.h:3154
const IntegrationPointsArrayType & IntegrationPoints() const
Definition: geometry.h:2284
Definition: amatrix_interface.h:41
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
NodesContainerType & Nodes()
Definition: mesh.h:346
ElementsContainerType & Elements()
Definition: mesh.h:568
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
TableType::Pointer pGetTable(IndexType TableId)
Definition: model_part.h:595
MeshType & GetMesh(IndexType ThisIndex=0)
Definition: model_part.h:1791
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
std::string GetString() const
This method returns the string contained in the current Parameter.
Definition: kratos_parameters.cpp:684
bool GetBool() const
This method returns the boolean contained in the current Parameter.
Definition: kratos_parameters.cpp:675
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
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
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
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
std::ostream & operator<<(std::ostream &rOStream, const DamUpliftConditionLoadProcess &rThis)
output stream function
Definition: dam_uplift_condition_load_process.hpp:517
std::istream & operator>>(std::istream &rIStream, DamUpliftConditionLoadProcess &rThis)
input stream function
def CrossProduct(A, B)
Definition: define_wake_process_3d.py:13
time
Definition: face_heat.py:85
int j
Definition: quadrature.py:648
int nnodes
Definition: sensitivityMatrix.py:24
Structs for mapping model parts ---------------------------------------------------------------------...
Definition: dam_uplift_condition_load_process.hpp:41
double StateVariable
Definition: dam_uplift_condition_load_process.hpp:43
array_1d< double, 3 > Coordinates
Definition: dam_uplift_condition_load_process.hpp:42