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.
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Kratos::TrilinosCuttingApplication Class Reference

TRILINOS CUTTING APPLICATION. More...

#include <trilinos_cutting_app.h>

Collaboration diagram for Kratos::TrilinosCuttingApplication:

Public Types

typedef ModelPart::NodesContainerType NodesArrayType
 
typedef ModelPart::ElementsContainerType ElementsArrayType
 
typedef ModelPart::ConditionsContainerType ConditionsArrayType
 
typedef vector< MatrixMatrix_Order_Tensor
 
typedef vector< VectorVector_Order_Tensor
 
typedef vector< Vector_Order_TensorNode_Vector_Order_Tensor
 
typedef Node PointType
 
typedef Node ::Pointer PointPointerType
 
typedef std::vector< PointType::Pointer > PointVector
 
typedef PointVector::iterator PointIterator
 

Public Member Functions

 TrilinosCuttingApplication (Epetra_MpiComm &Comm)
 
 ~TrilinosCuttingApplication ()
 
void FindSmallestEdge (ModelPart &mr_model_part)
 This function Creates cutting planes by creating nodes and conditions (to define the conectivities) in a different model part. More...
 
void AddSkinConditions (ModelPart &mr_model_part, ModelPart &mr_new_model_part, int plane_number)
 ADDSKINCONDITIONS: THIS FUNCTION ADDS TO THE NEW MODEL PART THE DATA OF THE CONDITIONS BELONGING TO THE OLD MODEL PART, THE NODES COORDINATES ALREADY EXIST. WE ONLY NEED TO COPY THEM INTO THE NEW MODEL PART. More...
 
void AddVariablesToCutModelPart (const ModelPart &rModelPart, ModelPart &rNewModelPart) const
 Initialize the solution step data container for the cut model part. More...
 
void GenerateCut (ModelPart &mr_model_part, ModelPart &mr_new_model_part, const array_1d< double, 3 > &versor, const array_1d< double, 3 > &Xp, int plane_number, double tolerance_factor)
 This function Creates cutting planes by creating nodes and conditions (to define the conectivities) in a different model part. (new_model_part) More...
 
void Clear ()
 
void CSR_Row_Matrix (ModelPart &this_model_part, Kratos::shared_ptr< Epetra_FECrsMatrix > &p_edge_ids, Kratos::shared_ptr< Epetra_FECrsMatrix > &used_nodes_matrix)
 
void FirstLoop (ModelPart &this_model_part, Kratos::shared_ptr< Epetra_FECrsMatrix > &p_edge_ids, Kratos::shared_ptr< Epetra_FECrsMatrix > &p_partition_ids, array_1d< double, 3 > versor, array_1d< double, 3 > Xp, int &number_of_triangles, vector< int > &Elems_In_Plane, double tolerance, Kratos::shared_ptr< Epetra_FECrsMatrix > &used_nodes_matrix)
 
void Create_List_Of_New_Nodes (ModelPart &this_model_part, ModelPart &new_model_part, Kratos::shared_ptr< Epetra_FECrsMatrix > &p_edge_ids, Kratos::shared_ptr< Epetra_FECrsMatrix > &p_partition_ids, vector< int > &List_New_Nodes, vector< int > &partition_new_nodes, vector< array_1d< int, 2 > > &father_node_ids, Kratos::shared_ptr< Epetra_FECrsMatrix > &used_nodes_matrix)
 
void Calculate_Coordinate_And_Insert_New_Nodes (ModelPart &this_model_part, ModelPart &new_model_part, const vector< array_1d< int, 2 > > &father_node_ids, const vector< int > &List_New_Nodes, const vector< int > &partition_new_nodes, array_1d< double, 3 > versor, array_1d< double, 3 > Xp, double tolerance)
 
void GenerateElements (ModelPart &this_model_part, ModelPart &new_model_part, vector< int > Elems_In_Plane, const Kratos::shared_ptr< Epetra_FECrsMatrix > p_edge_ids, array_1d< double, 3 > versor, int plane_number, int &number_of_triangles)
 
void UpdateCutData (ModelPart &new_model_part, ModelPart &old_model_part)
 

Protected Member Functions

double GetValueFromRow (int row, int j, int row_size, int *indices, double *values)
 
double GetUpperTriangularMatrixValue (const Kratos::shared_ptr< Epetra_FECrsMatrix > &p_edge_ids, int index_0, int index_1, int &MaxNumEntries, int &NumEntries, int *Indices, double *values)
 

Protected Attributes

double smallest_edge
 
bool mMPICommSetup_is_defined
 
Epetra_MpiComm & mrComm
 
Kratos::shared_ptr< Epetra_Map > mp_overlapping_map
 
Kratos::shared_ptr< Epetra_Map > mp_non_overlapping_map
 
int mtotal_number_of_existing_nodes
 
Kratos::shared_ptr< Epetra_FECrsGraph > mp_non_overlapping_graph
 
Kratos::shared_ptr< Epetra_CrsGraph > mp_overlapping_graph
 

Detailed Description

TRILINOS CUTTING APPLICATION.

The cutting app is used to create cutting planes in a 3D domain. Despite this can be done in the postprocessing (using Kratos), on large domains the output data would be really large and include info that is not useful for the user. This app creates nodes and conditions (in a new, empty model part) intersecting the domain with as many planes as the user want. It is also possible to use different layers If conditions are triangles, they can be added too to the new model part. After each time step UpdateCutData must be called to save the new info into the new model part, interpolating from the tetraeda elements NOTE: it only work with tetraedra elements, generating triangles (1 or 2) from the tetraedra - plane intersection. Info describing how to use it can be found in the wiki.

Member Typedef Documentation

◆ ConditionsArrayType

◆ ElementsArrayType

◆ Matrix_Order_Tensor

◆ Node_Vector_Order_Tensor

◆ NodesArrayType

◆ PointIterator

◆ PointPointerType

◆ PointType

◆ PointVector

typedef std::vector<PointType::Pointer> Kratos::TrilinosCuttingApplication::PointVector

◆ Vector_Order_Tensor

Constructor & Destructor Documentation

◆ TrilinosCuttingApplication()

Kratos::TrilinosCuttingApplication::TrilinosCuttingApplication ( Epetra_MpiComm &  Comm)
inline

constructor:

Parameters
ModelPart&the model part to be refined
Epetra_MpiCommthe Epetra Communicator to be used

◆ ~TrilinosCuttingApplication()

Kratos::TrilinosCuttingApplication::~TrilinosCuttingApplication ( )
inline

Member Function Documentation

◆ AddSkinConditions()

void Kratos::TrilinosCuttingApplication::AddSkinConditions ( ModelPart mr_model_part,
ModelPart mr_new_model_part,
int  plane_number 
)
inline

ADDSKINCONDITIONS: THIS FUNCTION ADDS TO THE NEW MODEL PART THE DATA OF THE CONDITIONS BELONGING TO THE OLD MODEL PART, THE NODES COORDINATES ALREADY EXIST. WE ONLY NEED TO COPY THEM INTO THE NEW MODEL PART.

this function adds the skin condtion. WARNING: They have to be triangles and it CAN'T be empty, otherwise a segmentation fault will appear

Parameters
mr_model_part. original model part
mr__new_model_part. destinantion model part
plane_number. layer to add the conditions (integer)

KRATOS_WATCH('line349')

◆ AddVariablesToCutModelPart()

void Kratos::TrilinosCuttingApplication::AddVariablesToCutModelPart ( const ModelPart rModelPart,
ModelPart rNewModelPart 
) const
inline

Initialize the solution step data container for the cut model part.

Please call this function before either GenerateCut or AddSkinCondition.

Parameters
rModelPartthe reference (problem) model part.
rNewModelPartthe new model part, where cut data will be stored.

◆ Calculate_Coordinate_And_Insert_New_Nodes()

void Kratos::TrilinosCuttingApplication::Calculate_Coordinate_And_Insert_New_Nodes ( ModelPart this_model_part,
ModelPart new_model_part,
const vector< array_1d< int, 2 > > &  father_node_ids,
const vector< int > &  List_New_Nodes,
const vector< int > &  partition_new_nodes,
array_1d< double, 3 >  versor,
array_1d< double, 3 >  Xp,
double  tolerance 
)
inline

calculating the coordinate of the new nodes

◆ Clear()

void Kratos::TrilinosCuttingApplication::Clear ( )
inline

◆ Create_List_Of_New_Nodes()

void Kratos::TrilinosCuttingApplication::Create_List_Of_New_Nodes ( ModelPart this_model_part,
ModelPart new_model_part,
Kratos::shared_ptr< Epetra_FECrsMatrix > &  p_edge_ids,
Kratos::shared_ptr< Epetra_FECrsMatrix > &  p_partition_ids,
vector< int > &  List_New_Nodes,
vector< int > &  partition_new_nodes,
vector< array_1d< int, 2 > > &  father_node_ids,
Kratos::shared_ptr< Epetra_FECrsMatrix > &  used_nodes_matrix 
)
inline
  • New Id of the nodes

◆ CSR_Row_Matrix()

void Kratos::TrilinosCuttingApplication::CSR_Row_Matrix ( ModelPart this_model_part,
Kratos::shared_ptr< Epetra_FECrsMatrix > &  p_edge_ids,
Kratos::shared_ptr< Epetra_FECrsMatrix > &  used_nodes_matrix 
)
inline

◆ FindSmallestEdge()

void Kratos::TrilinosCuttingApplication::FindSmallestEdge ( ModelPart mr_model_part)
inline

