Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rocstar/RFLO_GetDeformation.F90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !******************************************************************************
24 !
25 ! Purpose: obtain deformation to boundary nodes from GenX.
26 !
27 ! Description: none.
28 !
29 ! Input: region = grid dimensions and topology
30 ! boundMoved = flag for boundaries of region which have moved.
31 !
32 ! Output: dNode = deformations at all six boundaries.
33 !
34 ! Notes: variable dNode contains the whole 3-D field.
35 !
36 !******************************************************************************
37 !
38 ! $Id: RFLO_GetDeformation.F90,v 1.8 2009/08/12 04:15:57 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2001 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE rflo_getdeformation( region,boundMoved,dNode )
45 
46  USE moddatatypes
47  USE modbndpatch, ONLY : t_patch
48  USE moddatastruct, ONLY : t_region
49  USE modglobal, ONLY : t_global
52  USE moderror
53  USE modparameters
54  IMPLICIT NONE
55 
56 #include "Indexing.h"
57 
58 ! ... parameters
59  LOGICAL :: boundmoved(6)
60 
61  REAL(RFREAL), POINTER :: dnode(:,:)
62 
63  TYPE(t_region) :: region
64 
65 ! ... loop variables
66  INTEGER :: ipatch, i, j, k, ng1, ng2, ijkn
67 
68 ! ... local variables
69  INTEGER :: ilev, lbound, ibeg, iend, jbeg, jend, kbeg, kend, inoff, ijnoff
70  INTEGER :: ipnbeg, ipnend, jpnbeg, jpnend, kpnbeg, kpnend, nfixed
71  LOGICAL, POINTER :: allexternal(:)
72 
73  TYPE(t_global), POINTER :: global
74  TYPE(t_patch), POINTER :: patch
75 
76  REAL(RFREAL) :: dextrem(1:2),dist
77 
78 !******************************************************************************
79 
80  global => region%global
81 
82  CALL registerfunction( global,'RFLO_GetDeformation',&
83  'RFLO_GetDeformation.F90' )
84 
85 ! initialize variables --------------------------------------------------------
86 
87  ilev = 1 ! finest grid
88  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
89  CALL rflo_getdimensphysnodes( region,ilev,ipnbeg,ipnend, &
90  jpnbeg,jpnend,kpnbeg,kpnend )
91 
92 ! zero out displacements
93 
94  dnode(:,:) = 0._rfreal
95 
96 ! reset boundary movement flags
97 
98  allexternal => region%levels(ilev)%grid%allExternal
99  boundmoved(:) = .false.
100  allexternal(:) = .false.
101 
102 ! obtain displacements --------------------------------------------------------
103 
104  IF ( global%myProcid == 0 .AND. &
105  global%verbLevel >= verbose_high ) THEN
106  WRITE(stdout,'(A,1X,A,1X,I3)') solver_name, &
107  'Getting displacements from Rocstar....'
108  END IF ! global%myProcid
109 
110 
111  DO ipatch=1,region%nPatches
112  patch => region%levels(ilev)%patches(ipatch)
113  lbound = patch%lbound
114  dextrem(2) = 10.0_rfreal
115  dextrem(1) = 0._rfreal
116  nfixed = 0
117  IF (patch%bcMotion == bc_external) THEN
118  CALL rflo_getpatchindicesnodes( region,patch,ilev, &
119  ibeg,iend,jbeg,jend,kbeg,kend )
120  boundmoved(lbound) = .true.
121 
122  DO k=kbeg,kend
123  DO j=jbeg,jend
124  DO i=ibeg,iend
125  ijkn = indijk(i,j,k,inoff,ijnoff)
126  IF (lbound==1 .OR. lbound==2) THEN
127  IF (lbound == 2) THEN
128  ng1 = j - jbeg + 1
129  ELSE
130  ng1 = jend - j + 1
131  ENDIF
132  ng2 = k - kbeg + 1
133  ELSE IF (lbound==3 .OR. lbound==4) THEN
134  ng1 = k - kbeg + 1
135  IF (lbound == 4) THEN
136  ng2 = i - ibeg + 1
137  ELSE
138  ng2 = iend - i + 1
139  ENDIF
140  ELSE IF (lbound==5 .OR. lbound==6) THEN
141  IF (lbound == 6) THEN
142  ng1 = i - ibeg + 1
143  ELSE
144  ng1 = iend - i + 1
145  ENDIF
146  ng2 = j - jbeg + 1
147  ENDIF
148  dnode(xcoord,ijkn) = patch%duAlp(1,ng1,ng2)
149  dnode(ycoord,ijkn) = patch%duAlp(2,ng1,ng2)
150  dnode(zcoord,ijkn) = patch%duAlp(3,ng1,ng2)
151  dist = sqrt(dnode(xcoord,ijkn)*dnode(xcoord,ijkn) +&
152  dnode(ycoord,ijkn)*dnode(ycoord,ijkn) + &
153  dnode(zcoord,ijkn)*dnode(zcoord,ijkn))
154  if(dist > dextrem(2)) dextrem(2) = dist
155  if(dist < dextrem(1)) dextrem(1) = dist
156  if(dist < 1e-12_rfreal) nfixed = nfixed + 1
157  ENDDO
158  ENDDO
159  ENDDO
160 ! WRITE(*,*) 'MOTION EXTREMA FOR PATCH: ',dextrem(1),dextrem(2),nfixed
161  IF (lbound==1 .OR. lbound==2) THEN
162  IF (jbeg==jpnbeg .AND. jend==jpnend .AND. &
163  kbeg==kpnbeg .AND. kend==kpnend) THEN
164  allexternal(lbound) = .true.
165  ENDIF
166  ELSEIF (lbound==3 .OR. lbound==4) THEN
167  IF (ibeg==ipnbeg .AND. iend==ipnend .AND. &
168  kbeg==kpnbeg .AND. kend==kpnend) THEN
169  allexternal(lbound) = .true.
170  ENDIF
171  ELSEIF (lbound==5 .OR. lbound==6) THEN
172  IF (ibeg==ipnbeg .AND. iend==ipnend .AND. &
173  jbeg==jpnbeg .AND. jend==jpnend) THEN
174  allexternal(lbound) = .true.
175  ENDIF
176  ENDIF
177 
178  ELSE ! external BC
179  ! IF(patch%bcMotion .ne. BC_EXTERNAL) THEN
180  IF (patch%mixt%setMotion .AND. &
181  global%verbLevel >= verbose_high) THEN
182  WRITE(*,*) 'SETTING MOTION ON PATCH '
183  CALL rflo_getpatchindicesnodes( region,patch,ilev, &
184  ibeg,iend,jbeg,jend,kbeg,kend )
185  boundmoved(lbound) = .true.
186 
187  DO k=kbeg,kend
188  DO j=jbeg,jend
189  DO i=ibeg,iend
190  ijkn = indijk(i,j,k,inoff,ijnoff)
191  if(dnode(xcoord,ijkn) .eq. 0) then
192  dnode(xcoord,ijkn) = patch%mixt%bndVel(xcoord)*global%dtMin
193  endif
194  if(dnode(ycoord,ijkn) .eq. 0) then
195  dnode(ycoord,ijkn) = patch%mixt%bndVel(ycoord)*global%dtMin
196  endif
197  if(dnode(xcoord,ijkn) .eq. 0) then
198  dnode(zcoord,ijkn) = patch%mixt%bndVel(zcoord)*global%dtMin
199  endif
200  ENDDO
201  ENDDO
202  ENDDO
203 
204  ENDIF ! motion prescribed internally
205  ENDIF ! external BC
206  ENDDO ! iPatch
207 
208 ! finalize --------------------------------------------------------------------
209  IF ( global%myProcid == 0 .AND. &
210  global%verbLevel >= verbose_high ) THEN
211  WRITE(stdout,'(A,1X,A,1X,I3)') solver_name, &
212  'Getting displacements from Rocstar done.'
213  END IF ! global%myProcid
214 
215 999 CALL deregisterfunction( global )
216 
217 END SUBROUTINE rflo_getdeformation
218 
219 !******************************************************************************
220 !
221 ! RCS Revision history:
222 !
223 ! $Log: RFLO_GetDeformation.F90,v $
224 ! Revision 1.8 2009/08/12 04:15:57 mtcampbe
225 ! Major update, bugfix from Abe development, more propagation compatibility,
226 ! some Rocstar IO changes, Ju's temporary clipping fix for turbulence. A bug
227 ! fix for initialization IO.
228 !
229 ! Revision 1.7 2008/12/06 08:44:00 mtcampbe
230 ! Updated license.
231 !
232 ! Revision 1.6 2008/11/19 22:17:14 mtcampbe
233 ! Added Illinois Open Source License/Copyright
234 !
235 ! Revision 1.5 2006/08/19 15:37:49 mparmar
236 ! Renamed patch variables
237 !
238 ! Revision 1.4 2005/09/28 20:49:26 wasistho
239 ! modified for non-external moving boundary
240 !
241 ! Revision 1.3 2005/06/13 21:45:33 wasistho
242 ! changed patch%bcCoupled to patch%bcMotion
243 !
244 ! Revision 1.2 2005/06/05 23:03:02 wasistho
245 ! distinguish external boundary to be fully and partly external
246 !
247 ! Revision 1.1 2004/12/01 21:23:50 haselbac
248 ! Initial revision after changing case
249 !
250 ! Revision 1.8 2004/11/13 22:37:41 wasistho
251 ! invert orientation of genx-surface-variables
252 !
253 ! Revision 1.7 2003/11/20 16:40:33 mdbrandy
254 ! Backing out RocfluidMP changes from 11-17-03
255 !
256 ! Revision 1.4 2003/05/15 02:57:00 jblazek
257 ! Inlined index function.
258 !
259 ! Revision 1.3 2002/10/10 23:49:48 jblazek
260 ! Changed orientation of surface grid.
261 !
262 ! Revision 1.2 2002/09/27 00:57:09 jblazek
263 ! Changed makefiles - no makelinks needed.
264 !
265 ! Revision 1.1 2002/09/20 22:22:34 jblazek
266 ! Finalized integration into GenX.
267 !
268 !******************************************************************************
269 
270 
271 
272 
273 
274 
275 
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE ibeg
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE jpnbeg
j indices k indices k
Definition: Indexing.h:6
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE kpnbeg
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
double sqrt(double d)
Definition: double.h:73
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE jpnend
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
Definition: patch.h:74
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
subroutine rflo_getpatchindicesnodes(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
blockLoc i
Definition: read.cpp:79
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE ipnbeg
subroutine rflo_getdeformation(region, boundMoved, dNode)
subroutine rflo_getdimensphysnodes(region, iLev, ipnbeg, ipnend, jpnbeg, jpnend, kpnbeg, kpnend)
j indices j
Definition: Indexing.h:6
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode jend
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode jbeg
long double dist(long double *coord1, long double *coord2, int size)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode kbeg
subroutine deregisterfunction(global)
Definition: ModError.F90:469
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE ipnend