Subroutine for reading mesh
It is now complete and working. I also added some minor improvements to moduleMesh.f90 using 'associate' to practice. I noticed there are a lot of things (allocating K, for example) that are common for all meshes and should be moved to a general module.
This commit is contained in:
parent
7d4f4b98c3
commit
3083e20ff7
2 changed files with 46 additions and 14 deletions
|
|
@ -499,28 +499,29 @@ MODULE moduleMesh
|
|||
IMPLICIT NONE
|
||||
|
||||
CLASS(meshParticles), INTENT(inout):: self
|
||||
INTEGER:: e
|
||||
INTEGER:: nNodes
|
||||
INTEGER:: c
|
||||
INTEGER, ALLOCATABLE:: n(:)
|
||||
REAL(8), ALLOCATABLE:: localK(:,:)
|
||||
INTEGER:: i, j
|
||||
|
||||
DO e = 1, self%numCells
|
||||
nNodes = self%cells(e)%obj%nNodes
|
||||
ALLOCATE(n(1:nNodes))
|
||||
ALLOCATE(localK(1:nNodes, 1:nNodes))
|
||||
n = self%cells(e)%obj%getNodes(nNodes)
|
||||
localK = self%cells(e)%obj%elemK(nNodes)
|
||||
DO c = 1, self%numCells
|
||||
associate(nNodes => self%cells(c)%obj%nNodes)
|
||||
ALLOCATE(n(1:nNodes))
|
||||
ALLOCATE(localK(1:nNodes, 1:nNodes))
|
||||
n = self%cells(c)%obj%getNodes(nNodes)
|
||||
localK = self%cells(c)%obj%elemK(nNodes)
|
||||
|
||||
DO i = 1, nNodes
|
||||
DO j = 1, nNodes
|
||||
self%K(n(i), n(j)) = self%K(n(i), n(j)) + localK(i, j)
|
||||
DO i = 1, nNodes
|
||||
DO j = 1, nNodes
|
||||
self%K(n(i), n(j)) = self%K(n(i), n(j)) + localK(i, j)
|
||||
|
||||
END DO
|
||||
|
||||
END DO
|
||||
|
||||
END DO
|
||||
DEALLOCATE(n, localK)
|
||||
|
||||
DEALLOCATE(n, localK)
|
||||
end associate
|
||||
|
||||
END DO
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue