From a3e27c076d76b64dcc8c0fe325fc7bc07f88cad8 Mon Sep 17 00:00:00 2001 From: Vikas Sharma Date: Fri, 8 Mar 2024 23:11:33 +0900 Subject: [PATCH] Update in Reference Hexahedron --- .../src/ReferenceHexahedron_Method.F90 | 25 +++- .../src/HexahedronInterpolationUtility.F90 | 23 +--- .../ReferenceHexahedron_Method@Methods.F90 | 120 ++++++++++++++++-- ...HexahedronInterpolationUtility@Methods.F90 | 38 +----- 4 files changed, 131 insertions(+), 75 deletions(-) diff --git a/src/modules/Geometry/src/ReferenceHexahedron_Method.F90 b/src/modules/Geometry/src/ReferenceHexahedron_Method.F90 index da86b45a..9780f87d 100644 --- a/src/modules/Geometry/src/ReferenceHexahedron_Method.F90 +++ b/src/modules/Geometry/src/ReferenceHexahedron_Method.F90 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/src/modules/Polynomial/src/HexahedronInterpolationUtility.F90 b/src/modules/Polynomial/src/HexahedronInterpolationUtility.F90 index 5915c9a6..ed51320a 100644 --- a/src/modules/Polynomial/src/HexahedronInterpolationUtility.F90 +++ b/src/modules/Polynomial/src/HexahedronInterpolationUtility.F90 @@ -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 @@ -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 !---------------------------------------------------------------------------- @@ -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 diff --git a/src/submodules/Geometry/src/ReferenceHexahedron_Method@Methods.F90 b/src/submodules/Geometry/src/ReferenceHexahedron_Method@Methods.F90 index fe4d8678..b9d901cc 100644 --- a/src/submodules/Geometry/src/ReferenceHexahedron_Method@Methods.F90 +++ b/src/submodules/Geometry/src/ReferenceHexahedron_Method@Methods.F90 @@ -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 !---------------------------------------------------------------------------- @@ -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 @@ -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 !---------------------------------------------------------------------------- @@ -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 !---------------------------------------------------------------------------- @@ -137,10 +152,8 @@ 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 !---------------------------------------------------------------------------- @@ -148,6 +161,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE Hexahedron_quality +ans = 0.0_I4B ! TODO Implement Hexahedron_quality END PROCEDURE Hexahedron_quality @@ -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 diff --git a/src/submodules/Polynomial/src/HexahedronInterpolationUtility@Methods.F90 b/src/submodules/Polynomial/src/HexahedronInterpolationUtility@Methods.F90 index ae011e0a..eb8998b7 100644 --- a/src/submodules/Polynomial/src/HexahedronInterpolationUtility@Methods.F90 +++ b/src/submodules/Polynomial/src/HexahedronInterpolationUtility@Methods.F90 @@ -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 !---------------------------------------------------------------------------- @@ -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 !----------------------------------------------------------------------------