Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_CalcThrust.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: calculate amount of thrust for a region.
26 !
27 ! Description: none.
28 !
29 ! Input: region%levels%mixt = flow variables
30 ! region%levels%grid%si/j/k = face vectors (at boundaries)
31 !
32 ! Output: global%thrustTotal = thrust
33 !
34 ! Notes: none.
35 !
36 !******************************************************************************
37 !
38 ! $Id: RFLO_CalcThrust.F90,v 1.3 2008/12/06 08:44:26 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2003 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE rflo_calcthrust( region )
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  TYPE(t_region) :: region
60 
61 ! ... loop variables
62  INTEGER :: ipatch, i, j, k
63 
64 ! ... local variables
65  INTEGER :: ilev, lbound, ibeg, iend, jbeg, jend, kbeg, kend, idir, jdir, kdir
66  INTEGER :: icoff, ijcoff, inoff, ijnoff, ijkc, ijkn
67  INTEGER :: inode, jnode, knode
68 
69  REAL(RFREAL) :: sgn, thrustmom, thrustpress, rhoua, rhova, rhowa, &
70  ua, va, wa, ds
71  REAL(RFREAL), POINTER :: cv(:,:), dv(:,:), sface(:,:)
72 
73  TYPE(t_patch), POINTER :: patch
74 
75 !******************************************************************************
76 
77  CALL registerfunction( region%global,'RFLO_CalcThrust',&
78  'RFLO_CalcThrust.F90' )
79 
80 ! get dimensions and pointers -------------------------------------------------
81 
82  ilev = region%currLevel
83 
84  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
85  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
86 
87  cv => region%levels(ilev)%mixt%cv
88  dv => region%levels(ilev)%mixt%dv
89 
90  thrustmom = region%global%thrustMom
91  thrustpress = region%global%thrustPress
92 
93 ! loop over patches -----------------------------------------------------------
94 
95  DO ipatch=1,region%nPatches
96 
97  patch => region%levels(ilev)%patches(ipatch)
98 
99  IF (patch%thrustCalc) THEN
100 
101 ! --- get dimensions of the patch
102 
103  lbound = patch%lbound
104 
105  CALL rflo_getpatchindices( region,patch,ilev, &
106  ibeg,iend,jbeg,jend,kbeg,kend )
108 
109 ! --- to take the right face vector and make it point outwards
110 
111  sgn = +1._rfreal
112  inode = 0
113  jnode = 0
114  knode = 0
115  IF (lbound==2 .OR. lbound==4 .OR. lbound==6) THEN
116  sgn = -1._rfreal
117  inode = -idir
118  jnode = -jdir
119  knode = -kdir
120  ENDIF
121 
122 ! --- get the appropriate face vector
123 
124  IF (lbound==1 .OR. lbound==2) sface => region%levels(ilev)%grid%si
125  IF (lbound==3 .OR. lbound==4) sface => region%levels(ilev)%grid%sj
126  IF (lbound==5 .OR. lbound==6) sface => region%levels(ilev)%grid%sk
127 
128 ! --- loop over all cells of the patch
129 
130  DO k=kbeg,kend
131  DO j=jbeg,jend
132  DO i=ibeg,iend
133  ijkc = indijk(i,j,k,icoff,ijcoff)
134  ijkn = indijk(i+inode,j+jnode,k+knode,inoff,ijnoff)
135  rhoua = cv(cv_mixt_xmom,ijkc)
136  rhova = cv(cv_mixt_ymom,ijkc)
137  rhowa = cv(cv_mixt_zmom,ijkc)
138  ua = dv(dv_mixt_uvel,ijkc)
139  va = dv(dv_mixt_vvel,ijkc)
140  wa = dv(dv_mixt_wvel,ijkc)
141  thrustmom = sgn*sface(xcoord,ijkn)*rhoua*ua + &
142  sgn*sface(ycoord,ijkn)*rhova*va + &
143  sgn*sface(zcoord,ijkn)*rhowa*wa + thrustmom
144  IF (region%global%thrustType == thrust_momp) THEN
145  ds = sqrt(sface(xcoord,ijkn)*sface(xcoord,ijkn)+ &
146  sface(ycoord,ijkn)*sface(ycoord,ijkn)+ &
147  sface(zcoord,ijkn)*sface(zcoord,ijkn))
148  thrustpress = (dv(dv_mixt_pres,ijkc)- &
149  region%global%thrustPamb)*ds + thrustpress
150  ENDIF
151  ENDDO
152  ENDDO
153  ENDDO
154 
155  ENDIF ! thrustCalc
156 
157  ENDDO ! iPatch
158 
159 ! finalize --------------------------------------------------------------------
160 
161  region%global%thrustMom = thrustmom
162  region%global%thrustPress = thrustpress
163 
164  CALL deregisterfunction( region%global )
165 
166 END SUBROUTINE rflo_calcthrust
167 
168 !******************************************************************************
169 !
170 ! RCS Revision history:
171 !
172 ! $Log: RFLO_CalcThrust.F90,v $
173 ! Revision 1.3 2008/12/06 08:44:26 mtcampbe
174 ! Updated license.
175 !
176 ! Revision 1.2 2008/11/19 22:17:37 mtcampbe
177 ! Added Illinois Open Source License/Copyright
178 !
179 ! Revision 1.1 2004/11/29 20:51:38 wasistho
180 ! lower to upper case
181 !
182 ! Revision 1.5 2003/11/20 16:40:37 mdbrandy
183 ! Backing out RocfluidMP changes from 11-17-03
184 !
185 ! Revision 1.1 2003/06/02 17:12:00 jblazek
186 ! Added computation of thrust.
187 !
188 !******************************************************************************
189 
190 
191 
192 
193 
194 
195 
**********************************************************************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
subroutine rflo_getpatchdirection(patch, idir, jdir, kdir)
**********************************************************************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 inode
j indices k indices k
Definition: Indexing.h:6
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_getpatchindices(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
double sqrt(double d)
Definition: double.h:73
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
**********************************************************************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 jdir
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
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 idir
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
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 kdir
**********************************************************************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
**********************************************************************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
subroutine rflo_calcthrust(region)
**********************************************************************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 jnode