Skip to content

Commit

Permalink
Update in Reference Hexahedron (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
vickysharma0812 authored Mar 9, 2024
2 parents 94b8036 + a3e27c0 commit bdb5ee0
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 75 deletions.
25 changes: 22 additions & 3 deletions src/modules/Geometry/src/ReferenceHexahedron_Method.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ MODULE ReferenceHexahedron_Method
PUBLIC :: Initiate
PUBLIC :: ReferenceHexahedron
PUBLIC :: ReferenceHexahedron_Pointer
PUBLIC :: highorderElement_Hexahedron
PUBLIC :: HighorderElement_Hexahedron
PUBLIC :: Measure_Simplex_Hexahedron
PUBLIC :: Hexahedron_Quality
PUBLIC :: Quality_Hexahedron
PUBLIC :: HexahedronVolume3D
PUBLIC :: GetEdgeConnectivity_Hexahedron
PUBLIC :: GetFaceConnectivity_Hexahedron
PUBLIC :: RefCoord_Hexahedron
PUBLIC :: RefHexahedronCoord

!----------------------------------------------------------------------------
! Initiate@Hexahedron
Expand Down Expand Up @@ -138,7 +140,7 @@ END SUBROUTINE HexahedronVolume3D
! summary: Returns number of edges in the element

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

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

!----------------------------------------------------------------------------
! RefHexahedronCoord
!----------------------------------------------------------------------------

!> author: Vikas Sharma, Ph. D.
! date: 2023-07-07
! summary: Returns coordinates of reference Hexahedron

INTERFACE RefCoord_Hexahedron
MODULE PURE FUNCTION RefHexahedronCoord(refHexahedron) RESULT(ans)
CHARACTER(*), INTENT(IN) :: refHexahedron
!! UNIT
!! BIUNIT
REAL(DFP) :: ans(3, 8)
END FUNCTION RefHexahedronCoord
END INTERFACE RefCoord_Hexahedron

END MODULE ReferenceHexahedron_Method
23 changes: 2 additions & 21 deletions src/modules/Polynomial/src/HexahedronInterpolationUtility.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ MODULE HexahedronInterpolationUtility
PUBLIC :: EquidistanceInPoint_Hexahedron
PUBLIC :: InterpolationPoint_Hexahedron
PUBLIC :: LagrangeCoeff_Hexahedron
PUBLIC :: RefHexahedronCoord
PUBLIC :: RefCoord_Hexahedron
PUBLIC :: EdgeConnectivity_Hexahedron
PUBLIC :: FacetConnectivity_Hexahedron
PUBLIC :: QuadratureNumber_Hexahedron
Expand Down Expand Up @@ -330,23 +328,6 @@ MODULE PURE FUNCTION EdgeConnectivity_Hexahedron( &
END FUNCTION EdgeConnectivity_Hexahedron
END INTERFACE

!----------------------------------------------------------------------------
! RefHexahedronCoord
!----------------------------------------------------------------------------

!> author: Vikas Sharma, Ph. D.
! date: 2023-07-07
! summary: Returns coordinates of reference Hexahedron

INTERFACE RefCoord_Hexahedron
MODULE PURE FUNCTION RefHexahedronCoord(refHexahedron) RESULT(ans)
CHARACTER(*), INTENT(IN) :: refHexahedron
!! UNIT
!! BIUNIT
REAL(DFP) :: ans(3, 8)
END FUNCTION RefHexahedronCoord
END INTERFACE RefCoord_Hexahedron

!----------------------------------------------------------------------------
! LagrangeDegree_Hexahedron
!----------------------------------------------------------------------------
Expand Down Expand Up @@ -2453,8 +2434,8 @@ MODULE FUNCTION LagrangeGradientEvalAll_Hexahedron1( &
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_Hexahedron1
END INTERFACE LagrangeGradientEvalAll_Hexahedron
Expand Down
120 changes: 106 additions & 14 deletions src/submodules/Geometry/src/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,17 @@
! summary: This module contains method for [[ReferenceHexahedron_]]

SUBMODULE(ReferenceHexahedron_Method) Methods
USE BaseMethod
USE ReferenceElement_Method
USE ApproxUtility
USE InvUtility
USE InputUtility
USE StringUtility
USE ArangeUtility
USE ReferenceQuadrangle_Method, ONLY: RefQuadrangleCoord
USE ReferencePrism_Method, ONLY: PolyhedronVolume3d

IMPLICIT NONE

CONTAINS

!----------------------------------------------------------------------------
Expand All @@ -34,18 +43,22 @@
REAL(DFP) :: unit_xij(3, 8), biunit_xij(3, 8)
CALL DEALLOCATE (obj)

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

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

CALL GetEdgeConnectivity_Hexahedron(con=p1p2, opt=2_I4B)
CALL GetFaceConnectivity_Hexahedron(con=lloop, opt=2_I4B)

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

unit_xij = RefCoord_Hexahedron("UNIT")
biunit_xij = RefCoord_Hexahedron("BIUNIT")

IF (PRESENT(xij)) THEN
obj%xij = xij(1:3, 1:8)
IF (ALL(obj%xij(1:3, 1:8) .approxeq.unit_xij)) THEN
Expand Down Expand Up @@ -104,7 +117,8 @@
!----------------------------------------------------------------------------

MODULE PROCEDURE reference_Hexahedron
CALL Initiate(obj=obj, nsd=NSD, xij=xij, domainName=domainName)
CALL Initiate_ref_Hexahedron(obj=obj, nsd=NSD, xij=xij, &
& domainName=domainName)
END PROCEDURE reference_Hexahedron

!----------------------------------------------------------------------------
Expand All @@ -113,7 +127,8 @@

MODULE PROCEDURE reference_Hexahedron_Pointer
ALLOCATE (obj)
CALL Initiate(obj=obj, nsd=NSD, xij=xij, domainName=domainName)
CALL Initiate_ref_Hexahedron(obj=obj, nsd=NSD, xij=xij, &
& domainName=domainName)
END PROCEDURE reference_Hexahedron_Pointer

!----------------------------------------------------------------------------
Expand All @@ -137,17 +152,16 @@
Node0(iFace, 1:Order0(iFace)) = FM(iFace, 4:b)
END DO
CALL PolyhedronVolume3d(coord=XiJ(1:3, 1:8), &
& order_max=4, face_num=6, &
& node=node0, node_num=8, &
& order=order0, &
& ans=ans)
& order_max=4, face_num=6, node=node0, node_num=8, &
& order=order0, ans=ans)
END PROCEDURE Measure_Simplex_Hexahedron

!----------------------------------------------------------------------------
!
!----------------------------------------------------------------------------

MODULE PROCEDURE Hexahedron_quality
ans = 0.0_I4B
! TODO Implement Hexahedron_quality
END PROCEDURE Hexahedron_quality

Expand All @@ -157,9 +171,87 @@

MODULE PROCEDURE HexahedronVolume3D
TYPE(ReferenceHexahedron_) :: refelem
CALL Initiate(obj=refelem, nsd=3_I4B)
CALL Initiate_ref_Hexahedron(obj=refelem, nsd=3_I4B)
ans = Measure_Simplex_Hexahedron(refelem=refelem, xij=xij)
CALL DEALLOCATE (refelem)
END PROCEDURE HexahedronVolume3D

!----------------------------------------------------------------------------
! RefHexahedronCoord
!----------------------------------------------------------------------------

MODULE PROCEDURE RefHexahedronCoord
REAL(DFP) :: one, mone
CHARACTER(:), ALLOCATABLE :: astr

astr = UpperCase(refHexahedron)

SELECT CASE (astr)
CASE ("UNIT")
one = 1.0_DFP
mone = 0.0_DFP
CASE ("BIUNIT")
one = 1.0_DFP
mone = -1.0_DFP
END SELECT

astr = ""

ans(3, 1:4) = mone
ans(3, 5:8) = one
ans(1:2, 1:4) = RefQuadrangleCoord(refHexahedron)
ans(1:2, 5:8) = ans(1:2, 1:4)
END PROCEDURE RefHexahedronCoord

!----------------------------------------------------------------------------
! GetEdgeConnectivity_Hexahedron
!----------------------------------------------------------------------------

MODULE PROCEDURE GetEdgeConnectivity_Hexahedron
con(1:2, 1) = [1, 2]
con(1:2, 2) = [1, 4]
con(1:2, 3) = [1, 5]
con(1:2, 4) = [2, 3]
con(1:2, 5) = [2, 6]
con(1:2, 6) = [3, 4]
con(1:2, 7) = [3, 7]
con(1:2, 8) = [4, 8]
con(1:2, 9) = [5, 6]
con(1:2, 10) = [5, 8]
con(1:2, 11) = [6, 7]
con(1:2, 12) = [7, 8]
END PROCEDURE GetEdgeConnectivity_Hexahedron

!----------------------------------------------------------------------------
! GetFaceConnectivity_Hexahedron
!----------------------------------------------------------------------------

MODULE PROCEDURE GetFaceConnectivity_Hexahedron
INTEGER(I4B) :: opt0

opt0 = Input(default=1_I4B, option=opt)

SELECT CASE (opt0)
CASE (1_I4B)
con(1:4, 1) = [1, 2, 3, 4] ! back
con(1:4, 2) = [5, 6, 7, 8] ! front
con(1:4, 3) = [1, 4, 8, 5] ! left
con(1:4, 4) = [2, 3, 7, 6] ! right
con(1:4, 5) = [1, 2, 6, 5] ! bottom
con(1:4, 6) = [4, 3, 7, 8] ! top

CASE (2_I4B)
con(1:4, 1) = [1, 4, 3, 2] ! back
con(1:4, 2) = [5, 6, 7, 8] ! front
con(1:4, 3) = [1, 5, 8, 4] ! left
con(1:4, 4) = [2, 3, 7, 6] ! right
con(1:4, 5) = [1, 2, 6, 5] ! bottom
con(1:4, 6) = [3, 4, 8, 7] ! top
END SELECT
END PROCEDURE GetFaceConnectivity_Hexahedron

!----------------------------------------------------------------------------
!
!----------------------------------------------------------------------------

END SUBMODULE Methods
38 changes: 1 addition & 37 deletions src/submodules/Polynomial/src/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,7 @@
!----------------------------------------------------------------------------

MODULE PROCEDURE EdgeConnectivity_Hexahedron
ans(:, 1) = [1, 2]
ans(:, 2) = [1, 4]
ans(:, 3) = [1, 5]
ans(:, 4) = [2, 3]
ans(:, 5) = [2, 6]
ans(:, 6) = [3, 4]
ans(:, 7) = [3, 7]
ans(:, 8) = [4, 8]
ans(:, 9) = [5, 6]
ans(:, 10) = [5, 8]
ans(:, 11) = [6, 7]
ans(:, 12) = [7, 8]
CALL GetEdgeConnectivity_Hexahedron(con=ans)
END PROCEDURE EdgeConnectivity_Hexahedron

!----------------------------------------------------------------------------
Expand Down Expand Up @@ -193,31 +182,6 @@

END PROCEDURE FacetConnectivity_Hexahedron

!----------------------------------------------------------------------------
! RefHexahedronCoord
!----------------------------------------------------------------------------

MODULE PROCEDURE RefHexahedronCoord
REAL(DFP) :: one, mone
TYPE(String) :: astr

astr = UpperCase(refHexahedron)

SELECT CASE (astr%chars())
CASE ("UNIT")
one = 1.0_DFP
mone = 0.0_DFP
CASE ("BIUNIT")
one = 1.0_DFP
mone = -1.0_DFP
END SELECT

ans(3, 1:4) = mone
ans(3, 5:8) = one
ans(1:2, 1:4) = RefQuadrangleCoord(refHexahedron)
ans(1:2, 5:8) = ans(1:2, 1:4)
END PROCEDURE RefHexahedronCoord

!----------------------------------------------------------------------------
! LagrangeDegree_Hexahedron
!----------------------------------------------------------------------------
Expand Down

0 comments on commit bdb5ee0

Please sign in to comment.