Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ALEUpdateMassMatrix.f90
Go to the documentation of this file.
1 !*********************************************************************
2 !* Illinois Open Source License *
3 !* *
4 !* University of Illinois/NCSA *
5 !* Open Source License *
6 !* *
7 !* Copyright@2008, University of Illinois. All rights reserved. *
8 !* *
9 !* Developed by: *
10 !* *
11 !* Center for Simulation of Advanced Rockets *
12 !* *
13 !* University of Illinois *
14 !* *
15 !* www.csar.uiuc.edu *
16 !* *
17 !* Permission is hereby granted, free of charge, to any person *
18 !* obtaining a copy of this software and associated documentation *
19 !* files (the "Software"), to deal with the Software without *
20 !* restriction, including without limitation the rights to use, *
21 !* copy, modify, merge, publish, distribute, sublicense, and/or *
22 !* sell copies of the Software, and to permit persons to whom the *
23 !* Software is furnished to do so, subject to the following *
24 !* conditions: *
25 !* *
26 !* *
27 !* @ Redistributions of source code must retain the above copyright *
28 !* notice, this list of conditions and the following disclaimers. *
29 !* *
30 !* @ Redistributions in binary form must reproduce the above *
31 !* copyright notice, this list of conditions and the following *
32 !* disclaimers in the documentation and/or other materials *
33 !* provided with the distribution. *
34 !* *
35 !* @ Neither the names of the Center for Simulation of Advanced *
36 !* Rockets, the University of Illinois, nor the names of its *
37 !* contributors may be used to endorse or promote products derived *
38 !* from this Software without specific prior written permission. *
39 !* *
40 !* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
41 !* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
42 !* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
43 !* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
44 !* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
45 !* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
46 !* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
47 !* USE OR OTHER DEALINGS WITH THE SOFTWARE. *
48 !*********************************************************************
49 !* Please acknowledge The University of Illinois Center for *
50 !* Simulation of Advanced Rockets in works and publications *
51 !* resulting from this software or its derivatives. *
52 !*********************************************************************
53 SUBROUTINE aleupdatemassmatrix(glb)
54 
55 !!****f* Rocfrac/Rocfrac/Source/ALEUpdateMassMatrix.f90
56 !!
57 !! NAME
58 !! ALEUpdateMassMatrix
59 !!
60 !! FUNCTION
61 !! Updates the nodal coordinates as a result
62 !! of the regressing boundaries. Calculates
63 !! the new lumped inverse mass matrix from the new
64 !! nodal coordinates, MPI calls handle
65 !! communication between partition boundaries
66 !!
67 !! USED BY
68 !! RocfracMain
69 !!
70 !! USES
71 !! ROCSTAR_RocFrac -- Global variables
72 !! V3D4_MASS, V3D4N_MASS, V3D10_MASS
73 !!
74 !! INPUTS
75 !! glb -- global array
76 !!
77 !! OUTPUTS
78 !! xmass -- Inverse lumped mass matrix
79 !!
80 !!***
81 
82  USE rocstar_rocfrac
83 
84  IMPLICIT NONE
85  include 'mpif.h'
86 
87  INTEGER :: j, j1, k , k1
88  INTEGER :: ierr
89  INTEGER :: totnumndcomm3
90 
91 !-- UPDATE MESH POSITION
92 
93  DO j = 1, glb%NumNP
94  j1 = j*3
95  glb%MeshCoor(1,j) = glb%coor(1,j) + glb%DispBar(j1 - 2)
96  glb%MeshCoor(2,j) = glb%coor(2,j) + glb%DispBar(j1 - 1)
97  glb%MeshCoor(3,j) = glb%coor(3,j) + glb%DispBar(j1 )
98  ENDDO
99 
100 !-- UPDATE MASS MATRIX due to change in undeformed configuration
101 ! ***Warning ! initialize xm(j) first
102 
103  glb%xmass(:) = 0.d0
104  glb%TotalMassSolidp = 0.d0
105  IF(glb%iElType.EQ.4)THEN
106  IF( .NOT.(glb%NdBasedEl) )THEN
107  CALL v3d4_mass(glb%MeshCoor,glb%ElConnVol,glb%MatIdVol,glb%rho,glb%xmass, &
108  glb%NumNP,glb%NumElVol,glb%NumMatVol,1,glb%NumElPartBndry,glb%TotalMassSolidp)
109  ELSE IF(glb%NdBasedEl)THEN
110  CALL v3d4n_mass(glb%MeshCoor,glb%ElConnVol,glb%MatIdVol,glb%rho,glb%xmass, &
111  glb%NumNP,glb%NumElVol,glb%NumMatVol,1,glb%NumElVol,glb%TotalMassSolidp, &
112  glb%NumElNeigh,glb%ElConnNd,glb%AlphaR,glb%VolUndfmd)
113  ENDIF
114  ELSE
115  CALL v3d10_mass(glb%MeshCoor,glb%ElConnVol,glb%MatIdVol,glb%rho,glb%xmass, &
116  glb%NumNP,glb%NumElVol,glb%NumMatVol,1,glb%NumElPartBndry,glb%TotalMassSolidp)
117  ENDIF
118 !
119 !----- FORM THE BUFFER CONTAINING COMMUNICATED MASS MATRIX NODAL VALUES
120 !
121  totnumndcomm3 = glb%TotNumNdComm/3
122  ALLOCATE(buf(1:glb%TotNumNdComm3))
123  k1 = 1
124  DO j1 = 1, glb%TotNumNeighProcs
125  k = glb%NeighProcList(j1)
126  DO j = 1, glb%NumNdComm(j1)
127  buf(k1) = glb%xmass( glb%NdCommList(j1)%NdId(j) )
128  k1 = k1 + 1
129  ENDDO
130  ENDDO
131 !
132 !-MPI- RECEIVE THE RECIPRICAL MASS MATRIX DIAGONAL FROM THE NEIGHBORS
133 !
134  DO j1 = 1, glb%TotNumNeighProcs
135  k = glb%NeighProcList(j1)+1
136  CALL mpi_irecv(glb%RecvDataFrm(k)%rcvbuf(1),glb%NumNdComm(j1), &
137  mpi_double_precision,k-1,10,glb%MPI_COMM_ROCFRAC,glb%ReqRcv(j1),ierr)
138  ENDDO
139 !
140 !-MPI- SEND THE RECIPRICAL MASS MATRIX DIAGONAL TO THE NEIGHBORS
141 !
142  k1 = 1
143  DO j1 = 1, glb%TotNumNeighProcs
144  k = glb%NeighProcList(j1)
145  CALL mpi_isend(buf(k1),glb%NumNdComm(j1), &
146  mpi_double_precision,k,10,glb%MPI_COMM_ROCFRAC,glb%ReqSnd(j1),ierr)
147  k1 = k1 + glb%NumNdComm(j1)
148  ENDDO
149 !
150 !----- CALCULATE THE INTERIOR SUBMESH'S RECIPRICAL MASS MATRIX DIAGONAL
151 !
152  IF(glb%iElType.EQ.4)THEN
153  IF(glb%iSolnType.NE.10)THEN
154  CALL v3d4_mass(glb%MeshCoor,glb%ElConnVol,glb%MatIdVol,glb%rho,glb%xmass, &
155  glb%NumNP,glb%NumElVol,glb%NumMatVol,glb%NumElPartBndry+1,glb%NumElVol,glb%TotalMassSolidp)
156  ENDIF
157  ELSE
158  CALL v3d10_mass(glb%MeshCoor,glb%ElConnVol,glb%MatIdVol,glb%rho,glb%xmass, &
159  glb%NumNP,glb%NumElVol,glb%NumMatVol,glb%NumElPartBndry+1,glb%NumElVol,glb%TotalMassSolidp)
160  ENDIF
161 !
162 !-MPI- WAIT FOR THE RECIPRICAL MASS MATRIX DIAGONAL COMMUNICATION
163 ! TO COMPLETE
164 !
165  IF(glb%TotNumNeighProcs.GT.0)THEN
166  CALL mpi_waitall(glb%TotNumNeighProcs,glb%ReqRcv,glb%StatRcv,ierr)
167  CALL mpi_waitall(glb%TotNumNeighProcs,glb%ReqSnd,glb%StatSnd,ierr)
168  ENDIF
169  DEALLOCATE(buf)
170 !
171 !----- ADD NEIGHBOR'S CONTRIBUTION TO THE RECIPRICAL MASS
172 ! MATRIX DIAGONAL
173 !
174  DO j1 = 1, glb%TotNumNeighProcs
175  k = glb%NeighProcList(j1)+1
176  DO j = 1, glb%NumNdComm(j1)
177  k1 = glb%NdCommList(j1)%NdId(j)
178  glb%xmass(k1) = glb%xmass(k1) + glb%RecvDataFrm(k)%rcvbuf(j)
179  ENDDO
180  ENDDO
181 
182  glb%xmass(:) = 1.d0/glb%xmass(:)
183 
184  RETURN
185  END
186 
subroutine v3d4_mass(coor, lmcstet, matcstet, rho, xm, numnp, numcstet, numat_vol, nstart, nend)
Definition: v3d4_mass.f90:53
j indices k indices k
Definition: Indexing.h:6
subroutine v3d10_mass(coor, lmcstet, matcstet, rho, xm, numnp, numcstet, numat_vol, nstart, nend, TotalMass)
Definition: v3d10_mass.f90:53
subroutine aleupdatemassmatrix(glb)
j indices j
Definition: Indexing.h:6
subroutine v3d4n_mass(coor, lmcstet, matcstet, rho, xm, numnp, numcstet, numat_vol, nstart, nend, TotalMass, NumElNeigh, ElConn, Alpha, Vhat)
Definition: v3d4n_mass.f90:53