NeoPZ
TPZHybridizeHDiv.h
Go to the documentation of this file.
1 //
2 // TPZHybridizeHDiv.hpp
3 // ErrorEstimate
4 //
5 // Created by Philippe Devloo on 16/05/18.
6 //
7 
8 #ifndef TPZHybridizeHDiv_hpp
9 #define TPZHybridizeHDiv_hpp
10 
11 #include <stdio.h>
12 #include <map>
13 
14 template<class T>
15 class TPZVec;
16 
17 class TPZCompMesh;
18 class TPZMaterial;
19 class TPZCompElSide;
22 
24 
25  // boundary condition for flux with zero contribution
26  int fHDivWrapMatid = -10;
27  // material id of the lagrange interface (either pressure or displacement)
29  // material id of the interface elements
30  int fInterfaceMatid = -8;
31  // number of state variables
32  int fNState = 1;
33 
34  TPZHybridizeHDiv() = default;
35 
36  TPZHybridizeHDiv(TPZVec<TPZCompMesh *> &meshvec_Hybrid);
37 
38  void ComputeNState(TPZVec<TPZCompMesh*>& meshvec_Hybrid);
39 
42 
44  void SetPeriferalMaterialIds(int HDivWrapMatid, int LagrangeInterface, int InterfaceMatid)
45  {
46  fHDivWrapMatid = HDivWrapMatid;
47  fLagrangeInterface = LagrangeInterface;
48  fInterfaceMatid = InterfaceMatid;
49 
50  }
51 
53  bool IsPeriferalMaterialId(int matid)
54  {
55  return matid == fHDivWrapMatid || matid == fLagrangeInterface || matid == fInterfaceMatid;
56  }
58  void HybridizeInternalSides(TPZVec<TPZCompMesh *> &meshvec_Hybrid);
59 
61  void CreateInterfaceElements(TPZCompMesh *cmesh_Hybrid, TPZVec<TPZCompMesh *> &meshvec_Hybrid);
62 
66 
68  TPZCompMesh * CreateMultiphysicsMesh(TPZCompMesh *cmesh_HDiv, TPZVec<TPZCompMesh *> &meshvec_Hybrid, double Lagrange_term_multiplier = 1.);
69 
71  TPZCompMesh * CreateMultiphysicsMesh(TPZMultiphysicsCompMesh *cmesh_HDiv, double Lagrange_term_multiplier = 1.);
72 
74  void ReCreateMultiphysicsMesh(TPZMultiphysicsCompMesh *cmesh_HDiv, double Lagrange_term_multiplier = 1.);
75 
77  // elementgroup[el] = index of the element with which the element should be grouped
78  // this method only gives effective result for hybridized hdiv meshes
79  static void AssociateElements(TPZCompMesh *cmesh, TPZVec<int64_t> &elementgroup);
80 
82  static void GroupandCondenseElements(TPZCompMesh *cmesh_Hybrid);
83 
86 
88  void InsertPeriferalMaterialObjects(TPZCompMesh *cmesh_Hybrid, double Lagrange_term_multiplier = 1.);
89 
91  std::tuple<TPZCompMesh *, TPZVec<TPZCompMesh *> > Hybridize(TPZCompMesh *cmesh_Multiphysics, TPZVec<TPZCompMesh *> &meshvec_HDiv, bool group_elements=true, double Lagrange_term_multiplier = 1.);
92 
94  TPZMultiphysicsCompMesh *Hybridize(TPZMultiphysicsCompMesh *multiphysics, bool group_elements=true, double Lagrange_term_multiplier = 1.);
95 
97  void HybridizeGivenMesh(TPZMultiphysicsCompMesh &multiphysics, bool group_elements=true, double Lagrange_term_multiplier = 1.);
98 
100  static void VerifySolutionConsistency(TPZCompMesh *fluxmesh, std::ostream &out);
101 private:
102 
103  std::tuple<int64_t,int> SplitConnects(const TPZCompElSide &left, const TPZCompElSide &right, TPZVec<TPZCompMesh *> &meshvec_Hybrid);
104 
105 public:
106 
107  static TPZCompElSide RightElement(TPZInterpolatedElement *intel, int side);
108 
109 };
110 
111 #endif /* TPZHybridizeHDiv_hpp */
Implements computational element and a side. Computational Element.
Definition: pzcompel.h:632
std::tuple< TPZCompMesh *, TPZVec< TPZCompMesh * > > Hybridize(TPZCompMesh *cmesh_Multiphysics, TPZVec< TPZCompMesh *> &meshvec_HDiv, bool group_elements=true, double Lagrange_term_multiplier=1.)
clones the atomic meshes in meshvec_HDiv and creates a multiphysics hybrid mesh
void CreateInterfaceElements(TPZCompMesh *cmesh_Hybrid, TPZVec< TPZCompMesh *> &meshvec_Hybrid)
Create interface elements with material id InterfaceMatid.
void ComputeNState(TPZVec< TPZCompMesh *> &meshvec_Hybrid)
TPZHybridizeHDiv()=default
TPZCompMesh * CreateMultiphysicsMesh(TPZCompMesh *cmesh_HDiv, TPZVec< TPZCompMesh *> &meshvec_Hybrid, double Lagrange_term_multiplier=1.)
create a multiphysics mesh for the hybrid formulation using the materials of another mesh and the giv...
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
bool IsPeriferalMaterialId(int matid)
return true if a material id is a peripheral material
void ComputePeriferalMaterialIds(TPZVec< TPZCompMesh *> &meshvec_Hybrid)
compute material ids for the periferal material objects
void HybridizeGivenMesh(TPZMultiphysicsCompMesh &multiphysics, bool group_elements=true, double Lagrange_term_multiplier=1.)
make a hybrid mesh from a H(div) multiphysics mesh
static void GroupandCondenseElements(TPZCompMesh *cmesh_Hybrid)
group and condense the elements
void SetPeriferalMaterialIds(int HDivWrapMatid, int LagrangeInterface, int InterfaceMatid)
set the periferal material ids
void HybridizeInternalSides(TPZVec< TPZCompMesh *> &meshvec_Hybrid)
split the connects between flux elements and create a dim-1 pressure element
void InsertPeriferalMaterialObjects(TPZVec< TPZCompMesh *> &meshvec_Hybrid)
insert the material objects for HDivWrap and LagrangeInterface in the atomic meshes ...
static void AssociateElements(TPZCompMesh *cmesh, TPZVec< int64_t > &elementgroup)
Associate elements with a volumetric element.
std::tuple< int64_t, int > SplitConnects(const TPZCompElSide &left, const TPZCompElSide &right, TPZVec< TPZCompMesh *> &meshvec_Hybrid)
split the connect between two neighbouring elements
static void VerifySolutionConsistency(TPZCompMesh *fluxmesh, std::ostream &out)
verify the consistency of the solution of the flux mesh
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
void ReCreateMultiphysicsMesh(TPZMultiphysicsCompMesh *cmesh_HDiv, double Lagrange_term_multiplier=1.)
create a multiphysics hybridized mesh based on and input mesh
Implements computational element based on an interpolation space. Computational Element.
Definition: pzintel.h:27
static TPZCompElSide RightElement(TPZInterpolatedElement *intel, int side)
find an element which shares the connect and has the same dimension