Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TURB_InitRocstarInterface.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: register turbulence variables with GenX.
26 !
27 ! Description: none.
28 !
29 ! Input: regions = patches and region (volume) variables
30 !
31 ! Output: to Roccom via RFLO_initGenxInterface.
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: TURB_InitGenxInterface.F90,v 1.7 2008/12/06 08:44:01 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2002 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE turb_initgenxinterface( regions,wins,winv )
44 
45  USE moddatatypes
46  USE modglobal, ONLY : t_global
47 #ifdef RFLO
48  USE moddatastruct, ONLY : t_region
50 #include "Indexing.h"
51 #endif
52  USE moderror
53  USE modparameters
55  IMPLICIT NONE
56  include 'roccomf90.h'
57 
58 ! ... parameters
59  CHARACTER(CHRLEN) :: wins, winv
60  TYPE(t_region), POINTER :: regions(:)
61 
62 ! ... loop variables
63  INTEGER :: ireg
64 
65 ! ... local variables
66 #ifdef STATS
67  CHARACTER(CHRLEN), POINTER :: statnm(:,:,:)
68  INTEGER :: istat
69 #endif
70  INTEGER :: ilev, ibc, iec, pid, errorflag, ilb
71  INTEGER :: icoff, ijcoff, idcbeg, idcend, jdcbeg, jdcend, kdcbeg, kdcend
72 
73  TYPE(t_global), POINTER :: global
74 
75 !******************************************************************************
76 
77  global => regions(1)%global
78 
79  CALL registerfunction( global,'TURB_InitGenxInterface',&
80  'TURB_InitRocstarInterface.F90' )
81 
82 ! input data (currently none) -------------------------------------------------
83 
84 ! output global data
85 
86  CALL com_new_attribute( trim(winv)//'.esg1Sum' ,'w',com_double,1,'J/(m^3s)' )
87  CALL com_new_attribute( trim(winv)//'.esg4Sum' ,'w',com_double,1,'J/(m^3s)' )
88 
89 ! output surface data (currently none)
90 
91 ! output volume (for visualization) and restart data
92 
93  CALL com_new_attribute( trim(winv)//'.mut' ,'e',com_double,1,'kg/(ms)' )
94  CALL com_new_attribute( trim(winv)//'.lens','e',com_double,1,'m' )
95  CALL com_new_attribute( trim(winv)//'.vort','e',com_double,3,'1/s' )
96 
97 ! statistics
98 
99 #ifdef STATS
100  IF ((global%flowType == flow_unsteady) .AND. (global%doStat == active)) THEN
101  IF (global%turbNStat > 0) THEN
102  statnm => global%turbStatNm
103  DO istat=1,global%turbNStat
104 
105  CALL com_new_attribute( trim(winv)//'.'//trim(statnm(1,1,istat)),'e', &
106  com_double,1,trim(statnm(1,2,istat)) )
107  ENDDO
108  ENDIF
109  ENDIF
110 #endif
111 
112 ! store pointers to variables, loop over all regions --------------------------
113 
114 ! global data
115 
116  CALL com_set_array( trim(winv)//'.esg1Sum' ,0, global%esg1Sum )
117  CALL com_set_array( trim(winv)//'.esg4Sum' ,0, global%esg4Sum )
118 
119  DO ireg=1,global%nRegions
120  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
121  regions(ireg)%active==active) THEN ! on my processor
122 
123  ilev = regions(ireg)%currLevel
124 
125 ! --- volume data
126 
127  pid = ireg*regoff
128 
129  CALL rflo_getdimensdummy( regions(ireg),ilev,idcbeg,idcend, &
130  jdcbeg,jdcend,kdcbeg,kdcend )
131  CALL rflo_getcelloffset( regions(ireg),ilev,icoff,ijcoff )
132  ibc = indijk(idcbeg,jdcbeg,kdcbeg,icoff,ijcoff)
133  iec = indijk(idcend,jdcend,kdcend,icoff,ijcoff)
134 
135  IF (regions(ireg)%turbInput%modelClass /= model_rans) THEN
136  ALLOCATE( regions(ireg)%levels(ilev)%turb%lens(ibc:iec), &
137  stat=errorflag )
138  global%error = errorflag
139  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
140  ENDIF
141  IF (regions(ireg)%mixtInput%turbModel == turb_model_none) THEN
142  ALLOCATE( regions(ireg)%levels(ilev)%turb%vort(3,ibc:iec), &
143  stat=errorflag )
144  global%error = errorflag
145  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
146  ENDIF
147 
148  regions(ireg)%levels(ilev)%mixt%tv = 0._rfreal
149  regions(ireg)%levels(ilev)%turb%lens = 0._rfreal
150  regions(ireg)%levels(ilev)%turb%vort = 0._rfreal
151 
152  ilb = lbound(regions(ireg)%levels(ilev)%mixt%tv,2)
153 
154  CALL com_set_array( trim(winv)//'.lens' ,pid, &
155  regions(ireg)%levels(ilev)%turb%lens )
156 
157  CALL com_set_array( trim(winv)//'.mut',pid, &
158  regions(ireg)%levels(ilev)%mixt%tv(3,ilb),4)
159 
160  CALL com_set_array( trim(winv)//'.vort',pid, &
161  regions(ireg)%levels(ilev)%turb%vort(1,ilb))
162 
163 ! --- statistics
164 
165 #ifdef STATS
166  IF ((global%flowType==flow_unsteady) .AND. (global%doStat==active)) THEN
167  IF (global%turbNStat > 0) THEN
168  DO istat=1,global%turbNStat
169  CALL com_set_array( trim(winv)//'.'//trim(statnm(1,1,istat)), pid, &
170  regions(ireg)%levels(ilev)%turb%tav(istat,ilb), global%turbNStat)
171  ENDDO
172  ENDIF
173  ENDIF
174 #endif
175 
176  ENDIF ! region on this processor and active
177  ENDDO ! iReg
178 
179 ! finalize --------------------------------------------------------------------
180 
181  CALL deregisterfunction( global )
182 
183 END SUBROUTINE turb_initgenxinterface
184 
185 !******************************************************************************
186 !
187 ! RCS Revision history:
188 !
189 ! $Log: TURB_InitGenxInterface.F90,v $
190 ! Revision 1.7 2008/12/06 08:44:01 mtcampbe
191 ! Updated license.
192 !
193 ! Revision 1.6 2008/11/19 22:17:15 mtcampbe
194 ! Added Illinois Open Source License/Copyright
195 !
196 ! Revision 1.5 2005/12/07 20:03:43 wasistho
197 ! removed attemp to store actual tav i.o. accumulated
198 !
199 ! Revision 1.4 2005/12/07 04:44:06 wasistho
200 ! modified statistics treatment
201 !
202 ! Revision 1.3 2005/12/07 02:23:50 wasistho
203 ! added integrTime with eps
204 !
205 ! Revision 1.2 2005/12/06 21:53:05 wasistho
206 ! devided and multiply tav with integrTime
207 !
208 ! Revision 1.1 2004/12/01 21:24:00 haselbac
209 ! Initial revision after changing case
210 !
211 ! Revision 1.13 2004/06/30 04:06:22 wasistho
212 ! moved Genx related parameter REGOFF to ModParameters
213 !
214 ! Revision 1.12 2004/06/29 23:53:08 wasistho
215 ! migrated to Roccom-3
216 !
217 ! Revision 1.11 2004/06/07 23:05:36 wasistho
218 ! provide Genx statistics names, units, and anytime-activation
219 !
220 ! Revision 1.10 2004/05/12 20:05:36 wasistho
221 ! added USE TURB_ModParameters
222 !
223 ! Revision 1.9 2004/05/04 20:39:41 wasistho
224 ! added RaNS/DES length scale variables: lens
225 !
226 ! Revision 1.8 2004/03/02 00:07:51 wasistho
227 ! added global variables esg1Sum and esg4Sum for turb.(exact) restart
228 !
229 ! Revision 1.7 2003/11/20 16:40:34 mdbrandy
230 ! Backing out RocfluidMP changes from 11-17-03
231 !
232 ! Revision 1.4 2003/09/16 01:00:23 wasistho
233 ! composed vorticities to a 3-components vector
234 !
235 ! Revision 1.3 2003/09/10 21:11:37 jblazek
236 ! Setting variables to zero.
237 !
238 ! Revision 1.2 2003/08/14 20:06:58 jblazek
239 ! Corrected bug associated with radiation flux qr.
240 !
241 ! Revision 1.1 2003/08/09 02:09:26 wasistho
242 ! added TURB and RADI_initGenxInterface
243 !
244 !******************************************************************************
245 
246 
247 
248 
249 
250 
251 
**********************************************************************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 idcend
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_getdimensdummy(region, iLev, idcbeg, idcend, jdcbeg, jdcend, kdcbeg, kdcend)
subroutine turb_initgenxinterface(regions, wins, winv)
**********************************************************************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 kdcbeg
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
**********************************************************************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 idcbeg
**********************************************************************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 jdcend
**********************************************************************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 jdcbeg
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469