This function Creates cutting planes by creating nodes and conditions (to define the conectivities) in a different model part.

It is used to find the smallest edge that will be used later as a reference to identify whether a node is part of the plane or is simple close (and therefore a new point will be created by interpolation)

Parameters
mr_model_part. model part to find the smallest edge

◆ FirstLoop()

void Kratos::TrilinosCuttingApplication::FirstLoop ( ModelPart this_model_part,
Kratos::shared_ptr< Epetra_FECrsMatrix > &  p_edge_ids,
Kratos::shared_ptr< Epetra_FECrsMatrix > &  p_partition_ids,
array_1d< double, 3 >  versor,
array_1d< double, 3 >  Xp,
int number_of_triangles,
vector< int > &  Elems_In_Plane,
double  tolerance,
Kratos::shared_ptr< Epetra_FECrsMatrix > &  used_nodes_matrix 
)
inline

◆ GenerateCut()

void Kratos::TrilinosCuttingApplication::GenerateCut ( ModelPart mr_model_part,
ModelPart mr_new_model_part,
const array_1d< double, 3 > &  versor,
const array_1d< double, 3 > &  Xp,
int  plane_number,
double  tolerance_factor 
)
inline

This function Creates cutting planes by creating nodes and conditions (to define the conectivities) in a different model part. (new_model_part)

each time it is called a new cutting plane is created and therefore new nodes and conditions are added to the new model part WARNING: the cutting plane MUST cut the domain in at least one triangle, otherwise a segmentiation fault might appear

Parameters
mr_model_part. original model part
mr__new_model_part. destinantion model part
versor.unit vector perpendicular to the plane
Xp.a point that is part of the plane
plane_number. layer to add the conditions (integer)
tolerancefactor . if find_smallest edge has been called, then it is the tolerance relative to that edge, in this case it should be 0.5>factor>0. high values will generate less triangles but the result will not be a perfect plane. on the other hand small values will generate a perfect plane but with lots of ugly triangles. If findsmallestedge has noot been run, it absolute tolerance.
  • the news nodes
  • the news nodes
  • edges where are the news nodes
  • the coordinate of the new nodes

◆ GenerateElements()

void Kratos::TrilinosCuttingApplication::GenerateElements ( ModelPart this_model_part,
ModelPart new_model_part,
vector< int Elems_In_Plane,
const Kratos::shared_ptr< Epetra_FECrsMatrix >  p_edge_ids,
array_1d< double, 3 >  versor,
int  plane_number,
int number_of_triangles 
)
inline


as the name says...

we enter the element loop

we enter in the if for only one triangle in the tetraedra

entering now the if for 2 triangles inside the tetraedra.

◆ GetUpperTriangularMatrixValue()

double Kratos::TrilinosCuttingApplication::GetUpperTriangularMatrixValue ( const Kratos::shared_ptr< Epetra_FECrsMatrix > &  p_edge_ids,
int  index_0,
int  index_1,
int MaxNumEntries,
int NumEntries,
int Indices,
double values 
)
inlineprotected

◆ GetValueFromRow()

double Kratos::TrilinosCuttingApplication::GetValueFromRow ( int  row,
int  j,
int  row_size,
int indices,
double values 
)
inlineprotected

this function transfers the Constitutive Law internal variables from the father to the child. note that this is done through the vector Variable INTERNAL_VARIABLES which should also contain the geometric data needed for this.

◆ UpdateCutData()

void Kratos::TrilinosCuttingApplication::UpdateCutData ( ModelPart new_model_part,
ModelPart old_model_part 
)
inline


Member Data Documentation

◆ mMPICommSetup_is_defined

bool Kratos::TrilinosCuttingApplication::mMPICommSetup_is_defined
protected

◆ mp_non_overlapping_graph

Kratos::shared_ptr<Epetra_FECrsGraph> Kratos::TrilinosCuttingApplication::mp_non_overlapping_graph
protected

◆ mp_non_overlapping_map

Kratos::shared_ptr<Epetra_Map> Kratos::TrilinosCuttingApplication::mp_non_overlapping_map
protected

◆ mp_overlapping_graph

Kratos::shared_ptr<Epetra_CrsGraph> Kratos::TrilinosCuttingApplication::mp_overlapping_graph
protected

◆ mp_overlapping_map

Kratos::shared_ptr<Epetra_Map> Kratos::TrilinosCuttingApplication::mp_overlapping_map
protected

◆ mrComm

Epetra_MpiComm& Kratos::TrilinosCuttingApplication::mrComm
protected

◆ mtotal_number_of_existing_nodes

int Kratos::TrilinosCuttingApplication::mtotal_number_of_existing_nodes
protected

◆ smallest_edge

double Kratos::TrilinosCuttingApplication::smallest_edge
protected

The documentation for this class was generated from the following file: