First step of performance improvement
Finalysing first step of performance improvement focusing on reducing iteration CPU time by improving calculation of basic element functions, which took a lot of the CPU time
This commit is contained in:
parent
7b7a5c45ca
commit
746c5bea09
13 changed files with 260 additions and 252 deletions
|
|
@ -41,7 +41,6 @@ MODULE moduleMesh1DRad
|
|||
CLASS(meshNode), POINTER:: n1 => NULL(), n2 => NULL()
|
||||
!Connectivity to adjacent elements
|
||||
CLASS(meshElement), POINTER:: e1 => NULL(), e2 => NULL()
|
||||
REAL(8):: arNodes(1:2)
|
||||
CONTAINS
|
||||
!meshCell DEFERRED PROCEDURES
|
||||
PROCEDURE, PASS:: init => initCell1DRadSegm
|
||||
|
|
@ -60,7 +59,7 @@ MODULE moduleMesh1DRad
|
|||
PROCEDURE, PASS:: phy2log => phy2logSegm
|
||||
PROCEDURE, PASS:: neighbourElement => neighbourElementSegm
|
||||
!PARTICLUAR PROCEDURES
|
||||
PROCEDURE, PASS, PRIVATE:: area => areaSegm
|
||||
PROCEDURE, PASS, PRIVATE:: vol => volumeSegm
|
||||
|
||||
END TYPE meshCell1DRadSegm
|
||||
|
||||
|
|
@ -82,7 +81,7 @@ MODULE moduleMesh1DRad
|
|||
!Node volume, to be determined in mesh
|
||||
self%v = 0.D0
|
||||
|
||||
!Allocates output
|
||||
!Allocate output
|
||||
ALLOCATE(self%output(1:nSpecies))
|
||||
|
||||
CALL OMP_INIT_LOCK(self%lock)
|
||||
|
|
@ -100,7 +99,7 @@ MODULE moduleMesh1DRad
|
|||
END FUNCTION getCoord1DRad
|
||||
|
||||
!EDGE FUNCTIONS
|
||||
!Inits edge element
|
||||
!Init edge element
|
||||
SUBROUTINE initEdge1DRad(self, n, p, bt, physicalSurface)
|
||||
USE moduleSpecies
|
||||
USE moduleBoundary
|
||||
|
|
@ -162,7 +161,7 @@ MODULE moduleMesh1DRad
|
|||
|
||||
END FUNCTION intersection1DRad
|
||||
|
||||
!Calculates a 'random' position in edge
|
||||
!Calculate a 'random' position in edge
|
||||
FUNCTION randPos1DRad(self) RESULT(r)
|
||||
CLASS(meshEdge1DRad), INTENT(in):: self
|
||||
REAL(8):: r(1:3)
|
||||
|
|
@ -173,7 +172,7 @@ MODULE moduleMesh1DRad
|
|||
|
||||
!VOLUME FUNCTIONS
|
||||
!SEGMENT FUNCTIONS
|
||||
!Init segment element
|
||||
!Init element
|
||||
SUBROUTINE initCell1DRadSegm(self, n, p, nodes)
|
||||
USE moduleRefParam
|
||||
IMPLICIT NONE
|
||||
|
|
@ -194,9 +193,7 @@ MODULE moduleMesh1DRad
|
|||
self%r = (/ r1(1), r2(1) /)
|
||||
|
||||
!Assign node volume
|
||||
CALL self%area()
|
||||
self%n1%v = self%n1%v + self%arNodes(1)
|
||||
self%n2%v = self%n2%v + self%arNodes(2)
|
||||
CALL self%vol()
|
||||
|
||||
CALL OMP_INIT_LOCK(self%lock)
|
||||
|
||||
|
|
@ -237,7 +234,7 @@ MODULE moduleMesh1DRad
|
|||
|
||||
END FUNCTION randPos1DRadSegm
|
||||
|
||||
!Computes element functions at point Xi
|
||||
!Compute element functions at point Xi
|
||||
PURE FUNCTION fPsiSegm(Xi, nNodes) RESULT(fPsi)
|
||||
IMPLICIT NONE
|
||||
|
||||
|
|
@ -317,7 +314,7 @@ MODULE moduleMesh1DRad
|
|||
|
||||
END FUNCTION gatherMFSegm
|
||||
|
||||
!Computes element local stiffness matrix
|
||||
!Compute element local stiffness matrix
|
||||
PURE FUNCTION elemKSegm(self, nNodes) RESULT(localK)
|
||||
USE moduleConstParam, ONLY: PI2
|
||||
IMPLICIT NONE
|
||||
|
|
@ -352,7 +349,7 @@ MODULE moduleMesh1DRad
|
|||
|
||||
END FUNCTION elemKSegm
|
||||
|
||||
!Computes the local source vector for a force f
|
||||
!Compute the local source vector for a force f
|
||||
PURE FUNCTION elemFSegm(self, nNodes, source) RESULT(localF)
|
||||
USE moduleConstParam, ONLY: PI2
|
||||
IMPLICIT NONE
|
||||
|
|
@ -430,9 +427,9 @@ MODULE moduleMesh1DRad
|
|||
|
||||
END SUBROUTINE neighbourElementSegm
|
||||
|
||||
!Computes element area
|
||||
PURE SUBROUTINE areaSegm(self)
|
||||
USE moduleConstParam, ONLY: PI
|
||||
!Compute element vol
|
||||
PURE SUBROUTINE volumeSegm(self)
|
||||
USE moduleConstParam, ONLY: PI4
|
||||
IMPLICIT NONE
|
||||
|
||||
CLASS(meshCell1DRadSegm), INTENT(inout):: self
|
||||
|
|
@ -443,28 +440,27 @@ MODULE moduleMesh1DRad
|
|||
REAL(8):: r
|
||||
|
||||
self%volume = 0.D0
|
||||
self%arNodes = 0.D0
|
||||
!1D 1 point Gauss Quad Integral
|
||||
Xi = 0.D0
|
||||
dPsi = self%dPsi(Xi, 2)
|
||||
pDer = self%partialDer(2, dPsi)
|
||||
detJ = self%detJac(pDer)
|
||||
fPsi = self%fPsi(Xi, 2)
|
||||
!Computes total volume of the cell
|
||||
r = DOT_PRODUCT(fPsi, self%r)
|
||||
self%volume = r*detJ*2.D0*PI !2PI
|
||||
!Computes volume per node
|
||||
!Compute total volume of the cell
|
||||
self%volume = r*detJ*PI4 !2*2PI
|
||||
!Compute volume per node
|
||||
Xi = (/-5.D-1, 0.D0, 0.D0/)
|
||||
r = self%gatherF(Xi, 2, self%r)
|
||||
self%arNodes(1) = fPsi(1)*self%volume
|
||||
self%n1%v = self%n1%v + fPsi(1)*r*detJ*PI4
|
||||
Xi = (/ 5.D-1, 0.D0, 0.D0/)
|
||||
r = self%gatherF(Xi, 2, self%r)
|
||||
self%arNodes(2) = fPsi(2)*self%volume
|
||||
self%n2%v = self%n2%v + fPsi(2)*r*detJ*PI4
|
||||
|
||||
END SUBROUTINE areaSegm
|
||||
END SUBROUTINE volumeSegm
|
||||
|
||||
!COMMON FUNCTIONS FOR 1D VOLUME ELEMENTS
|
||||
!Computes element Jacobian determinant
|
||||
!Compute element Jacobian determinant
|
||||
PURE FUNCTION detJ1DRad(pDer) RESULT(dJ)
|
||||
IMPLICIT NONE
|
||||
|
||||
|
|
@ -475,7 +471,7 @@ MODULE moduleMesh1DRad
|
|||
|
||||
END FUNCTION detJ1DRad
|
||||
|
||||
!Computes element Jacobian inverse matrix (without determinant)
|
||||
!Compute element Jacobian inverse matrix (without determinant)
|
||||
PURE FUNCTION invJ1DRad(pDer) RESULT(invJ)
|
||||
IMPLICIT NONE
|
||||
|
||||
|
|
@ -591,7 +587,7 @@ MODULE moduleMesh1DRad
|
|||
elemA%e1 => elemB
|
||||
elemB%e2 => elemA
|
||||
|
||||
!Revers the normal to point inside the domain
|
||||
!Rever the normal to point inside the domain
|
||||
elemB%normal = - elemB%normal
|
||||
|
||||
END IF
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue