Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_WriteRegionTopology.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: write topology of all regions to file.
26 !
27 ! Description: none.
28 !
29 ! Input: regions = region dimensions and topology
30 !
31 ! Output: to file.
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: RFLO_WriteRegionTopology.F90,v 1.3 2008/12/06 08:44:07 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2001 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE rflo_writeregiontopology( regions )
44 
45  USE moddatatypes
46  USE modbndpatch, ONLY : t_patch
47  USE moddatastruct, ONLY : t_region
48  USE modglobal, ONLY : t_global
49  USE moderror
50  USE modparameters
51  IMPLICIT NONE
52 
53 ! ... parameters
54  TYPE(t_region), POINTER :: regions(:)
55 
56 ! ... loop variables
57  INTEGER :: ireg, ipatch
58 
59 ! ... local variables
60  CHARACTER(2*CHRLEN+4) :: fname
61 
62  INTEGER :: bctype, srcl1beg, srcl1end, srcl2beg, srcl2end, errorflag
63 
64  TYPE(t_patch), POINTER :: patch
65 
66  TYPE(t_global), POINTER :: global
67 
68 !******************************************************************************
69 
70  global => regions(1)%global
71 
72  CALL registerfunction( global,'RFLO_WriteRegionTopology',&
73  'RFLO_WriteRegionTopology.F90' )
74 
75 ! open file & write number of regions
76 
77  fname = trim(global%outDir)//trim(global%casename)//'.top'
78  OPEN(if_topol,file=fname,form='formatted',status='unknown',iostat=errorflag)
79  global%error = errorflag
80  IF (global%error /= 0) &
81  CALL errorstop( global,err_file_open,__line__,'File: '//trim(fname) )
82 
83  WRITE(if_topol,'(A)',err=10) '# topology for: '//trim(global%casename)
84  WRITE(if_topol,'(A)',err=10) '#'
85  WRITE(if_topol, * ,err=10) global%nRegions
86 
87 ! write topology of each region (at grid level 1 - the finest grid)
88 
89  DO ireg=1,global%nRegions
90  WRITE(if_topol,*,err=10) ireg,regions(ireg)%nGridLevels
91  WRITE(if_topol,*,err=10) regions(ireg)%nPatches, &
92  regions(ireg)%levels(1)%grid%ipc, &
93  regions(ireg)%levels(1)%grid%jpc, &
94  regions(ireg)%levels(1)%grid%kpc
95 
96 ! - loop over all patches of a region
97 
98  DO ipatch=1,regions(ireg)%nPatches
99 
100  patch => regions(ireg)%levels(1)%patches(ipatch)
101  bctype = patch%bcType
102 
103 ! --- patch with neighbour
104 
105  IF ((bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR. &
106  (bctype>=bc_regionint .AND. bctype<=bc_regionint +bc_range) .OR. &
107  (bctype>=bc_regnonconf .AND. bctype<=bc_regnonconf+bc_range) .OR. &
108  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
109  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range)) THEN
110  IF (patch%align) THEN ! l1 aligned with 11Src
111  srcl1beg = -patch%srcL1beg
112  srcl1end = -patch%srcL1end
113  srcl2beg = patch%srcL2beg
114  srcl2end = patch%srcL2end
115  ELSE ! l1 aligned with l2Src
116  srcl1beg = patch%srcL1beg
117  srcl1end = patch%srcL1end
118  srcl2beg = -patch%srcL2beg
119  srcl2end = -patch%srcL2end
120  ENDIF
121  WRITE(if_topol,*,err=10) &
122  patch%bcType ,patch%lbound , &
123  -patch%l1beg ,-patch%l1end , &
124  patch%l2beg , patch%l2end , &
125  patch%srcRegion,patch%srcLbound, &
126  srcl1beg ,srcl1end , &
127  srcl2beg ,srcl2end , &
128  patch%bcCoupled
129 
130 ! --- no neighbour
131 
132  ELSE
133  WRITE(if_topol,*,err=10) &
134  patch%bcType ,patch%lbound , &
135  patch%l1beg ,patch%l1end , &
136  patch%l2beg ,patch%l2end , &
137  0,0,0,0,0,0 ,patch%bcCoupled
138  ENDIF
139 
140  ENDDO ! iPatch
141  ENDDO ! iReg
142 
143  CLOSE(if_topol,iostat=errorflag)
144  global%error = errorflag
145  IF (global%error /= 0) &
146  CALL errorstop( global,err_file_close,__line__,'File: '//trim(fname) )
147 
148 ! error handling --------------------------------------------------------------
149 
150  CALL deregisterfunction( global )
151  goto 999
152 
153 10 CONTINUE
154  CALL errorstop( global,err_file_write,__line__,'File: '//trim(fname) )
155 
156 999 CONTINUE
157 
158 END SUBROUTINE rflo_writeregiontopology
159 
160 !******************************************************************************
161 !
162 ! RCS Revision history:
163 !
164 ! $Log: RFLO_WriteRegionTopology.F90,v $
165 ! Revision 1.3 2008/12/06 08:44:07 mtcampbe
166 ! Updated license.
167 !
168 ! Revision 1.2 2008/11/19 22:17:21 mtcampbe
169 ! Added Illinois Open Source License/Copyright
170 !
171 ! Revision 1.1 2004/11/29 21:25:17 wasistho
172 ! lower to upper case
173 !
174 ! Revision 1.6 2003/05/15 02:57:01 jblazek
175 ! Inlined index function.
176 !
177 ! Revision 1.5 2002/10/12 03:20:50 jblazek
178 ! Replaced [io]stat=global%error with local errorFlag for Rocflo.
179 !
180 ! Revision 1.4 2002/09/27 00:57:09 jblazek
181 ! Changed makefiles - no makelinks needed.
182 !
183 ! Revision 1.3 2002/09/20 22:22:35 jblazek
184 ! Finalized integration into GenX.
185 !
186 ! Revision 1.2 2002/09/05 17:40:19 jblazek
187 ! Variable global moved into regions().
188 !
189 ! Revision 1.1 2002/07/12 21:50:07 jblazek
190 ! Added tool to split single grid into multiple regions.
191 !
192 !******************************************************************************
193 
194 
195 
196 
197 
198 
199 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
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 form
subroutine rflo_writeregiontopology(regions)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469