Skip to content

Commit

Permalink
Merge pull request #283 from easifem-fortran/dev
Browse files Browse the repository at this point in the history
January release of easifem-base v23.10.3
  • Loading branch information
vickysharma0812 authored Jan 31, 2024
2 parents 2206e9a + 3ff1952 commit 36126c6
Show file tree
Hide file tree
Showing 10 changed files with 1,127 additions and 993 deletions.
75 changes: 39 additions & 36 deletions cmake/addOpenBLAS.cmake
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
# This program is a part of EASIFEM library
# Copyright (C) 2020-2021 Vikas Sharma, Ph.D
# This program is a part of EASIFEM library Copyright (C) 2020-2021 Vikas
# Sharma, Ph.D
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https: //www.gnu.org/licenses/>
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https: //www.gnu.org/licenses/>
#

IF( ${PROJECT_NAME} MATCHES "easifemBase" )
#SET(BLA_VENDOR "OpenBLAS")
FIND_PACKAGE( LAPACK REQUIRED )
IF( LAPACK_FOUND )
MESSAGE(STATUS "FOUND LAPACK")
ENDIF()
IF( BLA_VENDOR MATCHES "MKL" )
MESSAGE(STATUS "BLA_VENDOR : MKL")
LIST( APPEND TARGET_COMPILE_DEF "-DUSE_INTEL_MKL" )
ELSEIF( BLA_VENDOR MATCHES "OpenBLAS" )
MESSAGE(STATUS "BLA_VENDOR : OpenBLAS")
LIST( APPEND TARGET_COMPILE_DEF "-DUSE_OpenBLAS" )
ELSE( )
MESSAGE(STATUS "BLA_VENDOR : ${BLA_VENDOR}")
MESSAGE(STATUS "BLA_VENDOR : System provided")
LIST( APPEND TARGET_COMPILE_DEF "-DUSE_NativeBLAS" )
if(${PROJECT_NAME} MATCHES "easifemBase")
# SET(BLA_VENDOR "OpenBLAS")
find_package(LAPACK REQUIRED)
if(LAPACK_FOUND)
message(STATUS "FOUND LAPACK")
endif()
if(BLA_VENDOR MATCHES "MKL")
message(STATUS "BLA_VENDOR : MKL")
list(APPEND TARGET_COMPILE_DEF "-DUSE_INTEL_MKL")
elseif(BLA_VENDOR MATCHES "OpenBLAS")
message(STATUS "BLA_VENDOR : OpenBLAS")
list(APPEND TARGET_COMPILE_DEF "-DUSE_OpenBLAS")
else()
message(STATUS "BLA_VENDOR : ${BLA_VENDOR}")
message(STATUS "BLA_VENDOR : System provided")
list(APPEND TARGET_COMPILE_DEF "-DUSE_NativeBLAS")

IF(APPLE)
LIST( APPEND TARGET_COMPILE_DEF "-DUSE_APPLE_NativeBLAS" )
ENDIF()
if(APPLE)
list(APPEND TARGET_COMPILE_DEF "-DUSE_APPLE_NativeBLAS")
endif()

ENDIF( )
TARGET_LINK_LIBRARIES(
${PROJECT_NAME} PUBLIC ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}
)
ENDIF()
endif()

message(STATUS "BLAS_LIBRARIES: ${BLAS_LIBRARIES}")
message(STATUS "LAPACK_LIBRARIES: ${LAPACK_LIBRARIES}")

target_link_libraries(${PROJECT_NAME} PUBLIC ${LAPACK_LIBRARIES}
${BLAS_LIBRARIES})
endif()
12 changes: 10 additions & 2 deletions src/modules/BaseType/src/BaseType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ MODULE BaseType
PUBLIC :: Rank2TensorPointer_
PUBLIC :: DeformationGradient_
PUBLIC :: DeformationGradientPointer_
PUBLIC :: TypeDeformationGradient
PUBLIC :: LeftCauchyGreen_
PUBLIC :: TypeLeftCauchyGreen
PUBLIC :: LeftCauchyGreenPointer_
Expand Down Expand Up @@ -784,9 +785,13 @@ MODULE BaseType

TYPE :: ReferenceElement_
CHARACTER(10) :: domainName = "GENERAL"
!! UNIT, BIUNIT, GENERAL
!! UNIT, BIUNIT, GENERAL
INTEGER(I4B) :: entityCounts(4) = 0
!! Number of 0D, 1D, 2D, 3D entities
!! entityCounts(1) = total number of points
!! entityCounts(2) = total number of edges
!! entityCounts(3) = total number of faces
!! entityCounts(4) = total number of cells
INTEGER(I4B) :: xiDimension = 0
!! Xidimension
INTEGER(I4B) :: name = 0
Expand All @@ -797,7 +802,10 @@ MODULE BaseType
!! Number of spatial dimensions
INTEGER(I4B) :: interpolationPointType = Equidistance
!! Interpolation point
!! Equidistance, GaussLegendre, GaussLobatto, Chebyshev
!! Equidistance
!! GaussLegendre
!! GaussLobatto
!! Chebyshev
TYPE(ReferenceTopology_), ALLOCATABLE :: topology(:)
!! Topology information of 0D, 1, 2, 3D entities
REAL(DFP), ALLOCATABLE :: xiJ(:, :)
Expand Down
55 changes: 54 additions & 1 deletion src/modules/Geometry/src/ReferenceElement_Method.F90
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,59 @@ MODULE ReferenceElement_Method
PUBLIC :: GetTotalEdges
PUBLIC :: GetTotalFaces
PUBLIC :: GetTotalCells
PUBLIC :: ReferenceElementInfo

!----------------------------------------------------------------------------
! ReferenceElementInfo_
!----------------------------------------------------------------------------

TYPE :: ReferenceElementInfo_
INTEGER(I4B) :: point = 1
INTEGER(I4B) :: line = 2
INTEGER(I4B) :: triangle = 3
INTEGER(I4B) :: quadrangle = 4
INTEGER(I4B) :: tetrahedron = 5
INTEGER(I4B) :: hexahedron = 6
INTEGER(I4B) :: prism = 7
INTEGER(I4B) :: pyramid = 8
INTEGER(I4B) :: tElemTopologyType_0D = 1
INTEGER(I4B) :: tElemTopologyType_1D = 1
INTEGER(I4B) :: tElemTopologyType_2D = 2
INTEGER(I4B) :: tElemTopologyType_3D = 4
INTEGER(I4B) :: tElemTopologyType = 8
INTEGER(I4B) :: elemTopologyName(8) = [ &
& Point, &
& Line, &
& Triangle, &
& Quadrangle, &
& Tetrahedron, Hexahedron, Prism, Pyramid]
INTEGER(I4B) :: maxFaces = 6
INTEGER(I4B) :: maxEdges = 12
INTEGER(I4B) :: maxPoints = 8
INTEGER(I4B) :: tCells(8) = [0, 0, 0, 0, 1, 1, 1, 1]
!! Here cell is a topology for which xidim = 3
INTEGER(I4B) :: tFaces(8) = [0, 0, 1, 1, 4, 6, 5, 5]
!! Here facet is topology entity for which xidim = 2
INTEGER(I4B) :: tEdges(8) = [0, 0, 3, 4, 6, 12, 9, 8]
!! Here edge is topology entity for which xidim = 1
INTEGER(I4B) :: tPoints(8) = [1, 2, 3, 4, 4, 8, 6, 5]
!! A point is topology entity for which xidim = 0
INTEGER(I4B) :: nne_in_face_triangle(1) = [3]
!! number of nodes in each face of triangle
INTEGER(I4B) :: nne_in_face_quadrangle(1) = [4]
!! number of nodes in each face of quadrangle
INTEGER(I4B) :: nne_in_face_tetrahedron(4) = [3, 3, 3, 3]
!! number of nodes in each face of tetrahedron
INTEGER(I4B) :: nne_in_face_hexahedron(6) = [4, 4, 4, 4, 4, 4]
!! number of nodes in each face of tetrahedron
INTEGER(I4B) :: nne_in_face_prism(5) = [3, 4, 4, 4, 3]
!! number of nodes in each face of tetrahedron
INTEGER(I4B) :: nne_in_face_pyramid(5) = [4, 3, 3, 3, 3]
!! number of nodes in each face of tetrahedron
END TYPE ReferenceElementInfo_

TYPE(ReferenceElementInfo_), PARAMETER :: ReferenceElementInfo = &
& ReferenceElementInfo_()

!----------------------------------------------------------------------------
! GetTotalEdges@GeometryMethods
Expand Down Expand Up @@ -381,7 +434,7 @@ END FUNCTION refelem_Constructor_2
END INTERFACE ReferenceElement_Pointer

!----------------------------------------------------------------------------
! Getnptrs@ConstrucorMethods
! GetConnectivity@ConstrucorMethods
!----------------------------------------------------------------------------

!> author: Vikas Sharma, Ph. D.
Expand Down
26 changes: 26 additions & 0 deletions src/modules/MassMatrix/src/MassMatrix_Method.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ MODULE MassMatrix_Method
PRIVATE

PUBLIC :: MassMatrix
PUBLIC :: ViscousBoundaryMassMatrix

!----------------------------------------------------------------------------
! MassMatrix@MassMatrixMethods
Expand Down Expand Up @@ -125,6 +126,31 @@ MODULE PURE FUNCTION MassMatrix_4(test, trial, rho, rhorank) &
END FUNCTION MassMatrix_4
END INTERFACE MassMatrix

!----------------------------------------------------------------------------
! MassMatrix@MassMatrixMethods
!----------------------------------------------------------------------------

!> author: Vikas Sharma, Ph. D.
! date: 2024-01-15
! summary: This subroutine makes mass matrix used for viscous boundary

