Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SPEC_RFLU_EnforceBounds.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: Enforce bounds on species.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pRegion Pointer to region
31 !
32 ! Output: None.
33 !
34 ! Notes:
35 ! 1. At present, only enforce minimum bound. In future, could also enforce
36 ! maximum bound on each individual component, and that the sum is equal
37 ! to the mixture density.
38 !
39 !******************************************************************************
40 !
41 ! $Id: SPEC_RFLU_EnforceBounds.F90,v 1.3 2008/12/06 08:44:40 mtcampbe Exp $
42 !
43 ! Copyright: (c) 2004 by the University of Illinois
44 !
45 !******************************************************************************
46 
47 SUBROUTINE spec_rflu_enforcebounds(pRegion)
48 
49  USE modglobal, ONLY: t_global
50  USE moddatatypes
51  USE modparameters
52  USE moderror
53  USE modgrid, ONLY: t_grid
54  USE moddatastruct, ONLY: t_region
55  USE modmpi
56 
58 
59  IMPLICIT NONE
60 
61 ! ******************************************************************************
62 ! Declarations and definitions
63 ! ******************************************************************************
64 
65 ! ==============================================================================
66 ! Parameters
67 ! ==============================================================================
68 
69  TYPE(t_region), POINTER :: pregion
70 
71 ! ==============================================================================
72 ! Local variables
73 ! ==============================================================================
74 
75  CHARACTER(CHRLEN) :: rcsidentstring
76  INTEGER :: icg,ispec,negvalcntr
77  REAL(RFREAL) :: negvalmin
78  REAL(RFREAL), DIMENSION(:,:), POINTER :: pcvmixt,pcvspec
79  TYPE(t_grid), POINTER :: pgrid
80  TYPE(t_global), POINTER :: global
81 
82  rcsidentstring = '$RCSfile: SPEC_RFLU_EnforceBounds.F90,v $ $Revision: 1.3 $'
83 
84 ! ******************************************************************************
85 ! Start
86 ! ******************************************************************************
87 
88  global => pregion%global
89 
90  CALL registerfunction(global,'SPEC_RFLU_EnforceBounds',&
91  'SPEC_RFLU_EnforceBounds.F90')
92 
93 ! ==============================================================================
94 ! Set pointers and variables
95 ! ==============================================================================
96 
97  pcvmixt => pregion%mixt%cv
98  pcvspec => pregion%spec%cv
99  pgrid => pregion%grid
100 
101  negvalcntr = 0
102  negvalmin = huge(1.0_rfreal)
103 
104 ! ******************************************************************************
105 ! Enforce bounds
106 ! ******************************************************************************
107 
108  DO icg = 1,pgrid%nCells
109  DO ispec = 1,pregion%specInput%nSpecies
110  IF ( pcvspec(ispec,icg) < 0.0_rfreal ) THEN
111  negvalcntr = negvalcntr + 1
112  negvalmin = min(negvalmin,pcvspec(ispec,icg))
113  pcvspec(ispec,icg) = 0.0_rfreal
114  END IF ! pCvSpec
115  END DO ! iSpec
116  END DO ! icg
117 
118 ! ******************************************************************************
119 ! Write information
120 ! ******************************************************************************
121 
122  IF ( (global%verbLevel > verbose_low) .AND. &
123  (global%myProcid == masterproc) ) THEN
124  IF ( (rflu_decideprint(global) .EQV. .true.) .AND. (negvalcntr > 0) ) THEN
125  global%warnCounter = global%warnCounter + 1
126 
127  WRITE(stdout,'(A,1X,A)') solver_name, &
128  '*** WARNING *** Detected negative species mass fractions!'
129 
130  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
131  pregion%iRegionGlobal
132  IF ( global%flowType == flow_unsteady ) THEN
133  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name,'Current time:', &
134  global%currentTime
135  END IF ! global%flowType
136 
137  WRITE(stdout,'(A,3X,A,1X,I1)') solver_name,'Runge-Kutta stage:', &
138  pregion%irkStep
139 
140  WRITE(stdout,'(A,3X,A,1X,I6)') solver_name, &
141  'Number of locations with negative species mass fractions:', &
142  negvalcntr
143  WRITE(stdout,'(A,3X,A,1X,E23.16)') solver_name, &
144  'Largest negative species mass fraction:',negvalmin
145  WRITE(stdout,'(A,3X,A)') solver_name, &
146  'Negative species mass fractions set to zero.'
147  END IF ! RFLU_DecidePrint
148  END IF ! global%verbLevel
149 
150 ! ******************************************************************************
151 ! End
152 ! ******************************************************************************
153 
154  CALL deregisterfunction(global)
155 
156 END SUBROUTINE spec_rflu_enforcebounds
157 
158 
159 ! ******************************************************************************
160 !
161 ! RCS Revision history:
162 !
163 ! $Log: SPEC_RFLU_EnforceBounds.F90,v $
164 ! Revision 1.3 2008/12/06 08:44:40 mtcampbe
165 ! Updated license.
166 !
167 ! Revision 1.2 2008/11/19 22:17:52 mtcampbe
168 ! Added Illinois Open Source License/Copyright
169 !
170 ! Revision 1.1 2004/01/29 22:59:29 haselbac
171 ! Initial revision
172 !
173 ! ******************************************************************************
174 
175 
176 
177 
178 
179 
180 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine spec_rflu_enforcebounds(pRegion)
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
LOGICAL function rflu_decideprint(global)
subroutine deregisterfunction(global)
Definition: ModError.F90:469