Commit a1c8e14f by Axel Modave

add TETRAHEDRON_2

parent eb90b15b
Pipeline #1142 passed with stage
in 57 seconds
......@@ -116,6 +116,7 @@ struct StringXDefine Element_Type[] = {
{"Triangle" , TRIANGLE},
{"Quadrangle" , QUADRANGLE},
{"Tetrahedron" , TETRAHEDRON},
{"Tetrahedron2" , TETRAHEDRON_2},
{"Hexahedron" , HEXAHEDRON},
{"Prism" , PRISM},
{"Pyramid" , PYRAMID},
......@@ -396,6 +397,7 @@ struct DefineXFunction FunctionForGauss[] = {
{TRIANGLE , (CAST)Gauss_Triangle},
{QUADRANGLE , (CAST)Gauss_Quadrangle},
{TETRAHEDRON , (CAST)Gauss_Tetrahedron},
{TETRAHEDRON_2 , (CAST)Gauss_Tetrahedron},
{HEXAHEDRON , (CAST)Gauss_Hexahedron},
{PRISM , (CAST)Gauss_Prism},
{PYRAMID , (CAST)Gauss_Pyramid},
......
......@@ -158,6 +158,23 @@ void BF_Node(struct Element * Element, int NumNode,
}
break ;
case TETRAHEDRON_2 :
r = 1.-u-v-w ;
switch(NumNode) {
case 1 : *s = r*(2.*r-1.) ; break ;
case 2 : *s = u*(2.*u-1.) ; break ;
case 3 : *s = v*(2.*v-1.) ; break ;
case 4 : *s = w*(2.*w-1.) ; break ;
case 5 : *s = 4.*r*u ; break ;
case 6 : *s = 4.*r*v ; break ;
case 7 : *s = 4.*r*w ; break ;
case 8 : *s = 4.*u*v ; break ;
case 9 : *s = 4.*u*w ; break ;
case 10 : *s = 4.*v*w ; break ;
default : WrongNumNode ;
}
break ;
default :
Message::Error("Unknown type of Element in BF_Node");
break;
......@@ -372,6 +389,23 @@ void BF_GradNode(struct Element * Element, int NumNode,
}
break ;
case TETRAHEDRON_2 :
r = 1.-u-v-w ;
switch(NumNode) {
case 1 : s[0] = -(4.*r-1) ; s[1] = -(4.*r-1) ; s[2] = -(4.*r-1) ; break ;
case 2 : s[0] = (4.*u-1) ; s[1] = 0 ; s[2] = 0 ; break ;
case 3 : s[0] = 0 ; s[1] = (4.*v-1) ; s[2] = 0 ; break ;
case 4 : s[0] = 0 ; s[1] = 0 ; s[2] = (4.*w-1) ; break ;
case 5 : s[0] = 4.*(r-u) ; s[1] = -4.*u ; s[2] = -4.*u ; break ;
case 6 : s[0] = -4.*v ; s[1] = 4.*(r-v) ; s[2] = -4.*v ; break ;
case 7 : s[0] = -4.*w ; s[1] = -4.*w ; s[2] = 4.*(r-w) ; break ;
case 8 : s[0] = 4.*v ; s[1] = 4.*u ; s[2] = 0 ; break ;
case 9 : s[0] = 4.*w ; s[1] = 0 ; s[2] = 4.*u ; break ;
case 10 : s[0] = 0 ; s[1] = 4.*w ; s[2] = 4.*v ; break ;
default : WrongNumNode ;
}
break ;
default :
Message::Error("Unknown type of Element in BF_GradNode");
break;
......
......@@ -342,7 +342,7 @@ void F_GetVolume(F_ARG)
Element.Num = Element.GeoElement->Num ;
Element.Type = Element.GeoElement->Type ;
if (Element.Type == TETRAHEDRON ||
if (Element.Type == TETRAHEDRON || Element.Type == TETRAHEDRON_2 ||
Element.Type == HEXAHEDRON ||
Element.Type == PRISM) {
......@@ -370,6 +370,7 @@ void F_GetVolume(F_ARG)
switch(Element.Type){
case TETRAHEDRON:
case TETRAHEDRON_2:
Val_Volume += 1./6. * fabs(DetJac);
break;
case HEXAHEDRON:
......
......@@ -33,6 +33,7 @@ double * Geo_GetNodes_uvw(int Type, int *nbn)
case TRIANGLE_2 : *nbn = NbrNodes_Triangle_2 ; return(*Nodes_Triangle_2) ;
case QUADRANGLE_2: *nbn = NbrNodes_Quadrangle_2 ;return(*Nodes_Quadrangle_2) ;
case QUADRANGLE_2_8N: *nbn = NbrNodes_Quadrangle_2_8N ;return(*Nodes_Quadrangle_2_8N);
case TETRAHEDRON_2: *nbn = NbrNodes_Tetrahedron_2; return(*Nodes_Tetrahedron_2) ;
default :
Message::Error("Unknown type of Element in Geo_GetNodes_uvw") ; return(NULL) ;
}
......@@ -116,6 +117,7 @@ int *Geo_GetIM_Den(int Type_Element, int * Nbe)
case TRIANGLE_2 : *Nbe = NbrEdges_Triangle_2 ; return(*Den_Triangle_2) ;
case QUADRANGLE_2 :*Nbe = NbrEdges_Quadrangle_2; return(*Den_Quadrangle_2) ;
case QUADRANGLE_2_8N :*Nbe = NbrEdges_Quadrangle_2_8N; return(*Den_Quadrangle_2_8N) ;
case TETRAHEDRON_2 : *Nbe = NbrEdges_Tetrahedron_2; return(*Den_Tetrahedron_2) ;
default :
Message::Error("Unknown incidence matrix for element type %d", Type_Element);
return(NULL) ;
......@@ -141,6 +143,7 @@ int *Geo_GetIM_Dfe(int Type_Element, int * Nbf)
case TRIANGLE_2 : *Nbf = NbrFacets_Triangle_2 ; return(*Dfe_Triangle_2) ;
case QUADRANGLE_2 :*Nbf = NbrFacets_Quadrangle_2; return(*Dfe_Quadrangle_2) ;
case QUADRANGLE_2_8N :*Nbf = NbrFacets_Quadrangle_2_8N; return(*Dfe_Quadrangle_2_8N) ;
case TETRAHEDRON_2 : *Nbf = NbrFacets_Tetrahedron_2; return(*Dfe_Tetrahedron_2);
default :
Message::Error("Unknown incidence matrix for element type %d", Type_Element);
return(NULL) ;
......@@ -166,6 +169,7 @@ int *Geo_GetIM_Dfn(int Type_Element, int * Nbf)
case TRIANGLE_2 : *Nbf = NbrFacets_Triangle_2 ; return(*Dfn_Triangle_2) ;
case QUADRANGLE_2:*Nbf = NbrFacets_Quadrangle_2; return(*Dfn_Quadrangle_2) ;
case QUADRANGLE_2_8N:*Nbf = NbrFacets_Quadrangle_2_8N; return(*Dfn_Quadrangle_2_8N) ;
case TETRAHEDRON_2: *Nbf = NbrFacets_Tetrahedron_2; return(*Dfn_Tetrahedron_2);
default :
Message::Error("Unknown incidence matrix for element type %d", Type_Element);
return(NULL) ;
......@@ -215,6 +219,9 @@ int * Geo_GetIM_Den_Xp(int Type_Element, int * Nbe, int * Nbn)
case QUADRANGLE_2_8N :
*Nbe = NbrEdges_Quadrangle_2_8N ; *Nbn = NbrNodes_Quadrangle_2_8N ;
return(Den_Quadrangle_2_8N_Xp) ;
case TETRAHEDRON_2 :
*Nbe = NbrEdges_Tetrahedron_2 ; *Nbn = NbrNodes_Tetrahedron_2 ;
return(Den_Tetrahedron_2_Xp) ;
default :
Message::Error("Unknown incidence matrix for element type %d", Type_Element);
return(NULL) ;
......@@ -264,6 +271,9 @@ int * Geo_GetIM_Dfe_Xp(int Type_Element, int * nbf, int * nbe)
case QUADRANGLE_2_8N :
*nbf = NbrFacets_Quadrangle_2_8N ; *nbe = NbrEdges_Quadrangle_2_8N ;
return(Dfe_Quadrangle_2_8N_Xp) ;
case TETRAHEDRON_2 :
*nbf = NbrFacets_Tetrahedron_2 ; *nbe = NbrEdges_Tetrahedron_2 ;
return(Dfe_Tetrahedron_2_Xp) ;
default :
Message::Error("Unknown incidence matrix for element type %d", Type_Element);
return(NULL) ;
......
......@@ -331,6 +331,57 @@ static int Dfn_Tetrahedron [] [NBR_MAX_SUBENTITIES_IN_ELEMENT]
{ 1, 4, 3, 0}, { 2, 3, 4, 0} } ;
/* ------------------------------------------------------------------------
TETRAHEDRON_2 edge 1: nodes 1 -> 2
v 2: 1 -> 3
| 3: 1 -> 4
| 4: 2 -> 3
| 5: 2 -> 4
3 6: 3 -> 4
|\
| \ facet 1: edges 1 -3 5 nodes 1 2 4
|__\2_____u 2: -1 2 -4 1 3 2
1\ / 3: -2 3 -6 1 4 3
\4 4: 4 -5 6 2 3 4
\
w
------------------------------------------------------------------------ */
static int NbrNodes_Tetrahedron_2 = 10 ;
static int NbrEdges_Tetrahedron_2 = 6 ;
static int NbrFacets_Tetrahedron_2 = 4 ;
static double Nodes_Tetrahedron_2 [][3]
= { {0., 0., 0.}, {1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.},
{0.5, 0., 0.}, {0., 0.5, 0.}, {0., 0., 0.5},
{0.5, 0.5, 0.}, {0.5, 0., 0.5}, {0., 0.5, 0.5} } ;
static int Den_Tetrahedron_2 [] [NBR_MAX_SUBENTITIES_IN_ELEMENT]
= { { 1, -2, 0}, { 1, -3, 0}, { 1, -4, 0},
{ 2, -3, 0}, { 2, -4, 0}, { 3, -4, 0} } ;
static int Den_Tetrahedron_2_Xp []
= { -1, 1, 0, 0,
-1, 0, 1, 0,
-1, 0, 0, 1,
0,-1, 1, 0,
0,-1, 0, 1,
0, 0,-1, 1 } ;
static int Dfe_Tetrahedron_2 [] [NBR_MAX_SUBENTITIES_IN_ELEMENT]
= { { 1, -3, 5, 0}, { -1, 2, -4, 0},
{ -2, 3, -6, 0}, { 4, -5, 6, 0} } ;
static int Dfe_Tetrahedron_2_Xp []
= { 1, 0,-1, 0, 1, 0,
-1, 1, 0,-1, 0, 0,
0,-1, 1, 0, 0,-1,
0, 0, 0, 1,-1, 1 } ;
static int Dfn_Tetrahedron_2 [] [NBR_MAX_SUBENTITIES_IN_ELEMENT]
= { { 1, 2, 4, 0}, { 1, 3, 2, 0},
{ 1, 4, 3, 0}, { 2, 3, 4, 0} } ;
/* ------------------------------------------------------------------------
HEXAHEDRON edge 1: nodes 1 -> 2
v 2: 1 -> 4
| 3: 1 -> 5
......
......@@ -233,6 +233,7 @@ void Cut_PostElement(struct PostElement * PE, struct Geo_Element * GE,
break;
case TETRAHEDRON :
case TETRAHEDRON_2 :
u01 = .5 * (PE->u[0] + PE->u[1]); u02 = .5 * (PE->u[0] + PE->u[2]);
v01 = .5 * (PE->v[0] + PE->v[1]); v02 = .5 * (PE->v[0] + PE->v[2]);
w01 = .5 * (PE->w[0] + PE->w[1]); w02 = .5 * (PE->w[0] + PE->w[2]);
......@@ -369,7 +370,8 @@ void Fill_PostElement(struct Geo_Element * GE, List_T * PE_L,
case QUADRANGLE :
case QUADRANGLE_2:
case QUADRANGLE_2_8N: PE->u[0] = 0. ; PE->v[0] = 0. ; PE->w[0] = 0. ; break ;
case TETRAHEDRON : PE->u[0] = 0.25 ; PE->v[0] = 0.25 ; PE->w[0] = 0.25 ; break ;
case TETRAHEDRON :
case TETRAHEDRON_2 : PE->u[0] = 0.25 ; PE->v[0] = 0.25 ; PE->w[0] = 0.25 ; break ;
case HEXAHEDRON : PE->u[0] = 0. ; PE->v[0] = 0. ; PE->w[0] = 0. ; break ;
case PRISM : PE->u[0] = 1./3.; PE->v[0] = 1./3.; PE->w[0] = 0. ; break ;
case PYRAMID : PE->u[0] = 0. ; PE->v[0] = 0. ; PE->w[0] = 1./3.; break ;
......@@ -460,6 +462,7 @@ void Fill_PostElement(struct Geo_Element * GE, List_T * PE_L,
break ;
case TETRAHEDRON :
case TETRAHEDRON_2 :
PE = Create_PostElement(Index, TETRAHEDRON, 4, 1) ; /* nodes 1 2 3 4 */
PE->NumNodes[0] = GE->NumNodes[0] ;
PE->NumNodes[1] = GE->NumNodes[1] ;
......
......@@ -246,6 +246,7 @@ static void GmshParsed_PrintElement(double Time, int TimeStep, int NbTimeStep, i
case TRIANGLE_2 : fprintf(PostStream, "ST("); break;
case QUADRANGLE_2: fprintf(PostStream, "SQ("); break;
case QUADRANGLE_2_8N: fprintf(PostStream, "SQ("); break;
case TETRAHEDRON_2 : fprintf(PostStream, "SS("); break;
}
for(i = 0 ; i < NbrNodes ; i++){
if(i) fprintf(PostStream, ",");
......@@ -295,6 +296,7 @@ static void GmshParsed_PrintElement(double Time, int TimeStep, int NbTimeStep, i
case TRIANGLE_2 : fprintf(PostStream, "VT("); break;
case QUADRANGLE_2: fprintf(PostStream, "VQ("); break;
case QUADRANGLE_2_8N: fprintf(PostStream, "VQ("); break;
case TETRAHEDRON_2 : fprintf(PostStream, "VS("); break;
}
for(i = 0 ; i < NbrNodes ; i++){
if(i) fprintf(PostStream, ",");
......@@ -352,6 +354,7 @@ static void GmshParsed_PrintElement(double Time, int TimeStep, int NbTimeStep, i
case TRIANGLE_2 : fprintf(PostStream, "TT("); break;
case QUADRANGLE_2: fprintf(PostStream, "TQ("); break;
case QUADRANGLE_2_8N: fprintf(PostStream, "TQ("); break;
case TETRAHEDRON_2 : fprintf(PostStream, "TS("); break;
}
for(i = 0 ; i < NbrNodes ; i++){
if(i) fprintf(PostStream, ",");
......@@ -449,6 +452,7 @@ static void Gmsh_PrintElement(double Time, int TimeStep, int NbTimeStep, int NbH
case TRIANGLE_2 : Current_L = &ST ; NbST++ ; break ;
case QUADRANGLE_2: Current_L = &SQ ; NbSQ++ ; break ;
case QUADRANGLE_2_8N: Current_L = &SQ ; NbSQ++ ; break ;
case TETRAHEDRON_2 : Current_L = &SS ; NbSS++ ; break ;
}
if(Flag_GMSH_VERSION != 2){
for(i = 0 ; i < NbrNodes ; i++) Current_L->push_back(x[i]);
......@@ -492,6 +496,7 @@ static void Gmsh_PrintElement(double Time, int TimeStep, int NbTimeStep, int NbH
case TRIANGLE_2 : Current_L = &VT ; NbVT++ ; break ;
case QUADRANGLE_2: Current_L = &VQ ; NbVQ++ ; break ;
case QUADRANGLE_2_8N: Current_L = &VQ ; NbVQ++ ; break ;
case TETRAHEDRON_2 : Current_L = &VS ; NbVS++ ; break ;
}
if(Flag_GMSH_VERSION != 2){
for(i = 0 ; i < NbrNodes ; i++) Current_L->push_back(x[i]);
......@@ -539,6 +544,7 @@ static void Gmsh_PrintElement(double Time, int TimeStep, int NbTimeStep, int NbH
case TRIANGLE_2 : Current_L = &TT ; NbTT++ ; break ;
case QUADRANGLE_2: Current_L = &TQ ; NbTQ++ ; break ;
case QUADRANGLE_2_8N: Current_L = &TQ ; NbTQ++ ; break ;
case TETRAHEDRON_2 : Current_L = &TS1 ; NbTS++ ; break ;
}
if(Flag_GMSH_VERSION != 2){
for(i = 0 ; i < NbrNodes ; i++) Current_L->push_back(x[i]);
......
......@@ -120,6 +120,7 @@ void Cal_Iso(struct PostElement *PE, List_T *list,
}
break ;
case TETRAHEDRON :
case TETRAHEDRON_2 :
Cal_IsoTetrahedron(PE->x, PE->y, PE->z, PE->Value,
val, vmin, vmax, x, y, z, &nb) ;
......
......@@ -446,7 +446,7 @@ void xyz2uvwInAnElement (struct Element *Element,
*u = *v = *w = 0.0;
if(Element->Type & (TETRAHEDRON|HEXAHEDRON|PRISM|PYRAMID))
if(Element->Type & (TETRAHEDRON|TETRAHEDRON_2|HEXAHEDRON|PRISM|PYRAMID))
ChainDim = _3D;
else if(Element->Type & (TRIANGLE|QUADRANGLE|TRIANGLE_2|QUADRANGLE_2))
ChainDim = _2D;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment