Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
INRT_SourceTerms.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: compute the source terms for all interactions.
26 !
27 ! Description:
28 ! The interactions are computed in the order specified by the integer
29 ! inrt%order for each interaction inrt. An interaction is computed by
30 ! calling a routine specific to the interaction (INRT_Calc*) which computes
31 ! the primary quantities transferred, followed by one of two generic routines
32 ! (INRT_Augment*Sources) which then computes secondary quantities and augment
33 ! source terms as the Tokens on the interaction Edges allow.
34 !
35 ! Input: region
36 !
37 ! Output: region with source terms augmented by all the interactions
38 !
39 ! Notes: the outer loop structure is designed so that arbitrary values of
40 ! inrt%order may be specified: this is less restrictive than looping over
41 ! a given range of allowed values of inrt%order.
42 !
43 ! The rather strange value of "big" is used to avoid the possibility that
44 ! HUGE(1) = +2^31, and thus -HUGE(1) = -2^31 = +2^31 > 0. In practice,
45 ! however, HUGE(1) = 2^31-1, so -HUGE(1) is indeed negative, but it seems
46 ! improper to rely on this.
47 !
48 !******************************************************************************
49 !
50 ! $Id: INRT_SourceTerms.F90,v 1.3 2008/12/06 08:44:32 mtcampbe Exp $
51 !
52 ! Copyright: (c) 2003 by the University of Illinois
53 !
54 !******************************************************************************
55 
56 SUBROUTINE inrt_sourceterms( region ) ! PUBLIC
57 
58  USE moddatatypes
59  USE moddatastruct, ONLY : t_region
60  USE modglobal, ONLY : t_global
61  USE modinteract, ONLY : t_inrt_interact
62  USE moderror
64 
68  IMPLICIT NONE
69 
70 ! ... parameters
71  TYPE(t_region), INTENT(INOUT) :: region
72 
73 ! ... loop variables
74  INTEGER :: order, iinrt
75 
76 ! ... local variables
77  CHARACTER(CHRLEN) :: rcsidentstring
78 
79  INTEGER :: big,currentorder,nextorder
80 
81  TYPE(t_inrt_interact), POINTER :: inrt
82  TYPE(t_global), POINTER :: global
83 
84 !******************************************************************************
85 
86  rcsidentstring = '$RCSfile: INRT_SourceTerms.F90,v $ $Revision: 1.3 $'
87 
88  global => region%global
89 
90  CALL registerfunction( global,'INRT_SourceTerms',&
91  'INRT_SourceTerms.F90' )
92 
93 ! begin -----------------------------------------------------------------------
94 
95  big = huge(1) - 3 ! see Notes above for explanation
96 
97  currentorder = -big
98 
99  DO
100  nextorder = big
101 
102  DO iinrt = 1,inrt_type_total
103 
104  inrt => region%inrtInput%inrts(iinrt)
105 
106  IF (inrt%used) THEN ! interaction used?
107 
108  IF (inrt%order == currentorder) THEN ! time to do it?
109 
110 ! ------- compute primary source terms for interaction
111 
112  SELECT CASE (iinrt)
113 
114  CASE (inrt_type_burning)
115  CALL inrt_calcburning(region)
116 
117  CASE (inrt_type_drag)
118  CALL inrt_calcdrag(region)
119 
120  CASE (inrt_type_htransnb)
121  CALL inrt_calcheattransfernonburn(region)
122 
123  CASE (inrt_type_scouring)
124  CALL inrt_calcscouring(region)
125 
126  CASE (inrt_type_boilrgn)
127  CONTINUE ! nothing to calculate at this stage
128 
129  CASE default
130  CALL errorstop( global,err_inrt_noinrt,__line__,inrt%name )
131 
132  END SELECT ! iInrt
133 
134 ! ------- update RHS for primary and secondary quantities
135 
136  IF (inrt%pclsUsed) THEN
137  CALL inrt_augmentdissources(region,iinrt)
138  ELSE
139  CALL inrt_augmentconsources(region,iinrt)
140  END IF ! inrt%pclsUsed
141 
142  ELSE IF (inrt%order > currentorder) THEN ! future interaction?
143 
144  nextorder = min(nextorder,inrt%order) ! if so, see if it is next
145 
146  END IF ! inrt%order
147 
148  END IF ! inrt%used
149 
150  END DO ! iInrt
151 
152  IF (nextorder == big) EXIT ! exit loop if no future interactions
153 
154  currentorder = nextorder ! set currentOrder to index next interaction
155 
156  END DO
157 
158 ! finalize --------------------------------------------------------------------
159 
160  CALL deregisterfunction( global )
161 
162 END SUBROUTINE inrt_sourceterms
163 
164 !******************************************************************************
165 !
166 ! RCS Revision history:
167 !
168 ! $Log: INRT_SourceTerms.F90,v $
169 ! Revision 1.3 2008/12/06 08:44:32 mtcampbe
170 ! Updated license.
171 !
172 ! Revision 1.2 2008/11/19 22:17:44 mtcampbe
173 ! Added Illinois Open Source License/Copyright
174 !
175 ! Revision 1.1 2004/12/01 21:56:46 fnajjar
176 ! Initial revision after changing case
177 !
178 ! Revision 1.8 2004/07/28 15:42:13 jferry
179 ! deleted defunct constructs: useDetangle, useSmokeDrag, useSmokeHeatTransfer
180 !
181 ! Revision 1.7 2004/03/05 22:09:03 jferry
182 ! created global variables for peul, plag, and inrt use
183 !
184 ! Revision 1.6 2003/09/25 15:48:43 jferry
185 ! implemented Boiling Regulation interaction
186 !
187 ! Revision 1.5 2003/04/03 21:10:18 jferry
188 ! implemented additional safety checks for rocinteract
189 !
190 ! Revision 1.4 2003/04/03 16:18:28 fnajjar
191 ! Include routines for burning and scouring
192 !
193 ! Revision 1.3 2003/03/24 23:30:52 jferry
194 ! overhauled rocinteract to allow interaction design to use user input
195 !
196 ! Revision 1.2 2003/03/11 16:09:39 jferry
197 ! Added comments
198 !
199 ! Revision 1.1 2003/03/04 22:12:35 jferry
200 ! Initial import of Rocinteract
201 !
202 !******************************************************************************
203 
204 
205 
206 
207 
208 
209 
Size order() const
Degree of the element. 1 for linear and 2 for quadratic.
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine inrt_calcdrag(region)
subroutine inrt_calcburning(region)
subroutine inrt_calcheattransfernonburn(region)
subroutine inrt_sourceterms(region)
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine inrt_augmentconsources(region, iInrt)
subroutine inrt_augmentdissources(region, iInrt)
subroutine inrt_calcscouring(region)