Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_InitGenxInterface.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 PLAG windows with GenX.
26 !
27 ! Description: none.
28 !
29 ! Input: regions = data of all regions,
30 ! wins, winp = GenX window registrations.
31 !
32 ! Output: to Roccom.
33 !
34 ! Notes: Surface registration for Tiles works only for External coupled bc.
35 ! Need to activate for both Internal and External bc.
36 !
37 !******************************************************************************
38 !
39 ! $Id: PLAG_InitGenxInterface.F90,v 1.5 2009/10/26 00:19:31 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2003 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE plag_initgenxinterface( regions, wins, inPlag, obtain_attribute )
46 
47  USE moddatatypes
48  USE modglobal, ONLY : t_global
49  USE modbndpatch, ONLY : t_patch
50  USE moddatastruct, ONLY : t_region
52  USE moderror
53  USE modparameters
55  USE modpartlag, ONLY : t_plag, t_tile_plag
56  IMPLICIT NONE
57  include 'roccomf90.h'
58 
59 ! ... parameters
60 
61  TYPE(t_region), POINTER :: regions(:)
62 
63  CHARACTER(CHRLEN) :: wins, inplag
64 
65  INTEGER :: obtain_attribute
66 
67 ! ... loop variables
68 
69  INTEGER :: icont, ireg, ipatch
70 
71 ! ... local variables
72 
73  CHARACTER(CHRLEN) :: winp
74 
75  INTEGER, PARAMETER :: ascii_zero = 48 ! char representation of zero
76  INTEGER :: bctype, errorflag, ilb, icount, ilev,pid
77  INTEGER :: idnbeg, idnend, jdnbeg, jdnend, kdnbeg, kdnend
78  INTEGER :: naiv, narv, ncont, ncontmax, ncv, ncvtile, ndv, ndvtile
79  INTEGER :: ndimplag
80  INTEGER :: plagstatus
81  INTEGER, POINTER, DIMENSION(:) :: pcvtilemass
82  INTEGER, POINTER :: pint
83 
84  TYPE(t_global), POINTER :: pglobal
85  TYPE(t_patch) , POINTER :: ppatch
86  TYPE(t_plag) , POINTER :: pplag
87  TYPE(t_tile_plag), POINTER :: ptileplag
88 
89 !******************************************************************************
90 
91  pglobal => regions(1)%global
92 
93  CALL registerfunction( pglobal,'PLAG_InitGenxInterface',&
94  'PLAG_InitGenxInterface.F90' )
95 
96 ! set PLAG window -------------------------------------------------------------
97 
98  winp = trim(pglobal%winName)//'_plag'
99  pglobal%winp = winp
100 
101 ! input data (currently none) -------------------------------------------------
102 
103 ! output surface data ---------------------------------------------------------
104 
105  CALL com_new_attribute( trim(wins)//'.plag_momnrm', 'e', &
106  com_double, 1, 'kg/(m^2 s)' )
107  CALL com_new_attribute( trim(wins)//'.plag_ener', 'e', &
108  com_double, 1, 'J/kg' )
109 
110  ncontmax = 0
111  IF ( pglobal%plagUsed ) THEN
112  DO ireg=1,pglobal%nRegions
113  ncontmax = max(ncontmax,regions(ireg)%plagInput%nCont)
114  ENDDO ! iReg
115  ENDIF ! plagUsed
116 
117  DO icont=1,ncontmax
118  CALL com_new_attribute( trim(wins)//'.plag_mass'//char(icont+ascii_zero), 'e', &
119  com_double, 1, 'kg/m^3' )
120  ENDDO ! iCont
121 
122  CALL com_new_attribute( trim(wins)//'.plag_dv_timefctr', 'e', &
123  com_double, 1, '' )
124 
125  CALL com_new_attribute( trim(wins)//'.plag_dv_diam' , 'e', &
126  com_double, 1, 'm' )
127 
128  CALL com_new_attribute( trim(wins)//'.plag_dv_spload' , 'e', &
129  com_double, 1, '' )
130 
131 ! restart data (av, cv ) and additional plot data (dv= diam) ------------------
132  CALL com_new_window( trim(winp))
133 
134  CALL com_new_attribute( trim(winp)//'.plag_aiv_pidini', 'n' , &
135  com_integer, 1, '' )
136  CALL com_new_attribute( trim(winp)//'.plag_aiv_regini', 'n' , &
137  com_integer, 1, '' )
138  CALL com_new_attribute( trim(winp)//'.plag_aiv_regcrt', 'n' , &
139  com_integer, 1, '' )
140  CALL com_new_attribute( trim(winp)//'.plag_aiv_icells', 'n' , &
141  com_integer, 1, '' )
142  CALL com_new_attribute( trim(winp)//'.plag_aiv_indexi', 'n' , &
143  com_integer, 1, '' )
144  CALL com_new_attribute( trim(winp)//'.plag_aiv_indexj', 'n' , &
145  com_integer, 1, '' )
146  CALL com_new_attribute( trim(winp)//'.plag_aiv_indexk', 'n' , &
147  com_integer, 1, '' )
148  CALL com_new_attribute( trim(winp)//'.plag_aiv_burnstat', 'n' ,&
149  com_integer, 1, '' )
150  CALL com_new_attribute( trim(winp)//'.plag_arv_spload', 'n' , &
151  com_double, 1, '' )
152 
153  CALL com_new_attribute( trim(winp)//'.plag_xmom', 'n', &
154  com_double, 1, 'kg/(m^2 s)' )
155  CALL com_new_attribute( trim(winp)//'.plag_ymom', 'n', &
156  com_double, 1, 'kg/(m^2 s)' )
157  CALL com_new_attribute( trim(winp)//'.plag_zmom', 'n', &
158  com_double, 1, 'kg/(m^2 s)' )
159  CALL com_new_attribute( trim(winp)//'.plag_ener', 'n', &
160  com_double, 1, 'J/kg' )
161  CALL com_new_attribute( trim(winp)//'.plag_enervapor', 'n', &
162  com_double, 1, 'J/kg' )
163  DO icont = 1, ncontmax
164  CALL com_new_attribute( trim(winp)//'.plag_mass'//char(icont+ascii_zero), 'n', &
165  com_double,1, 'kg/m^3' )
166  ENDDO ! iCont
167 
168  CALL com_new_attribute( trim(winp)//'.plag_diam', 'n', &
169  com_double, 1,'m' )
170 
171  CALL com_new_attribute( trim(winp)//'.plag_nextid', 'p',com_integer, 1,'')
172 
173 ! loop over all regions -------------------------------------------------------
174 
175  DO ireg=1,pglobal%nRegions
176  IF ( regions(ireg)%procid==pglobal%myProcid .AND. & ! region active and
177  regions(ireg)%active==active .AND. & ! on my processor
178  pglobal%plagUsed ) THEN ! and particles used
179 
180  ilev = regions(ireg)%currLevel
181  icount = 0
182 
183 ! - set pointer ---------------------------------------------------------------
184 
185  pplag => regions(ireg)%levels(ilev)%plag
186 
187 
188 
189 ! - get dimensions ------------------------------------------------------------
190 
191  ndimplag = regions(ireg)%plagInput%nPclsMax
192  ncont = regions(ireg)%plagInput%nCont
193  naiv = pplag%nAiv
194  narv = pplag%nArv
195  ncv = pplag%nCv
196  ndv = pplag%nDv
197  ncvtile = cv_tile_last+ncont
198  ndvtile = dv_tile_last
199 
200 ! - surface data for tile infrastructure --------------------------------------
201 
202  DO ipatch=1,regions(ireg)%nPatches
203  ppatch => regions(ireg)%levels(ilev)%patches(ipatch)
204  bctype = ppatch%bcType
205 
206  IF ( ppatch%bcCoupled == bc_external .AND. &
207  ( bctype>=bc_injection .AND. bctype<=bc_injection+bc_range ) ) THEN
208  icount = icount + 1
209  pid = ireg*regoff + icount
210 
211  ptileplag => ppatch%tilePlag
212  pcvtilemass => ptileplag%cvTileMass
213 
214 ! -- output tile data ---------------------------------------------------------
215 
216  ilb = lbound(ptileplag%cv,2)
217  CALL com_set_array( trim(wins)//'.plag_momnrm',pid, &
218  ptileplag%cv(cv_tile_momnrm,ilb),ncvtile)
219  CALL com_set_array( trim(wins)//'.plag_ener', pid, &
220  ptileplag%cv(cv_tile_ener,ilb),ncvtile)
221 
222  DO icont = 1, ncont
223  CALL com_set_array( trim(wins)//'.plag_mass'//char(icont+ascii_zero),&
224  pid, ptileplag%cv(pcvtilemass(icont),ilb),ncvtile)
225  ENDDO ! iCont
226 
227  ilb = lbound(ptileplag%dv,2)
228  CALL com_set_array( trim(wins)//'.plag_dv_timefctr', &
229  pid, ptileplag%dv(dv_tile_countdown,ilb),ndvtile)
230  CALL com_set_array( trim(wins)//'.plag_dv_diam', &
231  pid, ptileplag%dv(dv_tile_diam ,ilb),ndvtile)
232  CALL com_set_array( trim(wins)//'.plag_dv_spload', &
233  pid, ptileplag%dv(dv_tile_spload ,ilb),ndvtile)
234 
235  ENDIF ! external BC
236  ENDDO ! iPatch
237 
238 ! -- volume data --------------------------------------------------------------
239 
240 ! -- create PLAG pane data ----------------------------------------------------
241 
242  pid = ireg*regoff+1
243 
244 ! Obtain status
245  plagstatus = com_get_status( trim(inplag),pid )
246 
247 ! Obtain the number of particles
248 ! check if status is inexistent first.
249 
250  IF ( plagstatus == -1 ) THEN
251 #ifndef NATIVE_MP_IO
252  pplag%nPcls = 0
253 #endif
254  ELSE
255  CALL com_get_size( trim(inplag)//'.nc',pid,pplag%nPcls)
256  END IF ! plagStatus
257 
258 ! COM_set_size procedure must be called in RFLO_sendBoundaryValues
259 ! if nPcls has changed.
260 
261  CALL com_set_size( trim(winp)//'.nc',pid,pplag%nPcls)
262 
263 ! COM_set_array on '.nc' processes all three components at once
264  ilb = lbound(pplag%cv,2)
265  CALL com_set_array( trim(winp)//'.nc',pid, &
266  pplag%cv(cv_plag_xpos,ilb),ncv,ndimplag )
267 
268  pint => pplag%nextIdNumber
269  CALL com_set_size( trim(winp)//'.plag_nextid',pid,1)
270  CALL com_set_array( trim(winp)//'.plag_nextid', pid, pint)
271 
272 ! -- aiv data -----------------------------------------------------------------
273 
274  ilb = lbound(pplag%aiv,2)
275  CALL com_set_array( trim(winp)//'.plag_aiv_pidini',pid, &
276  pplag%aiv(aiv_plag_pidini,ilb),naiv,ndimplag )
277  CALL com_set_array( trim(winp)//'.plag_aiv_regini',pid, &
278  pplag%aiv(aiv_plag_regini,ilb),naiv,ndimplag )
279  CALL com_set_array( trim(winp)//'.plag_aiv_regcrt',pid, &
280  pplag%aiv(aiv_plag_regcrt,ilb),naiv,ndimplag )
281  CALL com_set_array( trim(winp)//'.plag_aiv_icells',pid, &
282  pplag%aiv(aiv_plag_icells,ilb),naiv,ndimplag )
283  CALL com_set_array( trim(winp)//'.plag_aiv_indexi',pid, &
284  pplag%aiv(aiv_plag_indexi,ilb),naiv,ndimplag )
285  CALL com_set_array( trim(winp)//'.plag_aiv_indexj',pid, &
286  pplag%aiv(aiv_plag_indexj,ilb),naiv,ndimplag )
287  CALL com_set_array( trim(winp)//'.plag_aiv_indexk',pid, &
288  pplag%aiv(aiv_plag_indexk,ilb),naiv,ndimplag )
289  CALL com_set_array( trim(winp)//'.plag_aiv_burnstat',pid, &
290  pplag%aiv(aiv_plag_burnstat,ilb),naiv,ndimplag )
291 
292 ! -- arv data -----------------------------------------------------------------
293 
294  ilb = lbound(pplag%arv,2)
295  CALL com_set_array( trim(winp)//'.plag_arv_spload',pid, &
296  pplag%arv(arv_plag_spload,ilb),narv,ndimplag )
297 
298 ! -- cv data ------------------------------------------------------------------
299 
300  ilb = lbound(pplag%cv,2)
301  CALL com_set_array( trim(winp)//'.plag_xmom',pid, &
302  pplag%cv(cv_plag_xmom,ilb),ncv,ndimplag )
303  CALL com_set_array( trim(winp)//'.plag_ymom',pid, &
304  pplag%cv(cv_plag_ymom,ilb),ncv,ndimplag )
305  CALL com_set_array( trim(winp)//'.plag_zmom',pid, &
306  pplag%cv(cv_plag_zmom,ilb),ncv,ndimplag )
307  CALL com_set_array( trim(winp)//'.plag_ener',pid, &
308  pplag%cv(cv_plag_ener,ilb),ncv,ndimplag )
309  CALL com_set_array( trim(winp)//'.plag_enervapor',pid, &
310  pplag%cv(cv_plag_enervapor,ilb),ncv,ndimplag )
311  DO icont = 1, ncont
312  CALL com_set_array( trim(winp)//'.plag_mass'//char(icont+ascii_zero), &
313  pid, pplag%cv(cv_plag_last+icont,ilb),ncv,ndimplag )
314  ENDDO ! iCont
315 
316 ! -- dv data (for plotting) ---------------------------------------------------
317 
318  ilb = lbound(pplag%dv,2)
319  CALL com_set_array( trim(winp)//'.plag_diam',pid, &
320  pplag%dv(dv_plag_diam,ilb),ndv,ndimplag )
321 
322  ENDIF ! region on this processor and active
323 
324  ENDDO ! iReg
325 
326  CALL com_window_init_done( trim(winp))
327 
328 #ifndef NATIVE_MP_IO
329  CALL com_call_function( obtain_attribute,2, &
330  com_get_attribute_handle_const(trim(inplag)//".all"), &
331  com_get_attribute_handle(trim(winp)//".all") )
332 #endif
333 
334 ! finalize --------------------------------------------------------------------
335 
336  CALL deregisterfunction( pglobal )
337 
338 END SUBROUTINE plag_initgenxinterface
339 
340 !******************************************************************************
341 !
342 ! RCS Revision history:
343 !
344 ! $Log: PLAG_InitGenxInterface.F90,v $
345 ! Revision 1.5 2009/10/26 00:19:31 mtcampbe
346 ! Updates for completion of NATIVE_MP_IO
347 !
348 ! Revision 1.4 2008/12/06 08:44:00 mtcampbe
349 ! Updated license.
350 !
351 ! Revision 1.3 2008/11/19 22:17:14 mtcampbe
352 ! Added Illinois Open Source License/Copyright
353 !
354 ! Revision 1.2 2007/03/13 18:54:19 fnajjar
355 ! Fixed bug to change nPclsTot to nPclsMax
356 !
357 ! Revision 1.1 2004/12/01 21:23:44 haselbac
358 ! Initial revision after changing case
359 !
360 ! Revision 1.14 2004/11/05 22:29:31 fnajjar
361 ! Included a COM_get_status call before calling COM_get_size
362 !
363 ! Revision 1.13 2004/11/05 19:12:06 fnajjar
364 ! Deleted REGOFF definition since it now resides in ModParameters
365 !
366 ! Revision 1.12 2004/10/03 03:04:46 fnajjar
367 ! Bug fix for attribute surface variable changed to plag_dv_diam
368 !
369 ! Revision 1.11 2004/07/02 22:05:56 fnajjar
370 ! Modified routine for Roccom3 import
371 !
372 ! Revision 1.10 2004/06/16 23:08:48 fnajjar
373 ! Renamed DV_TILE_TIMEFCTR to DV_TILE_COUNTDOWN for CRE kernel
374 !
375 ! Revision 1.9 2004/05/12 14:13:29 fnajjar
376 ! Added missing array entries for aiv and cv to Genx IO
377 !
378 ! Revision 1.8 2004/03/16 21:24:51 fnajjar
379 ! Bug fix for plagUsed as it needs to use pGlobal pointer rather than global pointer
380 !
381 ! Revision 1.7 2004/03/05 22:08:58 jferry
382 ! created global variables for peul, plag, and inrt use
383 !
384 ! Revision 1.6 2004/03/05 16:27:18 fnajjar
385 ! Added dv(diam) and dv(spload) from tile datastructure to insure proper restart
386 !
387 ! Revision 1.5 2004/01/21 16:37:20 fnajjar
388 ! Fixed semantics of iCont in Roccom window to bypass Frost compilation error
389 !
390 ! Revision 1.4 2004/01/20 23:22:48 fnajjar
391 ! Fixed CHAR operation in RocCom window naming to correct Frost compilation error
392 !
393 ! Revision 1.3 2003/12/03 03:02:07 jiao
394 ! Removed all calls involving COM_NULL.
395 !
396 ! Revision 1.2 2003/11/26 22:04:12 fnajjar
397 ! Defined nDvTile correctly for Roccom restart
398 !
399 ! Revision 1.1 2003/11/21 22:21:42 fnajjar
400 ! Initial import of Rocpart GenX interfaces
401 !
402 !******************************************************************************
403 
404 
405 
406 
407 
408 
409 
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
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 jdnbeg
**********************************************************************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 idnend
**********************************************************************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 jdnend
**********************************************************************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 idnbeg
subroutine rflo_getdimensdummynodes(region, iLev, idnbeg, idnend, jdnbeg, jdnend, kdnbeg, kdnend)
void obtain_attribute(const COM::Attribute *attribute_in, COM::Attribute *user_attribute, int *pane_id=NULL)
Fill the destination (second) attribute from files using the data corresponding to the source (first)...
Definition: Rocin.C:2431
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine plag_initgenxinterface(regions, wins, inPlag, obtain_attribute)
**********************************************************************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 kdnbeg