From 012adbbd0c5866c3e35439c3d4e27b503100cebf Mon Sep 17 00:00:00 2001 From: Vikas Sharma Date: Fri, 8 Mar 2024 22:24:32 +0900 Subject: [PATCH] Updates in Reference Tetrahedron --- .../src/ReferenceTetrahedron_Method.F90 | 20 +++- .../src/TetrahedronInterpolationUtility.F90 | 52 ++++------- .../ReferenceTetrahedron_Method@Methods.F90 | 93 ++++++++++++++++--- ...etrahedronInterpolationUtility@Methods.F90 | 21 ----- 4 files changed, 116 insertions(+), 70 deletions(-) diff --git a/src/modules/Geometry/src/ReferenceTetrahedron_Method.F90 b/src/modules/Geometry/src/ReferenceTetrahedron_Method.F90 index 833e9eff..bd0f558a 100644 --- a/src/modules/Geometry/src/ReferenceTetrahedron_Method.F90 +++ b/src/modules/Geometry/src/ReferenceTetrahedron_Method.F90 @@ -34,6 +34,7 @@ MODULE ReferenceTetrahedron_Method PUBLIC :: Quality_Tetrahedron PUBLIC :: GetEdgeConnectivity_Tetrahedron PUBLIC :: GetFaceConnectivity_Tetrahedron +PUBLIC :: RefCoord_Tetrahedron !---------------------------------------------------------------------------- ! Initiate@Tetrahedron @@ -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 @@ -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 @@ -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 diff --git a/src/modules/Polynomial/src/TetrahedronInterpolationUtility.F90 b/src/modules/Polynomial/src/TetrahedronInterpolationUtility.F90 index a9d71f51..31840d41 100644 --- a/src/modules/Polynomial/src/TetrahedronInterpolationUtility.F90 +++ b/src/modules/Polynomial/src/TetrahedronInterpolationUtility.F90 @@ -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 @@ -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 !---------------------------------------------------------------------------- @@ -728,7 +712,6 @@ MODULE PURE FUNCTION BarycentricVertexBasis_Tetrahedron(lambda) & END FUNCTION BarycentricVertexBasis_Tetrahedron END INTERFACE - !---------------------------------------------------------------------------- ! BarycentricVertexBasis_Tetrahedron !---------------------------------------------------------------------------- @@ -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 @@ -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( & @@ -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) @@ -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( & @@ -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 @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/src/submodules/Geometry/src/ReferenceTetrahedron_Method@Methods.F90 b/src/submodules/Geometry/src/ReferenceTetrahedron_Method@Methods.F90 index 311acb81..ea151da5 100644 --- a/src/submodules/Geometry/src/ReferenceTetrahedron_Method@Methods.F90 +++ b/src/submodules/Geometry/src/ReferenceTetrahedron_Method@Methods.F90 @@ -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 !---------------------------------------------------------------------------- @@ -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) @@ -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 !---------------------------------------------------------------------------- @@ -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 !---------------------------------------------------------------------------- @@ -141,7 +153,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE Tetrahedron_quality -! TODO Implement Tetrahedron_quality +! TODO Implement Tetrahedron_quality END PROCEDURE Tetrahedron_quality !---------------------------------------------------------------------------- @@ -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 diff --git a/src/submodules/Polynomial/src/TetrahedronInterpolationUtility@Methods.F90 b/src/submodules/Polynomial/src/TetrahedronInterpolationUtility@Methods.F90 index 8038a3f2..21d9d254 100644 --- a/src/submodules/Polynomial/src/TetrahedronInterpolationUtility@Methods.F90 +++ b/src/submodules/Polynomial/src/TetrahedronInterpolationUtility@Methods.F90 @@ -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 !----------------------------------------------------------------------------