Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PEUL_EnforcePositivity.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: Check if there are negative values of concentration, and, when
26 ! indicated, report and possibly fix these values.
27 !
28 ! Description: none.
29 !
30 ! Input: region = data of current region.
31 !
32 ! Output: region%levels%peul%cv
33 !
34 ! Notes: none.
35 !
36 !******************************************************************************
37 !
38 ! $Id: PEUL_EnforcePositivity.F90,v 1.3 2008/12/06 08:44:39 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2004 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE peul_enforcepositivity( region )
45 
46  USE moddatatypes
47  USE moddatastruct, ONLY : t_region
48  USE modglobal, ONLY : t_global
49  USE moderror
50  USE modparameters
52 
54  IMPLICIT NONE
55 
56 #include "Indexing.h"
57 
58 ! ... parameters
59  TYPE(t_region), INTENT(INOUT) :: region
60 
61 ! ... loop variables
62  INTEGER :: i,j,k,ipt
63 
64 ! ... local variables
65  CHARACTER(CHRLEN) :: rcsidentstring
66 
67  INTEGER :: ipcbeg,ipcend,jpcbeg,jpcend,kpcbeg,kpcend,nptypes
68  INTEGER :: ilev,icoff,ijcoff,ijkc0
69  INTEGER :: ncnt1,ncnt2,iloc1,jloc1,kloc1,iloc2,jloc2,kloc2
70 
71  LOGICAL :: clip,firsttype
72 
73  REAL(RFREAL) :: minc,maxc,maxconc
74  REAL(RFREAL), POINTER :: cv(:,:)
75 
76  TYPE(t_global), POINTER :: global
77 
78 !******************************************************************************
79 
80  rcsidentstring = '$RCSfile: PEUL_EnforcePositivity.F90,v $ $Revision: 1.3 $'
81 
82  global => region%global
83 
84  CALL registerfunction( global,'PEUL_EnforcePositivity',&
85  'PEUL_EnforcePositivity.F90' )
86 
87 ! begin -----------------------------------------------------------------------
88 
89 ! get dimensions and pointers -------------------------------------------------
90 
91  ilev = region%currLevel
92 
93  CALL rflo_getdimensphys( region,ilev,ipcbeg,ipcend, &
94  jpcbeg,jpcend,kpcbeg,kpcend )
95  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
96 
97  cv => region%levels(ilev)%peul%cv
98 
99  nptypes = region%peulInput%nPtypes
100 
101  firsttype = .true.
102 
103  DO ipt=1,nptypes
104 
105  maxconc = region%peulInput%ptypes(ipt)%maxConc
106 
107  minc = 1.e20_rfreal
108  maxc = -1.e20_rfreal
109  ncnt1 = 0
110  ncnt2 = 0
111  iloc1 = crazy_value_int
112  jloc1 = crazy_value_int
113  kloc1 = crazy_value_int
114  iloc2 = crazy_value_int
115  jloc2 = crazy_value_int
116  kloc2 = crazy_value_int
117 
118  clip = .false.
119 
120  SELECT CASE (region%peulInput%ptypes(ipt)%clipModel)
121 
122  CASE (peul_clip_model_used)
123  clip = .true.
124 
125  END SELECT ! clipModel
126 
127  IF (region%peulInput%ptypes(ipt)%negReport == peul_neg_report_none &
128  .AND. .NOT.clip) cycle
129 
130  DO k=kpcbeg,kpcend
131  DO j=jpcbeg,jpcend
132  DO i=ipcbeg,ipcend
133  ijkc0 = indijk(i,j,k,icoff,ijcoff)
134 
135  IF (cv(ipt,ijkc0) < minc) THEN
136  minc = cv(ipt,ijkc0)
137  iloc1 = i
138  jloc1 = j
139  kloc1 = k
140  ENDIF ! minc
141 
142  IF (cv(ipt,ijkc0) > maxc) THEN
143  maxc = cv(ipt,ijkc0)
144  iloc2 = i
145  jloc2 = j
146  kloc2 = k
147  ENDIF ! maxc
148 
149  IF (cv(ipt,ijkc0) < 0._rfreal) THEN
150  ncnt1 = ncnt1 + 1
151  IF (clip) cv(ipt,ijkc0) = 0._rfreal
152  ENDIF ! cv(ipt,ijkC0)
153 
154  IF (cv(ipt,ijkc0) > maxconc) THEN
155  ncnt2 = ncnt2 + 1
156  IF (clip) cv(ipt,ijkc0) = maxconc
157  ENDIF ! cv(ipt,ijkC0)
158 
159  ENDDO ! i
160  ENDDO ! j
161  ENDDO ! k
162 
163  IF (ncnt1 > 0 .OR. ncnt2 > 0) THEN
164 
165  SELECT CASE (region%peulInput%ptypes(ipt)%negReport)
166 
167  CASE (peul_neg_report_used)
168 
169  IF (firsttype) THEN
170 
171  WRITE(stdout,'(A,1X,A)') solver_name, &
172  'Negative smoke concentration detected!'
173 
174  IF ( global%flowType == flow_unsteady ) THEN
175  WRITE(stdout,'(A,3X,A,1X,ES12.5,A,I1)') solver_name, &
176  'Current time and stage:',global%currentTime,', ',region%irkStep
177  ELSE
178  WRITE(stdout,'(A,3X,A,1X,I6)') solver_name, &
179  'Current iteration number:', global%currentIter
180  ENDIF ! flowType
181 
182  WRITE(stdout,'(A,2X,12(1X,A))') solver_name, &
183  ' Region', &
184  ' ipt', &
185  ' # negs', &
186  ' Least value', &
187  ' i', &
188  ' j', &
189  ' k', &
190  ' # bigs', &
191  ' Greatest value', &
192  ' i', &
193  ' j', &
194  ' k'
195  firsttype = .false.
196 
197  ENDIF ! firstType
198 
199  WRITE(stdout,'(A,I10,I6,I8,ES16.6,3I6,I8,ES16.6,3I6)') &
200  solver_name,region%iRegionGlobal,ipt,ncnt1,minc,iloc1,jloc1,kloc1, &
201  ncnt2,maxc,iloc2,jloc2,kloc2
202 
203  END SELECT ! negReport
204 
205  ENDIF ! ncnt1 > 0 .OR. ncnt2 > 0
206 
207  ENDDO ! ipt
208 
209 ! finalize --------------------------------------------------------------------
210 
211  CALL deregisterfunction( global )
212 
213 END SUBROUTINE peul_enforcepositivity
214 
215 !******************************************************************************
216 !
217 ! RCS Revision history:
218 !
219 ! $Log: PEUL_EnforcePositivity.F90,v $
220 ! Revision 1.3 2008/12/06 08:44:39 mtcampbe
221 ! Updated license.
222 !
223 ! Revision 1.2 2008/11/19 22:17:51 mtcampbe
224 ! Added Illinois Open Source License/Copyright
225 !
226 ! Revision 1.1 2004/12/01 21:09:33 haselbac
227 ! Initial revision after changing case
228 !
229 ! Revision 1.3 2004/05/03 15:09:05 jferry
230 ! added ability to clip smoke values greater than maximal space packing
231 !
232 ! Revision 1.2 2004/03/05 22:09:04 jferry
233 ! created global variables for peul, plag, and inrt use
234 !
235 ! Revision 1.1 2004/03/02 21:44:52 jferry
236 ! Added clipping options
237 !
238 !******************************************************************************
239 
240 
241 
242 
243 
244 
245 
subroutine peul_enforcepositivity(region)
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
blockLoc i
Definition: read.cpp:79
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 jpcend
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine rflo_getdimensphys(region, iLev, ipcbeg, ipcend, jpcbeg, jpcend, kpcbeg, kpcend)