Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
INRT_DetermineTokens.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: puts permission Tokens on Edges
26 !
27 ! Description: sets values of Tokens based in several criteria:
28 !
29 ! (a) the Permission level of Nodes
30 ! (b) the relative Activeness of the Nodes at either end
31 ! (c) if it is an upwind Node of a mass Edge
32 ! (d) if the Edge contains an internal Node
33 !
34 ! Input: region = region data
35 ! inrt = interaction
36 !
37 ! Output: modifies inrt
38 !
39 ! Notes: none.
40 !
41 !******************************************************************************
42 !
43 ! $Id: INRT_DetermineTokens.F90,v 1.3 2008/12/06 08:44:31 mtcampbe Exp $
44 !
45 ! Copyright: (c) 2003 by the University of Illinois
46 !
47 !******************************************************************************
48 
49 SUBROUTINE inrt_determinetokens( region,inrt )
50 
51  USE moddatatypes
52  USE moddatastruct, ONLY : t_region
53  USE modglobal, ONLY : t_global
54  USE modinteract
55  USE moderror
57 
58  IMPLICIT NONE
59 
60 ! ... parameters
61  TYPE(t_region), INTENT(INOUT) :: region
62  TYPE(t_inrt_interact), POINTER :: inrt
63 
64 ! ... loop variables
65  INTEGER :: iedge
66 
67 ! ... local variables
68  CHARACTER(CHRLEN) :: rcsidentstring
69 
70  TYPE(t_inrt_input), POINTER :: input
71  TYPE(t_inrt_edge), POINTER :: edge
72  TYPE(t_global), POINTER :: global
73 
74 !******************************************************************************
75 
76  rcsidentstring = '$RCSfile: INRT_DetermineTokens.F90,v $ $Revision: 1.3 $'
77 
78  global => region%global
79 
80  CALL registerfunction( global,'INRT_DetermineTokens',&
81  'INRT_DetermineTokens.F90' )
82 
83 ! begin -----------------------------------------------------------------------
84 
85  input => region%inrtInput
86 
87  DO iedge=1,inrt%nEdges
88 
89  edge => inrt%edges(iedge)
90 
91 ! - Permission Tokens already placed on dummy Edges
92 
93  IF (edge%tEdge == inrt_edge_mome_dum) cycle
94 
95 ! - For Ghost mass Edge, set downwind permission Token to 0 (Block), and
96 ! - Upwind Token to either 1 (Permit Mass) or 0 (Block).
97 ! - Note that activeness plays no role for Ghost mass Edges.
98 
99  IF (edge%tEdge == inrt_edge_mass_gho) THEN
100 
101  edge%token(1) = min(inrt_perm_pmass,inrt%permission(edge%iNode(1)))
102  edge%token(2) = inrt_perm_block
103  cycle
104 
105  END IF ! INRT_EDGE_MASS_GHO
106 
107 ! - Decrease permission Tokens to Permission level of corresponding Nodes
108 
109  edge%token(1) = min(edge%token(1),inrt%permission(edge%iNode(1)))
110  edge%token(2) = min(edge%token(2),inrt%permission(edge%iNode(2)))
111 
112 ! - If Nodes on either end of Edge differ in Activeness, decrease the
113 ! - permission Token on the more active end to 0 (Block)
114 
115  IF (inrt%activeness(edge%iNode(1)) > inrt%activeness(edge%iNode(2))) &
116  edge%token(1) = min(edge%token(1),inrt_perm_block)
117 
118  IF (inrt%activeness(edge%iNode(2)) > inrt%activeness(edge%iNode(1))) &
119  edge%token(2) = min(edge%token(2),inrt_perm_block)
120 
121 ! - Decrease permission Token of the upwind end of a mass Edge to 1
122 ! - (Permit Mass only)
123 
124  IF (edge%tEdge == inrt_edge_mass) &
125  edge%token(1) = min(edge%token(1),inrt_perm_pmass)
126 
127 ! - Decrease permission Token of the upwind end of an Edge if there is
128 ! - an Internal Node there
129 
130  IF (edge%iNode(1) == input%indIntl) &
131  edge%token(1) = min(edge%token(1),inrt_perm_block)
132 
133 ! - Decrease permission Token to 0 (Block) if it is equivalent to Block
134 ! - for its Edge type
135 
136  SELECT CASE (edge%tEdge)
137 
138  CASE (inrt_edge_mome)
139  IF (edge%token(1) < inrt_perm_pmome) edge%token(1) = inrt_perm_block
140  IF (edge%token(2) < inrt_perm_pmome) edge%token(2) = inrt_perm_block
141 
142  CASE (inrt_edge_ener)
143  IF (edge%token(1) < inrt_perm_pall ) edge%token(1) = inrt_perm_block
144  IF (edge%token(2) < inrt_perm_pall ) edge%token(2) = inrt_perm_block
145 
146  END SELECT ! edge%tEdge
147 
148  END DO ! iEdge
149 
150 ! finalize --------------------------------------------------------------------
151 
152  CALL deregisterfunction( global )
153 
154 END SUBROUTINE inrt_determinetokens
155 
156 !******************************************************************************
157 !
158 ! RCS Revision history:
159 !
160 ! $Log: INRT_DetermineTokens.F90,v $
161 ! Revision 1.3 2008/12/06 08:44:31 mtcampbe
162 ! Updated license.
163 !
164 ! Revision 1.2 2008/11/19 22:17:44 mtcampbe
165 ! Added Illinois Open Source License/Copyright
166 !
167 ! Revision 1.1 2004/12/01 21:56:26 fnajjar
168 ! Initial revision after changing case
169 !
170 ! Revision 1.5 2003/09/19 20:35:26 jferry
171 ! Implemented oxidizer species for burning interaction
172 !
173 ! Revision 1.4 2003/04/02 22:32:04 jferry
174 ! codified Activeness and Permission structures for rocinteract
175 !
176 ! Revision 1.3 2003/03/24 23:30:52 jferry
177 ! overhauled rocinteract to allow interaction design to use user input
178 !
179 ! Revision 1.2 2003/03/11 16:09:39 jferry
180 ! Added comments
181 !
182 ! Revision 1.1 2003/03/04 22:12:35 jferry
183 ! Initial import of Rocinteract
184 !
185 !******************************************************************************
186 
187 
188 
189 
190 
191 
192 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine inrt_determinetokens(region, inrt)
subroutine input(X, NNODE, NDC, NCELL, NFCE, NBPTS, NBFACE, ITYP, NPROP, XBNDY, XFAR, YFAR, ZFAR)
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
subroutine deregisterfunction(global)
Definition: ModError.F90:469