Skip to content

Commit

Permalink
Updates in Reference Tetrahedron (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
vickysharma0812 authored Mar 9, 2024
2 parents 9730d57 + dd5a0db commit 94b8036
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 70 deletions.
20 changes: 18 additions & 2 deletions src/modules/Geometry/src/ReferenceTetrahedron_Method.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ MODULE ReferenceTetrahedron_Method
PUBLIC :: Quality_Tetrahedron
PUBLIC :: GetEdgeConnectivity_Tetrahedron
PUBLIC :: GetFaceConnectivity_Tetrahedron
PUBLIC :: RefCoord_Tetrahedron

!----------------------------------------------------------------------------
! Initiate@Tetrahedron
Expand Down Expand Up @@ -140,7 +141,7 @@ END SUBROUTINE TetrahedronVolume3D
! summary: Returns number of edges in the element

INTERFACE
MODULE SUBROUTINE GetEdgeConnectivity_Tetrahedron(con, opt)
MODULE PURE SUBROUTINE GetEdgeConnectivity_Tetrahedron(con, opt)
INTEGER(I4B), INTENT(INOUT) :: con(:, :)
!! Connectivity
!! The columns represents the edge number
Expand All @@ -162,7 +163,7 @@ END SUBROUTINE GetEdgeConnectivity_Tetrahedron
! summary: Returns number of edges in the element

INTERFACE
MODULE SUBROUTINE GetFaceConnectivity_Tetrahedron(con, opt)
MODULE PURE SUBROUTINE GetFaceConnectivity_Tetrahedron(con, opt)
INTEGER(I4B), INTENT(INOUT) :: con(:, :)
!! Connectivity
!! The columns represents the face number
Expand All @@ -175,4 +176,19 @@ MODULE SUBROUTINE GetFaceConnectivity_Tetrahedron(con, opt)
END SUBROUTINE GetFaceConnectivity_Tetrahedron
END INTERFACE

!----------------------------------------------------------------------------
! RefCoord_Tetrahedron
!----------------------------------------------------------------------------

!> author: Vikas Sharma, Ph. D.
! date: 2023-07-03
! summary: Returns the coordinate of reference Tetrahedron

INTERFACE
MODULE PURE FUNCTION RefCoord_Tetrahedron(refTetrahedron) RESULT(ans)
CHARACTER(*), INTENT(IN) :: refTetrahedron
REAL(DFP) :: ans(3, 4)
END FUNCTION RefCoord_Tetrahedron
END INTERFACE

END MODULE ReferenceTetrahedron_Method
52 changes: 17 additions & 35 deletions src/modules/Polynomial/src/TetrahedronInterpolationUtility.F90
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ MODULE TetrahedronInterpolationUtility
PUBLIC :: FacetBasis_Tetrahedron
PUBLIC :: CellBasis_Tetrahedron
PUBLIC :: HeirarchicalBasis_Tetrahedron
PUBLIC :: RefCoord_Tetrahedron
PUBLIC :: FacetConnectivity_Tetrahedron
PUBLIC :: EdgeConnectivity_Tetrahedron
PUBLIC :: GetVertexDOF_Tetrahedron
Expand Down Expand Up @@ -220,21 +219,6 @@ MODULE PURE FUNCTION EdgeConnectivity_Tetrahedron( &
END FUNCTION EdgeConnectivity_Tetrahedron
END INTERFACE

!----------------------------------------------------------------------------
! RefCoord_Tetrahedron
!----------------------------------------------------------------------------

!> author: Vikas Sharma, Ph. D.
! date: 2023-07-03
! summary: Returns the coordinate of reference Tetrahedron

INTERFACE
MODULE PURE FUNCTION RefCoord_Tetrahedron(refTetrahedron) RESULT(ans)
CHARACTER(*), INTENT(IN) :: refTetrahedron
REAL(DFP) :: ans(3, 4)
END FUNCTION RefCoord_Tetrahedron
END INTERFACE

!----------------------------------------------------------------------------
! LagrangeDegree_Tetrahedron
!----------------------------------------------------------------------------
Expand Down Expand Up @@ -728,7 +712,6 @@ MODULE PURE FUNCTION BarycentricVertexBasis_Tetrahedron(lambda) &
END FUNCTION BarycentricVertexBasis_Tetrahedron
END INTERFACE


!----------------------------------------------------------------------------
! BarycentricVertexBasis_Tetrahedron
!----------------------------------------------------------------------------
Expand All @@ -748,7 +731,7 @@ MODULE PURE FUNCTION BarycentricVertexBasisGradient_Tetrahedron(lambda) &
!! - ans(:,:,i) denotes gradient wrt $\lambda_{i}$
!! - index1: point of evaluation
!! - index2: vertex basis number
!! - index3: gradient
!! - index3: gradient
END FUNCTION BarycentricVertexBasisGradient_Tetrahedron
END INTERFACE

Expand Down Expand Up @@ -802,7 +785,7 @@ END FUNCTION BarycentricEdgeBasis_Tetrahedron

!> author: Vikas Sharma, Ph. D.
! date: 30 Oct 2022
! summary: Evaluate the edge basis on Tetrahedron in terms of barycentric
! summary: Evaluate the edge basis on Tetrahedron in terms of barycentric

INTERFACE
MODULE PURE FUNCTION BarycentricEdgeBasis_Tetrahedron2( &
Expand Down Expand Up @@ -878,7 +861,7 @@ MODULE PURE FUNCTION BarycentricEdgeBasisGradient_Tetrahedron2( &
!! size(lambda,2) = number of points of evaluation
REAL(DFP), INTENT(IN) :: phi(1:, 0:)
!! lobatto kernel values
!! size(phi1, 1) = 6*number of points
!! size(phi1, 1) = 6*number of points
!! - (lambda2-lambda1)
!! - (lambda3-lambda1)
!! - (lambda4-lambda1)
Expand All @@ -887,10 +870,10 @@ MODULE PURE FUNCTION BarycentricEdgeBasisGradient_Tetrahedron2( &
!! - (lambda4-lambda3)
!! size(phi1, 2) = max(pe1-2, pe2-2, pe3-2)+1
REAL(DFP), INTENT(IN) :: dphi(1:, 0:)
!! gradient of lobatto kernel
!! size(phi1, 1) = 3*number of points
!! gradient of lobatto kernel
!! size(phi1, 1) = 3*number of points
!! - (lambda2-lambda1),
!! - (lambda3-lambda1),
!! - (lambda3-lambda1),
!! - (lambda3-lambda2)
!! size(phi1, 2) = max(pe1-2, pe2-2, pe3-2)+1
REAL(DFP) :: ans( &
Expand All @@ -899,7 +882,7 @@ MODULE PURE FUNCTION BarycentricEdgeBasisGradient_Tetrahedron2( &
!! - ans(:,:,i) denotes gradient wrt $\lambda_{i}$
!! - index1: point of evaluation
!! - index2: vertex basis number
!! - index3: gradient
!! - index3: gradient
END FUNCTION BarycentricEdgeBasisGradient_Tetrahedron2
END INTERFACE

Expand Down Expand Up @@ -1012,7 +995,7 @@ MODULE PURE FUNCTION BarycentricFacetBasisGradient_Tetrahedron2( &
!! Number of rows in lambda is equal to 4
REAL(DFP), INTENT(IN) :: phi(1:, 0:)
!! lobatto kernel values
!! size(phi1, 1) = 6*number of points
!! size(phi1, 1) = 6*number of points
!! - (lambda2-lambda1)
!! - (lambda3-lambda1)
!! - (lambda4-lambda1)
Expand All @@ -1021,7 +1004,7 @@ MODULE PURE FUNCTION BarycentricFacetBasisGradient_Tetrahedron2( &
!! - (lambda4-lambda3)
REAL(DFP), INTENT(IN) :: dphi(1:, 0:)
!! gradient of lobatto kernel values
!! size(phi1, 1) = 6*number of points
!! size(phi1, 1) = 6*number of points
!! - (lambda2-lambda1)
!! - (lambda3-lambda1)
!! - (lambda4-lambda1)
Expand Down Expand Up @@ -1082,7 +1065,7 @@ MODULE PURE FUNCTION BarycentricCellBasis_Tetrahedron2( &
!! Number of rows in lambda is equal to 4
REAL(DFP), INTENT(IN) :: phi(1:, 0:)
!! Value of lobatto kernel values
!! size(phi1, 1) = 6*number of points
!! size(phi1, 1) = 6*number of points
!! - (lambda2-lambda1)
!! - (lambda3-lambda1)
!! - (lambda4-lambda1)
Expand Down Expand Up @@ -1113,7 +1096,7 @@ MODULE PURE FUNCTION BarycentricCellBasisGradient_Tetrahedron2( &
!! Number of rows in lambda is equal to 4
REAL(DFP), INTENT(IN) :: phi(1:, 0:)
!! Value of lobatto kernel values
!! size(phi1, 1) = 6*number of points
!! size(phi1, 1) = 6*number of points
!! - (lambda2-lambda1)
!! - (lambda3-lambda1)
!! - (lambda4-lambda1)
Expand All @@ -1122,7 +1105,7 @@ MODULE PURE FUNCTION BarycentricCellBasisGradient_Tetrahedron2( &
!! - (lambda4-lambda3)
REAL(DFP), INTENT(IN) :: dphi(1:, 0:)
!! Gradient of lobatto kernel values
!! size(phi1, 1) = 6*number of points
!! size(phi1, 1) = 6*number of points
!! - (lambda2-lambda1)
!! - (lambda3-lambda1)
!! - (lambda4-lambda1)
Expand All @@ -1135,7 +1118,7 @@ MODULE PURE FUNCTION BarycentricCellBasisGradient_Tetrahedron2( &
!! - ans(:,:,i) denotes gradient wrt $\lambda_{i}$
!! - index1: point of evaluation
!! - index2: vertex basis number
!! - index3: gradient
!! - index3: gradient
END FUNCTION BarycentricCellBasisGradient_Tetrahedron2
END INTERFACE

Expand Down Expand Up @@ -1266,7 +1249,7 @@ END FUNCTION BarycentricHeirarchicalBasisGradient_Tetrahedron1
!----------------------------------------------------------------------------

!> author: Vikas Sharma, Ph. D.
! date: 2023-08-25
! date: 2023-08-25
! summary: Evaluate heirarchical basis in terms of barycentric coord

INTERFACE BarycentricHeirarchicalBasis_Tetrahedron
Expand All @@ -1288,9 +1271,8 @@ END FUNCTION BarycentricHeirarchicalBasis_Tetrahedron2
! BarycentricHeirarchicalBasisGradient_Tetrahedron
!----------------------------------------------------------------------------


!> author: Vikas Sharma, Ph. D.
! date: 2023-08-25
! date: 2023-08-25
! summary: Gradient of heirarchical basis in terms of barycentric coord

INTERFACE BarycentricHeirarchicalBasisGradient_Tetrahedron
Expand Down Expand Up @@ -1837,8 +1819,8 @@ MODULE FUNCTION LagrangeGradientEvalAll_Tetrahedron1( &
REAL(DFP) :: ans(SIZE(x, 2), SIZE(xij, 2), 3)
!! Value of gradient of nth order Lagrange polynomials at point x
!! The first index denotes point of evaluation
!! the second index denotes Lagrange polynomial number
!! The third index denotes the spatial dimension in which gradient is
!! the second index denotes Lagrange polynomial number
!! The third index denotes the spatial dimension in which gradient is
!! computed
END FUNCTION LagrangeGradientEvalAll_Tetrahedron1
END INTERFACE LagrangeGradientEvalAll_Tetrahedron
Expand Down
93 changes: 81 additions & 12 deletions src/submodules/Geometry/src/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@

!> author: Vikas Sharma, Ph. D.
! date: 2 March 2021
! summary: This submodule contains methods for [[ReferenceTetrahedron_]]
! summary: This submodule contains methods for [[ReferenceTetrahedron_]]

SUBMODULE(ReferenceTetrahedron_Method) Methods
USE BaseMethod
USE ReferenceElement_Method
USE ApproxUtility
USE InvUtility
USE InputUtility
USE StringUtility
USE ArangeUtility

IMPLICIT NONE

CONTAINS

!----------------------------------------------------------------------------
Expand All @@ -30,19 +37,22 @@

MODULE PROCEDURE Initiate_ref_Tetrahedron
INTEGER(I4B) :: ii, jj
INTEGER(I4B), PARAMETER :: tNodes = 4, tFaces=4, tEdges=6
INTEGER(I4B), PARAMETER :: tNodes = 4, tFaces = 4, tEdges = 6
INTEGER(I4B) :: p1p2(2, tEdges), lloop(3, tFaces), vol(tNodes, 1)
REAL(DFP) :: unit_xij(3, 4), biunit_xij(3, 4)

CALL DEALLOCATE (obj)

p1p2 = EdgeConnectivity_Tetrahedron( &
& baseInterpol="LAGRANGE", &
& baseContinuity="H1")
! p1p2 = EdgeConnectivity_Tetrahedron( &
! & baseInterpol="LAGRANGE", &
! & baseContinuity="H1")

lloop = FacetConnectivity_Tetrahedron( &
& baseInterpol="LAGRANGE", &
& baseContinuity="H1")
CALL GetEdgeConnectivity_Tetrahedron(con=p1p2, opt=2_I4B)
CALL GetFaceConnectivity_Tetrahedron(con=lloop, opt=2_I4B)

! lloop = FacetConnectivity_Tetrahedron( &
! & baseInterpol="LAGRANGE", &
! & baseContinuity="H1")

vol(:, 1) = arange(1_I4B, tNodes)

Expand Down Expand Up @@ -108,7 +118,8 @@
!----------------------------------------------------------------------------

MODULE PROCEDURE reference_Tetrahedron
CALL Initiate(obj=obj, nsd=nsd, xij=xij, domainName=domainName)
CALL initiate_ref_tetrahedron(obj=obj, nsd=nsd, xij=xij, &
& domainName=domainName)
END PROCEDURE reference_Tetrahedron

!----------------------------------------------------------------------------
Expand All @@ -117,7 +128,8 @@

MODULE PROCEDURE reference_Tetrahedron_Pointer
ALLOCATE (obj)
CALL Initiate(obj=obj, nsd=nsd, xij=xij, domainName=domainName)
CALL initiate_ref_tetrahedron(obj=obj, nsd=nsd, xij=xij, &
& domainName=domainName)
END PROCEDURE reference_Tetrahedron_Pointer

!----------------------------------------------------------------------------
Expand All @@ -141,7 +153,7 @@
!----------------------------------------------------------------------------

MODULE PROCEDURE Tetrahedron_quality
! TODO Implement Tetrahedron_quality
! TODO Implement Tetrahedron_quality
END PROCEDURE Tetrahedron_quality

!----------------------------------------------------------------------------
Expand All @@ -155,4 +167,61 @@
ans = ABS(Det(a)) / 6.0_DFP
END PROCEDURE TetrahedronVolume3D

!----------------------------------------------------------------------------
! RefCoord_Tetrahedron
!----------------------------------------------------------------------------

MODULE PROCEDURE RefCoord_Tetrahedron
CHARACTER(:), ALLOCATABLE :: layout
layout = UpperCase(refTetrahedron)
SELECT CASE (layout)
CASE ("BIUNIT")
ans(:, 1) = [-1.0_DFP, -1.0_DFP, -1.0_DFP]
ans(:, 2) = [1.0_DFP, -1.0_DFP, -1.0_DFP]
ans(:, 3) = [-1.0_DFP, 1.0_DFP, -1.0_DFP]
ans(:, 4) = [-1.0_DFP, -1.0_DFP, 1.0_DFP]
CASE ("UNIT")
ans(:, 1) = [0.0_DFP, 0.0_DFP, 0.0_DFP]
ans(:, 2) = [1.0_DFP, 0.0_DFP, 0.0_DFP]
ans(:, 3) = [0.0_DFP, 1.0_DFP, 0.0_DFP]
ans(:, 4) = [0.0_DFP, 0.0_DFP, 1.0_DFP]
END SELECT
layout = ""
END PROCEDURE RefCoord_Tetrahedron

!----------------------------------------------------------------------------
! GetEdgeConnectivity_Tetrahedron
!----------------------------------------------------------------------------

MODULE PROCEDURE GetEdgeConnectivity_Tetrahedron
con(1:2, 1) = [1, 2]
con(1:2, 2) = [1, 3]
con(1:2, 3) = [1, 4]
con(1:2, 4) = [2, 3]
con(1:2, 5) = [2, 4]
con(1:2, 6) = [3, 4]
END PROCEDURE GetEdgeConnectivity_Tetrahedron

!----------------------------------------------------------------------------
! GetFaceConnectivity_Tetrahedron
!----------------------------------------------------------------------------

MODULE PROCEDURE GetFaceConnectivity_Tetrahedron
INTEGER(I4B) :: opt0
opt0 = input(option=opt, default=1_I4B)

SELECT CASE (opt0)
CASE (1_I4B)
con(1:3, 1) = [1, 2, 3]
con(1:3, 2) = [1, 2, 4]
con(1:3, 3) = [1, 3, 4]
con(1:3, 4) = [2, 3, 4]
CASE (2_I4B)
con(1:3, 1) = [1, 3, 2]
con(1:3, 2) = [1, 2, 4]
con(1:3, 3) = [1, 4, 3]
con(1:3, 4) = [2, 3, 4]
END SELECT
END PROCEDURE GetFaceConnectivity_Tetrahedron

END SUBMODULE Methods
21 changes: 0 additions & 21 deletions src/submodules/Polynomial/src/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -165,27 +165,6 @@

END PROCEDURE FacetConnectivity_Tetrahedron

!----------------------------------------------------------------------------
! RefCoord_Tetrahedron
!----------------------------------------------------------------------------

MODULE PROCEDURE RefCoord_Tetrahedron
CHARACTER(20) :: layout
layout = TRIM(UpperCase(refTetrahedron))
SELECT CASE (TRIM(layout))
CASE ("BIUNIT")
ans(:, 1) = [-1.0_DFP, -1.0_DFP, -1.0_DFP]
ans(:, 2) = [1.0_DFP, -1.0_DFP, -1.0_DFP]
ans(:, 3) = [-1.0_DFP, 1.0_DFP, -1.0_DFP]
ans(:, 4) = [-1.0_DFP, -1.0_DFP, 1.0_DFP]
CASE ("UNIT")
ans(:, 1) = [0.0_DFP, 0.0_DFP, 0.0_DFP]
ans(:, 2) = [1.0_DFP, 0.0_DFP, 0.0_DFP]
ans(:, 3) = [0.0_DFP, 1.0_DFP, 0.0_DFP]
ans(:, 4) = [0.0_DFP, 0.0_DFP, 1.0_DFP]
END SELECT
END PROCEDURE RefCoord_Tetrahedron

!----------------------------------------------------------------------------
! LagrangeDegree_Tetrahedron
!----------------------------------------------------------------------------
Expand Down

0 comments on commit 94b8036

Please sign in to comment.