Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UpdateR_bar.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 updaterbar(glb,Rnet)
54 
55  USE rocstar_rocfrac
56 
57  IMPLICIT NONE
58  include 'mpif.h'
59 
60  TYPE(rocfrac_global) :: glb
61 
62  REAL*8, ALLOCATABLE, DIMENSION(:) :: buf
63  REAL*8, DIMENSION(1:3*glb%NumNP) :: rnet
64 
65  INTEGER :: j, j1, k , k1, k2
66  INTEGER :: ierr
67 
68  IF(glb%iElType.EQ.4)THEN
69  CALL v3d4_r_bar(glb%DispBar,rnet, &
70  glb%NumNP,glb%NumElVol,glb%ElConnVol,glb%MeshCoor,1,glb%NumElPartBndry)
71  ELSE
72  CALL v3d10_r_bar(glb%DispBar,rnet, &
73  glb%NumNP,glb%NumElVol,glb%ElConnVol,glb%MeshCoor,1,glb%NumElPartBndry)
74  ENDIF
75 !
76 !----- FORM THE BUFFER CONTAINING COMMUNICATED NODAL VALUES
77 !
78  ALLOCATE(buf(1:glb%TotNumNdComm))
79  k1 = 1
80  DO j1 = 1, glb%TotNumNeighProcs
81  k = glb%NeighProcList(j1)
82  DO j = 1, glb%NumNdComm(j1)
83  k2 = 3*glb%NdCommList(j1)%NdId(j)
84  buf(k1) = rnet( k2 - 2 )
85  buf(k1+1) = rnet( k2 - 1 )
86  buf(k1+2) = rnet( k2 )
87  k1 = k1 + 3
88  ENDDO
89  ENDDO
90 
91 !
92 !-MPI- RECEIVE THE INTERNAL FORCE VECTOR FROM THE NEIGHBORS
93 !
94  DO j1 = 1, glb%TotNumNeighProcs
95  k = glb%NeighProcList(j1)+1
96  CALL mpi_irecv(glb%RecvDataFrm(k)%rcvbuf(1), &
97  glb%NumNdComm(j1)*3,mpi_double_precision,k-1,10,glb%MPI_COMM_ROCFRAC, &
98  glb%ReqRcv(j1),ierr)
99  ENDDO
100 !
101 !-MPI- SEND THE INTERNAL FORCE VECTOR TO THE NEIGHBORS
102 !
103  k1 = 1
104  DO j1 = 1, glb%TotNumNeighProcs
105  k = glb%NeighProcList(j1)
106  CALL mpi_isend(buf(k1),glb%NumNdComm(j1)*3,mpi_double_precision, &
107  k,10,glb%MPI_COMM_ROCFRAC,glb%ReqSnd(j1),ierr)
108  k1 = k1 + glb%NumNdComm(j1)*3
109  ENDDO
110 !
111 !----- CALCULATE THE INTERIOR SUBMESH'S INTERNAL FORCE VECTOR
112 !
113  IF(glb%iElType.EQ.4)THEN
114  CALL v3d4_r_bar(glb%DispBar,rnet, &
115  glb%NumNP,glb%NumElVol,glb%ElConnVol,glb%MeshCoor,glb%NumElPartBndry+1,glb%NumElVol)
116  ELSE
117  CALL v3d10_r_bar(glb%DispBar,rnet, &
118  glb%NumNP,glb%NumElVol,glb%ElConnVol,glb%MeshCoor,glb%NumElPartBndry+1,glb%NumElVol)
119  ENDIF
120 !
121 !-MPI- WAIT FOR INTERNAL FORCE VECTOR COMMUNICATION TO COMPLETE
122 !
123  IF(glb%TotNumNeighProcs.GT.0)THEN
124  CALL mpi_waitall(glb%TotNumNeighProcs,glb%ReqRcv,glb%StatRcv,ierr)
125  CALL mpi_waitall(glb%TotNumNeighProcs,glb%ReqSnd,glb%StatSnd,ierr)
126  ENDIF
127  DEALLOCATE(buf)
128 !
129 !----- ADD NEIGHBOR'S CONTRIBUTION TO THE INTERNAL FORCE VECTOR
130 !
131  DO j1 = 1, glb%TotNumNeighProcs
132  k = glb%NeighProcList(j1)+1
133  k1 = 1
134  DO j = 1, glb%NumNdComm(j1)
135  k2 = ( glb%NdCommList(j1)%NdId(j) )*3
136  rnet(k2-2)= rnet(k2-2) + glb%RecvDataFrm(k)%rcvbuf(k1)
137  rnet(k2-1)= rnet(k2-1) + glb%RecvDataFrm(k)%rcvbuf(k1+1)
138  rnet(k2) = rnet(k2) + glb%RecvDataFrm(k)%rcvbuf(k1+2)
139  k1 = k1 + 3
140  ENDDO
141  ENDDO
142 
143  RETURN
144 END SUBROUTINE updaterbar
145 
j indices k indices k
Definition: Indexing.h:6
subroutine v3d10_r_bar(d_bar, R_bar, numnp, numlstet, lmlstet, meshcoor, nstart, nend)
Definition: v3d10_r_bar.f90:59
subroutine v3d4_r_bar(d_bar, R_bar, numnp, NumElv, lmcstet, meshcoor, nstart, nend)
Definition: v3d4_r_bar.f90:53
subroutine updaterbar(glb, Rnet)
Definition: UpdateR_bar.f90:53
j indices j
Definition: Indexing.h:6