Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
INRT_TwoDimAverage.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: Average the cv variables for fluid and smoke in some direction
26 !
27 ! Description: none.
28 !
29 ! Input: region = data of current region.
30 !
31 ! Output: region%levels%mixt%cv
32 ! region%levels%peul%cv
33 ! region%levels%plag%cv
34 !
35 ! Notes: none.
36 !
37 !******************************************************************************
38 !
39 ! $Id: INRT_TwoDimAverage.F90,v 1.4 2008/12/06 08:44:32 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2004 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE inrt_twodimaverage( region )
46 
47  USE moddatatypes
48  USE moddatastruct, ONLY : t_region
49  USE modglobal, ONLY : t_global
50  USE moderror
51  USE modparameters
53 #ifdef PLAG
55 #endif
56 
58  IMPLICIT NONE
59 
60 #include "Indexing.h"
61 
62 ! ... parameters
63  TYPE(t_region), INTENT(INOUT) :: region
64 
65 ! ... loop variables
66  INTEGER :: i,j,k,ipcls
67 
68 ! ... local variables
69  CHARACTER(CHRLEN) :: rcsidentstring
70 
71  INTEGER :: ipcbeg,ipcend,jpcbeg,jpcend,kpcbeg,kpcend
72  INTEGER :: ilev,icoff,ijcoff,ijkc0
73  INTEGER :: npcls
74 
75  REAL(RFREAL), POINTER, DIMENSION(:,:) :: mixtcv,peulcv,plagcv
76 
77  TYPE(t_global), POINTER :: global
78 
79 !******************************************************************************
80 
81  rcsidentstring = '$RCSfile: INRT_TwoDimAverage.F90,v $ $Revision: 1.4 $'
82 
83  global => region%global
84 
85  CALL registerfunction( global,'INRT_TwoDimAverage',&
86  'INRT_TwoDimAverage.F90' )
87 
88 ! begin -----------------------------------------------------------------------
89 
90 ! get dimensions and pointers -------------------------------------------------
91 
92  ilev = region%currLevel
93 
94  CALL rflo_getdimensphys( region,ilev,ipcbeg,ipcend, &
95  jpcbeg,jpcend,kpcbeg,kpcend )
96  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
97 
98  mixtcv => region%levels(ilev)%mixt%cv
99 #ifdef PEUL
100  peulcv => region%levels(ilev)%peul%cv
101 #endif
102 #ifdef PLAG
103  plagcv => region%levels(ilev)%plag%cv
104 #endif
105 
106  SELECT CASE (region%inrtInput%twoDAverage)
107 
108  CASE (0)
109  CONTINUE ! do not average
110 
111  CASE (1)
112 
113 ! - zero z-momentum of gas ----------------------------------------------------
114 
115  DO k=kpcbeg,kpcend
116  DO j=jpcbeg,jpcend
117  DO i=ipcbeg,ipcend
118 
119  ijkc0 = indijk(i,j,k,icoff,ijcoff)
120  mixtcv(cv_mixt_zmom,ijkc0) = 0._rfreal
121 
122  END DO ! i
123  END DO ! j
124  END DO ! k
125 
126 ! - zero z-momentum of Lagrangian particles -----------------------------------
127 
128 #ifdef PLAG
129  npcls = 0
130  IF (global%plagUsed) npcls = region%levels(ilev)%plag%nPcls
131  IF (npcls > 0) THEN
132 
133  DO ipcls = 1,npcls
134  plagcv(cv_plag_zmom,ipcls) = 0._rfreal
135  END DO ! iPcls
136 
137  END IF ! nPcls
138 #endif
139 
140  CALL k_average(mixtcv,cv_mixt_neqs)
141 
142 #ifdef PEUL
143  IF (global%peulUsed) THEN
144  CALL k_average(peulcv,region%levels(ilev)%peul%nCv)
145  END IF ! peulUsed
146 #endif
147 
148  CASE default
149  CALL errorstop(global,err_reached_default,__line__)
150 
151  END SELECT ! twoDAverage
152 
153 ! finalize --------------------------------------------------------------------
154 
155  CALL deregisterfunction( global )
156 
157 CONTAINS
158 
159 ! average in k-direction ------------------------------------------------------
160 
161  SUBROUTINE k_average(cv,nCv)
162 
163  REAL(RFREAL), POINTER :: cv(:,:)
164  INTEGER, INTENT(IN) :: ncv
165 
166  INTEGER :: icv
167  REAL(RFREAL) :: csum,vsum
168  REAL(RFREAL), POINTER :: vol(:)
169 
170  vol => region%levels(ilev)%grid%vol
171 
172  DO j=jpcbeg,jpcend
173  DO i=ipcbeg,ipcend
174  DO icv = 1,ncv
175 
176  csum = 0._rfreal
177  vsum = 0._rfreal
178  DO k=kpcbeg,kpcend
179  ijkc0 = indijk(i,j,k,icoff,ijcoff)
180  csum = csum + vol(ijkc0) * cv(icv,ijkc0)
181  vsum = vsum + vol(ijkc0)
182  END DO ! k
183  csum = csum / vsum
184 
185  DO k=kpcbeg,kpcend
186  ijkc0 = indijk(i,j,k,icoff,ijcoff)
187  cv(icv,ijkc0) = csum
188  END DO ! k
189 
190  END DO ! iCv
191  END DO ! i
192  END DO ! j
193 
194  END SUBROUTINE k_average
195 
196 END SUBROUTINE inrt_twodimaverage
197 
198 !******************************************************************************
199 !
200 ! RCS Revision history:
201 !
202 ! $Log: INRT_TwoDimAverage.F90,v $
203 ! Revision 1.4 2008/12/06 08:44:32 mtcampbe
204 ! Updated license.
205 !
206 ! Revision 1.3 2008/11/19 22:17:44 mtcampbe
207 ! Added Illinois Open Source License/Copyright
208 !
209 ! Revision 1.2 2006/02/15 20:17:03 wasistho
210 ! put peul and plag within ifdef
211 !
212 ! Revision 1.1 2004/12/01 21:56:47 fnajjar
213 ! Initial revision after changing case
214 !
215 ! Revision 1.2 2004/03/05 22:09:03 jferry
216 ! created global variables for peul, plag, and inrt use
217 !
218 ! Revision 1.1 2004/03/02 21:47:29 jferry
219 ! Added After Update interactions
220 !
221 !******************************************************************************
222 
223 
224 
225 
226 
227 
228 
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 kpcbeg
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
**********************************************************************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 jpcbeg
**********************************************************************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 ipcend
**********************************************************************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 ipcbeg
subroutine inrt_twodimaverage(region)
blockLoc i
Definition: read.cpp:79
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
subroutine k_average(cv, nCv)
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 jpcend
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine rflo_getdimensphys(region, iLev, ipcbeg, ipcend, jpcbeg, jpcend, kpcbeg, kpcend)