INTERFACE ViscousBoundaryMassMatrix
MODULE PURE FUNCTION MassMatrix_5(test, trial, lambda, mu, rho) &
& RESULT(ans)
CLASS(ElemshapeData_), INTENT(IN) :: test
!! Shapedata for test function
CLASS(ElemshapeData_), INTENT(IN) :: trial
!! Shapedata for trial function
CLASS(FEVariable_), INTENT(IN) :: lambda
!! Lame parameter
CLASS(FEVariable_), INTENT(IN) :: mu
!! Lame parameter
CLASS(FEVariable_), INTENT(IN) :: rho
!! Mass Density
REAL(DFP), ALLOCATABLE :: ans(:, :)
END FUNCTION MassMatrix_5
END INTERFACE ViscousBoundaryMassMatrix

!----------------------------------------------------------------------------
!
!----------------------------------------------------------------------------
Expand Down
9 changes: 8 additions & 1 deletion src/submodules/ElemshapeData/src/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,15 @@
MODULE PROCEDURE stsd_initiate
INTEGER(I4B) :: tip, ip
REAL(DFP) :: x(3)

tip = SIZE(elemsd%N, 2)
IF (ALLOCATED(obj)) DEALLOCATE (obj)
IF (ALLOCATED(obj)) THEN
DO ip = 1, SIZE(obj)
CALL DEALLOCATE (obj(ip))
END DO
DEALLOCATE (obj)
END IF

ALLOCATE (obj(tip))
DO ip = 1, tip
obj(ip)%T = elemsd%N(:, ip)
Expand Down
2 changes: 1 addition & 1 deletion src/submodules/ElemshapeData/src/H1/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
ipType0 = Input(default=Equidistance, option=ipType)
basisType0 = Input(default=Monomial, option=basisType)

CALL DEALLOCATE (obj)
! CALL DEALLOCATE (obj)
CALL Initiate(obj%refelem, refelem)
nsd = refelem%nsd
xidim = refelem%xiDimension
Expand Down
12 changes: 8 additions & 4 deletions src/submodules/Geometry/src/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,13 @@
!----------------------------------------------------------------------------

MODULE PROCEDURE refelem_FacetElements_Line
INTEGER(I4B) :: ii
INTEGER(I4B) :: ii, tFacet, xiCell
INTEGER(I4B) :: nptrs(1)

DO ii = 1, 2
xiCell = refelem%xiDimension
tFacet = refelem%entityCounts(xicell)

DO ii = 1, tFacet
nptrs = refelem%topology(ii)%nptrs
ans(ii)%xij = refelem%xij(:, nptrs)
ans(ii)%entityCounts = [1, 0, 0, 0]
Expand All @@ -131,7 +134,7 @@

MODULE PROCEDURE refelem_FacetElements_Surface
INTEGER(I4B) :: tFacet, ii, xiCell, T(4), istart, iend, tsize, jj
INTEGER(I4B) :: nptrs(2)
INTEGER(I4B), ALLOCATABLE :: nptrs(:)
TYPE(Referencetopology_) :: topo

xiCell = refelem%xiDimension
Expand Down Expand Up @@ -159,7 +162,7 @@

ans(ii)%Order = ElementOrder(elemType=topo%name)
ans(ii)%NSD = refelem%nsd
ans(ii)%entityCounts = [2, 1, 0, 0]
ans(ii)%entityCounts = [SIZE(nptrs), 1, 0, 0]
tsize = SIZE(nptrs) + 1

ALLOCATE (ans(ii)%topology(tsize))
Expand All @@ -170,6 +173,7 @@

ans(ii)%topology(tsize) = Referencetopology(nptrs=nptrs, name=ans(ii)%name)

DEALLOCATE (nptrs)
END DO

END PROCEDURE refelem_FacetElements_Surface
Expand Down
16 changes: 8 additions & 8 deletions src/submodules/Geometry/src/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@
CALL Initiate(obj=obj, Anotherobj=refelem)
CASE DEFAULT
obj%xij = InterpolationPoint_Quadrangle( &
& xij=refelem%xij(1:3, 1:4), &
& xij=refelem%xij, &
& order=order, &
& ipType=ipType, &
& layout="VEFC")
obj%domainName=refelem%domainName
obj%domainName = refelem%domainName
NNS = LagrangeDOF_Quadrangle(order=order)
obj%entityCounts = [NNS, 4, 1, 0]
obj%xidimension = 2
Expand Down Expand Up @@ -220,9 +220,9 @@
ans = ans + area_triangle
END PROCEDURE QuadArea2D

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

PURE FUNCTION R8MATDET4D(a)
REAL(DFP), INTENT(IN) :: a(4, 4)
Expand All @@ -246,9 +246,9 @@ PURE FUNCTION R8MATDET4D(a)
+ a(2, 3) * (a(3, 1) * a(4, 2) - a(3, 2) * a(4, 1)))
END FUNCTION R8MATDET4D

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

!> author: Vikas Sharma, Ph. D.
! date: 2023-07-17
Expand Down Expand Up @@ -288,9 +288,9 @@ PURE SUBROUTINE PARALLELOGRAMAREA3D(p, ans)
ans = SQRT(SUM(cross(1:3)**2))
END SUBROUTINE PARALLELOGRAMAREA3D

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

!> author: Vikas Sharma, Ph. D.
! date: 2023-07-17
Expand Down
Loading

0 comments on commit 36126c6

Please sign in to comment.